Browse
 
Tools
Rss Categories

LVSpeechPort::LoadGrammarFromBuffer

Reference Number: AA-00800 Views: 6885 0 Rating/ Voters
 

 Loads an SRGS grammar specified as a string buffer into the speech port for later use in a decode, DTMF decode or interpret text operation.

Function

  • int LoadGrammarFromBuffer(const char* gram_name, const char* gram_buffer)

Parameters

gram_name

 The identifier for the grammar being loaded. Whenever you activate, deactivate, or unload, this is the identifier you will use.

gram_buffer

 A NULL-terminated string containing the contents of a valid SRGS grammar. 

Return Values

LV_SUCCESS

 No errors; this grammar is now ready to use.

LV_GRAMMAR_SYNTAX_WARNING

 The grammar provided was not fully conforming, but it was understandable and is now ready for use.

LV_INVALID_HPORT

 The port is not valid (either CreateClient has not been called or DestroyClient has been called prior to this call).

LV_FAILURE

 The operation may have failed because the port was shutting down or the vocab size of the grammar is zero. The error also occurs when an internal failure has occurred, may be out of resources.

LV_LICENSES_EXPIRED

 The license associated with the port has been invalidated. 

LV_ACQUIRING_LICENSE_FAILED

The grammar could not be loaded due to a license not being available.

LV_GRAMMAR_LOADING_ERROR

 Either gram_name or gram_buffer, or both are NULL.

LV_LOAD_GRAMMAR_TIMEOUT

 Sending the grammar to the ASR server timed out.

LV_GRAMMAR_SYNTAX_ERROR

 Either the tag-format specified in the grammar is not supported or the grammar provided was not understandable to the grammar compiler.

LV_NO_SERVER_AVAILABLE

 There are no ASR servers available to load and compile the grammar.

LV_ACTIVE_GRAMMAR_INVALID_LANGUAGE

 The connected ASR server(s) do not support the language of the grammar being loaded.

LV_EXCEPTION

 An exception occurred while processing the request.

Remarks

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

 It is possible that some of the above return codes may get returned for different underlying reasons. Use ReturnGrammarErrorString to obtain a description of the actual reason for failure. 

See Also