This function can be called to load an SRGS grammar into the ASR from a specified Uniform Resource Identifier (URI) along with an optional list of MRCP-style headers. This function serves to facilitate the loading of grammars when being passed grammar loading parameters in an MRCP or HTTP environment. It is also useful for specifying grammar load parameters that cannot be stored in the grammar itself, such as Fetch-Timeout and Cache-control parameters.
- int LV_SRE_LoadGrammarWithParameters(HPORT hport, const char* UniformResourceIdentifier, const char* ParameterList)
The handle for the speech port you are loading the grammar into.
The URI describing the location or identity of the source grammar to be loaded.
A character buffer containing a list of key-value pairs delimited by "\r\n"
e.g. LV_SRE_LoadGrammarWithParameters(PortHandle, "http://localhost/mygram.gram", "Content-Id: 1\r\nCache-Control: no-cache\r\n");
No errors; this grammar was loaded successfully from the URI and is now ready to use. This can be accessed using either the URI or optionally using the Content-Id specified in the parameter list.
The grammar was successfully loaded from the URI provided, however was not fully conforming, but it was understandable and is now ready for use. The warning should be checked in the log file.
The specified hport parameter is not a valid one.
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.
The license associated with the port has been invalidated.
The grammar could not be loaded due to a license not being available.
The specified grammar failed to load for some reason other than the grammar's contents. The most common reason for this error is that the grammar is not accessible at the specified location.
Grammar failed to load within the time specified by the GRAMMAR_LOAD_TIMEOUT configuration value.
Either the tag-format specified in the grammar is not supported or the grammar provided was not understandable to the grammar compiler. Grammar failed to load due to invalid grammar syntax. This can usually be fixed by modifying the contents of the grammar.
There are no ASR servers available to load and compile the grammar.
The connected ASR server(s) do not support the language of the grammar being loaded.
An exception occurred while processing the request.
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 LV_SRE_ReturnGrammarErrorString to obtain a description of the actual reason for failure.