@Test public void testToString() { Parse p1 = Parse.parseParse(PARSE_STRING); p1.toString(); }
private int movePastOf(int i, Parse[] toks) { if (i < toks.length && toks[i].toString().equals("of")) { i++; } return (i); }
private int movePastCopula(int i, Parse[] toks) { if (i < toks.length && toks[i].getType().startsWith("V")) { if (copulaPattern.matcher(toks[i].toString()).matches()) { i++; } } return (i); }
private String[] getLemmas(Parse np) { // make sure we're getting a single word. String word = np.getHead().toString().toLowerCase(); return wordnet.getLemmas(word,"NN"); }
boolean fnIsLast = false; for (; i < toks.length; i++) { String tok = toks[i].toString().toLowerCase(); if (isQueryWord(tok)) { queryWord = tok; if (tok.equals("how") && i+1 < toks.length) { if (howModifierTagPattern.matcher(toks[i+1].getType()).find()) { queryWord=tok+"_"+toks[i+1].toString(); features.add("rw=" + toks[ri].toString()); String tag = toks[vi].getType(); if (tag != null && tag.startsWith("V")) { verb = toks[vi].toString(); break;
int startOffset = p.toString().indexOf(min); int endOffset = startOffset + min.length();
int startOffset = p.toString().indexOf(min); int endOffset = startOffset + min.length();
tokens[i] = parseTokens[i].toString();
tokens[i] = parseTokens[i].toString();
if (falseHeadsPattern.matcher(head.toString()).matches()) { npStart += np.getChildren().length; int np2Start = movePastPrep(npStart, toks); if (np != null) { Parse head = np.getHead(); if (falseHeadsPattern.matcher(head.toString()).matches()) { npStart += np.getChildren().length; int np2Start = movePastPrep(npStart, toks);
// Renamed method to follow Java naming conventions public static String findNoun(Parse p) { for(Parse k : p.getChildren()) { // Removed a bunch of extraneous brackets, and added whitespace // for readability. You should consider a set NOUN_TYPES // so you could use if (NOUN_TYPES.contains(k.getType()) instead. if (k.getType().equals("NN") || k.getType().equals("NNP") || k.getType().equals("NNS")|| k.getType().equals("NNPS")) { return k.toString(); } else { String possibleNoun = findNoun(k); // Return immediately if the recursion found a noun if (possibleNoun != null) { return possibleNoun; } } } // Nothing found in this node or children: tell the caller return null; }
double[] probs = new double[words.length]; for (int i = 0, il = children.length; i < il; i++) { words[i] = children[i].toString();//<co id="cp.words"/>