Operations Summary: | |
ResultTokenArray2D | getAlternativeTokens(in ResultToken fromToken, in ResultToken toToken, in long max) raises |
Operations Inherited from FinalResult | |
getAudio, getAudioForToken, isAudioAvailable, releaseAudio, isTrainingInfoAvailable, releaseTrainingInfo, tokenCorrection |
Operations Inherited from Result | |
addResultListener, removeResultListener, getBestToken, getBestTokens, getGrammar, getResultState, getUnfinalizedTokens, numTokens |
Operations Inherited from Bonobo::Unknown | |
ref, unref, queryInterface |
Operation Details: |
Return a set of alternative token guesses for a single known token or sequence of tokens. In a dictation application the alternative guesses are typically provided to a user to facilitate efficient correction of dictated text. The assumption is that if a recognizer does not correctly hear a user (a mis-recognition) the correct tokens are likely to be amongst the top alternatives guesses.
Typically when a user selects one of the alternative guesses as the
correct token sequence, the tokenCorrection
method
of the FinalResult
interface is called with those
tokens. That call allows the Recognizer
to learn
from recognition errors and can improve future recognition accuarcy.
The fromToken
and toToken
parameters
define an inclusive set of tokens for which alternatives are
required. fromToken
and toToken
are
typically included in the set of alternative guesses.
If toToken
is null or if fromToken
and toToken
are the same, then alternatives are
provided for the single toToken
token.
The tokens passed to this method must be
ResultToken
objects provided by this result
through previous calls to getAlternativeTokens
or the getBestToken
and getBestTokens
methods of the Result
interface.
Returned Array Structure
The return value is a ragged two-dimension array with indices
being The number of tokens may be different in each alternative guess.
This means that the length of The max parameter indicates the maximum number of alternative
guesses to be returned. The number of guesses returned may be
less than or equal to max. The number of alternatives returned
is also less than or equal to the The number of alternative guesses and the number of tokens in each
guess can vary between results. The numbers can vary for different
values of The returned alternative guess is always an array of length one or
greater. If there is only one guess, it may be the sequence of
altTokens[guessNumber][tokenNumber]
. The
guesses are ordered by from best guess to least likely
(determined by the recognizer): altTokens[0] is the best
guess for the span of
fromToken
to
toToken,
altTokens[1]
is the first
alternative guess and so on.
altTokens[0]
may be
different from the length of altTokens[1]
and so
on. The length is never zero or less. (This point is illustrated
in the example below.)
NumResultAlternatives
property set in the RecognizerProperties
at the
time of recognition.
fromToken
and toToken
for the
calls to the same result.
fromToken
to toToken
tokens. Each
guess always contains one or more tokens. If the result is
ACCEPTED
then the recognizer is confident that all
the alternatives guesses are reasonable guesses of what the user
said.
Result
Result#numTokens
Result#getBestToken
Result#getBestTokens
FinalResult#tokenCorrection
RecognizerProperties#setNumResultAlternatives