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

edu.berkeley.nlp.io.FeatureLabelTokenFactory Maven / Gradle / Ivy

Go to download

The Berkeley parser analyzes the grammatical structure of natural language using probabilistic context-free grammars (PCFGs).

The newest version!
package edu.berkeley.nlp.io;

/**
 * Constructs FeatureLabel as a String with a corresponding BEGIN and END position.
 *
 * @author Marie-Catherine de Marneffe
 */
public class FeatureLabelTokenFactory implements LexedTokenFactory {

  /**
   * Constructs FeatureLabel as a String with a corresponding BEGIN and END position.
   * (Does not take substr).
   */
  public FeatureLabel makeToken(String str, int begin, int length) {
    FeatureLabel fl = new FeatureLabel();
    fl.setWord(str);
    fl.setCurrent(str);
    fl.setBeginPosition(begin);
    fl.setEndPosition(begin+length);
    return fl;
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy