This class provides a dictionary interface for the purpose of string encoding.
More...
#include <string_encoding_dictionary.hpp>
|
using | MapType = std::unordered_map< Token, size_t > |
| A convenient alias for the internal type of the map.
|
|
using | TokenType = Token |
| The type of the token that the dictionary stores.
|
|
|
bool | HasToken (const Token &token) const |
| The function returns true if the dictionary contains the given token. More...
|
|
template<typename T > |
size_t | AddToken (T &&token) |
| The function adds the given token to the dictionary and assigns a label to the token. More...
|
|
size_t | Value (const Token &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 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.
|
|
template<typename Token>
class mlpack::data::StringEncodingDictionary< Token >
This class provides a dictionary interface for the purpose of string encoding.
It works like an adapter to the internal dictionary.
- Template Parameters
-
Token | Type of the token that the dictionary stores. |
◆ AddToken()
template<typename Token >
template<typename T >
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.
- Parameters
-
◆ HasToken()
template<typename Token >
The function returns true if the dictionary contains the given token.
- Parameters
-
◆ Value()
template<typename Token >
The function returns the label assigned to the given token.
The function throws std::out_of_range if no such token is found.
- Parameters
-
The documentation for this class was generated from the following file: