SpeechRecognitionEngine sre = new SpeechRecognitionEngine();
Choices clist = new Choices();
// just assume I have added words in clist not shown here
Grammar gr = new Grammar(new GrammarBuilder(clist));
sre.RequestRecognizerUpdate();
sre.LoadGrammar(gr);
sre.SpeechRecognized += sre_SpeechRecognized;
sre.SetInputToDefaultAudioDevice();
sre.RecognizeAsync(RecognizeMode.Multiple);
void sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
//This only outputs words present in grammar
Console.WriteLine(e.Result.Text);
}
In short why do we need a grammar in speech recognition. Whats the point if a grammar is needed. If the recognizer has to match strings present in grammar, why can't we just output what the speech recognizer recognized without grammar?
Thanks and kindly correct me where i'm wrong.