Microsoft Speech Platform
Additionally, a sample code is provided to demonstrate ISpGrammarBuilder.
ISpGrammarBuilder
This interface details the SAPI context-free grammar (CFG) backend compiler. These methods can be used to programmatically construct and modify grammars.
When To Use
Applications should use the ISpGrammarBuilder interface to change and save dynamically loaded grammars (see ISpRecoGrammar).
Methods in Vtable Order
ISpGrammarBuilder Methods | Description |
---|---|
ResetGrammar | Clears all grammar rules (un-defines them) and resets the grammar's language to NewLanguage. |
GetRule | Retrieves a grammar rule's initial state information (and defines the rule if requested). |
ClearRule | Removes all of the grammar rule information except for the rule's initial state handle. |
CreateNewState | Creates a new state in the same grammar rule as hState. |
AddWordTransition | Adds a word or a sequence of words to the grammar. |
AddRuleTransition | Adds a rule (reference) transition from one grammar rule to another. |
AddResource | Adds a resource (name and string value) to the grammar rule specified in hRuleState. |
Commit | Performs consistency checks of the grammar structure, creates the serialized format, saves the grammar structure, reloads the grammar structure to the stream provided by SetSaveObjects, or reloads it into the SR engine. |