protected String cons(Parse p, int i) { StringBuilder feat = new StringBuilder(20); feat.append(i).append("="); if (p != null) { if (useLabel && i < 0) { feat.append(p.getLabel()).append("|"); } feat.append(p.getType()).append("|").append(p.getHead().getCoveredText()); } else { feat.append(EOS); } return feat.toString(); }
/** * Produces features to determine whether the specified child node is part of * a complete constituent of the specified type and adds those features to the * specfied list. * @param child The parse node to consider. * @param i A string indicating the position of the child node. * @param type The type of constituent being built. * @param features List to add features to. */ protected void checkcons(Parse child, String i, String type, List<String> features) { StringBuilder feat = new StringBuilder(20); feat.append("c").append(i).append("=").append(child.getType()).append("|") .append(child.getHead().getCoveredText()).append("|").append(type); features.add(feat.toString()); feat.setLength(0); feat.append("c").append(i).append("*=").append(child.getType()).append("|").append(type); features.add(feat.toString()); }
protected void checkcons(Parse p1, Parse p2, String type, List<String> features) { StringBuilder feat = new StringBuilder(20); feat.append("cil=").append(type).append(",").append(p1.getType()).append("|") .append(p1.getHead().getCoveredText()).append(",").append(p2.getType()) .append("|").append(p2.getHead().getCoveredText()); features.add(feat.toString()); feat.setLength(0); feat.append("ci*l=").append(type).append(",").append(p1.getType()).append(",") .append(p2.getType()).append("|").append(p2.getHead().getCoveredText()); features.add(feat.toString()); feat.setLength(0); feat.append("cil*=").append(type).append(",").append(p1.getType()).append("|") .append(p1.getHead().getCoveredText()).append(",").append(p2.getType()); features.add(feat.toString()); feat.setLength(0); feat.append("ci*l*=").append(type).append(",").append(p1.getType()) .append(",").append(p2.getType()); features.add(feat.toString()); }
for (int ti = tags1.length - 1; ti >= 0; ti--) { if (constituents[ci].getType().equals(tags1[ti])) { return constituents[ci].getHead(); return constituents[ci].getHead(); for (int ti = tags2.length - 1; ti >= 0; ti--) { if (constituents[ci].getType().equals(tags2[ti])) { return constituents[ci].getHead(); for (int ti = tags3.length - 1; ti >= 0; ti--) { if (constituents[ci].getType().equals(tags3[ti])) { return constituents[ci].getHead(); return constituents[constituents.length - 1].getHead(); for (int ci = 0; ci < cl; ci++) { if (constituents[ci].getType().equals(tags[ti])) { return constituents[ci].getHead(); return constituents[0].getHead(); for (int ci = cl - 1; ci >= 0; ci--) { if (constituents[ci].getType().equals(tags[ti])) { return constituents[ci].getHead(); return constituents[cl - 1].getHead(); return constituents[constituents.length - 1].getHead();
unigram[0] = p_2.getHead().getCoveredText(); u_2 = dict.contains(new StringList(unigram)); unigram[0] = p2.getHead().getCoveredText(); u2 = dict.contains(new StringList(unigram)); unigram[0] = p0.getHead().getCoveredText(); u0 = dict.contains(new StringList(unigram)); bigram[0] = p_2.getHead().getCoveredText(); bigram[1] = p_1.getHead().getCoveredText(); b_2_1 = dict.contains(new StringList(bigram)); trigram[0] = p_2.getHead().getCoveredText(); trigram[1] = p_1.getHead().getCoveredText(); trigram[2] = p0.getHead().getCoveredText(); t_2_10 = dict.contains(new StringList(trigram)); trigram[0] = p_1.getHead().getCoveredText(); trigram[1] = p0.getHead().getCoveredText(); trigram[2] = p1.getHead().getCoveredText(); t_101 = dict.contains(new StringList(trigram)); unigram[0] = p_1.getHead().getCoveredText(); u_1 = dict.contains(new StringList(unigram)); bigram[0] = p_1.getHead().getCoveredText(); bigram[1] = p0.getHead().getCoveredText(); b_10 = dict.contains(new StringList(bigram)) && u_1 && u0;
String[] cwords = new String[chunks.length]; for (int wi = 0; wi < cwords.length; wi++) { cwords[wi] = chunks[wi].getHead().getCoveredText(); String[] window = new String[5]; int wi = 0; if (ci - 2 >= 0) window[wi++] = chunks[ci - 2].getHead().getCoveredText(); if (ci - 1 >= 0) window[wi++] = chunks[ci - 1].getHead().getCoveredText(); window[wi++] = chunks[ci].getHead().getCoveredText(); if (ci + 1 < chunks.length) window[wi++] = chunks[ci + 1].getHead().getCoveredText(); if (ci + 2 < chunks.length) window[wi++] = chunks[ci + 2].getHead().getCoveredText(); if (wi < 5) { String[] subWindow = new String[wi];
words[i] = sp.getHead().getCoveredText(); ptags[i] = sp.getType();
if (!tag.equals(DONE)) { Parse newParse1 = (Parse) p.clone(); Parse newNode = new Parse(p.getText(),advanceNode.getSpan(),tag,bprob,advanceNode.getHead()); newParse1.insert(newNode); newParse1.addProb(Math.log(bprob)); Parse newNode2 = new Parse(p.getText(),advanceNode.getSpan(),tag,bprob,advanceNode.getHead()); newParse2.insert(newNode2); newParse2.addProb(Math.log(bprob));
protected String cons(Parse p, int i) { StringBuilder feat = new StringBuilder(20); feat.append(i).append("="); if (p != null) { if (useLabel && i < 0) { feat.append(p.getLabel()).append("|"); } feat.append(p.getType()).append("|").append(p.getHead().getCoveredText()); } else { feat.append(EOS); } return feat.toString(); }
protected String cons(Parse p, int i) { StringBuilder feat = new StringBuilder(20); feat.append(i).append("="); if (p != null) { if (useLabel && i < 0) { feat.append(p.getLabel()).append("|"); } feat.append(p.getType()).append("|").append(p.getHead().getCoveredText()); } else { feat.append(EOS); } return feat.toString(); }
/** * Produces features to determine whether the specified child node is part of * a complete constituent of the specified type and adds those features to the * specfied list. * @param child The parse node to consider. * @param i A string indicating the position of the child node. * @param type The type of constituent being built. * @param features List to add features to. */ protected void checkcons(Parse child, String i, String type, List<String> features) { StringBuilder feat = new StringBuilder(20); feat.append("c").append(i).append("=").append(child.getType()).append("|") .append(child.getHead().getCoveredText()).append("|").append(type); features.add(feat.toString()); feat.setLength(0); feat.append("c").append(i).append("*=").append(child.getType()).append("|").append(type); features.add(feat.toString()); }
/** * Produces features to determine whether the specified child node is part of * a complete constituent of the specified type and adds those features to the * specfied list. * @param child The parse node to consider. * @param i A string indicating the position of the child node. * @param type The type of constituent being built. * @param features List to add features to. */ protected void checkcons(Parse child, String i, String type, List<String> features) { StringBuilder feat = new StringBuilder(20); feat.append("c").append(i).append("=").append(child.getType()).append("|") .append(child.getHead().getCoveredText()).append("|").append(type); features.add(feat.toString()); feat.setLength(0); feat.append("c").append(i).append("*=").append(child.getType()).append("|").append(type); features.add(feat.toString()); }
private String[] getLemmas(Parse np) { // make sure we're getting a single word. String word = np.getHead().toString().toLowerCase(); return wordnet.getLemmas(word,"NN"); }
protected void checkcons(Parse p1, Parse p2, String type, List<String> features) { StringBuilder feat = new StringBuilder(20); feat.append("cil=").append(type).append(",").append(p1.getType()).append("|") .append(p1.getHead().getCoveredText()).append(",").append(p2.getType()) .append("|").append(p2.getHead().getCoveredText()); features.add(feat.toString()); feat.setLength(0); feat.append("ci*l=").append(type).append(",").append(p1.getType()).append(",") .append(p2.getType()).append("|").append(p2.getHead().getCoveredText()); features.add(feat.toString()); feat.setLength(0); feat.append("cil*=").append(type).append(",").append(p1.getType()).append("|") .append(p1.getHead().getCoveredText()).append(",").append(p2.getType()); features.add(feat.toString()); feat.setLength(0); feat.append("ci*l*=").append(type).append(",").append(p1.getType()) .append(",").append(p2.getType()); features.add(feat.toString()); }
protected void checkcons(Parse p1, Parse p2, String type, List<String> features) { StringBuilder feat = new StringBuilder(20); feat.append("cil=").append(type).append(",").append(p1.getType()).append("|") .append(p1.getHead().getCoveredText()).append(",").append(p2.getType()) .append("|").append(p2.getHead().getCoveredText()); features.add(feat.toString()); feat.setLength(0); feat.append("ci*l=").append(type).append(",").append(p1.getType()).append(",") .append(p2.getType()).append("|").append(p2.getHead().getCoveredText()); features.add(feat.toString()); feat.setLength(0); feat.append("cil*=").append(type).append(",").append(p1.getType()).append("|") .append(p1.getHead().getCoveredText()).append(",").append(p2.getType()); features.add(feat.toString()); feat.setLength(0); feat.append("ci*l*=").append(type).append(",").append(p1.getType()) .append(",").append(p2.getType()); features.add(feat.toString()); }
Parse head = np.getHead(); if (falseHeadsPattern.matcher(head.toString()).matches()) { npStart += np.getChildren().length; Parse np = getContainingNounPhrase(toks[npStart]); if (np != null) { Parse head = np.getHead(); if (falseHeadsPattern.matcher(head.toString()).matches()) { npStart += np.getChildren().length;
addHeadAnnotation(cons, parse.getHead().getSpan()); } catch (CASRuntimeException e) {