AppendDictation on Microsoft Speech Platform 11 (Server)?
Asked Answered
A

2

9

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

Aleuromancy answered 19/2, 2012 at 6:50 Comment(0)
A
11

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.

Aleuromancy answered 29/2, 2012 at 18:1 Comment(1)
Is there any other way to do dictation then?Turquoise
P
3

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.

Paleoasiatic answered 5/7, 2012 at 4:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.