/** * Convert the given dashed string (e.g. "aaa-bbb") into (word) Items in * the WordRelation. * * @param tokenVal the dashed string */ private void dashToWords(String tokenVal) { int index = tokenVal.indexOf('-'); String aaa = tokenVal.substring(0, index); String bbb = tokenVal.substring(index + 1, tokenVal.length()); if (matches(digitsPattern, aaa) && matches(digitsPattern, bbb)) { FeatureSet featureSet = tokenItem.getFeatures(); featureSet.setString("name", aaa); tokenToWords(aaa); wordRelation.addWord("to"); featureSet.setString("name", bbb); tokenToWords(bbb); featureSet.setString("name", ""); } else { tokenToWords(aaa); tokenToWords(bbb); } }
/** * Convert the given string (which does not only consist of alphabet) into * (word) Items in the WordRelation. * * @param tokenVal the string */ private void notJustAlphasToWords(String tokenVal) { /* its not just alphas */ int index = 0; int tokenLength = tokenVal.length(); for (; index < tokenLength - 1; index++) { if (isTextSplitable(tokenVal, index)) { break; } } if (index == tokenLength - 1) { wordRelation.addWord(tokenVal.toLowerCase()); return; } String aaa = tokenVal.substring(0, index + 1); String bbb = tokenVal.substring(index + 1, tokenLength); FeatureSet featureSet = tokenItem.getFeatures(); featureSet.setString("nsw", "nide"); tokenToWords(aaa); tokenToWords(bbb); }
} else if (dotIndex == -1) { String aaa = tokenVal.substring(1); tokenToWords(aaa); if (aaa.equals("1")) { wordRelation.addWord("dollar");
tokenToWords(tokenVal);
} else if (tokenLength > 0 && tokenVal.charAt(tokenLength - 1) == '%') { tokenToWords(tokenVal.substring(0, tokenLength - 1)); wordRelation.addWord("percent"); } else if (matches(numessPattern, tokenVal)) {
/** * Convert the given dashed string (e.g. "aaa-bbb") into (word) Items in * the WordRelation. * * @param tokenVal the dashed string */ private void dashToWords(String tokenVal) { int index = tokenVal.indexOf('-'); String aaa = tokenVal.substring(0, index); String bbb = tokenVal.substring(index + 1, tokenVal.length()); if (matches(digitsPattern, aaa) && matches(digitsPattern, bbb)) { FeatureSet featureSet = tokenItem.getFeatures(); featureSet.setString("name", aaa); tokenToWords(aaa); wordRelation.addWord("to"); featureSet.setString("name", bbb); tokenToWords(bbb); featureSet.setString("name", ""); } else { tokenToWords(aaa); tokenToWords(bbb); } }
/** * Convert the given string (which does not only consist of alphabet) into * (word) Items in the WordRelation. * * @param tokenVal the string */ private void notJustAlphasToWords(String tokenVal) { /* its not just alphas */ int index = 0; int tokenLength = tokenVal.length(); for (; index < tokenLength - 1; index++) { if (isTextSplitable(tokenVal, index)) { break; } } if (index == tokenLength - 1) { wordRelation.addWord(tokenVal.toLowerCase()); return; } String aaa = tokenVal.substring(0, index + 1); String bbb = tokenVal.substring(index + 1, tokenLength); FeatureSet featureSet = tokenItem.getFeatures(); featureSet.setString("nsw", "nide"); tokenToWords(aaa); tokenToWords(bbb); }
} else if (dotIndex == -1) { String aaa = tokenVal.substring(1); tokenToWords(aaa); if (aaa.equals("1")) { wordRelation.addWord("dollar");
tokenToWords(tokenVal);
} else if (tokenLength > 0 && tokenVal.charAt(tokenLength - 1) == '%') { tokenToWords(tokenVal.substring(0, tokenLength - 1)); wordRelation.addWord("percent"); } else if (matches(numessPattern, tokenVal)) {