ISpRecoGrammar
The ISpRecoGrammar interface enables applications to manage the words and phrases that the SR engine will recognize.
A single SpRecognizer object can have multiple SpRecoContext objects associated with it. And similarly, a single SpRecoContext object can have multiple SpRecoGrammar objects associated with it. Using a one-to-many relationship with SpRecoContext objects and SpRecoGrammar objects allows applications to separate types of recognizable phrases and content into separate objects for clearer application logic. Each SpRecoGrammar object can also have a context-free grammar (CFG) and a dictation grammar loaded simultaneously (e.g., use the CFG if possible, but back off to dictation if CFG fails to parse).
See Designing Grammar Rules for examples of how to create context-free grammars.
Methods in Vtable Order
ISpRecoGrammar Methods | Description |
---|---|
ISpGrammarBuilder interface | Inherits from ISpGrammarBuilder and all those methods are accessible from an ISpRecoGrammar object. |
GetGrammarId | Retrieves the grammar identifier associated with the application. |
GetRecoContext | Retrieves the context object that created this grammar. |
LoadCmdFromFile | Loads a command and control grammar from a file. |
LoadCmdFromObject | Loads a command and control grammar from a COM object. |
LoadCmdFromResource | Loads a command and control grammar from a Win32 resource. |
LoadCmdFromMemory | Loads a command and control grammar from memory. |
LoadCmdFromProprietaryGrammar | Loads an engine proprietary format command and control grammar. |
SetRuleState | Activates or deactivates a rule by its rule name. |
SetRuleIdState | Activates or deactivates a rule by its rule ID. |
LoadDictation | Loads and initializes a dictation topic. |
UnloadDictation | Unloads the active dictation topic from the grammar. |
SetDictationState | Sets a dictation state to active or inactive. |
SetWordSequenceData | Sets a word sequence buffer in the SR engine. |
SetTextSelection | Sets the current text selection and insertion point information. |
IsPronounceable | Determines if the word has a pronunciation. |
SetGrammarState | Sets the grammar state. |
SaveCmd | Allows applications using dynamic grammars to save the current grammar state to a stream. |
GetGrammarState | Retrieves recognition grammar state information. |