To decode using multiple grammars (or grammars identified by string labels), you must activate the grammar, which places it in the speech port's active grammar set.
When you activate a grammar, it is first looked for among the pre-loaded grammars. If the grammar is not found among the loaded grammars, the speech port attempts to load the grammar by treating the label provided as a URI.
The active grammar set is identified during decode as LV_ACTIVE_GRAMMAR_SET when you call:
LV_SRE_Decode(my_hport, my_voicechannel, LV_ACTIVE_GRAMMAR_SET, my_decodeflags) /* C Non-streaming API */
LV_SRE_StreamSetParameter(my_hport, STREAM_PARM_GRAMMAR_SET, LV_ACTIVE_GRAMMAR_SET); /* C streaming API */
or
my_port.Decode(my_voicechannel, LV_ACTIVE_GRAMMAR_SET, my_decodeflags) //C++ Non-streaming API
This system allows the LumenVox 4.1 API to remain backward compatible with code based on the API before 4.1
int LVSpeechPort::ActivateGrammar(const char* label);
int LVSpeechPort::ActivateGrammar(int index);
int LVSpeechPort::ActivateGlobalGrammar(const char* label);
int LVSpeechPort::DeactivateGrammar(const char* label);
int LVSpeechPort::DeactivateGrammar(int index);
int LVSpeechPort::DeactivateGlobalGrammar(const char* label);
int LVSpeechPort::DeactivateGrammars();
int LV_SRE_ActivateGrammar(HPORT port, const char* label);
int LV_SRE_ActivateGrammarIdx(HPORT port, int index);
int LV_SRE_ActivateGlobalGrammar(HPORT port, const char* label);
int LV_SRE_DeactivateGrammar(HPORT port, const char* label);
int LV_SRE_DeactivateGrammarIdx(HPORT port, int index);
int LV_SRE_DeactivateGlobalGrammar(HPORT port, const char* label);
int LV_SRE_DeactivateGrammars(HPORT port);
LV_SUCCESS
No errors; this grammar is now active or deactivated, depending on the call.
LV_GRAMMAR_WARNING
The grammar was not in the collection of loaded grammars. The grammar was successfully loaded by treating the label as a URI, but the grammar generated warning messages when it was compiled. The grammar is now active. See the logs for details.
LV_GRAMMAR_ERROR
The grammar was not activated. It wasn't in the collection of loaded grammars. Also, its name did not resolve to a valid location, or it did, but the grammar there did not compile. See the logs for details.
Complete Help Topic List | Speech Engine Product Information