
cc.mallet.share.upenn.ner.FeatureWindow Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jcore-mallet-2.0.9 Show documentation
Show all versions of jcore-mallet-2.0.9 Show documentation
MALLET is a Java-based package for statistical natural language processing, document classification, clustering, topic modeling, information extraction, and other machine learning applications to text.
The newest version!
package cc.mallet.share.upenn.ner;
import cc.mallet.pipe.*;
import cc.mallet.types.*;
import cc.mallet.util.*;
import gnu.trove.*;
/**
* Adds all features of tokens in the window to the center token.
*/
public class FeatureWindow extends Pipe implements java.io.Serializable {
int left, right;
public FeatureWindow (int left, int right) {
assert (left >= 0 && right >= 0);
this.left = left;
this.right = right;
}
public Instance pipe (Instance carrier) {
TokenSequence seq = (TokenSequence)carrier.getData();
TObjectDoubleHashMap[] original = new TObjectDoubleHashMap[seq.size()];
for (int i=0; i=original.length) continue;
Token t = seq.get(i);
Object[] features = original[index].keys();
for (int k=0; k
© 2015 - 2025 Weber Informatics LLC | Privacy Policy