@Override public Constituent transform(Relation arg0) { return arg0.getTarget(); } };
@Override public Boolean transform(Constituent c1) { boolean found = false; for (Relation r : c.getOutgoingRelations()) { if (r.getTarget() == c1) { found = true; break; } } return found; } };
public static List<Constituent> getArgumentConstituents(Constituent predicate) { List<Constituent> args = new ArrayList<>(); for (Relation r : getArguments(predicate)) { args.add(r.getTarget()); } return args; } }
@Override public List<Constituent> transform(Constituent input) { List<Constituent> c = new ArrayList<>(); for (Relation r : input.getOutgoingRelations()) { c.add(addPointerToSource(input, r.getTarget())); } return c; }
@Override public Boolean transform(Constituent arg0) { List<Relation> relations = parent.getOutgoingRelations(); if (relations.size() <= n) return false; return relations.get(n).getTarget() == parent; } };
public String discreteValue(Object __example) { if (!(__example instanceof Relation)) { String type = __example == null ? "null" : __example.getClass().getName(); System.err.println("Classifier 'headText(Relation)' defined on line 33 of extent.lbj received '" + type + "' as input."); new Exception().printStackTrace(); System.exit(1); } Relation r = (Relation) __example; return "" + (r.getTarget().toString().toLowerCase()); }
public String discreteValue(Object __example) { if (!(__example instanceof Relation)) { String type = __example == null ? "null" : __example.getClass().getName(); System.err.println("Classifier 'headLevel(Relation)' defined on line 67 of extent.lbj received '" + type + "' as input."); new Exception().printStackTrace(); System.exit(1); } Relation r = (Relation) __example; return "" + (r.getTarget().getAttribute("EntityMentionType")); }
public String discreteValue(Object __example) { if (!(__example instanceof Relation)) { String type = __example == null ? "null" : __example.getClass().getName(); System.err.println("Classifier 'headLevel(Relation)' defined on line 67 of extent.lbj received '" + type + "' as input."); new Exception().printStackTrace(); System.exit(1); } Relation r = (Relation) __example; return "" + (r.getTarget().getAttribute("EntityMentionType")); }
public String discreteValue(Object __example) { if (!(__example instanceof Relation)) { String type = __example == null ? "null" : __example.getClass().getName(); System.err.println("Classifier 'headType(Relation)' defined on line 63 of extent.lbj received '" + type + "' as input."); new Exception().printStackTrace(); System.exit(1); } Relation r = (Relation) __example; return "" + (r.getTarget().getAttribute("EntityType")); }
@Override public Boolean transform(Constituent c1) { boolean found = false; for (Relation r : c.getOutgoingRelations()) { if (r.getTarget() == c1) { found = true; break; } } return found; } };
@Override public List<Constituent> transform(Constituent input) { List<Constituent> c = new ArrayList<>(); for (Relation r : input.getOutgoingRelations()) { c.add(addPointerToSource(input, r.getTarget())); } return c; }
public static List<Constituent> getArgumentConstituents(Constituent predicate) { List<Constituent> args = new ArrayList<>(); for (Relation r : getArguments(predicate)) { args.add(r.getTarget()); } return args; } }
public String discreteValue(Object __example) { if (!(__example instanceof Relation)) { String type = __example == null ? "null" : __example.getClass().getName(); System.err.println("Classifier 'headLastWord(Relation)' defined on line 15 of extent.lbj received '" + type + "' as input."); new Exception().printStackTrace(); System.exit(1); } Relation r = (Relation) __example; return "" + (r.getTarget().getTextAnnotation().getToken(r.getTarget().getEndSpan() - 1).toLowerCase()); }
public String discreteValue(Object __example) { if (!(__example instanceof Relation)) { String type = __example == null ? "null" : __example.getClass().getName(); System.err.println("Classifier 'headLastWord(Relation)' defined on line 15 of extent.lbj received '" + type + "' as input."); new Exception().printStackTrace(); System.exit(1); } Relation r = (Relation) __example; return "" + (r.getTarget().getTextAnnotation().getToken(r.getTarget().getEndSpan() - 1).toLowerCase()); }
public String discreteValue(Object __example) { if (!(__example instanceof Relation)) { String type = __example == null ? "null" : __example.getClass().getName(); System.err.println("Classifier 'headLastWord(Relation)' defined on line 15 of extent.lbj received '" + type + "' as input."); new Exception().printStackTrace(); System.exit(1); } Relation r = (Relation) __example; return "" + (r.getTarget().getTextAnnotation().getToken(r.getTarget().getEndSpan() - 1).toLowerCase()); }
public static boolean isPreTerminal(Constituent treeNode) { List<Relation> out = treeNode.getOutgoingRelations(); if (out.size() == 0) return false; out = out.get(0).getTarget().getOutgoingRelations(); return out.size() == 0; }
@Override public int hashCode() { int hashCode = this.getRelationName().hashCode() * 79 + this.getSource().hashCode() * 7 + this.getTarget().hashCode() * 13 + (new Double(this.getScore())).hashCode() * 17; hashCode += (this.attributes == null ? 0 : this.attributes.hashCode() * 13); hashCode += (this.labelsToScores == null ? 0 : this.labelsToScores.hashCode() * 23); return hashCode; }
@Override public int hashCode() { int hashCode = this.getRelationName().hashCode() * 79 + this.getSource().hashCode() * 7 + this.getTarget().hashCode() * 13 + (new Double(this.getScore())).hashCode() * 17; hashCode += (this.attributes == null ? 0 : this.attributes.hashCode() * 13); hashCode += (this.labelsToScores == null ? 0 : this.labelsToScores.hashCode() * 23); return hashCode; }
/** * This is the meat of the headfinder. Based on the head search direction, find the head. */ private Constituent findHead(Constituent parseNode, Pair<HeadSearchDirection, String[]> rule, boolean getDefaultHeadChild) { int headChild = rule.getFirst().getHeadChildId(parseNode, rule.getSecond(), getDefaultHeadChild); if (headChild == -1) return null; headChild = fixHeadChildHacks(headChild, parseNode); return parseNode.getOutgoingRelations().get(headChild).getTarget(); }
/** * This is the meat of the headfinder. Based on the head search direction, find the head. */ private Constituent findHead(Constituent parseNode, Pair<HeadSearchDirection, String[]> rule, boolean getDefaultHeadChild) { int headChild = rule.getFirst().getHeadChildId(parseNode, rule.getSecond(), getDefaultHeadChild); if (headChild == -1) return null; headChild = fixHeadChildHacks(headChild, parseNode); return parseNode.getOutgoingRelations().get(headChild).getTarget(); }