LV_SRE_SwitchToNBestAlternative

Switch the n-best alternative that is viewable. After this function call, subsequent result retrieval functions, such as LV_SRE_CreateInterpretation will come from this n-best alternative. Please note that you must have set the number of n-best alternatives greater than the default of 1 to make use of this function (see the properties list for more information).

int LV_SRE_SwitchToNBestAlternatives(HPORT hport, int voicechannel, int index);

 

Return Values

LV_SUCCESS

LV_FAILURE

The index is not valid.

Parameters

HPort

The port's handle.

voicechannel

The channel containing the decoded audio.

index

The index of the n-best alternative to switch to. It may be any value in the range [0, LV_SRE_GetNumberOfNBestAlternatives).

Remarks

Each alternative represents a distinct sentence. However, since some sentences can have multiple interpretations or multiple parses, it is possible that for some alternatives you will have multiple parse tree or interpretation objects returned. For this reason, you should get all results out as follows:

int nbest_count;
int nbest_total = LV_SRE_GetNumberOfNBestAlternatives(port, vc);
int interp_count;
for (nbest_count=0; nbest_count<nbest_total; ++nbest_count)
{
LV_SRE_SwitchToNBestAlternative
(port, vc, nbest_count);
int interp_total = LV_SRE_GetNumberOfInterpretations(port, vc);
    for (interp_count=0; interp_count<interp_total; ++interp_count)
    {
H_SI
interp = LV_SRE_CreateInterpretation(port, vc, interp_count);
/* do something with the interp */
        LVInterpretation_Release(interp);
    }
}

Even though more than one interpretation can live in a single n-best result, the same interpretation will not live in more than one n-best result. The lower scoring interpretations are pruned out.

See Also


Complete Help Topic List | Speech Engine Product Information