/** * Convenience method that sets the named feature as a String. * * @param name the name of the feature * @param value the value of the feature */ public void setString(String name, String value) { features.setString(name, value); }
/** * Sets the last Item in this WordRelation to the given word. * * @param word the word to set */ public void setLastWord(String word) { Item lastItem = relation.getTail(); FeatureSet featureSet = lastItem.getFeatures(); featureSet.setString("name", word); }
/** * Adds a break as a feature to the last item in the list. */ public void addBreak() { Item wordItem = (Item) relation.getTail(); if (wordItem != null) { FeatureSet featureSet = wordItem.getFeatures(); featureSet.setString("break", "1"); } }
featureSet.setString("name", tokenWord); featureSet.setString("whitespace", token.getWhitespace()); featureSet.setString("prepunctuation", token.getPrepunctuation()); featureSet.setString("punc", token.getPostpunctuation()); featureSet.setString("file_pos", String.valueOf(token.getPosition())); featureSet.setString("line_number", String.valueOf(token.getLineNumber()));
/** * 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); }
/** * 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); }
featureSet.setString("punc", "");
tokenItem.getFeatures().setString("punc", ""); wordRelation.addWord("mister"); } else if (tokenVal.equals("Mrs")) { tokenItem.getFeatures().setString("punc", ""); wordRelation.addWord("missus"); } else if (tokenLength == 1 .findFeature("n.name")).charAt(0))) { tokenFeatures.setString("punc", ""); String aaa = tokenVal.toLowerCase(); if (aaa.equals("a")) { tokenItem.getFeatures().setString("punc", ","); .findFeature("n.name")).charAt(0))) { tokenFeatures.setString("punc", ""); String aaa = tokenVal.toLowerCase(); if (aaa.equals("a")) {
/** * Convenience method that sets the named feature as a String. * * @param name the name of the feature * @param value the value of the feature */ public void setString(String name, String value) { features.setString(name, value); }
/** * Sets the last Item in this WordRelation to the given word. * * @param word the word to set */ public void setLastWord(String word) { Item lastItem = relation.getTail(); FeatureSet featureSet = lastItem.getFeatures(); featureSet.setString("name", word); }
/** * Adds a break as a feature to the last item in the list. */ public void addBreak() { Item wordItem = (Item) relation.getTail(); if (wordItem != null) { FeatureSet featureSet = wordItem.getFeatures(); featureSet.setString("break", "1"); } }
featureSet.setString("name", tokenWord); featureSet.setString("whitespace", token.getWhitespace()); featureSet.setString("prepunctuation", token.getPrepunctuation()); featureSet.setString("punc", token.getPostpunctuation()); featureSet.setString("file_pos", String.valueOf(token.getPosition())); featureSet.setString("line_number", String.valueOf(token.getLineNumber()));
/** * 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); }
/** * 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); }
featureSet.setString("punc", "");
tokenItem.getFeatures().setString("punc", ""); wordRelation.addWord("mister"); } else if (tokenVal.equals("Mrs")) { tokenItem.getFeatures().setString("punc", ""); wordRelation.addWord("missus"); } else if (tokenLength == 1 .findFeature("n.name")).charAt(0))) { tokenFeatures.setString("punc", ""); String aaa = tokenVal.toLowerCase(); if (aaa.equals("a")) { tokenItem.getFeatures().setString("punc", ","); .findFeature("n.name")).charAt(0))) { tokenFeatures.setString("punc", ""); String aaa = tokenVal.toLowerCase(); if (aaa.equals("a")) {