JSAPI 2.0

javax.speech.recognition
Interface ResultToken


public interface ResultToken

A token (usually a word) contained by a Result representing something heard by a Recognizer. For a Result from a RuleGrammar, a ResultToken contains the same String as the defining RuleToken in the RuleGrammar.

For any Result, best finalized ResultTokens are obtained from the getBestToken and getBestTokens methods of the Result interface. For a finalized Result, alternatives may be available through the getAlternativeTokens method of the FinalResult interface.

The ResultToken provides the following information:

See Also:
Result, getBestToken, getBestTokens, FinalResult, getAlternativeTokens

Method Summary
 int getConfidenceLevel()
          Gets the confidence level of this token.
 long getEndTime()
          Gets the approximate end time for this token in milliseconds.
 Result getResult()
          Returns a reference to the result that contains this token.
 long getStartTime()
          Gets the approximate start time for this token in milliseconds.
 String getText()
          Gets the text of this token.
 

Method Detail

getConfidenceLevel

int getConfidenceLevel()
Gets the confidence level of this token. This indicates the recognizer's confidence in the token. Values lie in the range between MIN_CONFIDENCE and MAX_CONFIDENCE. Not all Engines support confidence levels for tokens.

Confidence levels may only be available in the ACCEPTED state. A value of UNKNOWN_CONFIDENCE may be returned if the confidence is unavailable or not supported

Returns:
the confidence level for this token.
See Also:
RecognizerProperties, setConfidenceThreshold, MIN_CONFIDENCE, MAX_CONFIDENCE, UNKNOWN_CONFIDENCE, getResultState, ACCEPTED

getEndTime

long getEndTime()
Gets the approximate end time for this token in milliseconds. The value is matched to the System.currentTimeMillis() time.

The end time of a token is always less than or equal to the start time of a succeeding token. The values will be different if the tokens are separated by a pause.

Returns UNKNOWN_AUDIO_POSITION if timing information is not available. Not all recognizers provide timing information. Timing information is not usually available for unfinalized or finalized tokens in a Result that is not yet finalized. Even if timing information is available for tokens in the best result, it might not be available for tokens in other alternatives.

Returns:
approximate end time for token or UNKNOWN_AUDIO_POSITION if not available.
See Also:
currentTimeMillis, getStartTime, UNKNOWN_AUDIO_POSITION

getResult

Result getResult()
Returns a reference to the result that contains this token.

Returns:
a Result object that contains this token.

getText

String getText()
Gets the text of this token.

Returns:
the text of this token.
See Also:
getText, getText

getStartTime

long getStartTime()
Gets the approximate start time for this token in milliseconds. The value is matched to the System.currentTimeMillis() time.

The start time of a token is always greater than or equal to the the end time of a preceding token. The values will be different if the tokens are separated by a pause.

Returns UNKNOWN_AUDIO_POSITION if timing information is not available. Not all recognizers provide timing information. Timing information is not usually available for unfinalized or finalized tokens in a Result that is not yet finalized. Even if timing information is available for tokens in the best result, it might not be available for tokens from other alternatives.

Returns:
approximate start time for token or UNKNOWN_AUDIO_POSITION if not available
See Also:
currentTimeMillis, getEndTime, UNKNOWN_AUDIO_POSITION

JSAPI 2.0

JavaTM Speech API 2.0, Final Release v2.0.6.
© 2008, Conversay and Sun Microsystems.

Free Web Hosting