c# - SpeechRecognitionEngine.InstalledRecognizers 返回未安装识别器

标签 c# speech-recognition

我正在尝试启动一个简单的语音识别程序,但它不起作用,我已经安装了一些语言(en-GB 和 en-US),但每当我使用以下内容时:

SpeechRecognitionEngine.InstalledRecognizers

它返回一个空集合。即使我只是尝试启动识别器,它也会返回“未安装识别器”。但是当我重新安装一种语言时,它说它已经安装了。

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.SetInputToDefaultAudioDevice();

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

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

找不到安装的识别器是什么原因?

编辑:

这是异常:{System.ArgumentException:找不到所需 ID 的识别器。 参数名称:文化 在 System.Speech.Recognition.SpeechRecognitionEngine..ctor(CultureInfo 文化)

并且:var recognitions = SpeechRecognitionEngine.InstalledRecognizers(); 返回一个计数为 0 的集合

最佳答案

问题是我安装了可以通过 Microsoft.Speech 访问的语言包,并且当我切换到 Microsoft 时我正在使用 System.Speech。语音它起作用了。

关于c# - SpeechRecognitionEngine.InstalledRecognizers 返回未安装识别器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16856798/

相关文章:

c# - 卸载 AppDomain 后,所有程序集都被释放,除了一个

c# - 如何将声音的音量从听不见(0db)增加到响亮(60db)

speech-recognition - Microsoft.Speech.Synthesis 不适用于文本转语音但 System.Speech.Synthesis 有效。为什么?

java - 使用 Sphinx4 识别关键字或关键词

xml - HRESULT : 0x80045003 异常

node.js - 直接在客户端使用watson-developer-cloud Node SDK?

java - Sphinx4 的 SphinxTrain 的示例配置/属性 xml 文件

c# - 使用 C# 从 asp.net 中的代码后面将文本加载到 textarea

c# - MVC4 Controller 将多个 json 对象发布到 Controller ,ajax 发布

c# - 使用 WPF 客户端和 Active Directory ADFS 对 Cloud NodeJS 后端进行身份验证