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

The first sentence should be a BRIEF DESCRIPTION of what the class does. More...

#include <VMatDictionaryCommand.h>

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

List of all members.

Public Member Functions

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

Static Protected Attributes

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

Private Types

typedef PLearnCommand inherited

Detailed Description

The first sentence should be a BRIEF DESCRIPTION of what the class does.

Place the rest of the class programmer documentation here. Doxygen supports Javadoc-style comments. See http://www.doxygen.org/manual.html

Todo:
Write class to-do's here if there are any.
Deprecated:
Write deprecated stuff here if there is any. Indicate what else should be used instead.

Definition at line 58 of file VMatDictionaryCommand.h.


Member Typedef Documentation

Definition at line 60 of file VMatDictionaryCommand.h.


Constructor & Destructor Documentation

PLearn::VMatDictionaryCommand::VMatDictionaryCommand ( )

Definition at line 52 of file VMatDictionaryCommand.cc.

    : PLearnCommand(
        "vmat_dictionary",
        "Create Dictionary objects for each field of a vmat",
        "Will create <dataset>.field#.dict, where # is the\n"
        "field (column) number, starting at 0. Those files contain the plearn\n"
        "scripts of the Dictionary objets for each field.\n"
        )
{}

Member Function Documentation

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

The actual implementation of the 'VMatDictionaryCommand' command.

Implements PLearn::PLearnCommand.

Definition at line 63 of file VMatDictionaryCommand.cc.

References PLearn::DictionaryVMatrix::build(), PLearn::DictionaryVMatrix::delimiters, PLearn::extract_extension(), PLearn::DictionaryVMatrix::file_names, PLearn::getDataSet(), i, PLearn::save(), PLearn::tostring(), and PLearn::VMat::width().

{
    PPath indexf= "";
    string vmat_file = args[0];
    string ext = extract_extension(vmat_file);
    VMat vmat;
    if(ext == ".txt")
    {
        DictionaryVMatrix* dvmat = new DictionaryVMatrix();
        TVec<PPath> file_names(1);
        file_names[0] = vmat_file;
        dvmat->file_names = file_names;
        dvmat->delimiters = "";
        dvmat->build();            
        vmat = dvmat;
    }
    else
        vmat = getDataSet(vmat_file);

    for(int i=0; i<vmat->width(); i++)
    {
        if(vmat->getDictionary(i))
        {
            string dico_name = vmat_file + ".col" + tostring(i) + ".dict";
            save(dico_name,*(vmat->getDictionary(i)));
        }
    }
}

Here is the call graph for this function:


Member Data Documentation

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

Definition at line 67 of file VMatDictionaryCommand.h.


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