LoadGrammar functions

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.

Functions

int LoadGrammar(const char* gram_name, const char* gram_location);

int LoadGrammar(int gram_name, const char* gram_location);

int LoadGrammarFromBuffer(const char* gram_name, const char* gram_contents);

int LoadGrammarFromBuffer(int gram_name, const char* gram_contents);

int LoadGrammarFromObject(const char* gram_name, LVGrammar&gram_obj);

int LoadGrammarFromObject(int gram_name, LVGrammar&gram_obj);

Parameters

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.  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_obj

An LVGrammar object.

 

Return Values

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.

Remarks

Detailed error and warning messages are sent to the speech port's logging callback function at priorities 0 and 1, respectively.

See Also


Complete Help Topic List | Speech Engine Product Information