#include <Vocabulary.h>
Public Types | |
typedef boost::unordered_map < std::string, int >::iterator | iterator |
typedef boost::unordered_map < std::string, int > ::const_iterator | const_iterator |
Public Member Functions | |
Vocabulary () | |
virtual | ~Vocabulary () |
int | Encode (const std::string &token) |
bool | Lookup (const std::string &str, int *v) const |
void | clear () |
bool | empty () const |
std::size_t | size () const |
iterator | find (const std::string &str) |
const_iterator | find (const std::string &str) const |
int & | operator[] (const std::string &str) |
iterator | begin () |
const_iterator | begin () const |
iterator | end () |
const_iterator | end () const |
TODO: replace this with more efficient data structure.
Definition at line 16 of file Vocabulary.h.
typedef boost::unordered_map<std::string, int>::const_iterator mert::Vocabulary::const_iterator |
Definition at line 20 of file Vocabulary.h.
typedef boost::unordered_map<std::string, int>::iterator mert::Vocabulary::iterator |
Definition at line 19 of file Vocabulary.h.
mert::Vocabulary::Vocabulary | ( | ) | [inline] |
Definition at line 22 of file Vocabulary.h.
virtual mert::Vocabulary::~Vocabulary | ( | ) | [inline, virtual] |
Definition at line 23 of file Vocabulary.h.
const_iterator mert::Vocabulary::begin | ( | ) | const [inline] |
Definition at line 59 of file Vocabulary.h.
iterator mert::Vocabulary::begin | ( | ) | [inline] |
Definition at line 56 of file Vocabulary.h.
void mert::Vocabulary::clear | ( | ) | [inline] |
Definition at line 33 of file Vocabulary.h.
Referenced by mert::BOOST_AUTO_TEST_CASE().
bool mert::Vocabulary::empty | ( | ) | const [inline] |
Definition at line 37 of file Vocabulary.h.
Referenced by mert::BOOST_AUTO_TEST_CASE().
int mert::Vocabulary::Encode | ( | const std::string & | token | ) |
Returns the assiged id for given "token".
Definition at line 11 of file Vocabulary.cpp.
Referenced by mert::BOOST_AUTO_TEST_CASE().
const_iterator mert::Vocabulary::end | ( | ) | const [inline] |
Definition at line 65 of file Vocabulary.h.
iterator mert::Vocabulary::end | ( | ) | [inline] |
Definition at line 62 of file Vocabulary.h.
const_iterator mert::Vocabulary::find | ( | const std::string & | str | ) | const [inline] |
Definition at line 48 of file Vocabulary.h.
iterator mert::Vocabulary::find | ( | const std::string & | str | ) | [inline] |
Definition at line 45 of file Vocabulary.h.
bool mert::Vocabulary::Lookup | ( | const std::string & | str, | |
int * | v | |||
) | const |
Return true iff the specified "str" is found in the container.
Definition at line 26 of file Vocabulary.cpp.
Referenced by mert::BOOST_AUTO_TEST_CASE().
int& mert::Vocabulary::operator[] | ( | const std::string & | str | ) | [inline] |
Definition at line 52 of file Vocabulary.h.
std::size_t mert::Vocabulary::size | ( | ) | const [inline] |
Definition at line 41 of file Vocabulary.h.
Referenced by mert::BOOST_AUTO_TEST_CASE().