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.
These functions load an SRGS grammar that will be usable by a single speech port object.
LV_SRE_LoadGrammar(HPORT hport, const char* gram_name, const char* gram_location);
LV_SRE_LoadGrammarIdx(HPORT hport, int gram_name, const char* gram_location);
LV_SRE_LoadGrammarFromBuffer(HPORT hport, const char* gram_name, const char* gram_contents);
LV_SRE_LoadGrammarFromBufferIdx(HPORT hport, int gram_name, const char* gram_contents);
LV_SRE_LoadGrammarFromObject(HPORT hport, const char* gram_name, HGRAMMARgram_handle);
LV_SRE_LoadGrammarFromObjectIdx(HPORT hport, int gram_name, HGRAMMARgram_handle);
hport
The handle for the speech port you are loading the grammar into.
gram_name
The identifier for the grammar being loaded. Whenever you activate, deactivate, or unload, this is the identifier you will use. This can be a string, or an integer ID if you use the *Idx version of the function call. The string "123" and the integer 123 are identical labels. Integer names are provided for backward compatibility.
gram_location
A file descriptor or uri that points to a valid SRGS grammar file, such as "c:/grammars/pizza.grxml", "http://www.gramsRus.com/phonenumber.gram", or "builtin:dtmf/boolean?y=1;n=2"
gram_contents
A null terminated string containing the contents of a valid SRGS grammar file.
gram_handle
A handle for an LVGrammar object, created by LVGrammar_Create
LV_SUCCESS
No errors; this grammar is now ready for use.
LV_GRAMMAR_SYNTAX_WARNING
The grammar file was not fully conforming, but it was understandable and is now ready to be used
LV_GRAMMAR_SYNTAX_ERROR
The grammar file was not understandable to the grammar compiler. You will not be able to decode with this grammar.
LV_GRAMMAR_LOADING_ERROR
The grammar compiler was unable to find the location of the grammar you loaded.
LV_LOAD_GRAMMAR_TIMEOUT
The grammar did not load in the time specified by PROP_EX_LOAD_GRAMMAR_TIMEOUT. See SetPropertyEx for details on setting this property.
Detailed error and warning messages are sent to the speech port's logging callback function at priorities 0 and 1, respectively.
LVSpeechPort::LoadGrammar functions (C++ API)
Complete Help Topic List | Speech Engine Product Information