JSAPI 2.0

javax.speech.recognition
Class RuleToken

Object
  extended by RuleComponent
      extended by RuleToken

public class RuleToken
extends RuleComponent

Represents speakable text in a RuleGrammar. This is the primitive type of a RuleComponent - eventually any Rule must break down into a sequence of RuleTokens that may be spoken.

This is also the primitive type of a RuleParse.

See Also:
RuleGrammar, RuleParse

Constructor Summary
RuleToken(String text)
          Constructs a RuleToken with the speakable text String.
 
Method Summary
 String getText()
          Gets the text of this RuleToken.
 String toString()
          Returns a String representing this RuleComponent as grammar text.
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RuleToken

public RuleToken(String text)
          throws IllegalArgumentException
Constructs a RuleToken with the speakable text String.

Any white space in the text is normalized:

For example, " New York " becomes "New York".

The String format must conform to the grammar text conventions. The text corresponds to the written-form text used in the Word class.

Parameters:
text - represents what can be said
Throws:
IllegalArgumentException - if the text is null or is not valid grammar text
See Also:
getText, Word
Required Features:
getSupportsLetterToSound when the vocabulary specified is not already present within the Recognizer
Method Detail

getText

public String getText()
Gets the text of this RuleToken.

The text corresponds to the written-form text used in the Word class.

Returns:
the text for this RuleToken
See Also:
Word

toString

public String toString()
Returns a String representing this RuleComponent as grammar text. The String represents a portion of a grammar that could appear on the right hand side of a Rule definition.

Overrides:
toString in class RuleComponent
Returns:
printable String representing grammar text.
See Also:
RuleComponent, Rule

JSAPI 2.0

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

Free Web Hosting