Speech to Text C# Train For Better Translation

心已入冬 提交于 2019-12-24 13:03:01

问题


I need to way to make the speech to text smarter as many of the words it is just getting incorrect in the translation. I cannot find much help on adding a list of words, not commands or grammar but words to help better translate audio recording.

Here is the code I found on the web, and this works, but I need to way to train, or make the engine smarter. Any ideas?

Thanks.

static void Main(string[] args)
{
    // Create an in-process speech recognizer for the en-US locale.
    using (SpeechRecognitionEngine recognizer =
          new SpeechRecognitionEngine(
            new System.Globalization.CultureInfo("en-US")))
    {
        // Create and load a dictation grammar.
        recognizer.LoadGrammar(new  DictationGrammar());

        // Add a handler for the speech recognized event.
        recognizer.SpeechRecognized +=
              new EventHandler<SpeechRecognizedEventArgs>(recognizer_SpeechRecognized);

        // Configure input to the speech recognizer.
        recognizer.SetInputToWaveFile(@"c:\test2.wav");  

        // Start asynchronous, continuous speech recognition.
        recognizer.RecognizeAsync(RecognizeMode.Multiple);

        // Keep the console window open.
        while (true)
        {
            Console.ReadLine();
        }
    }
}

// Handle the SpeechRecognized event.
static void recognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
    Console.WriteLine("Recognized text: " + e.Result.Text);

    using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\WriteLines2.txt", true))
    {
        file.WriteLine("");
    }  
}

来源:https://stackoverflow.com/questions/12764727/speech-to-text-c-sharp-train-for-better-translation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!