rita.support
Class RiTokenToWords

java.lang.Object
  extended by rita.support.RiTokenToWords
All Implemented Interfaces:
com.sun.speech.freetts.UtteranceProcessor

public class RiTokenToWords
extends java.lang.Object
implements com.sun.speech.freetts.UtteranceProcessor

Converts the tokens (in English words) in an Utterance into a list of words which are placed back into the Utterance. Usually, the tokens that gets expanded are numbers like "23" (to "twenty" "three").

* It translates the following code from flite:
lang/usenglish/us_text.c


Constructor Summary
RiTokenToWords(com.sun.speech.freetts.cart.CART usNumbersCART, com.sun.speech.freetts.en.us.PronounceableFSM prefixFSM, com.sun.speech.freetts.en.us.PronounceableFSM suffixFSM)
          Constructs a default USTokenWordProcessor.
 
Method Summary
 com.sun.speech.freetts.Item getTokenItem()
          Returns the currently processing token Item.
 boolean isPronounceable(java.lang.String word)
          Returns true if the given word is pronounceable.
static boolean kingLike(com.sun.speech.freetts.Item tokenItem)
          Returns true if the given token item contains a token that is in a king-like context, e.g., "King" or "Louis".
 void processUtterance(com.sun.speech.freetts.Utterance utterance)
          Processes the utterance
static boolean sectionLike(com.sun.speech.freetts.Item tokenItem)
          Returns true if the given token item contains a token that is in a section-like context, e.g., "chapter" or "act".
 java.lang.String toString()
          Converts this object to its String representation
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RiTokenToWords

public RiTokenToWords(com.sun.speech.freetts.cart.CART usNumbersCART,
                      com.sun.speech.freetts.en.us.PronounceableFSM prefixFSM,
                      com.sun.speech.freetts.en.us.PronounceableFSM suffixFSM)
Constructs a default USTokenWordProcessor. It uses the USEnglish regular expression set (USEngRegExp) by default.

Parameters:
usNumbersCART - the cart to use to classify numbers
Method Detail

getTokenItem

public com.sun.speech.freetts.Item getTokenItem()
Returns the currently processing token Item.

Returns:
the current token Item; null if no item

processUtterance

public void processUtterance(com.sun.speech.freetts.Utterance utterance)
                      throws com.sun.speech.freetts.ProcessException
Processes the utterance

Specified by:
processUtterance in interface com.sun.speech.freetts.UtteranceProcessor
Parameters:
utterance - the utterance contain the tokens
Throws:
com.sun.speech.freetts.ProcessException - if an IOException is thrown during the processing of the utterance

kingLike

public static boolean kingLike(com.sun.speech.freetts.Item tokenItem)
Returns true if the given token item contains a token that is in a king-like context, e.g., "King" or "Louis".

Parameters:
tokenItem - the token item to check
Returns:
true or false

sectionLike

public static boolean sectionLike(com.sun.speech.freetts.Item tokenItem)
Returns true if the given token item contains a token that is in a section-like context, e.g., "chapter" or "act".

Parameters:
tokenItem - the token item to check
Returns:
true or false

isPronounceable

public boolean isPronounceable(java.lang.String word)
Returns true if the given word is pronounceable. This method is originally called us_aswd() in Flite 1.1.

Parameters:
word - the word to test
Returns:
true if the word is pronounceable, false otherwise

toString

public java.lang.String toString()
Converts this object to its String representation

Overrides:
toString in class java.lang.Object
Returns:
the string representation of this object