* same as the one in called "name" in flite
*
*/
private void tokenToWords(String tokenVal) {
FeatureSet tokenFeatures = tokenItem.getFeatures();
String itemName = tokenFeatures.getString("name");
int tokenLength = tokenVal.length();
if (tokenFeatures.isPresent("phones")) {
wordRelation.addWord(tokenVal);
} else if ((tokenVal.equals("a") || tokenVal.equals("A")) &&
((tokenItem.getNext() == null) ||
!(tokenVal.equals(itemName)) ||
!(((String) tokenItem.findFeature("punc")).equals("")))) {
/* if A is a sub part of a token, then its ey not ah */
wordRelation.addWord("_a");
} else if (matches(alphabetPattern, tokenVal)) {
if (matches(romanNumbersPattern, tokenVal)) {
/* XVIII */
romanToWords(tokenVal);
} else if (matches(illionPattern, tokenVal) &&
matches(usMoneyPattern,
(String) tokenItem.findFeature("p.name"))) {
/* $ X -illion */
wordRelation.addWord(tokenVal);
wordRelation.addWord("dollars");
} else if (matches(drStPattern, tokenVal)) {
/* St Andrew's St, Dr King Dr */
drStToWords(tokenVal);
} else if (tokenVal.equals("Mr")) {
tokenItem.getFeatures().setString("punc", "");
wordRelation.addWord("mister");
} else if (tokenVal.equals("Mrs")) {
tokenItem.getFeatures().setString("punc", "");
wordRelation.addWord("missus");
} else if (tokenLength == 1
&& isUppercaseLetter(tokenVal.charAt(0))
&& ((String)tokenItem.findFeature("n.whitespace")).equals(" ")
&& isUppercaseLetter
(((String) tokenItem.findFeature("n.name")).charAt(0))) {
tokenFeatures.setString("punc", "");
String aaa = tokenVal.toLowerCase();
if (aaa.equals("a")) {
wordRelation.addWord("_a");
} else {
wordRelation.addWord(aaa);
}
} else if (isStateName(tokenVal)) {
/*
The name of a US state
isStateName() has already added the full name of the
state, so we're all set.
*/
} else if (tokenLength > 1 && !isPronounceable(tokenVal)) {
/* Need common exception list */
/* unpronouncable list of alphas */
NumberExpander.expandLetters
(tokenVal, wordRelation);
} else {
/* just a word */
wordRelation.addWord(tokenVal.toLowerCase());
}
} else if (matches(dottedAbbrevPattern, tokenVal)) {
/* U.S.A. */
// remove all dots
String aaa = Utilities.deleteChar(tokenVal, '.');
NumberExpander.expandLetters(aaa, wordRelation);
} else if (matches(commaIntPattern, tokenVal)) {
/* 99,999,999 */
String aaa = Utilities.deleteChar(tokenVal, ',');
NumberExpander.expandReal(aaa, wordRelation);
} else if (matches(sevenPhoneNumberPattern, tokenVal)) {
/* 234-3434 telephone numbers */
int dashIndex = tokenVal.indexOf('-');
String aaa = tokenVal.substring(0, dashIndex);
String bbb = tokenVal.substring(dashIndex+1);
NumberExpander.expandDigits(aaa, wordRelation);
wordRelation.addBreak();
NumberExpander.expandDigits(bbb, wordRelation);
} else if (matchesPartPhoneNumber(tokenVal)) {
/* part of a telephone number */
String punctuation = (String) tokenItem.findFeature("punc");
if (punctuation.equals("")) {
tokenItem.getFeatures().setString("punc", ",");
}
NumberExpander.expandDigits(tokenVal, wordRelation);
wordRelation.addBreak();
} else if (matches(numberTimePattern, tokenVal)) {
/* 12:35 */
int colonIndex = tokenVal.indexOf(':');
String aaa = tokenVal.substring(0, colonIndex);
String bbb = tokenVal.substring(colonIndex+1);
NumberExpander.expandNumber(aaa, wordRelation);
if (!(bbb.equals("00"))) {
NumberExpander.expandID(bbb, wordRelation);
}
} else if (matches(digits2DashPattern, tokenVal)) {
/* 999-999-999 */
digitsDashToWords(tokenVal);
} else if (matches(digitsPattern, tokenVal)) {
digitsToWords(tokenVal);
} else if (tokenLength == 1
&& isUppercaseLetter(tokenVal.charAt(0))
&& ((String)tokenItem.findFeature("n.whitespace")).equals
(" ")
&& isUppercaseLetter
(((String) tokenItem.findFeature("n.name")).charAt(0))) {
tokenFeatures.setString("punc", "");
String aaa = tokenVal.toLowerCase();
if (aaa.equals("a")) {
wordRelation.addWord("_a");
} else {
wordRelation.addWord(aaa);