【发布时间】:2017-03-22 03:27:09
【问题描述】:
SpeechRecognitionEngine sre = new SpeechRecognitionEngine();
Choices clist = new Choices();
// just assume I have added words in clist not shown here
Grammar gr = new Grammar(new GrammarBuilder(clist));
sre.RequestRecognizerUpdate();
sre.LoadGrammar(gr);
sre.SpeechRecognized += sre_SpeechRecognized;
sre.SetInputToDefaultAudioDevice();
sre.RecognizeAsync(RecognizeMode.Multiple);
void sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
//This only outputs words present in grammar
Console.WriteLine(e.Result.Text);
}
简而言之,为什么我们需要语音识别中的语法。如果需要语法,那有什么意义。如果识别器必须匹配语法中存在的字符串,为什么我们不能只输出语音识别器在没有语法的情况下识别的内容?
谢谢,如果我错了,请纠正我。
【问题讨论】:
标签: c# speech-recognition speech-to-text