rita.support
Class RiNumberExpander

java.lang.Object
  extended by rita.support.RiNumberExpander

public class RiNumberExpander
extends java.lang.Object

Expands Strings containing digits characters into a list of words representing those digits. Translates the following code from flite: lang/usEnglish/us_expand.c


Method Summary
static void expandDigits(java.lang.String numberString, RiWordRelation wordRelation)
          Expands given token to list of words pronouncing it as digits
static void expandID(java.lang.String numberString, RiWordRelation wordRelation)
          Expands the given number string as pairs as in years or IDs
static void expandLetters(java.lang.String letters, RiWordRelation wordRelation)
          Expands the given string of letters as a list of single char symbols.
static void expandNumber(java.lang.String numberString, RiWordRelation wordRelation)
          Expands a digit string into a list of English words of those digits.
static void expandOrdinal(java.lang.String rawNumberString, RiWordRelation wordRelation)
          Expands the digit string of an ordinal number.
static void expandReal(java.lang.String numberString, RiWordRelation wordRelation)
          Expands the given number string as a real number.
static int expandRoman(java.lang.String roman)
          Returns the integer value of the given string of Roman numerals.
static boolean isDigit(char ch)
          Returns true if the given character is a digit (0-9 only).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

expandNumber

public static void expandNumber(java.lang.String numberString,
                                RiWordRelation wordRelation)
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

public static void expandDigits(java.lang.String numberString,
                                RiWordRelation wordRelation)
Expands given token to list of words pronouncing it as digits

Parameters:
numberString - the string which is the number to expand
wordRelation - words are added to this Relation

expandOrdinal

public static void expandOrdinal(java.lang.String rawNumberString,
                                 RiWordRelation wordRelation)
Expands the digit string of an ordinal number.

Parameters:
rawNumberString - the string which is the number to expand
wordRelation - words are added to this Relation

expandID

public static void expandID(java.lang.String numberString,
                            RiWordRelation wordRelation)
Expands the given number string as pairs as in years or IDs

Parameters:
numberString - the string which is the number to expand
wordRelation - words are added to this Relation

expandReal

public static void expandReal(java.lang.String numberString,
                              RiWordRelation wordRelation)
Expands the given number string as a real number.

Parameters:
numberString - the string which is the real number to expand
wordRelation - words are added to this Relation

expandLetters

public static void expandLetters(java.lang.String letters,
                                 RiWordRelation wordRelation)
Expands the given string of letters as a list of single char symbols.

Parameters:
letters - the string of letters to expand
wordRelation - words are added to this Relation

expandRoman

public static int expandRoman(java.lang.String roman)
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