/** * Returns the Constituents generated by the parse tree. * The Constituents of a sentence include the preterminal categories * but not the leaves. * * @param cf ConstituentFactory used to build the Constituent objects * @return a Set of the constituents as SimpleConstituent type * (in the current implementation, a {@code HashSet} */ public Set<Constituent> constituents(ConstituentFactory cf) { return constituents(cf,false); }
@Override protected Set<Constituent> makeObjects(Tree tree) { if (tree == null) { return Collections.emptySet(); } // The eval trees won't have a root level, instead starting with // the S/SINV/FRAG/whatever, so just eval at the top level Set<Constituent> result = tree.constituents(cf, 0); return result; }
/** * evalb only evaluates phrasal categories, thus constituents() does not * return objects for terminals and pre-terminals. */ @Override protected Set<Constituent> makeObjects(Tree tree) { Set<Constituent> set = Generics.newHashSet(); if(tree != null) set.addAll(tree.constituents(cf)); return set; }
protected Set<?> makeObjects(Tree tree) { Set<Constituent> set = Generics.newHashSet(); if (tree != null) { set.addAll(tree.constituents(cf, false, subtreeFilter)); } return set; }
/** * Returns the Constituents generated by the parse tree. Constituents * are computed with respect to whitespace (e.g., at the word level). * * @return a Set of the constituents as constituents of * type {@code Constituent} */ public Set<Constituent> constituents() { return constituents(new SimpleConstituentFactory()); }
public Set<Constituent> constituents(ConstituentFactory cf, boolean charLevel, Predicate<Tree> filter) { Set<Constituent> constituentsSet = Generics.newHashSet(); constituents(constituentsSet, 0, cf, charLevel, filter, -1, 0); return constituentsSet; }
/** * Returns the Constituents generated by the parse tree. * The Constituents of a sentence include the preterminal categories * but not the leaves. * * @param cf ConstituentFactory used to build the Constituent objects * @param charLevel If true, compute bracketings irrespective of whitespace boundaries. * @return a Set of the constituents as SimpleConstituent type * (in the current implementation, a {@code HashSet} */ public Set<Constituent> constituents(ConstituentFactory cf, boolean charLevel) { Set<Constituent> constituentsSet = Generics.newHashSet(); constituents(constituentsSet, 0, cf, charLevel, null, -1, 0); return constituentsSet; }
/** * Returns the Constituents generated by the parse tree. * The Constituents of a sentence include the preterminal categories * but not the leaves. * * @param cf ConstituentFactory used to build the Constituent objects * @param maxDepth The maximum depth at which to add constituents, * where 0 is the root level. Negative maxDepth * indicates no maximum. * @return a Set of the constituents as SimpleConstituent type * (in the current implementation, a {@code HashSet} */ public Set<Constituent> constituents(ConstituentFactory cf, int maxDepth) { Set<Constituent> constituentsSet = Generics.newHashSet(); constituents(constituentsSet, 0, cf, false, null, maxDepth, 0); return constituentsSet; }
goldDeps.addAll(trees.second().constituents(cFact)); goldDeps.removeAll(trees.third().constituents(cFact)); for(Constituent c : goldDeps) goldDepPw.print(c.toString() + " "); guessDeps.addAll(trees.third().constituents(cFact)); guessDeps.removeAll(trees.second().constituents(cFact)); for(Constituent c : guessDeps) guessDepPw.print(c.toString() + " ");
Set<Constituent> goldConstituents = goldTree.constituents(LabeledConstituent.factory()); Set<Constituent> guessConstituents = guessTree.constituents(LabeledConstituent.factory());
position = kid.constituents(constituentsSet, position, cf, charLevel, filter, maxDepth, depth + 1);
Set<Constituent> pcfgConstituents = pcfgTree.constituents(new LabeledScoredConstituentFactory());
Set<Constituent> t1Labels = (t1 == null) ? Generics.<Constituent>newHashSet() : t1.constituents(cf); if(t2 != null) { t2.setSpans();
/** * Returns the Constituents generated by the parse tree. Constituents * are computed with respect to whitespace (e.g., at the word level). * * @return a Set of the constituents as constituents of * type {@code Constituent} */ public Set<Constituent> constituents() { return constituents(new SimpleConstituentFactory()); }
public Set<Constituent> constituents(ConstituentFactory cf, boolean charLevel, Predicate<Tree> filter) { Set<Constituent> constituentsSet = Generics.newHashSet(); constituents(constituentsSet, 0, cf, charLevel, filter, -1, 0); return constituentsSet; }
protected Set<?> makeObjects(Tree tree) { Set<Constituent> set = Generics.newHashSet(); if (tree != null) { set.addAll(tree.constituents(cf, false, subtreeFilter)); } return set; }
/** * evalb only evaluates phrasal categories, thus constituents() does not * return objects for terminals and pre-terminals. */ @Override protected Set<Constituent> makeObjects(Tree tree) { Set<Constituent> set = Generics.newHashSet(); if(tree != null) set.addAll(tree.constituents(cf)); return set; }
protected Set<?> makeObjects(Tree tree) { Set<Constituent> set = Generics.newHashSet(); if (tree != null) { set.addAll(tree.constituents(cf, false, subtreeFilter)); } return set; }
public Set<Constituent> constituents(ConstituentFactory cf, boolean charLevel, Predicate<Tree> filter) { Set<Constituent> constituentsSet = Generics.newHashSet(); constituents(constituentsSet, 0, cf, charLevel, filter, -1, 0); return constituentsSet; }
/** * Returns the Constituents generated by the parse tree. Constituents * are computed with respect to whitespace (e.g., at the word level). * * @return a Set of the constituents as constituents of * type {@code Constituent} */ public Set<Constituent> constituents() { return constituents(new SimpleConstituentFactory()); }