Modules | Files | Inheritance Tree | Inheritance Graph | Name Index
module GNOME::Speech::Recognition
interface FinalRuleResult
Files: GNOME_Speech.idl
GNOME-Speech-Recognition-FinalRuleResult-inheritance GNOME-Speech-Recognition-FinalResult.html GNOME-Speech-Recognition-Result.html GNOME-Speech-SpeechObject.html Bonobo-Unknown.html
Operations Summary:
ResultTokenArraygetAlternativeTokens(in long nBest) raises
 longgetNumberGuesses() raises
RuleGrammargetRuleGrammar(in long nBest) raises
 stringgetRuleName(in long nBest) raises
StringArraygetTags() 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:
ResultTokenArray getAlternativeTokens(in long nBest) raises (ResultStateError)
 long getNumberGuesses() raises (ResultStateError)

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).

Return:
the number of guesses for this result.
See Also:
Result#getBestTokens
Result#REJECTED
getAlternativeTokens
getRuleGrammar
getRuleName


RuleGrammar getRuleGrammar(in long nBest) raises (ResultStateError)

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.

Parameters:
nBest - the nBest value.
Return:
the RuleGrammar matched by the nth guess
See Also:
RuleGrammar#parse
getNumberGuesses
getAlternativeTokens
getRuleName


 string getRuleName(in long nBest) raises (ResultStateError)

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.

Parameters:
nBest - the nBest value.
Return:
the RuleName matched by the nth guess.
See Also:
RuleGrammar#parse
getAlternativeTokens
getRuleGrammar


StringArray getTags() raises (ResultStateError)

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.

Return:
the list of tags matched by the best-guess token sequence.
See Also:
RuleGrammar#parse
RuleParse#getTags