Loading and Unloading a Grammar

Before you can use a grammar, you must load it into the speech port's collection of grammars, or you must load it into the collection of application-level (Global) grammars.  When you load a grammar, it is compiled for use in the LumenVox Speech Engine.

Grammars can be loaded by specifying their location as a URI, or by passing them in as a null terminated string buffer.  

Grammars must be given a label when they are loaded.

C API

Loading

BOOL LVCA_LoadSRGSGrammar(HANDLE hCA, const char* label, const char* location);

BOOL LVCA_LoadSRGSGlobalGrammar(HANDLE hCA, const char* label, const char* location);

Unloading

BOOL LVCA_UnloadSRGSGrammar(HANDLE hCA, const char* label);

BOOL LVCA_UnloadSRGSGlobalGrammar(HANDLE hCA, const char* label);

Querying

BOOL LVCA_IsSRGSGrammarLoaded(HANDLE hCA, const char* label);

BOOL LVCA_IsSRGSGlobalGrammarLoaded(HANDLE hCA, const char* label);

Return Values

If successful, LVCA_GetCondition returns true.  If false is returned, call LVCA_GetLastCallError to retrieve the error code and message.

Remarks

Detailed error and warning messages are added to the speech port's log at priorities 0 and 1, respectively.

The location may be a local file description, or a URL for a grammar at a remote location.

If you load from a buffer, and have external references in your grammar with relative pathnames, your grammar needs to specify a base URI, or the compiler will be unable to find the references.

 


Complete Help Topic List | Speech Platform Product Information