LVSpeechPort::Decode

Processes the voice channel audio data against the active grammar. This is the manual process of telling the Engine to perform a recognition. The two most common reasons to use this function are to perform off-line decodes on existing audio or to programatically control whether to decode after a streaming process.

Function

Parameters

VoiceChannel

The audio channel holding the decode audio.

GrammarSet

The grammar to use for the decode. When using SRGS grammars this value should be set to LV_ACTIVE_GRAMMAR_SET. This tells the decoder to use every SRGS grammar which has been loaded and activated. Other values indicate the Engine should use a concept/phrase grammar set.

Note: Rather than using concept/phrase grammars, LumenVox encourages the use of SRGS grammars. SRGS grammars provide a standards-based method of creating grammars that is more robust and easier to troubleshoot than concept/phrase grammars. See our SRGS tutorial for more information on working with SRGS grammars. Concept phrase grammars were deprecated since 10.0

flags (bitwise OR flags to set desired options)

LV_DECODE_BLOCK - Decode will not return until it has finished.

LV_DECODE_SEMANTIC_INTERPRETATION - This flag is deprecated. It tells the Engine to expect SISR in the tags of the SRGS grammar. Without this, the engine will ignore what is contained in tag elements.

Return Values

Positive Number

A positive number will be returned if you have set LV_DECODE_BLOCK. This number indicates how many interpretations the ASR was able to decode.

LV_SUCCESS

LV_SUCCESS will be returned if the LV_DECODE_BLOCK flag was not set. This return indicates that the port was able to successfully communicate with the server.

LV_ACTIVE_GRAMMAR_INVALID_LANGUAGE

Indicates that the language specified in the grammar is either invalid or is not available on the ASR server.

LV_ACTIVE_GRAMMAR_LANGUAGE_CONFLICT

Indicates that more than one language was specified in the active grammar set.

LV_ACTIVE_GRAMMAR_VOCAB_SIZE_EXCEEDS_LIMIT

Indicates that you do not have the right license type for the decode. Either a Lite license was used when the vocabulary size of the active grammar set exceeded 500, or an SLM decode operation was attempted with a non-SLM license.

LV_BAD_SOUND_DATA

Sound sample was < 1/8 of a second.

LV_FAILURE

This grammar could not be activated, because the port was shutting down.

LV_GRAMMAR_LOADING_ERROR

Indicates an error in using an active grammar for the decode operation (eg: there were no words in the compiled grammar).

LV_INVALID_LICENSE

Indicates License used is not valid.

LV_INVALID_HPORT

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

LV_INVALID_SOUND_CHANNEL

The input VoiceChannel is not a valid one.

LV_LICENSES_EXPIRED

Indicates that the license acquired for the decode operation does not permit the use of the current version of the ASR server.

LV_NO_SERVER_AVAILABLE

Indicates that no ASR servers were available to perform the decode.

LV_TIME_OUT

Indicates that the preceeding decode operation timed out.

LV_EXCEPTION

An exception occured while processing the request.

Note: that if the number of interpretations against a grammar grows so high that continuing to build parse trees will cause memory issues, the Engine will return no interpretations but the client will not return an error (this is usually caused by improperly designed grammars that feature some sort of recursion). If the Engine returns no interpretations, please check the decode server log to see if the server recorded an error.

When not blocking the function, GetLastDecodeError should be called to check for additional grammar/language issues which may have occurred during the recognition process.

Remarks

If LV_DECODE_BLOCK is set, Decode will not return until it has finished processing the data.

If LV_DECODE_BLOCK is not set, Decode returns immediately (but continues processing the data on a separate thread); the client application can continue its own work. Calling other LVSpeechPort methods may block until the Decode is finished. Once the client application is ready to check for results, call WaitForEngineToIdle. If any function which requests the results of the decode is called before the result is ready, the function itself will call WaitForEngineToIdle with an infinite timeout.

On an error, call ReturnErrorString with the negative result from Decode to get a description of the error.

Of the error codes listed above, LV_INVALID_SOUND_CHANNEL is returned due to an error in the input to the function.

See Also

© 2012 LumenVox LLC. All rights reserved.