\section{String\+Encoding\+Dictionary$<$ Token $>$ Class Template Reference}
\label{classmlpack_1_1data_1_1StringEncodingDictionary}\index{String\+Encoding\+Dictionary$<$ Token $>$@{String\+Encoding\+Dictionary$<$ Token $>$}}


This class provides a dictionary interface for the purpose of string encoding.  


\subsection*{Public Types}
\begin{DoxyCompactItemize}
\item 
using \textbf{ Map\+Type} = std\+::unordered\+\_\+map$<$ Token, size\+\_\+t $>$
\begin{DoxyCompactList}\small\item\em A convenient alias for the internal type of the map. \end{DoxyCompactList}\item 
using \textbf{ Token\+Type} = Token
\begin{DoxyCompactList}\small\item\em The type of the token that the dictionary stores. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
{\footnotesize template$<$typename T $>$ }\\size\+\_\+t \textbf{ Add\+Token} (T \&\&token)
\begin{DoxyCompactList}\small\item\em The function adds the given token to the dictionary and assigns a label to the token. \end{DoxyCompactList}\item 
void \textbf{ Clear} ()
\begin{DoxyCompactList}\small\item\em Clear the dictionary. \end{DoxyCompactList}\item 
bool \textbf{ Has\+Token} (const Token \&token) const
\begin{DoxyCompactList}\small\item\em The function returns true if the dictionary contains the given token. \end{DoxyCompactList}\item 
const \textbf{ Map\+Type} \& \textbf{ Mapping} () const
\begin{DoxyCompactList}\small\item\em Get the mapping. \end{DoxyCompactList}\item 
\textbf{ Map\+Type} \& \textbf{ Mapping} ()
\begin{DoxyCompactList}\small\item\em Modify the mapping. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename Archive $>$ }\\void \textbf{ serialize} (Archive \&ar, const unsigned int)
\begin{DoxyCompactList}\small\item\em Serialize the class to the given archive. \end{DoxyCompactList}\item 
size\+\_\+t \textbf{ Size} () const
\begin{DoxyCompactList}\small\item\em Get the size of the dictionary. \end{DoxyCompactList}\item 
size\+\_\+t \textbf{ Value} (const Token \&token) const
\begin{DoxyCompactList}\small\item\em The function returns the label assigned to the given token. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
\subsubsection*{template$<$typename Token$>$\newline
class mlpack\+::data\+::\+String\+Encoding\+Dictionary$<$ Token $>$}

This class provides a dictionary interface for the purpose of string encoding. 

It works like an adapter to the internal dictionary.


\begin{DoxyTemplParams}{Template Parameters}
{\em Token} & Type of the token that the dictionary stores. \\
\hline
\end{DoxyTemplParams}


Definition at line 32 of file string\+\_\+encoding\+\_\+dictionary.\+hpp.



\subsection{Member Typedef Documentation}
\mbox{\label{classmlpack_1_1data_1_1StringEncodingDictionary_a246bffdf7ac108884d4d3bbd6fdac4a2}} 
\index{mlpack\+::data\+::\+String\+Encoding\+Dictionary@{mlpack\+::data\+::\+String\+Encoding\+Dictionary}!Map\+Type@{Map\+Type}}
\index{Map\+Type@{Map\+Type}!mlpack\+::data\+::\+String\+Encoding\+Dictionary@{mlpack\+::data\+::\+String\+Encoding\+Dictionary}}
\subsubsection{Map\+Type}
{\footnotesize\ttfamily using \textbf{ Map\+Type} =  std\+::unordered\+\_\+map$<$Token, size\+\_\+t$>$}



A convenient alias for the internal type of the map. 



Definition at line 36 of file string\+\_\+encoding\+\_\+dictionary.\+hpp.

\mbox{\label{classmlpack_1_1data_1_1StringEncodingDictionary_a408e837518782ddd4a94948d84a619f7}} 
\index{mlpack\+::data\+::\+String\+Encoding\+Dictionary@{mlpack\+::data\+::\+String\+Encoding\+Dictionary}!Token\+Type@{Token\+Type}}
\index{Token\+Type@{Token\+Type}!mlpack\+::data\+::\+String\+Encoding\+Dictionary@{mlpack\+::data\+::\+String\+Encoding\+Dictionary}}
\subsubsection{Token\+Type}
{\footnotesize\ttfamily using \textbf{ Token\+Type} =  Token}



The type of the token that the dictionary stores. 



Definition at line 39 of file string\+\_\+encoding\+\_\+dictionary.\+hpp.



\subsection{Member Function Documentation}
\mbox{\label{classmlpack_1_1data_1_1StringEncodingDictionary_ae8074a56f3029cc0b3060b40292bedb8}} 
\index{mlpack\+::data\+::\+String\+Encoding\+Dictionary@{mlpack\+::data\+::\+String\+Encoding\+Dictionary}!Add\+Token@{Add\+Token}}
\index{Add\+Token@{Add\+Token}!mlpack\+::data\+::\+String\+Encoding\+Dictionary@{mlpack\+::data\+::\+String\+Encoding\+Dictionary}}
\subsubsection{Add\+Token()}
{\footnotesize\ttfamily size\+\_\+t Add\+Token (\begin{DoxyParamCaption}\item[{T \&\&}]{token }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [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.


\begin{DoxyParams}{Parameters}
{\em token} & The given token. \\
\hline
\end{DoxyParams}


Definition at line 59 of file string\+\_\+encoding\+\_\+dictionary.\+hpp.

\mbox{\label{classmlpack_1_1data_1_1StringEncodingDictionary_aa71d36872f416feaa853788a7a7a7ef8}} 
\index{mlpack\+::data\+::\+String\+Encoding\+Dictionary@{mlpack\+::data\+::\+String\+Encoding\+Dictionary}!Clear@{Clear}}
\index{Clear@{Clear}!mlpack\+::data\+::\+String\+Encoding\+Dictionary@{mlpack\+::data\+::\+String\+Encoding\+Dictionary}}
\subsubsection{Clear()}
{\footnotesize\ttfamily void Clear (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Clear the dictionary. 



Definition at line 83 of file string\+\_\+encoding\+\_\+dictionary.\+hpp.

\mbox{\label{classmlpack_1_1data_1_1StringEncodingDictionary_a0822da0e4b21f9f071c45608515d2729}} 
\index{mlpack\+::data\+::\+String\+Encoding\+Dictionary@{mlpack\+::data\+::\+String\+Encoding\+Dictionary}!Has\+Token@{Has\+Token}}
\index{Has\+Token@{Has\+Token}!mlpack\+::data\+::\+String\+Encoding\+Dictionary@{mlpack\+::data\+::\+String\+Encoding\+Dictionary}}
\subsubsection{Has\+Token()}
{\footnotesize\ttfamily bool Has\+Token (\begin{DoxyParamCaption}\item[{const Token \&}]{token }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



The function returns true if the dictionary contains the given token. 


\begin{DoxyParams}{Parameters}
{\em token} & The given token. \\
\hline
\end{DoxyParams}


Definition at line 46 of file string\+\_\+encoding\+\_\+dictionary.\+hpp.

\mbox{\label{classmlpack_1_1data_1_1StringEncodingDictionary_aa2eae80cec94bbeb1f8bc25367fc0305}} 
\index{mlpack\+::data\+::\+String\+Encoding\+Dictionary@{mlpack\+::data\+::\+String\+Encoding\+Dictionary}!Mapping@{Mapping}}
\index{Mapping@{Mapping}!mlpack\+::data\+::\+String\+Encoding\+Dictionary@{mlpack\+::data\+::\+String\+Encoding\+Dictionary}}
\subsubsection{Mapping()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily const \textbf{ Map\+Type}\& Mapping (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the mapping. 



Definition at line 89 of file string\+\_\+encoding\+\_\+dictionary.\+hpp.

\mbox{\label{classmlpack_1_1data_1_1StringEncodingDictionary_a11a693fe23d0648d295d6715304e4130}} 
\index{mlpack\+::data\+::\+String\+Encoding\+Dictionary@{mlpack\+::data\+::\+String\+Encoding\+Dictionary}!Mapping@{Mapping}}
\index{Mapping@{Mapping}!mlpack\+::data\+::\+String\+Encoding\+Dictionary@{mlpack\+::data\+::\+String\+Encoding\+Dictionary}}
\subsubsection{Mapping()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily \textbf{ Map\+Type}\& Mapping (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Modify the mapping. 



Definition at line 91 of file string\+\_\+encoding\+\_\+dictionary.\+hpp.

\mbox{\label{classmlpack_1_1data_1_1StringEncodingDictionary_af0dd9205158ccf7bcfcd8ff81f79c927}} 
\index{mlpack\+::data\+::\+String\+Encoding\+Dictionary@{mlpack\+::data\+::\+String\+Encoding\+Dictionary}!serialize@{serialize}}
\index{serialize@{serialize}!mlpack\+::data\+::\+String\+Encoding\+Dictionary@{mlpack\+::data\+::\+String\+Encoding\+Dictionary}}
\subsubsection{serialize()}
{\footnotesize\ttfamily void serialize (\begin{DoxyParamCaption}\item[{Archive \&}]{ar,  }\item[{const unsigned}]{int }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Serialize the class to the given archive. 



Definition at line 97 of file string\+\_\+encoding\+\_\+dictionary.\+hpp.

\mbox{\label{classmlpack_1_1data_1_1StringEncodingDictionary_a58f4b9e873b7c1c7d512bd9f7d1489d8}} 
\index{mlpack\+::data\+::\+String\+Encoding\+Dictionary@{mlpack\+::data\+::\+String\+Encoding\+Dictionary}!Size@{Size}}
\index{Size@{Size}!mlpack\+::data\+::\+String\+Encoding\+Dictionary@{mlpack\+::data\+::\+String\+Encoding\+Dictionary}}
\subsubsection{Size()}
{\footnotesize\ttfamily size\+\_\+t Size (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the size of the dictionary. 



Definition at line 80 of file string\+\_\+encoding\+\_\+dictionary.\+hpp.

\mbox{\label{classmlpack_1_1data_1_1StringEncodingDictionary_afb15c4ab3b1af9a6ea7ee16d84360bd4}} 
\index{mlpack\+::data\+::\+String\+Encoding\+Dictionary@{mlpack\+::data\+::\+String\+Encoding\+Dictionary}!Value@{Value}}
\index{Value@{Value}!mlpack\+::data\+::\+String\+Encoding\+Dictionary@{mlpack\+::data\+::\+String\+Encoding\+Dictionary}}
\subsubsection{Value()}
{\footnotesize\ttfamily size\+\_\+t Value (\begin{DoxyParamCaption}\item[{const Token \&}]{token }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



The function returns the label assigned to the given token. 

The function throws std\+::out\+\_\+of\+\_\+range if no such token is found.


\begin{DoxyParams}{Parameters}
{\em token} & The given token. \\
\hline
\end{DoxyParams}


Definition at line 74 of file string\+\_\+encoding\+\_\+dictionary.\+hpp.



The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
/var/www/mlpack.\+ratml.\+org/mlpack.\+org/\+\_\+src/mlpack-\/3.\+3.\+1/src/mlpack/core/data/\textbf{ string\+\_\+encoding\+\_\+dictionary.\+hpp}\end{DoxyCompactItemize}
