|
mlpack
|
Public Types | |
| using | MapType = std::unordered_map< boost::string_view, size_t, boost::hash< boost::string_view > > |
| A convenient alias for the internal type of the map. | |
| using | TokenType = boost::string_view |
| The type of the token that the dictionary stores. | |
Public Member Functions | |
| StringEncodingDictionary ()=default | |
| Construct the default class. | |
| StringEncodingDictionary (const StringEncodingDictionary &other) | |
| Copy the class from the given object. | |
| StringEncodingDictionary (StringEncodingDictionary &&other)=default | |
| Standard move constructor. | |
| StringEncodingDictionary & | operator= (const StringEncodingDictionary &other) |
| Copy the class from the given object. | |
| StringEncodingDictionary & | operator= (StringEncodingDictionary &&other)=default |
| Standard move assignment operator. | |
| bool | HasToken (const boost::string_view token) const |
| The function returns true if the dictionary contains the given token. More... | |
| size_t | AddToken (const boost::string_view token) |
| The function adds the given token to the dictionary and assigns a label to the token. More... | |
| size_t | Value (const boost::string_view token) const |
| The function returns the label assigned to the given token. More... | |
| size_t | Size () const |
| Get the size of the dictionary. | |
| void | Clear () |
| Clear the dictionary. | |
| const std::deque< std::string > & | Tokens () const |
| Get the tokens. | |
| std::deque< std::string > & | Tokens () |
| Modify the tokens. | |
| const MapType & | Mapping () const |
| Get the mapping. | |
| MapType & | Mapping () |
| Modify the mapping. | |
| template<typename Archive > | |
| void | serialize (Archive &ar, const uint32_t) |
| Serialize the class to the given archive. | |
|
inline |
The function adds the given token to the dictionary and assigns a label to the token.
The label is equal to the resulting size of the dictionary. The function returns the assigned label.
| token | The given token. |
|
inline |
The function returns true if the dictionary contains the given token.
| token | The given token. |
|
inline |
The function returns the label assigned to the given token.
The function throws std::out_of_range if no such token is found.
| token | The given token. |
1.8.13