我认为您可以通过使用短语来做到这一点
GrammarBuilder thisIsPhrase = new GrammarBuilder("This is");
Choices choices = new Choices("Dog, Cat");
GrammarBuilder endPhrase = new GrammarBuilder(choices);
Choices both = new Choices(new GrammarBuilder[] { thisIsPhrase, endPhrase });
Grammar dictationGrammar = new Grammar((GrammarBuilder)both);
请参阅MSDN。
我还没有能够测试它。
更新:选择短语似乎不起作用。
GrammarBuilder thisIsPhrase = new GrammarBuilder("This is");
GrammarBuilder endPhrase = new GrammarBuilder("Dog"); //repeat creating phrases
Choices both = new Choices(new GrammarBuilder[] { thisIsPhrase, endPhrase });//also need to add phrases here
Grammar dictationGrammar = new Grammar((GrammarBuilder)both);