private static Constituent getNewConstituent(TextAnnotation ta, Constituent predicate, int start, int end) { Constituent newConstituent = new Constituent("", 1.0, viewName, ta, start, end); new Relation("ChildOf", predicate, newConstituent, 1.0); return newConstituent; } }
@Override public List<Constituent> transform(Constituent c) { Constituent c1 = c.cloneForNewView(c.getViewName()); new Relation("", c, c1, 0.0); return Collections.singletonList(c1); }
@Override public List<Constituent> transform(Constituent c) { Constituent c1 = c.cloneForNewView(c.getViewName()); new Relation("", c, c1, 0.0); return Collections.singletonList(c1); }
public void addPredicateArguments(Constituent predicate, List<Constituent> args, String[] relations, double[] scores) { if (args.size() != relations.length) { throw new IllegalArgumentException("Number of arguments != number of relations"); } if (args.size() != scores.length) { throw new IllegalArgumentException("Number of arguments != number of scores"); } this.addConstituent(predicate); this.predicates.add(predicate); for (int i = 0; i < args.size(); i++) { if(!this.containsConstituent(args.get(i))) this.addConstituent(args.get(i)); this.addRelation(new Relation(relations[i], predicate, args.get(i), scores[i])); } }
public void addPredicateArguments(Constituent predicate, List<Constituent> args, String[] relations, double[] scores, List<HashMap<String, String>> attributes) { if (args.size() != relations.length) { throw new IllegalArgumentException("Number of arguments != number of relations"); } if (args.size() != scores.length) { throw new IllegalArgumentException("Number of arguments != number of scores"); } this.addConstituent(predicate); this.predicates.add(predicate); for (int i = 0; i < args.size(); i++) { if(!this.containsConstituent(args.get(i))) this.addConstituent(args.get(i)); Relation relation = new Relation(relations[i], predicate, args.get(i), scores[i]); relation.attributes = attributes.get(i); this.addRelation(relation); } }
public void addPredicateArguments(Constituent predicate, List<Constituent> args, String[] relations, double[] scores) { if (args.size() != relations.length) { throw new IllegalArgumentException("Number of arguments != number of relations"); } if (args.size() != scores.length) { throw new IllegalArgumentException("Number of arguments != number of scores"); } this.addConstituent(predicate); this.predicates.add(predicate); for (int i = 0; i < args.size(); i++) { if(!this.containsConstituent(args.get(i))) this.addConstituent(args.get(i)); this.addRelation(new Relation(relations[i], predicate, args.get(i), scores[i])); } }
public void addPredicateArguments(Constituent predicate, List<Constituent> args, String[] relations, double[] scores, List<HashMap<String, String>> attributes) { if (args.size() != relations.length) { throw new IllegalArgumentException("Number of arguments != number of relations"); } if (args.size() != scores.length) { throw new IllegalArgumentException("Number of arguments != number of scores"); } this.addConstituent(predicate); this.predicates.add(predicate); for (int i = 0; i < args.size(); i++) { if(!this.containsConstituent(args.get(i))) this.addConstituent(args.get(i)); Relation relation = new Relation(relations[i], predicate, args.get(i), scores[i]); relation.attributes = attributes.get(i); this.addRelation(relation); } }
private static Constituent addPointerToSource(Constituent source, Constituent c) { Constituent c1 = c.cloneForNewView(c.getViewName()); new Relation("", source, c1, 0.0); return c1; }
private static Constituent addIncomingRelation(Constituent input, Constituent c) { Constituent i = input.cloneForNewView(""); Constituent c1 = c.cloneForNewView(""); new Relation("", i, c1, 0d); return c1; } }
private static Constituent addPointerToSource(Constituent source, Constituent c) { Constituent c1 = c.cloneForNewView(c.getViewName()); new Relation("", source, c1, 0.0); return c1; }
private static Constituent addIncomingRelation(Constituent input, Constituent c) { Constituent i = input.cloneForNewView(""); Constituent c1 = c.cloneForNewView(""); new Relation("", i, c1, 0d); return c1; } }
protected Constituent getNewConstituent(TextAnnotation ta, Constituent predicateClone, int start, int end) { Constituent newConstituent = new Constituent("", 1.0, getCandidateViewName(), ta, start, end); new Relation("ChildOf", predicateClone, newConstituent, 1.0); return newConstituent; }
/** * required: consMap *must* contain the source and target constituents for r as keys, and their values * must be non-null * @param r relation to copy * @param consMap map from original constituents to new counterparts * @return new relation with all info copied from original, but with new source and target constituents */ public static Relation copyRelation(Relation r, Map<Constituent, Constituent> consMap) { Relation newRel = null; if ( null == r.getLabelsToScores() ) newRel = new Relation(r.getRelationName(), consMap.get(r.getSource()), consMap.get(r.getTarget()), r.getScore()); else newRel = new Relation(r.getLabelsToScores(), consMap.get(r.getSource()), consMap.get(r.getTarget())); copyAttributesFromTo(r, newRel); return newRel; }
/** * required: consMap *must* contain the source and target constituents for r as keys, and their values * must be non-null * @param r relation to copy * @param consMap map from original constituents to new counterparts * @return new relation with all info copied from original, but with new source and target constituents */ public static Relation copyRelation(Relation r, Map<Constituent, Constituent> consMap) { Relation newRel = null; if ( null == r.getLabelsToScores() ) newRel = new Relation(r.getRelationName(), consMap.get(r.getSource()), consMap.get(r.getTarget()), r.getScore()); else newRel = new Relation(r.getLabelsToScores(), consMap.get(r.getSource()), consMap.get(r.getTarget())); copyAttributesFromTo(r, newRel); return newRel; }
@Override public List<Constituent> transform(Constituent input) { TextAnnotation ta = input.getTextAnnotation(); Constituent ce = new Constituent("", "", ta, input.getEndSpan() - 1, input.getEndSpan()); Constituent cs = new Constituent("", "", ta, input.getStartSpan(), input.getStartSpan() + 1); new Relation("", cs, ce, 0); return Collections.singletonList(ce); }
@Override public List<Constituent> transform(Constituent input) { TextAnnotation ta = input.getTextAnnotation(); Constituent ce = new Constituent("", "", ta, input.getEndSpan() - 1, input.getEndSpan()); Constituent cs = new Constituent("", "", ta, input.getStartSpan(), input.getStartSpan() + 1); new Relation("", cs, ce, 0); return Collections.singletonList(ce); }
@Override public List<Constituent> transform(Constituent input) { TextAnnotation ta = input.getTextAnnotation(); Constituent ce = new Constituent("", "", ta, input.getEndSpan() - 1, input.getEndSpan()); Constituent cs = new Constituent("", "", ta, input.getStartSpan(), input.getStartSpan() + 1); new Relation("", cs, ce, 0); return Collections.singletonList(ce); }
@Override public List<Constituent> transform(Constituent input) { TextAnnotation ta = input.getTextAnnotation(); Constituent ce = new Constituent("", "", ta, input.getEndSpan() - 1, input.getEndSpan()); Constituent cs = new Constituent("", "", ta, input.getStartSpan(), input.getStartSpan() + 1); new Relation("", cs, ce, 0); return Collections.singletonList(ce); }
@Override public List<Constituent> transform(Constituent input) { TextAnnotation ta = input.getTextAnnotation(); Constituent ce = new Constituent("", "", ta, input.getEndSpan() - 1, input.getEndSpan()); Constituent cs = new Constituent("", "", ta, input.getStartSpan(), input.getStartSpan() + 1); new Relation("", cs, ce, 0); return Collections.singletonList(ce); }
public void addCorefEdges(Constituent canonicalMention, List<Constituent> coreferentMentions, double[] scores) { this.addConstituent(canonicalMention); int canonicalMentionId = this.constituents.indexOf(canonicalMention); canonicalEntitiesMap.put(canonicalMentionId, canonicalMentionId); int i = 0; for (Constituent c : coreferentMentions) { if (c != canonicalMention) { this.addConstituent(c); Relation relation = new Relation(viewName, canonicalMention, c, scores[i]); this.addRelation(relation); int cId = this.constituents.indexOf(c); canonicalEntitiesMap.put(cId, canonicalMentionId); } i++; } }