use of edu.stanford.nlp.trees.LabeledConstituent in project CoreNLP by stanfordnlp.
the class TreeSpanScoring method simplifyConstituents.
public static Set<Constituent> simplifyConstituents(TreebankLanguagePack tlp, Set<Constituent> constituents) {
Set<Constituent> newConstituents = new HashSet<>();
for (Constituent con : constituents) {
if (!(con instanceof LabeledConstituent)) {
throw new AssertionError("Unexpected constituent type " + con.getClass());
}
LabeledConstituent labeled = (LabeledConstituent) con;
newConstituents.add(new LabeledConstituent(labeled.start(), labeled.end(), tlp.basicCategory(labeled.value())));
}
return newConstituents;
}
Aggregations