cc.mallet.pipe
Class FeatureSequenceConvolution

java.lang.Object
  extended by cc.mallet.pipe.Pipe
      extended by cc.mallet.pipe.FeatureSequenceConvolution
All Implemented Interfaces:
AlphabetCarrying, java.io.Serializable

public class FeatureSequenceConvolution
extends Pipe

Author:
lmyao Convert Feature sequence
See Also:
Serialized Form

Constructor Summary
FeatureSequenceConvolution()
           
 
Method Summary
 Instance pipe(Instance carrier)
          construct word co-occurrence features from the original sequence do combinatoric, n choose 2, can be extended to n choose 3 public void convolution() { int fi = -1; int pre = -1; int i,j; int curLen = length; for(i = 0; i < curLen-1; i++) { for(j = i + 1; j < curLen; j++) { pre = features[i]; fi = features[j]; Object preO = dictionary.lookupObject(pre); Object curO = dictionary.lookupObject(fi); Object coO = preO.toString() + "_" + curO.toString(); add(coO); } } }
 
Methods inherited from class cc.mallet.pipe.Pipe
alphabetsMatch, getAlphabet, getAlphabets, getDataAlphabet, getInstanceId, getTargetAlphabet, instanceFrom, instancesFrom, instancesFrom, isDataAlphabetSet, isTargetProcessing, newIteratorFrom, preceedingPipeDataAlphabetNotification, preceedingPipeTargetAlphabetNotification, precondition, readResolve, setDataAlphabet, setOrCheckDataAlphabet, setOrCheckTargetAlphabet, setTargetAlphabet, setTargetProcessing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FeatureSequenceConvolution

public FeatureSequenceConvolution()
Method Detail

pipe

public Instance pipe(Instance carrier)
construct word co-occurrence features from the original sequence do combinatoric, n choose 2, can be extended to n choose 3 public void convolution() { int fi = -1; int pre = -1; int i,j; int curLen = length; for(i = 0; i < curLen-1; i++) { for(j = i + 1; j < curLen; j++) { pre = features[i]; fi = features[j]; Object preO = dictionary.lookupObject(pre); Object curO = dictionary.lookupObject(fi); Object coO = preO.toString() + "_" + curO.toString(); add(coO); } } }

Overrides:
pipe in class Pipe