com.cloudgarden.speech
Class CGResult

java.lang.Object
  |
  +--com.cloudgarden.speech.CGResult
All Implemented Interfaces:
FinalDictationResult, FinalResult, FinalRuleResult, Result

public class CGResult
extends java.lang.Object
implements FinalRuleResult, FinalDictationResult

Implements both the FinalRuleResult and FinalDictationResult interfaces, as described in the JSAPI documentation, but adds two methods allowing the user to obtain the recognizer's confidence in it's estimate of the current result.


Fields inherited from interface javax.speech.recognition.FinalResult
DONT_KNOW, MISRECOGNITION, USER_CHANGE
 
Fields inherited from interface javax.speech.recognition.Result
ACCEPTED, REJECTED, UNFINALIZED
 
Method Summary
 void addResultListener(ResultListener listener)
           
 ResultToken[] getAlternativeTokens(int nBest)
           
 ResultToken[][] getAlternativeTokens(ResultToken fromToken, ResultToken toToken, int max)
           
 java.applet.AudioClip getAudio()
           
 java.applet.AudioClip getAudio(ResultToken fromToken, ResultToken toToken)
           
 ResultToken getBestToken(int tokNum)
           
 ResultToken[] getBestTokens()
           
 int getConfidence(int altIndex)
          Returns a confidence value from 0 to 100, indicating the degree of confidence the recognizer has in a certain alternate result (0 for the set of best tokens).
 int getEngineConfidence(int altIndex)
          Returns a confidence value in a range determined by the engine , indicating the degree of confidence the recognizer has in a certain alternate result (0 for the set of best tokens).
 Grammar getGrammar()
           
 int getNumberGuesses()
           
 int getResultState()
           
 RuleGrammar getRuleGrammar(int nBest)
           
 java.lang.String getRuleName(int nBest)
           
 java.lang.String[] getTags()
           
 ResultToken[] getUnfinalizedTokens()
           
 boolean isAudioAvailable()
           
 boolean isTrainingInfoAvailable()
           
 int numTokens()
           
 void releaseAudio()
           
 void releaseTrainingInfo()
           
 void removeResultListener(ResultListener listener)
           
 void setAudioAvailable(boolean available)
           
 void setMaxAlts(int max)
           
 void setTrainingInfoAvailable(boolean available)
           
 void tokenCorrection(java.lang.String[] correctTokens, ResultToken fromToken, ResultToken toToken, int correctionType)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getConfidence

public int getConfidence(int altIndex)
Returns a confidence value from 0 to 100, indicating the degree of confidence the recognizer has in a certain alternate result (0 for the set of best tokens).
Parameters:
altIndex - the index of the alternate result (0 for the set of best guess).

getEngineConfidence

public int getEngineConfidence(int altIndex)
Returns a confidence value in a range determined by the engine , indicating the degree of confidence the recognizer has in a certain alternate result (0 for the set of best tokens).
Parameters:
altIndex - the index of the alternate result (0 for the set of best guess).

addResultListener

public void addResultListener(ResultListener listener)
Specified by:
addResultListener in interface Result

getBestToken

public ResultToken getBestToken(int tokNum)
Specified by:
getBestToken in interface Result

getBestTokens

public ResultToken[] getBestTokens()
Specified by:
getBestTokens in interface Result

getGrammar

public Grammar getGrammar()
Specified by:
getGrammar in interface Result

getResultState

public int getResultState()
Specified by:
getResultState in interface Result

getUnfinalizedTokens

public ResultToken[] getUnfinalizedTokens()
Specified by:
getUnfinalizedTokens in interface Result

numTokens

public int numTokens()
Specified by:
numTokens in interface Result

removeResultListener

public void removeResultListener(ResultListener listener)
Specified by:
removeResultListener in interface Result

getAudio

public java.applet.AudioClip getAudio()
                               throws ResultStateError
Specified by:
getAudio in interface FinalResult

getAudio

public java.applet.AudioClip getAudio(ResultToken fromToken,
                                      ResultToken toToken)
                               throws ResultStateError,
                                      java.lang.IllegalArgumentException
Specified by:
getAudio in interface FinalResult

isAudioAvailable

public boolean isAudioAvailable()
                         throws ResultStateError
Specified by:
isAudioAvailable in interface FinalResult

isTrainingInfoAvailable

public boolean isTrainingInfoAvailable()
                                throws ResultStateError
Specified by:
isTrainingInfoAvailable in interface FinalResult

setAudioAvailable

public void setAudioAvailable(boolean available)

setTrainingInfoAvailable

public void setTrainingInfoAvailable(boolean available)

setMaxAlts

public void setMaxAlts(int max)

releaseAudio

public void releaseAudio()
                  throws ResultStateError
Specified by:
releaseAudio in interface FinalResult

releaseTrainingInfo

public void releaseTrainingInfo()
                         throws ResultStateError
Specified by:
releaseTrainingInfo in interface FinalResult

tokenCorrection

public void tokenCorrection(java.lang.String[] correctTokens,
                            ResultToken fromToken,
                            ResultToken toToken,
                            int correctionType)
                     throws ResultStateError,
                            java.lang.IllegalArgumentException
Specified by:
tokenCorrection in interface FinalResult

getAlternativeTokens

public ResultToken[] getAlternativeTokens(int nBest)
                                   throws ResultStateError
Specified by:
getAlternativeTokens in interface FinalRuleResult

getNumberGuesses

public int getNumberGuesses()
                     throws ResultStateError
Specified by:
getNumberGuesses in interface FinalRuleResult

getRuleGrammar

public RuleGrammar getRuleGrammar(int nBest)
                           throws ResultStateError
Specified by:
getRuleGrammar in interface FinalRuleResult

getRuleName

public java.lang.String getRuleName(int nBest)
                             throws ResultStateError
Specified by:
getRuleName in interface FinalRuleResult

getTags

public java.lang.String[] getTags()
                           throws ResultStateError
Specified by:
getTags in interface FinalRuleResult

getAlternativeTokens

public ResultToken[][] getAlternativeTokens(ResultToken fromToken,
                                            ResultToken toToken,
                                            int max)
                                     throws ResultStateError
Specified by:
getAlternativeTokens in interface FinalDictationResult

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object