语音识别在此系统上不可用。找不到SAPI和语音识别引擎。

3

您好!我尝试使用Speech SDK 11编写简单的语音转文本引擎。因此,我尝试从此示例中执行测试。

所以,我只是创建了一个控制台应用程序并运行了代码(使用任务)。

 Task speechRecognizer = new Task(DoWork);
        speechRecognizer.Start();
        speechRecognizer.Wait();

static void DoWork()
    {

        // Create a new SpeechRecognitionEngine instance.
        SpeechRecognitionEngine sre = new SpeechRecognitionEngine();

        // Configure the input to the recognizer.
        sre.SetInputToWaveFile(@"c:\Test\Colors.wav");

        // Create a simple grammar that recognizes "red", "green", or "blue".
        Choices colors = new Choices();
        colors.Add(new string[] { "red", "green", "blue" });

        // Create a GrammarBuilder object and append the Choices object.
        GrammarBuilder gb = new GrammarBuilder();
        gb.Append(colors);

        // Create the Grammar instance and load it into the speech recognition engine.
        Grammar g = new Grammar(gb);
        sre.LoadGrammar(g);

        // Register a handler for the SpeechRecognized event.
        sre.SpeechRecognized +=
          new EventHandler<SpeechRecognizedEventArgs>(sre_SpeechRecognized);

        // Start recognition.
        sre.Recognize();
    }

但是我遇到了这个异常:此系统上不支持语音识别。找不到SAPI和语音识别引擎。我尝试安装SpeechSDK51,但没有结果。

你能告诉我如何解决这个错误吗?

谢谢!

P.S. 错误出现在:

 // Create a new SpeechRecognitionEngine instance.
    SpeechRecognitionEngine sre = new SpeechRecognitionEngine();
2个回答

6

您是否都添加了x64和x86版本的运行时组件?这对我而言起作用了。


1

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接