public class NumberExpander extends Object
lang/usEnglish/us_expand.c
Modifier and Type | Field and Description |
---|---|
private static String[] |
digit2enty |
private static String[] |
digit2num |
private static String[] |
digit2teen |
private static String[] |
ord2enty |
private static String[] |
ord2num |
private static String[] |
ord2teen |
Modifier | Constructor and Description |
---|---|
private |
NumberExpander()
Unconstructable
|
Modifier and Type | Method and Description |
---|---|
private static void |
expand2DigitNumber(String numberString,
WordRelation wordRelation)
Expands a two-digit string into a list of English words.
|
private static void |
expand3DigitNumber(String numberString,
WordRelation wordRelation)
Expands a three-digit string into a list of English words.
|
private static void |
expandBelow10DigitNumber(String numberString,
WordRelation wordRelation)
Expands a string that is a 7 to 9 digits number into a list
of English words.
|
private static void |
expandBelow13DigitNumber(String numberString,
WordRelation wordRelation)
Expands a string that is a 10 to 12 digits number into a list
of English words.
|
private static void |
expandBelow7DigitNumber(String numberString,
WordRelation wordRelation)
Expands a string that is a 4 to 6 digits number into a list
of English words.
|
static void |
expandDigits(String numberString,
WordRelation wordRelation)
Expands given token to list of words pronouncing it as digits
|
static void |
expandID(String numberString,
WordRelation wordRelation)
Expands the given number string as pairs as in years or IDs
|
private static void |
expandLargeNumber(String numberString,
String order,
int numberZeroes,
WordRelation wordRelation)
Expands a string that is a number longer than 3 digits into a list
of English words.
|
static void |
expandLetters(String letters,
WordRelation wordRelation)
Expands the given string of letters as a list of single char symbols.
|
static void |
expandNumber(String numberString,
WordRelation wordRelation)
Expands a digit string into a list of English words of those digits.
|
private static void |
expandNumberAt(String numberString,
int startIndex,
WordRelation wordRelation)
Returns the number string list of the given string starting at
the given index.
|
static void |
expandOrdinal(String rawNumberString,
WordRelation wordRelation)
Expands the digit string of an ordinal number.
|
static void |
expandReal(String numberString,
WordRelation wordRelation)
Expands the given number string as a real number.
|
static int |
expandRoman(String roman)
Returns the integer value of the given string of Roman numerals.
|
private static String |
findMatchInArray(String strToMatch,
String[] matchInArray,
String[] returnInArray)
Finds a match of the given string in the given array,
and returns the element at the same index in the returnInArray
|
static boolean |
isDigit(char ch)
Returns true if the given character is a digit (0-9 only).
|
private static final String[] digit2teen
private static final String[] digit2enty
private NumberExpander()
public static void expandNumber(String numberString, WordRelation wordRelation)
numberString
- the digit string to expand.wordRelation
- words are added to this Relationprivate static void expand2DigitNumber(String numberString, WordRelation wordRelation)
numberString
- the string which is the number to expandwordRelation
- words are added to this Relationprivate static void expand3DigitNumber(String numberString, WordRelation wordRelation)
numberString
- the string which is the number to expandwordRelation
- words are added to this Relationprivate static void expandBelow7DigitNumber(String numberString, WordRelation wordRelation)
numberString
- the string which is the number to expandwordRelation
- words are added to this Relationprivate static void expandBelow10DigitNumber(String numberString, WordRelation wordRelation)
numberString
- the string which is the number to expandwordRelation
- words are added to this Relationprivate static void expandBelow13DigitNumber(String numberString, WordRelation wordRelation)
numberString
- the string which is the number to expandwordRelation
- words are added to this Relationprivate static void expandLargeNumber(String numberString, String order, int numberZeroes, WordRelation wordRelation)
numberString
- the string which is the number to expandorder
- either "thousand", "million", or "billion"numberZeroes
- the number of zeroes, depending on the order, so
its either 3, 6, or 9wordRelation
- words are added to this Relationprivate static void expandNumberAt(String numberString, int startIndex, WordRelation wordRelation)
numberString
- the string which is the number to expandstartIndex
- the starting positionwordRelation
- words are added to this Relationpublic static void expandDigits(String numberString, WordRelation wordRelation)
numberString
- the string which is the number to expandwordRelation
- words are added to this Relationpublic static void expandOrdinal(String rawNumberString, WordRelation wordRelation)
rawNumberString
- the string which is the number to expandwordRelation
- words are added to this Relationprivate static String findMatchInArray(String strToMatch, String[] matchInArray, String[] returnInArray)
strToMatch
- the string to matchmatchInArray
- the source arrayreturnInArray
- the return arraynull
if a match is not foundpublic static void expandID(String numberString, WordRelation wordRelation)
numberString
- the string which is the number to expandwordRelation
- words are added to this Relationpublic static void expandReal(String numberString, WordRelation wordRelation)
numberString
- the string which is the real number to expandwordRelation
- words are added to this Relationpublic static void expandLetters(String letters, WordRelation wordRelation)
letters
- the string of letters to expandwordRelation
- words are added to this Relationpublic static int expandRoman(String roman)
roman
- the string of Roman numberspublic static boolean isDigit(char ch)
ch
- the character to testWebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses