Class javax.speech.recognition.RuleToken
java.lang.Object
|
+--javax.speech.recognition.Rule
|
+--javax.speech.recognition.RuleToken
- public class RuleToken
- extends Rule
RuleToken
represents speakable text in a RuleGrammar
.
It is the primitive type of a Rule
(eventually any rule must break
down into a sequence of RuleTokens
that may be spoken). It is also the
primitive type of a RuleParse
.
- See Also:
- Rule, RuleAlternatives, RuleCount, RuleGrammar, RuleName, RuleParse, RuleSequence, RuleTag, Serialized Form
Constructor Summary
|
RuleToken(String text)
Construct a RuleToken with the speakable string.
|
RuleToken()
Empty constructor sets token text to null . |
Method Summary
|
Rule
|
copy()
Return a deep copy of this rule. |
String
|
getText()
Get the text of the token.
|
void
|
setText(String text)
Set the text. |
String
|
toString()
Return a string representing the RuleToken in partial
Java Speech Grammar Format. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait |
text
protected String text
- The token text.
- See Also:
- getText
RuleToken
public RuleToken(String text)
- Construct a
RuleToken
with the speakable string.
The string should not include the surrounding quotes
or escapes of JSGF tokens (except as necessary to
properly format a Java string).
RuleToken
public RuleToken()
- Empty constructor sets token text to
null
.
getText
public String getText()
- Get the text of the token.
The returned string is not in JSGF format (backslash and quote
characters are not escaped and surrounding quote characters
are not included).
Use
toString
to obtain a JSGF-compliant string.
- See Also:
- toString
setText
public void setText(String text)
- Set the text.
copy
public Rule copy()
- Return a deep copy of this rule.
- Overrides:
- copy in class Rule
toString
public String toString()
- Return a string representing the
RuleToken
in partial
Java Speech Grammar Format. (It returns a String that could appear
as the right hand side of a rule definition.) The string is quoted
if necessary (contains whitespace or escaped characters)
and the quote and backslash characters are escaped.
- Overrides:
- toString in class Rule
JavaTM Speech API
Copyright 1997-1998 Sun Microsystems, Inc. All rights reserved
Send comments to javaspeech-comments@sun.com