SpeechRecognizeEngine不触发事件 [英] SpeechRecognizeEngine not firing events

查看:50
本文介绍了SpeechRecognizeEngine不触发事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我已经使用了Mycrosoft语音识别引擎,该引擎工作正常,但未引发SpeechRecognized和SpeechHypothesized事件.
代码在下面给出

Hi,
I have used Mycrosoft Speech Recognize Engine, that is working fine, but not firing SpeechRecognized and SpeechHypothesized event.
Code is given below

SpeechRecognitionEngine _sre = new SpeechRecognitionEngine();
_sre.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(sre_SpeechRecognized);
            _sre.SpeechHypothesized+=new EventHandler<SpeechHypothesizedEventArgs>(_sre_SpeechHypothesized);
            _sre.SetInputToDefaultAudioDevice();
            _sre.RecognizeAsync(RecognizeMode.Multiple);


请任何人知道解决方案,请堆我.
Kailas


Please anyone know the solution please heap me.
Kailas

推荐答案

我认为您缺少加载用于指示语音的语法.尽管我没有使用SpeechHypothesized事件(但我认为它会像SpeechRecognized事件一样),但是我使用SpeechRecognized事件,如..
I think you missing to load grammer for dictating your speech.Though i haven''t used SpeechHypothesized event(but i think it will as like as SpeechRecognized event),but i use SpeechRecognized event as like as..
//create an instance
SpeechRecognitionEngine recognitionEngine = new SpeechRecognitionEngine(new System.Globalization.CultureInfo("en-US"));

// Create and load a dictation grammar.
recognitionEngine.LoadGrammar(new DictationGrammar());

// Add a handler for the speech recognized event.
recognitionEngine.SpeechRecognized += new EventHandler<speechrecognizedeventargs>(recognitionEngine_SpeechRecognized);

// Configure input to the speech recognizer.
recognitionEngine.SetInputToDefaultAudioDevice();

void recognitionEngine_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
//recognize your speech here
}


这篇关于SpeechRecognizeEngine不触发事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆