\section{ngram\+\_\+model\+\_\+s Struct Reference}
\label{structngram__model__s}\index{ngram\+\_\+model\+\_\+s@{ngram\+\_\+model\+\_\+s}}


Common implementation of ngram\+\_\+model\+\_\+t.  




{\ttfamily \#include $<$ngram\+\_\+model\+\_\+internal.\+h$>$}

\subsection*{Data Fields}
\begin{DoxyCompactItemize}
\item 
int {\bf refcount}\label{structngram__model__s_a3b14986e4dc40ccec1f7e206b7f41d06}

\begin{DoxyCompactList}\small\item\em Reference count. \end{DoxyCompactList}\item 
int32 $\ast$ {\bf n\+\_\+counts}
\begin{DoxyCompactList}\small\item\em Counts for 1, 2, 3, ... \end{DoxyCompactList}\item 
int32 {\bf n\+\_\+1g\+\_\+alloc}\label{structngram__model__s_a3e41109b30668bdfc077614c1ef49960}

\begin{DoxyCompactList}\small\item\em Number of allocated word strings (for new word addition) \end{DoxyCompactList}\item 
int32 {\bf n\+\_\+words}
\begin{DoxyCompactList}\small\item\em Number of actual word strings (N\+O\+T the same as the number of unigrams, due to class words). \end{DoxyCompactList}\item 
uint8 {\bf n}
\begin{DoxyCompactList}\small\item\em This is an n-\/gram model (1, 2, 3, ...). \end{DoxyCompactList}\item 
uint8 {\bf n\+\_\+classes}\label{structngram__model__s_adeb914f8e9f011a5c960f5ee9cd33919}

\begin{DoxyCompactList}\small\item\em Number of classes (maximum 128) \end{DoxyCompactList}\item 
uint8 {\bf writable}\label{structngram__model__s_a78a3253febced2cae4732044da466ee6}

\begin{DoxyCompactList}\small\item\em Are word strings writable? \end{DoxyCompactList}\item 
uint8 {\bf flags}\label{structngram__model__s_ac609a2f867496d6ca719351d566db328}

\begin{DoxyCompactList}\small\item\em Any other flags we might care about (F\+I\+X\+M\+E\+: Merge this and writable) \end{DoxyCompactList}\item 
{\bf logmath\+\_\+t} $\ast$ {\bf lmath}\label{structngram__model__s_a2ca373109c651ac998b33153eb38fd95}

\begin{DoxyCompactList}\small\item\em Log-\/math object. \end{DoxyCompactList}\item 
float32 {\bf lw}\label{structngram__model__s_a76ea0c65b23de80091e7c602bdb43bde}

\begin{DoxyCompactList}\small\item\em Language model scaling factor. \end{DoxyCompactList}\item 
int32 {\bf log\+\_\+wip}\label{structngram__model__s_a3d6bf5632760a16e52cb881d7010d774}

\begin{DoxyCompactList}\small\item\em Log of word insertion penalty. \end{DoxyCompactList}\item 
int32 {\bf log\+\_\+uw}\label{structngram__model__s_a6f0ec7b8b9d13d590bbe4b59df573abc}

\begin{DoxyCompactList}\small\item\em Log of unigram weight. \end{DoxyCompactList}\item 
int32 {\bf log\+\_\+uniform}\label{structngram__model__s_a616bf871a67f9cedce17d6b589ee33ea}

\begin{DoxyCompactList}\small\item\em Log of uniform (0-\/gram) probability. \end{DoxyCompactList}\item 
int32 {\bf log\+\_\+uniform\+\_\+weight}
\begin{DoxyCompactList}\small\item\em Log of uniform weight (i.\+e. \end{DoxyCompactList}\item 
int32 {\bf log\+\_\+zero}\label{structngram__model__s_a65425a599c4bcc4dda809d81149b8fc0}

\begin{DoxyCompactList}\small\item\em Zero probability, cached here for quick lookup. \end{DoxyCompactList}\item 
char $\ast$$\ast$ {\bf word\+\_\+str}\label{structngram__model__s_ae625e779e340845f03fb3da164e93039}

\begin{DoxyCompactList}\small\item\em Unigram names. \end{DoxyCompactList}\item 
{\bf hash\+\_\+table\+\_\+t} $\ast$ {\bf wid}
\begin{DoxyCompactList}\small\item\em Mapping of unigram names to word I\+Ds. \end{DoxyCompactList}\item 
int32 $\ast$ {\bf tmp\+\_\+wids}\label{structngram__model__s_a4f910ab2c18b0e68dce92816a27fb139}

\begin{DoxyCompactList}\small\item\em Temporary array of word I\+Ds for ngram\+\_\+model\+\_\+get\+\_\+ngram() \end{DoxyCompactList}\item 
struct {\bf ngram\+\_\+class\+\_\+s} $\ast$$\ast$ {\bf classes}
\begin{DoxyCompactList}\small\item\em Word class definitions. \end{DoxyCompactList}\item 
struct {\bf ngram\+\_\+funcs\+\_\+s} $\ast$ {\bf funcs}
\begin{DoxyCompactList}\small\item\em Implementation-\/specific methods. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Common implementation of ngram\+\_\+model\+\_\+t. 

The details of bigram, trigram, and higher-\/order N-\/gram storage, if any, can vary somewhat depending on the file format in use. 

Definition at line 55 of file ngram\+\_\+model\+\_\+internal.\+h.



\subsection{Field Documentation}
\index{ngram\+\_\+model\+\_\+s@{ngram\+\_\+model\+\_\+s}!classes@{classes}}
\index{classes@{classes}!ngram\+\_\+model\+\_\+s@{ngram\+\_\+model\+\_\+s}}
\subsubsection[{classes}]{\setlength{\rightskip}{0pt plus 5cm}struct {\bf ngram\+\_\+class\+\_\+s}$\ast$$\ast$ ngram\+\_\+model\+\_\+s\+::classes}\label{structngram__model__s_a39384af3e6b53591d433436db011ac8d}


Word class definitions. 



Definition at line 76 of file ngram\+\_\+model\+\_\+internal.\+h.



Referenced by ngram\+\_\+model\+\_\+add\+\_\+class(), ngram\+\_\+model\+\_\+add\+\_\+class\+\_\+word(), ngram\+\_\+model\+\_\+free(), ngram\+\_\+ng\+\_\+prob(), and ngram\+\_\+ng\+\_\+score().

\index{ngram\+\_\+model\+\_\+s@{ngram\+\_\+model\+\_\+s}!funcs@{funcs}}
\index{funcs@{funcs}!ngram\+\_\+model\+\_\+s@{ngram\+\_\+model\+\_\+s}}
\subsubsection[{funcs}]{\setlength{\rightskip}{0pt plus 5cm}struct {\bf ngram\+\_\+funcs\+\_\+s}$\ast$ ngram\+\_\+model\+\_\+s\+::funcs}\label{structngram__model__s_ad3d9d8ad9773f958a89534220eda6fb9}


Implementation-\/specific methods. 



Definition at line 77 of file ngram\+\_\+model\+\_\+internal.\+h.



Referenced by ngram\+\_\+iter\+\_\+free(), ngram\+\_\+iter\+\_\+get(), ngram\+\_\+iter\+\_\+next(), ngram\+\_\+iter\+\_\+successors(), ngram\+\_\+model\+\_\+add\+\_\+word(), ngram\+\_\+model\+\_\+apply\+\_\+weights(), ngram\+\_\+model\+\_\+flush(), ngram\+\_\+model\+\_\+free(), ngram\+\_\+model\+\_\+mgrams(), ngram\+\_\+ng\+\_\+iter(), ngram\+\_\+ng\+\_\+prob(), and ngram\+\_\+ng\+\_\+score().

\index{ngram\+\_\+model\+\_\+s@{ngram\+\_\+model\+\_\+s}!log\+\_\+uniform\+\_\+weight@{log\+\_\+uniform\+\_\+weight}}
\index{log\+\_\+uniform\+\_\+weight@{log\+\_\+uniform\+\_\+weight}!ngram\+\_\+model\+\_\+s@{ngram\+\_\+model\+\_\+s}}
\subsubsection[{log\+\_\+uniform\+\_\+weight}]{\setlength{\rightskip}{0pt plus 5cm}int32 ngram\+\_\+model\+\_\+s\+::log\+\_\+uniform\+\_\+weight}\label{structngram__model__s_aa38c5fdecaefd9a2f43b69f26ae492c1}


Log of uniform weight (i.\+e. 

1 -\/ unigram weight) 

Definition at line 71 of file ngram\+\_\+model\+\_\+internal.\+h.

\index{ngram\+\_\+model\+\_\+s@{ngram\+\_\+model\+\_\+s}!n@{n}}
\index{n@{n}!ngram\+\_\+model\+\_\+s@{ngram\+\_\+model\+\_\+s}}
\subsubsection[{n}]{\setlength{\rightskip}{0pt plus 5cm}uint8 ngram\+\_\+model\+\_\+s\+::n}\label{structngram__model__s_a3c87bc1b678662a2c8930b3b8c33a80f}


This is an n-\/gram model (1, 2, 3, ...). 



Definition at line 61 of file ngram\+\_\+model\+\_\+internal.\+h.



Referenced by ngram\+\_\+iter\+\_\+successors(), ngram\+\_\+model\+\_\+get\+\_\+size(), ngram\+\_\+model\+\_\+mgrams(), ngram\+\_\+model\+\_\+set\+\_\+add(), ngram\+\_\+model\+\_\+set\+\_\+init(), ngram\+\_\+model\+\_\+set\+\_\+remove(), and ngram\+\_\+ng\+\_\+iter().

\index{ngram\+\_\+model\+\_\+s@{ngram\+\_\+model\+\_\+s}!n\+\_\+counts@{n\+\_\+counts}}
\index{n\+\_\+counts@{n\+\_\+counts}!ngram\+\_\+model\+\_\+s@{ngram\+\_\+model\+\_\+s}}
\subsubsection[{n\+\_\+counts}]{\setlength{\rightskip}{0pt plus 5cm}int32$\ast$ ngram\+\_\+model\+\_\+s\+::n\+\_\+counts}\label{structngram__model__s_a9dcba9b49cc1cd189b257e5838da0eee}


Counts for 1, 2, 3, ... 

grams 

Definition at line 57 of file ngram\+\_\+model\+\_\+internal.\+h.



Referenced by ngram\+\_\+model\+\_\+free(), and ngram\+\_\+model\+\_\+get\+\_\+counts().

\index{ngram\+\_\+model\+\_\+s@{ngram\+\_\+model\+\_\+s}!n\+\_\+words@{n\+\_\+words}}
\index{n\+\_\+words@{n\+\_\+words}!ngram\+\_\+model\+\_\+s@{ngram\+\_\+model\+\_\+s}}
\subsubsection[{n\+\_\+words}]{\setlength{\rightskip}{0pt plus 5cm}int32 ngram\+\_\+model\+\_\+s\+::n\+\_\+words}\label{structngram__model__s_a74f85927ef0d5513a1e6c02d13864be3}


Number of actual word strings (N\+O\+T the same as the number of unigrams, due to class words). 



Definition at line 59 of file ngram\+\_\+model\+\_\+internal.\+h.



Referenced by ngram\+\_\+model\+\_\+casefold(), ngram\+\_\+model\+\_\+free(), ngram\+\_\+model\+\_\+set\+\_\+add(), ngram\+\_\+model\+\_\+set\+\_\+current\+\_\+wid(), ngram\+\_\+model\+\_\+set\+\_\+known\+\_\+wid(), ngram\+\_\+model\+\_\+set\+\_\+map\+\_\+words(), ngram\+\_\+model\+\_\+set\+\_\+remove(), and ngram\+\_\+word().

\index{ngram\+\_\+model\+\_\+s@{ngram\+\_\+model\+\_\+s}!wid@{wid}}
\index{wid@{wid}!ngram\+\_\+model\+\_\+s@{ngram\+\_\+model\+\_\+s}}
\subsubsection[{wid}]{\setlength{\rightskip}{0pt plus 5cm}{\bf hash\+\_\+table\+\_\+t}$\ast$ ngram\+\_\+model\+\_\+s\+::wid}\label{structngram__model__s_a75567419a8002ef6e916c81f5d9ee9ed}


Mapping of unigram names to word I\+Ds. 



Definition at line 74 of file ngram\+\_\+model\+\_\+internal.\+h.



Referenced by ngram\+\_\+model\+\_\+casefold(), ngram\+\_\+model\+\_\+free(), ngram\+\_\+model\+\_\+set\+\_\+map\+\_\+words(), ngram\+\_\+unknown\+\_\+wid(), and ngram\+\_\+wid().



The documentation for this struct was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
src/libsphinxbase/lm/ngram\+\_\+model\+\_\+internal.\+h\end{DoxyCompactItemize}
