Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AppendDictation on Microsoft Speech Platform 11 (Server)?

I'm relatively new to both C# and the Microsoft Speech platform, but I am working on a server application that will need to transcribe free dictation. The MS Speech Platform SDK seemed perfect, and works on the server, unless i reference the AppendDictation() method in GrammarBuilder.

I am using the Microsoft Speech Platform SDK 11, and the application works fine if I define a grammar, but the moment I add in AppendDictation(), I am met with this error:

Cannot find grammar referenced by this grammar.

Even this sample from the documentation seems to fail:

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);

Oddly, if I change LoadGrammar to LoadGrammarAsync, the grammar loads (or at least the event handler is called), but then the recoginzer fails with this error:

Error: At least one grammar must be loaded before doing a recognition.

I've read that the server version of the platform does not support dictation, but it seems odd that it would ship with a method that just doesn't work. Has anyone managed to get a dictation grammar to work on the server? What am I doing wrong?

Many thanks

like image 275
Jared Avatar asked Feb 19 '12 06:02

Jared


2 Answers

For anyone who may come across this in the future -- I've now emailed back and forth with Microsoft, and ultimately received this response:

The managed interfaces (Microsoft.Speech and System.Speech) are built on top of the native SAPI interfaces. These interfaces are the same for both the Server engine and the Desktop engine.

BUT the engine itself is responsible for implementing dictation, and the Server engine does not do so. Therefore, the call will fail when you load the grammar.

Not the answer I was hoping for, but it does explain it.

like image 54
Jared Avatar answered Nov 15 '22 14:11

Jared


If you use System.Speech you can load you grammar with _recognizer.LoadGrammar(new DictationGrammar()); , and it will work well. The recognition is not bad, but then you have to use a 16KHz PCM wave file or other compatible wave file configurations. Sadly the DictationGrammar() is not available with Microsoft.Speech.

like image 31
Sunil Mathew Avatar answered Nov 15 '22 14:11

Sunil Mathew