JSAPI 2.0

javax.speech.recognition
Class RuleTag

Object
  extended by RuleComponent
      extended by RuleTag

public class RuleTag
extends RuleComponent

Defines a tag to be used within a RuleGrammar.

A tag is a special kind of RuleComponent that can be used for semantic interpretation. Tags do not affect the recognition of RuleGrammars in which they are used. Instead, tags are used to embed information into a RuleGrammar that helps with processing results of recognition. Tags are

A tag's value may be any Object. Tags created from SRGS markup (tag element) are always Strings.

The toString() method uses Object.toString() to convert a tag's value to a String when creating SRGS markup. All characters in the String must be representable in XML to result in valid markup.

See Also:
RuleGrammar, RuleParse, toString()

Constructor Summary
RuleTag(Object tag)
          Constructs a RuleTag with a tag value.
 
Method Summary
 Object getTag()
          Returns the tag value.
 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

RuleTag

public RuleTag(Object tag)
Constructs a RuleTag with a tag value.

This may be included in a RuleGrammar via a RuleSequence or other RuleComponent subclass. During grammar processing, RuleTag behaves the same as NULL.

Parameters:
tag - the tag value
See Also:
RuleSequence, RuleComponent, NULL, getTag
Method Detail

getTag

public Object getTag()
Returns the tag value.

Returns:
the tag value

toString

public String toString()
                throws IllegalArgumentException
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.

The tag's String representation must not contain any characters not representable in XML (e.g., '\0' or ASCII control characters).

Overrides:
toString in class RuleComponent
Returns:
printable String representing grammar text.
Throws:
IllegalArgumentException - if the tag's String representation contains characters not representable in XML
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