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

  发布于 2023-01-07 13:57

美好的一天!我尝试使用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(sre_SpeechRecognized);

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

但我得到了这个例外:此系统无法使用语音识别功能.无法找到SAPI和语音识别引擎.我尝试安装SpeechSDK51,但没有结果.

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

谢谢!

PS错误出现在:

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

Ricardo Pere.. 5

您是否添加了运行时组件的x64和x86版本?它对我有用.

1 个回答
  • 您是否添加了运行时组件的x64和x86版本?它对我有用.

    2023-01-07 13:59 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有