我怎样才能使用System.speech来决定英语

时间:2013-04-16 05:12:09

标签: speech-recognition speech speech-to-text system.speech.recognition

我的程序只能识别中文,这很奇怪。顺便说一句,我在中国。

即使我安装了英文版的visual c#2010,它仍然只能识别中文。

如何更改语言设置?

 private void InitializeRecognizerSynthesizer()
    {
        var selectedRecognizer = (from e in SpeechRecognitionEngine.InstalledRecognizers()
                                  where e.Culture.Equals(Thread.CurrentThread.CurrentCulture)
                                  select e).FirstOrDefault();
        recognizer = new SpeechRecognitionEngine(selectedRecognizer);


        recognizer.AudioStateChanged+=new EventHandler<AudioStateChangedEventArgs>(recognizer_AudioStateChanged);
        recognizer.SpeechHypothesized += new EventHandler<SpeechHypothesizedEventArgs>(recognizer_SpeechHypothesized);
        recognizer.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(recognizer_SpeechRecognized);

        synthesizer = new SpeechSynthesizer();
    }

然后我改变了 var selectedRecognizer =(来自SpeechRecognitionEngine.InstalledRecognizers()中的e                                       其中e.Culture.Equals(Thread.CurrentThread.CurrentCulture)                                       选择e).FirstOrDefault();

到e.Culture.Equals(“en”);

但它似乎是识别器=新的SpeechRecognitionEngine(selectedRecognizer)的例外; 说检查以确定对象是否为空。

我在控制面板中使用麦克风作为默认音频输入设备。

我在http://msdn.microsoft.com/en-us/library/ms554259.aspx尝试了这个最简单的代码 现在。还会发生异常,警告句子中没有此类文化标识符: SpeechRecognitionEngine识别器=               新的SpeechRecognitionEngine(                 新的System.Globalization.CultureInfo(“en-US”)))

0 个答案:

没有答案