Switch the n-best alternative that is viewable. After this function call, following result retrieval functions, such as LVSpeechPort::GetInterpretation will be bound to 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 SwitchToNBestAlternatives(int voicechannel, int index);
LV_SUCCESS
LV_FAILURE
The index is not valid.
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, LVSpeechPort::GetNumberOfNBestAlternatives).
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, it is recommended to get all result out as follows:
int nbest_count;
int nbest_total = port.GetNumberOfNBestAlternatives(vc);
int interp_count;
for (nbest_count=0; nbest_count<nbest_total; ++nbest_count)
{
port.SwitchToNBestAlternative(vc, nbest_count);
int interp_total = port.GetNumberOfInterpretations(vc);
for (interp_count=0; interp_count<interp_total; ++interp_count)
{
LVInterpretation interp = port.GetInterpretation(vc, interp_count);
/* do something with the 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.
Complete Help Topic List | Speech Engine Product Information