简体   繁体   中英

Microsoft.Speech.Recognition recognize dictation

I`m using Microssoft.Speech.Recognition to recognize some speech. I have SDK v11 installed and it works pretty good until I try to AppendDictation to GrammarBuilder:

Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US"); 
sre = new SpeechRecognitionEngine(new System.Globalization.CultureInfo("en-US"));

sre.SetInputToDefaultAudioDevice();
GrammarBuilder gb = new GrammarBuilder();
gb.Append("start");
gb.AppendDictation();
gb.Append("end");
Grammar g = new Grammar(gb);
sre.LoadGrammar(g);

And it crashes at line sre.LoadGrammar(g) .

Error text: Cannot find grammar referenced by this grammar.

Am i doing something wrong? I will be grateful for Your help!

Unfortunately, the server version of Microsoft's Speech SDK doesn't support dictation grammars at the moment. You should try using the System.Speech.Recognition namespace instead of the Microsoft.Speech.Recognition namespace. You will need to have speech recognition installed on your server if it is not already installed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM