我對C#和微軟語音平臺都比較陌生,但我正在研究一個需要轉錄自由聽寫的服務器應用程序。 MS Speech Platform SDK似乎很完美,並且可以在服務器上工作,除非我引用了GrammarBuilder中的AppendDictation()方法。在Microsoft Speech Platform 11(服務器)上添加AppendDictation?
我使用的是微軟語音平臺SDK 11,如果我定義了一個語法的應用程序工作正常,但我在AppendDictation()添加的那一刻,我遇到了這個錯誤:
Cannot find grammar referenced by this grammar.
即使從文檔這個樣本似乎失敗:
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);
奇怪的是,如果我改變LoadGrammar到LoadGrammarAsync,語法負載(或至少是事件處理程序被調用),但隨後的recoginzer失敗,此錯誤:
Error: At least one grammar must be loaded before doing a recognition.
我讀過該平臺的服務器版本不支持聽寫,但它似乎很奇怪,它會出現一種方法,只是不工作。有沒有人設法讓聽寫語法在服務器上工作?我究竟做錯了什麼?
非常感謝
那麼有沒有其他的方法來做聽寫呢? – KTF 2014-05-03 02:20:01