#include <Dictionary.h>
Inheritance diagram for PLearn::Dictionary:
Public Member Functions | |
Dictionary () | |
Default constructor. | |
Dictionary (string file_name, bool up_mode=DEFAULT_UPDATE) | |
Constructor. | |
Dictionary (TVec< string > symbols, bool up_mode=DEFAULT_UPDATE) | |
Constructor. | |
Dictionary (WordNetOntology *ont, int ontology_type, bool up_mode=DEFAULT_UPDATE, bool stem=NO_STEM) | |
Constructor. | |
PLEARN_DECLARE_OBJECT (Dictionary) | |
int | size () |
Gives the size of the dictionary. | |
void | setUpdateMode (bool up_mode) |
Set update dictionary mode : UPDATE/NO_UPDATE. | |
void | setStemMode (bool stem) |
Set stem mode NO_STEM/STEM. | |
void | setDictionaryType (int type) |
Set the type of dictionary : VECTOR_DICTIONARY,FILE_DICTIONARY,WORDNET_WORD_DICTIONARY,WORDNET_SENSE_DICTIONARY. | |
int | getId (string symbol) |
Gives the id of a symbol in the dictionary If the symbol is not in the dictionary, returns index of OOV_TAG if update_mode = NO_UPDATE insert the new word otherwise and return its index. | |
string | getSymbol (int id) |
Gives the symbol from an id of the dictionary. | |
virtual void | build () |
Should call simply inherited::build(), then this class's build_(). | |
virtual void | makeDeepCopyFromShallowCopy (map< const void *, void * > &copies) |
Transforms a shallow copy into a deep copy. | |
Public Attributes | |
map< string, int > | string_to_int |
string to int mapping | |
map< int, string > | int_to_string |
int to string mapping | |
WordNetOntology * | wno |
WordNet ontology of the dictionary. | |
int | dict_type |
type of the dictionary | |
int | update_mode |
update mode update/no update | |
int | stem_mode |
Stem word before including in dictionary STEM/NO_STEM (ontology only). | |
string | file_name_dict |
file_name of dictionary | |
TVec< string > | vector_dict |
Vector of dictionary. | |
Static Protected Member Functions | |
void | declareOptions (OptionList &ol) |
Declares this class' options. | |
Private Types | |
typedef Object | inherited |
Private Member Functions | |
void | build_ () |
This does the actual building. |
|
Reimplemented from PLearn::Object. Definition at line 80 of file Dictionary.h. |
|
Default constructor.
Definition at line 49 of file Dictionary.cc. |
|
Constructor.
Definition at line 60 of file Dictionary.cc. References FILE_DICTIONARY, file_name_dict, NO_STEM, setDictionaryType(), setStemMode(), and setUpdateMode(). |
|
Constructor.
Definition at line 68 of file Dictionary.cc. References NO_STEM, setDictionaryType(), setStemMode(), setUpdateMode(), vector_dict, and VECTOR_DICTIONARY. |
|
Constructor.
Definition at line 76 of file Dictionary.cc. References setDictionaryType(), setStemMode(), setUpdateMode(), and wno. |
|
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. Definition at line 167 of file Dictionary.cc. References build_(). |
|
This does the actual building.
Reimplemented from PLearn::Object. Definition at line 115 of file Dictionary.cc. References ALL_WN_TYPE, PLearn::WordNetOntology::containsWord(), dict_type, PLearn::WordNetOntology::extractWord(), FILE_DICTIONARY, file_name_dict, getId(), NO_UPDATE, OOV_TAG, PLERROR, PLearn::TVec< string >::size(), UPDATE, update_mode, vector_dict, VECTOR_DICTIONARY, wno, and WORDNET_WORD_DICTIONARY. Referenced by build(). |
|
Declares this class' options.
Reimplemented from PLearn::Object. Definition at line 91 of file Dictionary.cc. References PLearn::declareOption(), and PLearn::OptionList. |
|
Gives the id of a symbol in the dictionary If the symbol is not in the dictionary, returns index of OOV_TAG if update_mode = NO_UPDATE insert the new word otherwise and return its index.
Definition at line 206 of file Dictionary.cc. References ALL_WN_TYPE, PLearn::WordNetOntology::containsWord(), dict_type, PLearn::endl(), PLearn::WordNetOntology::extractWord(), FILE_DICTIONARY, PLearn::WordNetOntology::getSynsetIDForSenseKey(), PLearn::WordNetOntology::getWordId(), int_to_string, OOV_TAG, PLERROR, PLearn::split(), string_to_int, UPDATE, update_mode, VECTOR_DICTIONARY, wno, WORDNET_SENSE_DICTIONARY, and WORDNET_WORD_DICTIONARY. Referenced by build_(). |
|
Gives the symbol from an id of the dictionary.
Definition at line 264 of file Dictionary.cc. References dict_type, FILE_DICTIONARY, PLearn::WordNetOntology::getWord(), int_to_string, PLERROR, VECTOR_DICTIONARY, wno, and WORDNET_WORD_DICTIONARY. |
|
Transforms a shallow copy into a deep copy.
Definition at line 285 of file Dictionary.cc. |
|
|
|
Set the type of dictionary : VECTOR_DICTIONARY,FILE_DICTIONARY,WORDNET_WORD_DICTIONARY,WORDNET_SENSE_DICTIONARY.
Definition at line 199 of file Dictionary.cc. References dict_type. Referenced by Dictionary(). |
|
Set stem mode NO_STEM/STEM.
Definition at line 194 of file Dictionary.cc. References stem_mode. Referenced by Dictionary(). |
|
Set update dictionary mode : UPDATE/NO_UPDATE.
Definition at line 189 of file Dictionary.cc. References update_mode. Referenced by Dictionary(). |
|
Gives the size of the dictionary.
Definition at line 173 of file Dictionary.cc. References dict_type, FILE_DICTIONARY, PLearn::WordNetOntology::getVocSize(), int_to_string, PLERROR, VECTOR_DICTIONARY, wno, and WORDNET_WORD_DICTIONARY. |
|
type of the dictionary
Definition at line 103 of file Dictionary.h. Referenced by build_(), getId(), getSymbol(), setDictionaryType(), and size(). |
|
file_name of dictionary
Definition at line 109 of file Dictionary.h. Referenced by build_(), and Dictionary(). |
|
int to string mapping
Definition at line 99 of file Dictionary.h. Referenced by getId(), getSymbol(), and size(). |
|
Stem word before including in dictionary STEM/NO_STEM (ontology only).
Definition at line 107 of file Dictionary.h. Referenced by setStemMode(). |
|
string to int mapping
Definition at line 97 of file Dictionary.h. Referenced by getId(). |
|
update mode update/no update
Definition at line 105 of file Dictionary.h. Referenced by build_(), getId(), and setUpdateMode(). |
|
Vector of dictionary.
Definition at line 111 of file Dictionary.h. Referenced by build_(), and Dictionary(). |
|
WordNet ontology of the dictionary.
Definition at line 101 of file Dictionary.h. Referenced by build_(), Dictionary(), getId(), getSymbol(), and size(). |