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#
非常感謝,並糾正我錯在哪裏。
[語音識別API沒有語法C#]可能的重複(http://stackoverflow.com/questions/9229187/speech-recognition-api-without-grammar-c-sharp) –