我正在使用SpeechRecognitionEngine
库在 C# 中进行语音识别,我已将单词“start”设置为要识别的单词(选择):
Choices choices_start = new Choices("start");
GrammarBuilder grBuilder_start = new GrammarBuilder(choices_start);
Grammar grammar_start = new Grammar(grBuilder_start);
SpeechRecognitionEngine speech = new SpeechRecognitionEngine();
speech.LoadGrammar(grammar_start);
speech.SpeechRecognized += RecognizerSpeechRecognized;
private void RecognizerSpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
foreach (RecognizedWordUnit word in e.Result.Words)
{
switch (word.Text)
{
case "start":
Console.WriteLine(word.Text);
speech.UnloadGrammar(grammar_start);
speech.LoadGrammar(grammar_using);
break;
default:
Console.WriteLine(word.Text);
break;
}
}
}
问题是不管我说什么,它总是能识别“开始”这个词,知道为什么吗?