How can I use ARPA files with MS Speech? The documentation for the Microsoft Speech Platform 11 Recognizer implies that one can compile a grammar from an ARPA file.
I am able to compile an ARPA file -- for instance, the tiny example provided by Microsoft -- using the following command line:
CompileGrammar.exe -In stock.arpa -InFormat ARPA
I'm able to use the resulting CFG file in the following test:
using Microsoft.Speech.Recognition;
// ...
using (var engine = new SpeechRecognitionEngine(new CultureInfo("en-US")))
{
engine.LoadGrammar(new Grammar("stock.cfg"));
var result = engine.EmulateRecognize("will stock go up");
Assert.That(result, Is.Not.Null);
}
This test passes, but note that it uses EmulateRecognize()
. When I switch to using an actual audio file, like this:
using (var engine = new SpeechRecognitionEngine(new CultureInfo("en-US")))
{
engine.LoadGrammar(new Grammar("stock.cfg"));
engine.SetInputToWaveFile("go-up.wav");
var result = engine.Recognize();
}
result is always null and the test fails.
Microsoft states quite clearly that it's supported, yet even very simple examples don't seem to work. What am I doing wrong?