edu.stanford.nlp.trees.EnglishGrammaticalStructureFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of stanford-parser Show documentation
Show all versions of stanford-parser Show documentation
Stanford Parser processes raw text in English, Chinese, German, Arabic, and French, and extracts constituency parse trees.
package edu.stanford.nlp.trees;
import java.util.function.Predicate;
public class EnglishGrammaticalStructureFactory implements GrammaticalStructureFactory {
private final Predicate puncFilter;
private final HeadFinder hf;
public EnglishGrammaticalStructureFactory() {
this(null, null);
}
public EnglishGrammaticalStructureFactory(Predicate puncFilter) {
this(puncFilter, null);
}
public EnglishGrammaticalStructureFactory(Predicate puncFilter, HeadFinder hf) {
this.puncFilter = puncFilter;
this.hf = hf;
}
public EnglishGrammaticalStructure newGrammaticalStructure(Tree t) {
if (puncFilter == null && hf == null) {
return new EnglishGrammaticalStructure(t);
} else if (hf == null) {
return new EnglishGrammaticalStructure(t, puncFilter);
} else {
return new EnglishGrammaticalStructure(t, puncFilter, hf);
}
}
}