Package com.sun.speech.freetts.en.us
Class TokenToWords
java.lang.Object
com.sun.speech.freetts.en.us.TokenToWords
- All Implemented Interfaces:
UtteranceProcessor
Converts the Tokens (in US English words) in an
Utterance into a list of words. It puts the produced list 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
ConstructorsConstructorDescriptionTokenToWords
(CART usNumbersCART, PronounceableFSM prefixFSM, PronounceableFSM suffixFSM) Constructs a default USTokenWordProcessor. -
Method Summary
Modifier and TypeMethodDescriptionReturns the currently processing token Item.boolean
isPronounceable
(String word) Returns true if the given word is pronounceable.static boolean
Returns true if the given token item contains a token that is in a king-like context, e.g., "King" or "Louis".void
processUtterance
(Utterance utterance) process the utterancestatic boolean
sectionLike
(Item tokenItem) Returns true if the given token item contains a token that is in a section-like context, e.g., "chapter" or "act".toString()
Converts this object to its String representation
-
Constructor Details
-
TokenToWords
Constructs a default USTokenWordProcessor. It uses the USEnglish regular expression set (USEngRegExp) by default.- Parameters:
usNumbersCART
- the cart to use to classify numbers
-
-
Method Details
-
getTokenItem
Returns the currently processing token Item.- Returns:
- the current token Item; null if no item
-
processUtterance
process the utterance- Specified by:
processUtterance
in interfaceUtteranceProcessor
- Parameters:
utterance
- the utterance contain the tokens- Throws:
ProcessException
- if an IOException is thrown during the processing of the utterance
-
kingLike
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
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
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
Converts this object to its String representation
-