Operations Summary: | |
ResultTokenArray | getAlternativeTokens(in long nBest) raises |
long | getNumberGuesses() raises |
RuleGrammar | getRuleGrammar(in long nBest) raises |
string | getRuleName(in long nBest) raises |
StringArray | getTags() 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 the number of guesses for this result. The guesses are
numbered from 0 up. The 0th guess is the best guess for the result
and provides the same tokens as the getBestTokens
method of the Result
interface.
If only the best guess is available (no alternatives) the return
value is 1. If the result is was rejected (REJECTED
state), the return value may be 0 if no tokens are available.
If a best guess plus alternatives are available, the return value
is greater than 1.
The integer parameter to the getAlternativeTokens
,
getRuleGrammar
and getRuleName
methods
are indexed from 0 to (getNumberGuesses()-1).
Result#getBestTokens
Result#REJECTED
getAlternativeTokens
getRuleGrammar
getRuleName
Return the RuleGrammar
matched by the nth guess.
Return null if @nBest is out-of-range.
getRuleName
returns the rule matched in the
RuleGrammar
. See the documentation for
getAlternativeTokens
for a description of how
tokens, grammars and rules correspond.
An application can use the parse method of the matched grammar to analyse a result.
RuleGrammar
matched by the nth guessRuleGrammar#parse
getNumberGuesses
getAlternativeTokens
getRuleName
Return the RuleName
matched by the nth guess.
Return null if nBest
is out-of-range. Typically
used in combination with getAlternativeTokens
and
getRuleGrammar
which return the corresponding
tokens and grammar.
The documentation for getAlternativeTokens
shows
and example result with alternatives.
RuleName
matched by the nth guess.RuleGrammar#parse
getAlternativeTokens
getRuleGrammar
Return the list of tags matched by the best-guess token sequence. The tags in the array are ordered strictly in the left to right order in which they would appear in the supported grammat format.
For example, if the following simple Java Speech Grammar Format (JSGF) rule is active:
public= (open {ACT_OPEN} | close {ACT_CLOSE}) [(it{WHAT} now) {NOW}];
and the user says "close it now", then getTags returns an array containing {"ACT_CLOSE", "WHAT", "NOW"}. Note how both the {WHAT} and {NOW} tags are attached starting from the word "it" but that {TAG} appears first in the array. In effect, when tags start at the same token, they are listed "bottom-up".
getTags
does not indicate which tokens are matched
by which tags. To obtain this information use the
parse
method of the RuleGrammar
.
Also, getTags
only provides tags for the best guess.
To get tags for the alternative guesses using parsing through the
RuleGrammar
.
The string array returned by the getTags
method of
the RuleParse
object returned by parsing the
best-guess token sequence will be the same as returned by this
method.
RuleGrammar#parse
RuleParse#getTags