} else if (matches(alphabetPattern, tokenVal)) { if (matches(romanNumbersPattern, tokenVal)) { romanToWords(tokenVal); } else if (matches(illionPattern, tokenVal) && matches(usMoneyPattern, (String) tokenItem.findFeature("p.name"))) { } else if (matches(drStPattern, tokenVal)) { drStToWords(tokenVal); } else if (tokenVal.equals("Mr")) { tokenItem.getFeatures().setString("punc", ""); } else if (isStateName(tokenVal)) { } else if (tokenLength > 1 && !isPronounceable(tokenVal)) { } else if (matches(dottedAbbrevPattern, tokenVal)) { } else if (matches(commaIntPattern, tokenVal)) { } else if (matches(sevenPhoneNumberPattern, tokenVal)) { } else if (matchesPartPhoneNumber(tokenVal)) { } else if (matches(numberTimePattern, tokenVal)) {
/** * Adds a word as an Item to this WordRelation object. * * @param word the word to add */ public void addWord(String word) { Item tokenItem = tokenToWords.getTokenItem(); Item wordItem = tokenItem.createDaughter(); FeatureSet featureSet = wordItem.getFeatures(); featureSet.setString("name", word); relation.appendItem(wordItem); }
/** * Returns true if the given token item contains a token that is in a * section-like context, e.g., "chapter" or "act". * * @param tokenItem the token item to check * * @return true or false */ public static boolean sectionLike(Item tokenItem) { String sectionType = ((String) tokenItem.findFeature("p.name")).toLowerCase(); return inKingSectionLikeMap(sectionType, SECTION_TYPES); }
/** * 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); }
/** * 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 (matches(alphabetPattern, tokenVal)) { if (matches(romanNumbersPattern, tokenVal)) { romanToWords(tokenVal); } else if (matches(illionPattern, tokenVal) && matches(usMoneyPattern, (String) tokenItem.findFeature("p.name"))) { } else if (matches(drStPattern, tokenVal)) { drStToWords(tokenVal); } else if (tokenVal.equals("Mr")) { tokenItem.getFeatures().setString("punc", ""); } else if (isStateName(tokenVal)) { } else if (tokenLength > 1 && !isPronounceable(tokenVal)) { } else if (matches(dottedAbbrevPattern, tokenVal)) { } else if (matches(commaIntPattern, tokenVal)) { } else if (matches(sevenPhoneNumberPattern, tokenVal)) { } else if (matchesPartPhoneNumber(tokenVal)) { } else if (matches(numberTimePattern, tokenVal)) {
/** * Returns true if the given token item contains a token that is in a * king-like context, e.g., "King" or "Louis". * * @param tokenItem the token item to check * * @return true or false */ public static boolean kingLike(Item tokenItem) { String kingName = ((String) tokenItem.findFeature("p.name")).toLowerCase(); if (inKingSectionLikeMap(kingName, KING_NAMES)) { return true; } else { String kingTitle = ((String) tokenItem.findFeature("p.p.name")).toLowerCase(); return inKingSectionLikeMap(kingTitle, KING_TITLES); } }
/** * Adds a word as an Item to this WordRelation object. * * @param word the word to add */ public void addWord(String word) { Item tokenItem = tokenToWords.getTokenItem(); Item wordItem = tokenItem.createDaughter(); FeatureSet featureSet = wordItem.getFeatures(); featureSet.setString("name", word); relation.appendItem(wordItem); }
/** * Returns true if the given token item contains a token that is in a * section-like context, e.g., "chapter" or "act". * * @param tokenItem the token item to check * * @return true or false */ public static boolean sectionLike(Item tokenItem) { String sectionType = ((String) tokenItem.findFeature("p.name")).toLowerCase(); return inKingSectionLikeMap(sectionType, SECTION_TYPES); }
/** * Returns true if the given token item contains a token that is in a * king-like context, e.g., "King" or "Louis". * * @param tokenItem the token item to check * * @return true or false */ public static boolean kingLike(Item tokenItem) { String kingName = ((String) tokenItem.findFeature("p.name")).toLowerCase(); if (inKingSectionLikeMap(kingName, KING_NAMES)) { return true; } else { String kingTitle = ((String) tokenItem.findFeature("p.p.name")).toLowerCase(); return inKingSectionLikeMap(kingTitle, KING_TITLES); } }