All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.stanford.nlp.trees.UniversalEnglishGrammaticalStructureFactory Maven / Gradle / Ivy

Go to download

Stanford Parser processes raw text in English, Chinese, German, Arabic, and French, and extracts constituency parse trees.

There is a newer version: 3.9.2
Show newest version
package edu.stanford.nlp.trees;

import java.util.function.Predicate;

public class UniversalEnglishGrammaticalStructureFactory implements GrammaticalStructureFactory {

  private final Predicate puncFilter;
  private final HeadFinder hf;

  public UniversalEnglishGrammaticalStructureFactory() {
    this(null, null);
  }

  public UniversalEnglishGrammaticalStructureFactory(Predicate puncFilter) {
    this(puncFilter, null);
  }

  public UniversalEnglishGrammaticalStructureFactory(Predicate puncFilter, HeadFinder hf) {
    this.puncFilter = puncFilter;
    this.hf = hf;
  }

  @Override
  public UniversalEnglishGrammaticalStructure newGrammaticalStructure(Tree t) {
    if (puncFilter == null && hf == null) {
      return new UniversalEnglishGrammaticalStructure(t);
    } else if (hf == null) {
      return new UniversalEnglishGrammaticalStructure(t, puncFilter);
    } else {
      return new UniversalEnglishGrammaticalStructure(t, puncFilter, hf);
    }
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy