@Override public int compare(Relation arg0, Relation arg1) { return arg0.getRelationName().compareTo(arg1.getRelationName()); } });
@Override public int compare(Relation arg0, Relation arg1) { return arg0.getRelationName().compareTo(arg1.getRelationName()); } });
public String discreteValue(Object __example) { if (!(__example instanceof Relation)) { String type = __example == null ? "null" : __example.getClass().getName(); System.err.println("Classifier 'extentLabel(Relation)' defined on line 11 of extent.lbj received '" + type + "' as input."); new Exception().printStackTrace(); System.exit(1); } Relation r = (Relation) __example; return "" + (r.getRelationName()); }
public String discreteValue(Object __example) { if (!(__example instanceof Relation)) { String type = __example == null ? "null" : __example.getClass().getName(); System.err.println("Classifier 'extentLabel(Relation)' defined on line 11 of extent.lbj received '" + type + "' as input."); new Exception().printStackTrace(); System.exit(1); } Relation r = (Relation) __example; return "" + (r.getRelationName()); }
public String discreteValue(Object __example) { if (!(__example instanceof Relation)) { String type = __example == null ? "null" : __example.getClass().getName(); System.err.println("Classifier 'extentLabel(Relation)' defined on line 11 of extent.lbj received '" + type + "' as input."); new Exception().printStackTrace(); System.exit(1); } Relation r = (Relation) __example; return "" + (r.getRelationName()); }
protected void setDependencyTreeSwitch(Constituent root) { List<Relation> rootRelations = root.getOutgoingRelations(); isDependencyTree = rootRelations.size() != 0 && !rootRelations.get(0).getRelationName().equals(PARENT_OF_STRING); }
public List<Relation> getFilteredIncomingRelations(Constituent c) { List<Relation> filteredIncomingRelations = new ArrayList<>(); for (Relation r : c.getIncomingRelations()) { if (!Objects.equals(r.getRelationName(), viewName)) continue; filteredIncomingRelations.add(r); } return filteredIncomingRelations; }
public List<Relation> getFilteredIncomingRelations(Constituent c) { List<Relation> filteredIncomingRelations = new ArrayList<>(); for (Relation r : c.getIncomingRelations()) { if (!Objects.equals(r.getRelationName(), viewName)) continue; filteredIncomingRelations.add(r); } return filteredIncomingRelations; }
protected void setDependencyTreeSwitch(Constituent root) { List<Relation> rootRelations = root.getOutgoingRelations(); isDependencyTree = rootRelations.size() != 0 && !rootRelations.get(0).getRelationName().equals(PARENT_OF_STRING); }
/** * Since all the relations are being populated inside the View class, we need to filter out the * relations which are irrelevant to coreference. This function, given a constituent, returns * all of the outgoing coreference relations. */ public List<Relation> getFilteredOutgoingRelations(Constituent c) { List<Relation> filteredOutgoingRelations = new ArrayList<>(); for (Relation r : c.getOutgoingRelations()) { if (!Objects.equals(r.getRelationName(), viewName)) continue; filteredOutgoingRelations.add(r); } return filteredOutgoingRelations; }
@Override public String toString() { StringBuilder bldr = new StringBuilder( source.toString() ); bldr.append( "--" ).append( getRelationName() ).append("--> "); bldr.append( target ).append("(").append( getScore() ).append( ")" ); return bldr.toString(); }
@Override public String toString() { StringBuilder bldr = new StringBuilder( source.toString() ); bldr.append( "--" ).append( getRelationName() ).append("--> "); bldr.append( target ).append("(").append( getScore() ).append( ")" ); return bldr.toString(); }
/** * Since all the relations are being populated inside the View class, we need to filter out the * relations which are irrelevant to coreference. This function, given a constituent, returns * all of the outgoing coreference relations. */ public List<Relation> getFilteredOutgoingRelations(Constituent c) { List<Relation> filteredOutgoingRelations = new ArrayList<>(); for (Relation r : c.getOutgoingRelations()) { if (!Objects.equals(r.getRelationName(), viewName)) continue; filteredOutgoingRelations.add(r); } return filteredOutgoingRelations; }
public static String printRelation(Relation c) { StringBuilder output = new StringBuilder(); output.append( "Relation has type: " ); output.append( c.getRelationName() ); output.append( "Attributes: "); for ( String attType : c.getAttributeKeys() ) { String val = c.getAttribute( attType ); output.append( "[").append( attType ).append( ", " ).append( val ).append( "], " ); } output.append("\nFirst argument:\n"); output.append(printConstituent(c.getSource())); output.append("\n\nSecond argument:\n"); output.append(printConstituent(c.getTarget())); return output.toString(); }
public static String printRelation(Relation c) { StringBuilder output = new StringBuilder(); output.append( "Relation has type: " ); output.append( c.getRelationName() ); output.append( "Attributes: "); for ( String attType : c.getAttributeKeys() ) { String val = c.getAttribute( attType ); output.append( "[").append( attType ).append( ", " ).append( val ).append( "], " ); } output.append("\nFirst argument:\n"); output.append(printConstituent(c.getSource())); output.append("\n\nSecond argument:\n"); output.append(printConstituent(c.getTarget())); return output.toString(); }
@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; }
private Map<IntPair, String> getGoldArgumentSpanLabels(Constituent predicate) { List<Relation> args = predicate.getOutgoingRelations(); Map<IntPair, String> argSpans = new HashMap<>(); for (Relation r : args) { Constituent arg = r.getTarget(); argSpans.put(new IntPair(arg.getStartSpan(), arg.getEndSpan()), r.getRelationName()); } return argSpans; }
protected Tree<String> buildTree(Constituent root) { Tree<String> t; if (isDependencyTree) t = new Tree<>(root.toString()); else t = new Tree<>(root.getLabel()); for (Relation r : root.getOutgoingRelations()) { if (!isDependencyTree) t.addSubtree(buildTree(r.getTarget())); else t.addSubtree(buildTree(r.getTarget()), r.getRelationName()); } return t; }
protected Tree<String> buildTree(Constituent root) { Tree<String> t; if (isDependencyTree) t = new Tree<>(root.toString()); else t = new Tree<>(root.getLabel()); for (Relation r : root.getOutgoingRelations()) { if (!isDependencyTree) t.addSubtree(buildTree(r.getTarget())); else t.addSubtree(buildTree(r.getTarget()), r.getRelationName()); } return t; }