I am working on a simple voice recognition application. I need some help with GrammarBuilder. Here is what I have tried:
Choices choice1 = new Choices(....);
Choices choice2 = new Choices(....);
Choices choice3 = new Choices(....);
GrammarBuilder gb = new GrammarBuilder();
gb.Append(choice1);
gb.Append(choice2);
gb.Append(choice3);
Grammar grammar = new Grammar(gb);
recognitionEngine.LoadGrammar(grammar);
This code expects the user to say something from choice1 then choice2 and then choice3 in that order and works great. But I want the code to expect choice1 then choice2 then ANY combination of choice2 and choice3. I am not sure how to implement this.
You can add all the choiches of 2 to 3. And then add that combination twice to the GrammarBuilder. (You have 4 choices added then.) I'm sure there is a better solution to this though, as this may seem like a work-a-round.
Myself, I am using a static SRGS-xml-file. And it has more options than the Choices class, I think.
You can also do that dynamically, have a look at this example. http://gotspeech.net/forums/thread/5206.aspx