我正在运行一些简单的main方法代码,该代码实例化一个SpeechRecognitionEngine并将一些语法数据传递给它。我似乎找不到为什么错误总是出现。我尝试删除.csproj和.suo,但没有任何变化。
SpeechRecognitionEngine spe = new SpeechRecognitionEngine();
Choices commands = new Choices();
commands.Add("hello", "what is your name");
GrammarBuilder gB = new GrammarBuilder(commands);
Grammar g = new Grammar(gB);
//every single call to spe.SomeMethod() breaks with the error in the title
spe.LoadGrammarAsync(g);
spe.SetInputToDefaultAudioDevice();
spe.RecognizeAsync(RecognizeMode.Multiple);发布于 2019-02-10 15:51:26
好了,弄明白了:转到: Build>Configuration Manager>Active Solution Platform单击“Any CPU”下拉列表。选择Set the platform to the compatible Speech SDK type (在我的例子中是x64),享受正在开发的机器人服务程序
ps。省去麻烦,使用RecognizeAsync()和not Recognize()。由于某些原因,Recognize喜欢执行两次。
https://stackoverflow.com/questions/54610171
复制相似问题