Partager via


ISpRecoGrammar (SAPI 5.4)

Microsoft Speech API 5.4

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
ISpGrammarBuilder interface
GetGrammarId
GetRecoContext
LoadCmdFromFile
LoadCmdFromObject
LoadCmdFromResource
LoadCmdFromMemory
LoadCmdFromProprietaryGrammar
SetRuleState
SetRuleIdState
LoadDictation
UnloadDictation
SetDictationState
SetWordSequenceData
SetTextSelection
IsPronounceable
SetGrammarState
SaveCmd
GetGrammarState