在Microsoft Speech Platform 11(服务器)上附加注释?

Jar*_*red 9 c# speech-recognition sapi speech-to-text

我对C#和Microsoft Speech平台都比较陌生,但我正在研究一个需要转录免费听写的服务器应用程序.MS Speech Platform SDK看起来很完美,并且可以在服务器上运行,除非我在GrammarBuilder中引用了AppendDictation()方法.

我正在使用Microsoft Speech Platform SDK 11,如果我定义语法,应用程序工作正常,但是当我在AppendDictation()中添加时,我遇到了这个错误:

Cannot find grammar referenced by this grammar.
Run Code Online (Sandbox Code Playgroud)

即使文档中的这个示例似乎也失败了:

GrammarBuilder startStop = new GrammarBuilder();
GrammarBuilder dictation = new GrammarBuilder();
dictation.AppendDictation();

startStop.Append(new SemanticResultKey("StartDictation", new SemanticResultValue("Start Dictation",true)));
startStop.Append(new SemanticResultKey("DictationInput", dictation));
startStop.Append(new SemanticResultKey("StopDictation", new SemanticResultValue("Stop Dictation", false)));
Grammar grammar=new Grammar(startStop);
grammar.Enabled=true;
grammar.Name=" Free-Text Dictation ";
_recognizer.LoadGrammar(grammar);
Run Code Online (Sandbox Code Playgroud)

奇怪的是,如果我将LoadGrammar更改为LoadGrammarAsync,语法加载(或至少调用事件处理程序),但是recoginzer失败并出现此错误:

Error: At least one grammar must be loaded before doing a recognition.
Run Code Online (Sandbox Code Playgroud)

我已经读过该平台的服务器版本不支持听写,但它似乎很奇怪,它将附带一个不起作用的方法.有没有人设法获得在服务器上工作的听写语法?我究竟做错了什么?

非常感谢

Jar*_*red 11

对于将来可能会遇到此问题的任何人 - 我现在已经通过电子邮件与Microsoft进行了来回通信,并最终收到了此回复:

托管接口(Microsoft.Speech和System.Speech)构建在本机SAPI接口之上.这些接口对于Server引擎和Desktop引擎都是相同的.

但是引擎本身负责实现听写,而服务器引擎则不这样做.因此,加载语法时调用将失败.

不是我希望的答案,但确实解释了它.

  • 那么还有其他方法可以听写吗? (2认同)