唷,大标题,但是是的,它总结了这个问题。
我在 C# 中使用 Microsoft SAPI,在我正在处理的程序中使用他们的语音识别。
我所做的是。语法 = objRecoContext.CreateGrammar(0);
menuRule = grammar.Rules.Add("typewrite", SpeechRuleAttributes.SRATopLevel | SpeechRuleAttributes.SRADynamic, 1);
object PropValue = "";
menuRule.InitialState.AddWordTransition(null, "will", " ", SpeechGrammarWordType.SGLexical, "will", 1, ref PropValue, 1.0F);
menuRule.InitialState.AddWordTransition(null, "New", " ", SpeechGrammarWordType.SGLexical, "New", 1, ref PropValue, 1.0F);
menuRule.InitialState.AddWordTransition(null, "Open", " ", SpeechGrammarWordType.SGLexical, "Open", 2, ref PropValue, 1.0F);
menuRule.InitialState.AddWordTransition(null, "Close", " ", SpeechGrammarWordType.SGLexical, "Close", 3, ref PropValue, 1.0F);
对于自定义词。但这会比我想要的更多。我怎样才能解决这个问题。
我要问的是,我怎样才能让 m$ sapi 只关心我想要的单词。不是默认字典中的每个单词。