|
PLearn 0.1
|
Base class for sets of sparse features. More...
#include <FeatureSet.h>


Public Member Functions | |
| FeatureSet () | |
| Default constructor. | |
| virtual FeatureSet * | deepCopy (CopiesMap &copies) const |
| virtual void | build () |
| Post-constructor. | |
| virtual void | makeDeepCopyFromShallowCopy (CopiesMap &copies) |
| Transforms a shallow copy into a deep copy. | |
| virtual void | getFeatures (string token, TVec< int > &feats)=0 |
| Gives features of token in index form. | |
| virtual string | getStringFeature (int index)=0 |
| Gives string form of a feature in index form An invalid feature index should provoke an error. | |
| virtual int | getIndexFeature (string str)=0 |
| Gives index form of a feature in string form An invalid string feature should provoke an error. | |
| virtual int | size ()=0 |
| Gives the number of features in the set. | |
| virtual void | addFeatures (string token)=0 |
| Adds the features for a given token in the set. | |
| virtual void | addFeatures (VMat tokens, int min_freq=-1)=0 |
| Adds the features for the tokens contained in the set. | |
| virtual void | clear ()=0 |
| Clears all features from the feature set. | |
| virtual void | getNewFeaturesString (string token, TVec< string > &feats_str)=0 |
| Gives the possibly new features in string form for a token. | |
Static Public Member Functions | |
| static string | _classname_ () |
| static OptionList & | _getOptionList_ () |
| static RemoteMethodMap & | _getRemoteMethodMap_ () |
| static bool | _isa_ (const Object *o) |
| static void | _static_initialize_ () |
| static const PPath & | declaringFile () |
Static Public Attributes | |
| static StaticInitializer | _static_initializer_ |
Static Protected Member Functions | |
| static void | declareOptions (OptionList &ol) |
| Declares the class options. | |
Private Types | |
| typedef Object | inherited |
Private Member Functions | |
| void | build_ () |
| This does the actual building. | |
Private Attributes | |
| TVec< string > | feats_str |
| Temporary computations vector. | |
Base class for sets of sparse features.
FeatureSet provides an abstraction for feature sets, where features are indexed from 0 to size()-1 and have a string representation. They can be added token by token, or by specifying a VMat of tokens. Features can be filtered based on their frequencies in that VMat.
Definition at line 56 of file FeatureSet.h.
typedef Object PLearn::FeatureSet::inherited [private] |
Reimplemented from PLearn::Object.
Reimplemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, PLearn::HashMapFeatureSet, PLearn::IdentityFeatureSet, PLearn::PythonFeatureSet, and PLearn::WordNetFeatureSet.
Definition at line 58 of file FeatureSet.h.
| PLearn::FeatureSet::FeatureSet | ( | ) |
| string PLearn::FeatureSet::_classname_ | ( | ) | [static] |
Reimplemented from PLearn::Object.
Reimplemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, PLearn::HashMapFeatureSet, PLearn::IdentityFeatureSet, PLearn::PythonFeatureSet, and PLearn::WordNetFeatureSet.
Definition at line 52 of file FeatureSet.cc.
| OptionList & PLearn::FeatureSet::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::Object.
Reimplemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, PLearn::HashMapFeatureSet, PLearn::IdentityFeatureSet, PLearn::PythonFeatureSet, and PLearn::WordNetFeatureSet.
Definition at line 52 of file FeatureSet.cc.
| RemoteMethodMap & PLearn::FeatureSet::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::Object.
Reimplemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, PLearn::HashMapFeatureSet, PLearn::IdentityFeatureSet, PLearn::PythonFeatureSet, and PLearn::WordNetFeatureSet.
Definition at line 52 of file FeatureSet.cc.
Reimplemented from PLearn::Object.
Reimplemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, PLearn::HashMapFeatureSet, PLearn::IdentityFeatureSet, PLearn::PythonFeatureSet, and PLearn::WordNetFeatureSet.
Definition at line 52 of file FeatureSet.cc.
| StaticInitializer FeatureSet::_static_initializer_ & PLearn::FeatureSet::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::Object.
Reimplemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, PLearn::HashMapFeatureSet, PLearn::IdentityFeatureSet, PLearn::PythonFeatureSet, and PLearn::WordNetFeatureSet.
Definition at line 52 of file FeatureSet.cc.
| virtual void PLearn::FeatureSet::addFeatures | ( | string | token | ) | [pure virtual] |
Adds the features for a given token in the set.
Implemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, and PLearn::HashMapFeatureSet.
Adds the features for the tokens contained in the set.
Features with frequency smaller than min_freq are not added.
Implemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, and PLearn::HashMapFeatureSet.
| void PLearn::FeatureSet::build | ( | ) | [virtual] |
Post-constructor.
The normal implementation should call simply inherited::build(), then this class's build_(). This method should be callable again at later times, after modifying some option fields to change the "architecture" of the object.
Reimplemented from PLearn::Object.
Reimplemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, PLearn::HashMapFeatureSet, PLearn::IdentityFeatureSet, PLearn::PythonFeatureSet, and PLearn::WordNetFeatureSet.
Definition at line 58 of file FeatureSet.cc.
Referenced by PLearn::HashMapFeatureSet::build(), and PLearn::CachedFeatureSet::build().
{
inherited::build();
build_();
}

| void PLearn::FeatureSet::build_ | ( | ) | [private] |
This does the actual building.
Reimplemented from PLearn::Object.
Reimplemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, PLearn::HashMapFeatureSet, PLearn::IdentityFeatureSet, PLearn::PythonFeatureSet, and PLearn::WordNetFeatureSet.
Definition at line 77 of file FeatureSet.cc.
{}
| virtual void PLearn::FeatureSet::clear | ( | ) | [pure virtual] |
Clears all features from the feature set.
Implemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, and PLearn::HashMapFeatureSet.
| void PLearn::FeatureSet::declareOptions | ( | OptionList & | ol | ) | [static, protected] |
Declares the class options.
Reimplemented from PLearn::Object.
Reimplemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, PLearn::HashMapFeatureSet, PLearn::IdentityFeatureSet, PLearn::PythonFeatureSet, and PLearn::WordNetFeatureSet.
Definition at line 71 of file FeatureSet.cc.
Referenced by PLearn::HashMapFeatureSet::declareOptions(), and PLearn::CachedFeatureSet::declareOptions().
{
// Now call the parent class' declareOptions
inherited::declareOptions(ol);
}

| static const PPath& PLearn::FeatureSet::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::Object.
Reimplemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, PLearn::HashMapFeatureSet, PLearn::IdentityFeatureSet, PLearn::PythonFeatureSet, and PLearn::WordNetFeatureSet.
Definition at line 72 of file FeatureSet.h.
:
//##### Protected Options ###############################################
| FeatureSet * PLearn::FeatureSet::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::Object.
Reimplemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, PLearn::HashMapFeatureSet, PLearn::IdentityFeatureSet, PLearn::PythonFeatureSet, and PLearn::WordNetFeatureSet.
Definition at line 52 of file FeatureSet.cc.
Gives features of token in index form.
Implemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, and PLearn::HashMapFeatureSet.
| virtual int PLearn::FeatureSet::getIndexFeature | ( | string | str | ) | [pure virtual] |
Gives index form of a feature in string form An invalid string feature should provoke an error.
Implemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, and PLearn::HashMapFeatureSet.
| virtual void PLearn::FeatureSet::getNewFeaturesString | ( | string | token, |
| TVec< string > & | feats_str | ||
| ) | [pure virtual] |
Gives the possibly new features in string form for a token.
Implemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, PLearn::HashMapFeatureSet, PLearn::IdentityFeatureSet, PLearn::PythonFeatureSet, and PLearn::WordNetFeatureSet.
| virtual string PLearn::FeatureSet::getStringFeature | ( | int | index | ) | [pure virtual] |
Gives string form of a feature in index form An invalid feature index should provoke an error.
Implemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, and PLearn::HashMapFeatureSet.
| void PLearn::FeatureSet::makeDeepCopyFromShallowCopy | ( | CopiesMap & | copies | ) | [virtual] |
Transforms a shallow copy into a deep copy.
Reimplemented from PLearn::Object.
Reimplemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, PLearn::HashMapFeatureSet, PLearn::IdentityFeatureSet, PLearn::PythonFeatureSet, and PLearn::WordNetFeatureSet.
Definition at line 64 of file FeatureSet.cc.
Referenced by PLearn::HashMapFeatureSet::makeDeepCopyFromShallowCopy(), and PLearn::CachedFeatureSet::makeDeepCopyFromShallowCopy().
{
inherited::makeDeepCopyFromShallowCopy(copies);
//PLERROR("FeatureSet::makeDeepCopyFromShallowCopy not fully (correctly) implemented yet!");
}

| virtual int PLearn::FeatureSet::size | ( | ) | [pure virtual] |
Gives the number of features in the set.
Implemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, and PLearn::HashMapFeatureSet.
Reimplemented from PLearn::Object.
Reimplemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, PLearn::HashMapFeatureSet, PLearn::IdentityFeatureSet, PLearn::PythonFeatureSet, and PLearn::WordNetFeatureSet.
Definition at line 72 of file FeatureSet.h.
TVec<string> PLearn::FeatureSet::feats_str [private] |
Temporary computations vector.
Definition at line 128 of file FeatureSet.h.
1.7.4