@Override protected Predicate<Constituent> getQuery(List<String> args, Constituent c) { return Queries.containsConstituent(c); } });
@Override protected Predicate<Constituent> getQuery(List<String> args, Constituent c) { return Queries.containsConstituent(c); } });
@Override public Boolean transform(Pair<Constituent, SpanLabelView> input) { Constituent candidate = input.getFirst(); SpanLabelView view = input.getSecond(); assert candidate != null; if (!typesToFilter.contains(candidate.getLabel())) return true; for (Constituent c : view.where(Queries.containsConstituent(candidate))) { if (c == candidate) continue; if (otherSet.contains(c.getLabel())) { return false; } } return true; } };
@Override public Boolean transform(Pair<Constituent, SpanLabelView> input) { Constituent candidate = input.getFirst(); SpanLabelView view = input.getSecond(); assert candidate != null; if (!typesToFilter.contains(candidate.getLabel())) return true; for (Constituent c : view.where(Queries.containsConstituent(candidate))) { if (c == candidate) continue; if (otherSet.contains(c.getLabel())) { return false; } } return true; } };
@SuppressWarnings({"unchecked", "serial"}) private Constituent getParsePhraseSingeWordHack(Constituent c, Constituent phrase) { List<Constituent> candidates; if (phrase == null || !Queries.containsConstituent(phrase).transform(c)) { // a hack that deals with cases when a single word constituent is // not found in the parse tree because it is not a phrase. if (c.getStartSpan() == c.getEndSpan() - 1) { candidates = (List<Constituent>) this.where(Queries.sameSpanAsConstituent(c).and( new Predicate<Constituent>() { @Override public Boolean transform(Constituent input) { return input.getOutgoingRelations().size() > 0; } })); phrase = candidates.get(0); } } return phrase; }
@SuppressWarnings({"unchecked", "serial"}) private Constituent getParsePhraseSingeWordHack(Constituent c, Constituent phrase) { List<Constituent> candidates; if (phrase == null || !Queries.containsConstituent(phrase).transform(c)) { // a hack that deals with cases when a single word constituent is // not found in the parse tree because it is not a phrase. if (c.getStartSpan() == c.getEndSpan() - 1) { candidates = (List<Constituent>) this.where(Queries.sameSpanAsConstituent(c).and( new Predicate<Constituent>() { @Override public Boolean transform(Constituent input) { return input.getOutgoingRelations().size() > 0; } })); phrase = candidates.get(0); } } return phrase; }
public Constituent getParsePhrase(Constituent c) throws Exception { Predicate<Constituent> predicate = Queries.containsConstituent(c).and(new Predicate<Constituent>() {
public Constituent getParsePhrase(Constituent c) throws Exception { Predicate<Constituent> predicate = Queries.containsConstituent(c).and(new Predicate<Constituent>() {
public static Predicate<Constituent> exclusivelyOverlaps(Constituent argument) { return Queries.hasOverlap(argument).and(Queries.containedInConstituent(argument).negate()) .and(Queries.containsConstituent(argument).negate()) .and(Queries.sameSpanAsConstituent(argument).negate()); }
public static Predicate<Constituent> exclusivelyOverlaps(Constituent argument) { return Queries.hasOverlap(argument).and(Queries.containedInConstituent(argument).negate()) .and(Queries.containsConstituent(argument).negate()) .and(Queries.sameSpanAsConstituent(argument).negate()); }
condition = Queries.containsConstituent(c);
condition = Queries.containsConstituent(c);