Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

PLearn::Dictionary Class Reference

#include <Dictionary.h>

Inheritance diagram for PLearn::Dictionary:

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

Collaboration graph
[legend]
List of all members.

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, intstring_to_int
 string to int mapping

map< int, stringint_to_string
 int to string mapping

WordNetOntologywno
 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< stringvector_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.


Member Typedef Documentation

typedef Object PLearn::Dictionary::inherited [private]
 

Reimplemented from PLearn::Object.

Definition at line 80 of file Dictionary.h.


Constructor & Destructor Documentation

PLearn::Dictionary::Dictionary  ) 
 

Default constructor.

Definition at line 49 of file Dictionary.cc.

PLearn::Dictionary::Dictionary string  file_name,
bool  up_mode = DEFAULT_UPDATE
 

Constructor.

Parameters:
file_name file containing the symbols of the dictionary

Definition at line 60 of file Dictionary.cc.

References FILE_DICTIONARY, file_name_dict, NO_STEM, setDictionaryType(), setStemMode(), and setUpdateMode().

PLearn::Dictionary::Dictionary TVec< string symbols,
bool  up_mode = DEFAULT_UPDATE
 

Constructor.

Parameters:
symbols vector of the symbols of the dictionary

Definition at line 68 of file Dictionary.cc.

References NO_STEM, setDictionaryType(), setStemMode(), setUpdateMode(), vector_dict, and VECTOR_DICTIONARY.

PLearn::Dictionary::Dictionary WordNetOntology ont,
int  ontology_type,
bool  up_mode = DEFAULT_UPDATE,
bool  stem = NO_STEM
 

Constructor.

Parameters:
up_mode update mode : NO_UPDATE, UPDATE
stem use word stemming : NO_STEM/STEM

Definition at line 76 of file Dictionary.cc.

References setDictionaryType(), setStemMode(), setUpdateMode(), and wno.


Member Function Documentation

void PLearn::Dictionary::build  )  [virtual]
 

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_().

void PLearn::Dictionary::build_  )  [private]
 

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().

void PLearn::Dictionary::declareOptions OptionList ol  )  [static, protected]
 

Declares this class' options.

Reimplemented from PLearn::Object.

Definition at line 91 of file Dictionary.cc.

References PLearn::declareOption(), and PLearn::OptionList.

int PLearn::Dictionary::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.

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_().

string PLearn::Dictionary::getSymbol int  id  ) 
 

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.

void PLearn::Dictionary::makeDeepCopyFromShallowCopy map< const void *, void * > &  copies  )  [virtual]
 

Transforms a shallow copy into a deep copy.

Definition at line 285 of file Dictionary.cc.

PLearn::Dictionary::PLEARN_DECLARE_OBJECT Dictionary   ) 
 

void PLearn::Dictionary::setDictionaryType int  type  ) 
 

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().

void PLearn::Dictionary::setStemMode bool  stem  ) 
 

Set stem mode NO_STEM/STEM.

Definition at line 194 of file Dictionary.cc.

References stem_mode.

Referenced by Dictionary().

void PLearn::Dictionary::setUpdateMode bool  up_mode  ) 
 

Set update dictionary mode : UPDATE/NO_UPDATE.

Definition at line 189 of file Dictionary.cc.

References update_mode.

Referenced by Dictionary().

int PLearn::Dictionary::size  ) 
 

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.


Member Data Documentation

int PLearn::Dictionary::dict_type
 

type of the dictionary

Definition at line 103 of file Dictionary.h.

Referenced by build_(), getId(), getSymbol(), setDictionaryType(), and size().

string PLearn::Dictionary::file_name_dict
 

file_name of dictionary

Definition at line 109 of file Dictionary.h.

Referenced by build_(), and Dictionary().

map<int,string> PLearn::Dictionary::int_to_string
 

int to string mapping

Definition at line 99 of file Dictionary.h.

Referenced by getId(), getSymbol(), and size().

int PLearn::Dictionary::stem_mode
 

Stem word before including in dictionary STEM/NO_STEM (ontology only).

Definition at line 107 of file Dictionary.h.

Referenced by setStemMode().

map<string,int> PLearn::Dictionary::string_to_int
 

string to int mapping

Definition at line 97 of file Dictionary.h.

Referenced by getId().

int PLearn::Dictionary::update_mode
 

update mode update/no update

Definition at line 105 of file Dictionary.h.

Referenced by build_(), getId(), and setUpdateMode().

TVec<string> PLearn::Dictionary::vector_dict
 

Vector of dictionary.

Definition at line 111 of file Dictionary.h.

Referenced by build_(), and Dictionary().

WordNetOntology* PLearn::Dictionary::wno
 

WordNet ontology of the dictionary.

Definition at line 101 of file Dictionary.h.

Referenced by build_(), Dictionary(), getId(), getSymbol(), and size().


The documentation for this class was generated from the following files:
Generated on Tue Aug 17 16:27:36 2004 for PLearn by doxygen 1.3.7