Create Grammars Using GrammarBuilder (Microsoft.Speech)
The GrammarBuilder class provides a lightweight, programmatic approach to authoring grammars that is powerful enough to meet the requirements of many common speech recognition scenarios.
Using constructors and methods on the GrammarBuilder class, you can create individual phrases from strings, SemanticResultValue objects, and wildcards. You can combine these phrases with instances of Choices objects, which you can use to create lists of alternative words and phrases, any one of which may be used in recognition. You can also use a GrammarBuilder object to incorporate rules from external XML-format grammar files using a rule reference to the file or to a specific rule within the file.
Authoring with GrammarBuilder is best suited to grammars that have a single rule containing lists, or perhaps lists of lists. Grammars that have multiple rules, or that need to make internal rule references should be built using the Microsoft.Speech.Recognition.SrgsGrammar classes instead. For more information, see Create Grammars Using SrgsGrammar (Microsoft.Speech).