edu.berkeley.nlp.io.FeatureLabelTokenFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of berkeleyparser Show documentation
Show all versions of berkeleyparser Show documentation
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