PLearn 0.1
Public Member Functions | Static Protected Attributes | Private Types
PLearn::FillFeatureSetCommand Class Reference

PLearn command that fills a FeatureSet with the features instantiated in a VMat. More...

#include <FillFeatureSetCommand.h>

Inheritance diagram for PLearn::FillFeatureSetCommand:
Inheritance graph
[legend]
Collaboration diagram for PLearn::FillFeatureSetCommand:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 FillFeatureSetCommand ()
virtual void run (const std::vector< std::string > &args)
 The actual implementation of the 'FillFeatureSetCommand' command.

Static Protected Attributes

static PLearnCommandRegistry reg_
 This allows to register the 'FillFeatureSetCommand' command in the command registry.

Private Types

typedef PLearnCommand inherited

Detailed Description

PLearn command that fills a FeatureSet with the features instantiated in a VMat.

A .plearn file for the FeatureSet and a .vmat file for the VMatrix need to be provided. Only the features of the input fields of the VMatrix are are inserted. A path for the saved FeatureSet needs also to be provided

Definition at line 54 of file FillFeatureSetCommand.h.


Member Typedef Documentation

Definition at line 56 of file FillFeatureSetCommand.h.


Constructor & Destructor Documentation

PLearn::FillFeatureSetCommand::FillFeatureSetCommand ( )

Definition at line 53 of file FillFeatureSetCommand.cc.

    : PLearnCommand(
        "fill-feat-set",
        "PLearn command that fills a FeatureSet with the features instantiated in a VMat",
        "Usage: fill-feat-set <dataset> <feat_set> <filled_feat_set> [min_freq] [col]\n"
        "       Will fill the FeatureSet instantiated from <feat_set> \n"
        "       from the input tokens found in the <dataset> VMat.\n"
        "       The filled FeatureSet will be saved in file <filled_feat_set>.\n"
        "       A minimum frequency can be specified for the features to be\n"
        "       included in the FeatureSet. The FeatureSet can be filled by\n"
        "       the features of the tokens found in a particular column of\n"
        "       <dataset>. If not specified, then the tokens found in all the\n"
        "       input columns are used.\n"
        )
{}

Member Function Documentation

void PLearn::FillFeatureSetCommand::run ( const std::vector< std::string > &  args) [virtual]

The actual implementation of the 'FillFeatureSetCommand' command.

Implements PLearn::PLearnCommand.

Definition at line 70 of file FillFeatureSetCommand.cc.

References PLearn::endl(), PLearn::getDataSet(), PLearn::PLearnCommand::helpmsg, PLearn::VMat::length(), PLearn::load(), PLearn::save(), and PLearn::toint().

{
    if(args.size() != 3 && args.size() != 4 && args.size() != 5)
    {
        cerr << helpmsg << endl;
        return;
    }
    string vmat_file = args[0];
    string feat_file = args[1];
    string filled_feat_file = args[2];
    int min_freq = -1;
    int col = -1;
    if(args.size() >= 4)
        min_freq = toint(args[3]);
    if(args.size() >=5)
        col = toint(args[4]);
    VMat vmat = getDataSet(vmat_file);
    VMat get_input_vmat;
    if(col < 0)
        get_input_vmat = 
            new SubVMatrix(vmat,0,0,vmat->length(),
                           vmat->inputsize());
    else
        get_input_vmat = 
            new SubVMatrix(vmat,0,col,vmat->length(),
                           1);
        
    PP<FeatureSet> feat;
    load(feat_file,feat);
    feat->addFeatures(get_input_vmat,min_freq);
    save(filled_feat_file,feat);
}

Here is the call graph for this function:


Member Data Documentation

This allows to register the 'FillFeatureSetCommand' command in the command registry.

Definition at line 63 of file FillFeatureSetCommand.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines