Package com.sun.speech.freetts.en.us
Class NumberExpander
java.lang.Object
com.sun.speech.freetts.en.us.NumberExpander
Expands Strings containing digits characters into
a list of words representing those digits.
It translates the following code from flite:
lang/usEnglish/us_expand.c-
Method Summary
Modifier and TypeMethodDescriptionstatic voidexpandDigits(String numberString, WordRelation wordRelation) Expands given token to list of words pronouncing it as digitsstatic voidexpandID(String numberString, WordRelation wordRelation) Expands the given number string as pairs as in years or IDsstatic voidexpandLetters(String letters, WordRelation wordRelation) Expands the given string of letters as a list of single char symbols.static voidexpandNumber(String numberString, WordRelation wordRelation) Expands a digit string into a list of English words of those digits.static voidexpandOrdinal(String rawNumberString, WordRelation wordRelation) Expands the digit string of an ordinal number.static voidexpandReal(String numberString, WordRelation wordRelation) Expands the given number string as a real number.static intexpandRoman(String roman) Returns the integer value of the given string of Roman numerals.static booleanisDigit(char ch) Returns true if the given character is a digit (0-9 only).
-
Method Details
-
expandNumber
Expands a digit string into a list of English words of those digits. For example, "1234" expands to "one two three four"- Parameters:
numberString- the digit string to expand.wordRelation- words are added to this Relation
-
expandDigits
Expands given token to list of words pronouncing it as digits- Parameters:
numberString- the string which is the number to expandwordRelation- words are added to this Relation
-
expandOrdinal
Expands the digit string of an ordinal number.- Parameters:
rawNumberString- the string which is the number to expandwordRelation- words are added to this Relation
-
expandID
Expands the given number string as pairs as in years or IDs- Parameters:
numberString- the string which is the number to expandwordRelation- words are added to this Relation
-
expandReal
Expands the given number string as a real number.- Parameters:
numberString- the string which is the real number to expandwordRelation- words are added to this Relation
-
expandLetters
Expands the given string of letters as a list of single char symbols.- Parameters:
letters- the string of letters to expandwordRelation- words are added to this Relation
-
expandRoman
Returns the integer value of the given string of Roman numerals.- Parameters:
roman- the string of Roman numbers- Returns:
- the integer value
-
isDigit
public static boolean isDigit(char ch) Returns true if the given character is a digit (0-9 only).- Parameters:
ch- the character to test- Returns:
- true or false
-