Class AddClassifierTokenPredictions

  • All Implemented Interfaces:
    AlphabetCarrying, java.io.Serializable

    public class AddClassifierTokenPredictions
    extends Pipe
    implements java.io.Serializable
    This pipe uses a Classifier to label each token (i.e., using 0-th order Markov assumption), then adds the predictions as features to each token. This pipe assumes the input Instance's data is of type FeatureVectorSequence (each an augmentable feature vector). Example usage:
                    1) Create and serialize a featurePipe that converts raw input to FeatureVectorSequences
                    2) Pipe input data through featurePipe, train a TokenClassifiers via cross validation, then serialize the classifiers
                    2) Pipe input data through featurePipe and this pipe (using the saved classifiers), and train a Transducer 
                    4) Serialize the trained Transducer 
     
    Author:
    ghuang
    See Also:
    Serialized Form
    • Method Detail

      • setInProduction

        public void setInProduction​(boolean inProduction)
      • getInProduction

        public boolean getInProduction()
      • setInProduction

        public static void setInProduction​(Pipe p,
                                           boolean value)
      • pipe

        public Instance pipe​(Instance carrier)
        Add the token classifier's predictions as features to the instance. This method assumes the input instance contains FeatureVectorSequence as data
        Overrides:
        pipe in class Pipe
      • convert

        public static InstanceList convert​(InstanceList ilist,
                                           Noop alphabetsPipe)
        Converts each instance containing a FeatureVectorSequence to multiple instances, each containing an AugmentableFeatureVector as data.
        Parameters:
        ilist - Instances with FeatureVectorSequence as data field
        alphabetsPipe - a Noop pipe containing the data and target alphabets for the resulting InstanceList
        Returns:
        an InstanceList where each Instance contains one Token's AugmentableFeatureVector as data
      • convert

        public static InstanceList convert​(Instance inst,
                                           Noop alphabetsPipe)
        Parameters:
        inst - input instance, with FeatureVectorSequence as data.
        alphabetsPipe - a Noop pipe containing the data and target alphabets for the resulting InstanceList and AugmentableFeatureVectors
        Returns:
        list of instances, each with one AugmentableFeatureVector as data