\section{src/libsphinxbase/lm/ngram\+\_\+model\+\_\+set.c File Reference}
\label{ngram__model__set_8c}\index{src/libsphinxbase/lm/ngram\+\_\+model\+\_\+set.\+c@{src/libsphinxbase/lm/ngram\+\_\+model\+\_\+set.\+c}}


Set of language models.  


{\ttfamily \#include $<$string.\+h$>$}\newline
{\ttfamily \#include $<$stdlib.\+h$>$}\newline
{\ttfamily \#include \char`\"{}sphinxbase/err.\+h\char`\"{}}\newline
{\ttfamily \#include \char`\"{}sphinxbase/ckd\+\_\+alloc.\+h\char`\"{}}\newline
{\ttfamily \#include \char`\"{}sphinxbase/strfuncs.\+h\char`\"{}}\newline
{\ttfamily \#include \char`\"{}sphinxbase/filename.\+h\char`\"{}}\newline
{\ttfamily \#include \char`\"{}ngram\+\_\+model\+\_\+set.\+h\char`\"{}}\newline
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\textbf{ ngram\+\_\+model\+\_\+t} $\ast$ \textbf{ ngram\+\_\+model\+\_\+set\+\_\+init} (\textbf{ cmd\+\_\+ln\+\_\+t} $\ast$config, \textbf{ ngram\+\_\+model\+\_\+t} $\ast$$\ast$models, char $\ast$$\ast$names, const float32 $\ast$weights, int32 n\+\_\+models)
\begin{DoxyCompactList}\small\item\em Create a set of language models sharing a common space of word I\+Ds. \end{DoxyCompactList}\item 
\textbf{ ngram\+\_\+model\+\_\+t} $\ast$ \textbf{ ngram\+\_\+model\+\_\+set\+\_\+read} (\textbf{ cmd\+\_\+ln\+\_\+t} $\ast$config, const char $\ast$lmctlfile, \textbf{ logmath\+\_\+t} $\ast$lmath)
\begin{DoxyCompactList}\small\item\em Read a set of language models from a control file. \end{DoxyCompactList}\item 
\mbox{\label{ngram__model__set_8c_afa38d4e0f6cd64cc2875000fcef487f0}} 
int32 \textbf{ ngram\+\_\+model\+\_\+set\+\_\+count} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$base)
\begin{DoxyCompactList}\small\item\em Returns the number of language models in a set. \end{DoxyCompactList}\item 
\textbf{ ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+t} $\ast$ \textbf{ ngram\+\_\+model\+\_\+set\+\_\+iter} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$base)
\begin{DoxyCompactList}\small\item\em Begin iterating over language models in a set. \end{DoxyCompactList}\item 
\textbf{ ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+t} $\ast$ \textbf{ ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+next} (\textbf{ ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+t} $\ast$itor)
\begin{DoxyCompactList}\small\item\em Move to the next language model in a set. \end{DoxyCompactList}\item 
\mbox{\label{ngram__model__set_8c_a532787b5b709d0c5f0ad57e3df0d1d73}} 
void \textbf{ ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+free} (\textbf{ ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+t} $\ast$itor)
\begin{DoxyCompactList}\small\item\em Finish iteration over a langauge model set. \end{DoxyCompactList}\item 
\textbf{ ngram\+\_\+model\+\_\+t} $\ast$ \textbf{ ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+model} (\textbf{ ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+t} $\ast$itor, char const $\ast$$\ast$lmname)
\begin{DoxyCompactList}\small\item\em Get language model and associated name from an iterator. \end{DoxyCompactList}\item 
\textbf{ ngram\+\_\+model\+\_\+t} $\ast$ \textbf{ ngram\+\_\+model\+\_\+set\+\_\+lookup} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$base, const char $\ast$name)
\begin{DoxyCompactList}\small\item\em Look up a language model by name from a set. \end{DoxyCompactList}\item 
\textbf{ ngram\+\_\+model\+\_\+t} $\ast$ \textbf{ ngram\+\_\+model\+\_\+set\+\_\+select} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$base, const char $\ast$name)
\begin{DoxyCompactList}\small\item\em Select a single language model from a set for scoring. \end{DoxyCompactList}\item 
\mbox{\label{ngram__model__set_8c_a3a4f2bb40d10e9420e6291e2706b6865}} 
const char $\ast$ \textbf{ ngram\+\_\+model\+\_\+set\+\_\+current} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$base)
\begin{DoxyCompactList}\small\item\em Get the current language model name, if any. \end{DoxyCompactList}\item 
int32 \textbf{ ngram\+\_\+model\+\_\+set\+\_\+current\+\_\+wid} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$base, int32 set\+\_\+wid)
\begin{DoxyCompactList}\small\item\em Query the word-\/\+ID mapping for the current language model. \end{DoxyCompactList}\item 
int32 \textbf{ ngram\+\_\+model\+\_\+set\+\_\+known\+\_\+wid} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$base, int32 set\+\_\+wid)
\begin{DoxyCompactList}\small\item\em Test whether a word ID corresponds to a known word in the current state of the language model set. \end{DoxyCompactList}\item 
\textbf{ ngram\+\_\+model\+\_\+t} $\ast$ \textbf{ ngram\+\_\+model\+\_\+set\+\_\+interp} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$base, const char $\ast$$\ast$names, const float32 $\ast$weights)
\begin{DoxyCompactList}\small\item\em Set interpolation weights for a set and enables interpolation. \end{DoxyCompactList}\item 
\textbf{ ngram\+\_\+model\+\_\+t} $\ast$ \textbf{ ngram\+\_\+model\+\_\+set\+\_\+add} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$base, \textbf{ ngram\+\_\+model\+\_\+t} $\ast$model, const char $\ast$name, float32 weight, int reuse\+\_\+widmap)
\begin{DoxyCompactList}\small\item\em Add a language model to a set. \end{DoxyCompactList}\item 
\textbf{ ngram\+\_\+model\+\_\+t} $\ast$ \textbf{ ngram\+\_\+model\+\_\+set\+\_\+remove} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$base, const char $\ast$name, int reuse\+\_\+widmap)
\begin{DoxyCompactList}\small\item\em Remove a language model from a set. \end{DoxyCompactList}\item 
\mbox{\label{ngram__model__set_8c_af3ac3bbec3eed0b9638c4e64c8b75949}} 
void \textbf{ ngram\+\_\+model\+\_\+set\+\_\+map\+\_\+words} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$base, const char $\ast$$\ast$words, int32 n\+\_\+words)
\begin{DoxyCompactList}\small\item\em Set the word-\/to-\/\+ID mapping for this model set. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Set of language models. 

\begin{DoxyAuthor}{Author}
David Huggins-\/\+Daines {\tt dhuggins@cs.\+cmu.\+edu} 
\end{DoxyAuthor}


\subsection{Function Documentation}
\mbox{\label{ngram__model__set_8c_a53071575bca9465361740c809666349d}} 
\index{ngram\+\_\+model\+\_\+set.\+c@{ngram\+\_\+model\+\_\+set.\+c}!ngram\+\_\+model\+\_\+set\+\_\+add@{ngram\+\_\+model\+\_\+set\+\_\+add}}
\index{ngram\+\_\+model\+\_\+set\+\_\+add@{ngram\+\_\+model\+\_\+set\+\_\+add}!ngram\+\_\+model\+\_\+set.\+c@{ngram\+\_\+model\+\_\+set.\+c}}
\subsubsection{ngram\+\_\+model\+\_\+set\+\_\+add()}
{\footnotesize\ttfamily \textbf{ ngram\+\_\+model\+\_\+t}$\ast$ ngram\+\_\+model\+\_\+set\+\_\+add (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{set,  }\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{model,  }\item[{const char $\ast$}]{name,  }\item[{float32}]{weight,  }\item[{int}]{reuse\+\_\+widmap }\end{DoxyParamCaption})}



Add a language model to a set. 


\begin{DoxyParams}{Parameters}
{\em set} & The language model set to add to. \\
\hline
{\em model} & The language model to add. \\
\hline
{\em name} & The name to associate with this model. \\
\hline
{\em weight} & Interpolation weight for this model, relative to the uniform distribution. 1.\+0 is a safe value. \\
\hline
{\em reuse\+\_\+widmap} & Reuse the existing word-\/\+ID mapping in {\ttfamily set}. Any new words present in {\ttfamily model} will not be added to the word-\/\+ID mapping in this case. \\
\hline
\end{DoxyParams}


Definition at line 520 of file ngram\+\_\+model\+\_\+set.\+c.



References ckd\+\_\+calloc\+\_\+2d, ckd\+\_\+free\+\_\+2d(), ckd\+\_\+realloc, ckd\+\_\+salloc, ngram\+\_\+model\+\_\+s\+::lmath, logmath\+\_\+log(), ngram\+\_\+model\+\_\+s\+::n, ngram\+\_\+model\+\_\+s\+::n\+\_\+words, ngram\+\_\+wid(), and ngram\+\_\+model\+\_\+s\+::word\+\_\+str.

\mbox{\label{ngram__model__set_8c_aa6239b58f333177839a15de79bae6146}} 
\index{ngram\+\_\+model\+\_\+set.\+c@{ngram\+\_\+model\+\_\+set.\+c}!ngram\+\_\+model\+\_\+set\+\_\+current\+\_\+wid@{ngram\+\_\+model\+\_\+set\+\_\+current\+\_\+wid}}
\index{ngram\+\_\+model\+\_\+set\+\_\+current\+\_\+wid@{ngram\+\_\+model\+\_\+set\+\_\+current\+\_\+wid}!ngram\+\_\+model\+\_\+set.\+c@{ngram\+\_\+model\+\_\+set.\+c}}
\subsubsection{ngram\+\_\+model\+\_\+set\+\_\+current\+\_\+wid()}
{\footnotesize\ttfamily int32 ngram\+\_\+model\+\_\+set\+\_\+current\+\_\+wid (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{set,  }\item[{int32}]{set\+\_\+wid }\end{DoxyParamCaption})}



Query the word-\/\+ID mapping for the current language model. 

\begin{DoxyReturn}{Returns}
the local word ID in the current language model, or N\+G\+R\+A\+M\+\_\+\+I\+N\+V\+A\+L\+I\+D\+\_\+\+W\+ID if {\ttfamily set\+\_\+wid} is invalid or interpolation is enabled. 
\end{DoxyReturn}


Definition at line 456 of file ngram\+\_\+model\+\_\+set.\+c.



References ngram\+\_\+model\+\_\+s\+::n\+\_\+words, and N\+G\+R\+A\+M\+\_\+\+I\+N\+V\+A\+L\+I\+D\+\_\+\+W\+ID.

\mbox{\label{ngram__model__set_8c_aa4cc619035ac8091759c07d6a3b2fb7c}} 
\index{ngram\+\_\+model\+\_\+set.\+c@{ngram\+\_\+model\+\_\+set.\+c}!ngram\+\_\+model\+\_\+set\+\_\+init@{ngram\+\_\+model\+\_\+set\+\_\+init}}
\index{ngram\+\_\+model\+\_\+set\+\_\+init@{ngram\+\_\+model\+\_\+set\+\_\+init}!ngram\+\_\+model\+\_\+set.\+c@{ngram\+\_\+model\+\_\+set.\+c}}
\subsubsection{ngram\+\_\+model\+\_\+set\+\_\+init()}
{\footnotesize\ttfamily \textbf{ ngram\+\_\+model\+\_\+t}$\ast$ ngram\+\_\+model\+\_\+set\+\_\+init (\begin{DoxyParamCaption}\item[{\textbf{ cmd\+\_\+ln\+\_\+t} $\ast$}]{config,  }\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$$\ast$}]{models,  }\item[{char $\ast$$\ast$}]{names,  }\item[{const float32 $\ast$}]{weights,  }\item[{int32}]{n\+\_\+models }\end{DoxyParamCaption})}



Create a set of language models sharing a common space of word I\+Ds. 

This function creates a meta-\/language model which groups together a set of language models, synchronizing word I\+Ds between them. To use this language model, you can either select a submodel to use exclusively using \doxyref{ngram\+\_\+model\+\_\+set\+\_\+select()}{p.}{ngram__model_8h_a5e7a3fd20d32783ce07b760781f658f8}, or interpolate between scores from all models. To do the latter, you can either pass a non-\/\+N\+U\+LL value of the {\ttfamily weights} parameter, or re-\/activate interpolation later on by calling \doxyref{ngram\+\_\+model\+\_\+set\+\_\+interp()}{p.}{ngram__model_8h_a8a4c853e77c6b48face3a781480e77d6}.

In order to make this efficient, there are some restrictions on the models that can be grouped together. The most important (and currently the only) one is that they {\bfseries must} all share the same log-\/math parameters.


\begin{DoxyParams}{Parameters}
{\em config} & Any configuration parameters to be shared between models. \\
\hline
{\em models} & Array of pointers to previously created language models. \\
\hline
{\em names} & Array of strings to use as unique identifiers for L\+Ms. \\
\hline
{\em weights} & Array of weights to use in interpolating L\+Ms, or N\+U\+LL for no interpolation. \\
\hline
{\em n\+\_\+models} & Number of elements in the arrays passed to this function. \\
\hline
\end{DoxyParams}


Definition at line 121 of file ngram\+\_\+model\+\_\+set.\+c.

\mbox{\label{ngram__model__set_8c_a3a926714c60e2b8308d4c88d11d17d7e}} 
\index{ngram\+\_\+model\+\_\+set.\+c@{ngram\+\_\+model\+\_\+set.\+c}!ngram\+\_\+model\+\_\+set\+\_\+interp@{ngram\+\_\+model\+\_\+set\+\_\+interp}}
\index{ngram\+\_\+model\+\_\+set\+\_\+interp@{ngram\+\_\+model\+\_\+set\+\_\+interp}!ngram\+\_\+model\+\_\+set.\+c@{ngram\+\_\+model\+\_\+set.\+c}}
\subsubsection{ngram\+\_\+model\+\_\+set\+\_\+interp()}
{\footnotesize\ttfamily \textbf{ ngram\+\_\+model\+\_\+t}$\ast$ ngram\+\_\+model\+\_\+set\+\_\+interp (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{set,  }\item[{const char $\ast$$\ast$}]{names,  }\item[{const float32 $\ast$}]{weights }\end{DoxyParamCaption})}



Set interpolation weights for a set and enables interpolation. 

If {\ttfamily weights} is N\+U\+LL, any previously initialized set of weights will be used. If no weights were specified to \doxyref{ngram\+\_\+model\+\_\+set\+\_\+init()}{p.}{ngram__model_8h_a02310e01a48928e1d430aef0ea3c9a99}, then a uniform distribution will be used. 

Definition at line 489 of file ngram\+\_\+model\+\_\+set.\+c.



References E\+\_\+\+E\+R\+R\+OR.

\mbox{\label{ngram__model__set_8c_a5a1593344017a1210569beb63e4089d3}} 
\index{ngram\+\_\+model\+\_\+set.\+c@{ngram\+\_\+model\+\_\+set.\+c}!ngram\+\_\+model\+\_\+set\+\_\+iter@{ngram\+\_\+model\+\_\+set\+\_\+iter}}
\index{ngram\+\_\+model\+\_\+set\+\_\+iter@{ngram\+\_\+model\+\_\+set\+\_\+iter}!ngram\+\_\+model\+\_\+set.\+c@{ngram\+\_\+model\+\_\+set.\+c}}
\subsubsection{ngram\+\_\+model\+\_\+set\+\_\+iter()}
{\footnotesize\ttfamily \textbf{ ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+t}$\ast$ ngram\+\_\+model\+\_\+set\+\_\+iter (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{set }\end{DoxyParamCaption})}



Begin iterating over language models in a set. 

\begin{DoxyReturn}{Returns}
iterator pointing to the first language model, or N\+U\+LL if no models remain. 
\end{DoxyReturn}


Definition at line 368 of file ngram\+\_\+model\+\_\+set.\+c.

\mbox{\label{ngram__model__set_8c_abec0455e59945b910d86c2f825ab0894}} 
\index{ngram\+\_\+model\+\_\+set.\+c@{ngram\+\_\+model\+\_\+set.\+c}!ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+model@{ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+model}}
\index{ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+model@{ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+model}!ngram\+\_\+model\+\_\+set.\+c@{ngram\+\_\+model\+\_\+set.\+c}}
\subsubsection{ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+model()}
{\footnotesize\ttfamily \textbf{ ngram\+\_\+model\+\_\+t}$\ast$ ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+model (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+t} $\ast$}]{itor,  }\item[{char const $\ast$$\ast$}]{lmname }\end{DoxyParamCaption})}



Get language model and associated name from an iterator. 


\begin{DoxyParams}{Parameters}
{\em itor} & the iterator \\
\hline
{\em lmname} & Output\+: string name associated with this language model. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Language model pointed to by this iterator. 
\end{DoxyReturn}


Definition at line 397 of file ngram\+\_\+model\+\_\+set.\+c.



References ngram\+\_\+model\+\_\+set\+\_\+s\+::lms, and ngram\+\_\+model\+\_\+set\+\_\+s\+::names.

\mbox{\label{ngram__model__set_8c_a13893e41e56962f6f237aa1305337b7a}} 
\index{ngram\+\_\+model\+\_\+set.\+c@{ngram\+\_\+model\+\_\+set.\+c}!ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+next@{ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+next}}
\index{ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+next@{ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+next}!ngram\+\_\+model\+\_\+set.\+c@{ngram\+\_\+model\+\_\+set.\+c}}
\subsubsection{ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+next()}
{\footnotesize\ttfamily \textbf{ ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+t}$\ast$ ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+next (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+t} $\ast$}]{itor }\end{DoxyParamCaption})}



Move to the next language model in a set. 

\begin{DoxyReturn}{Returns}
iterator pointing to the next language model, or N\+U\+LL if no models remain. 
\end{DoxyReturn}


Definition at line 381 of file ngram\+\_\+model\+\_\+set.\+c.



References ngram\+\_\+model\+\_\+set\+\_\+s\+::n\+\_\+models, and ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+free().

\mbox{\label{ngram__model__set_8c_af30197146b9b2d6c143914240dee3c04}} 
\index{ngram\+\_\+model\+\_\+set.\+c@{ngram\+\_\+model\+\_\+set.\+c}!ngram\+\_\+model\+\_\+set\+\_\+known\+\_\+wid@{ngram\+\_\+model\+\_\+set\+\_\+known\+\_\+wid}}
\index{ngram\+\_\+model\+\_\+set\+\_\+known\+\_\+wid@{ngram\+\_\+model\+\_\+set\+\_\+known\+\_\+wid}!ngram\+\_\+model\+\_\+set.\+c@{ngram\+\_\+model\+\_\+set.\+c}}
\subsubsection{ngram\+\_\+model\+\_\+set\+\_\+known\+\_\+wid()}
{\footnotesize\ttfamily int32 ngram\+\_\+model\+\_\+set\+\_\+known\+\_\+wid (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{set,  }\item[{int32}]{set\+\_\+wid }\end{DoxyParamCaption})}



Test whether a word ID corresponds to a known word in the current state of the language model set. 

\begin{DoxyReturn}{Returns}
If there is a current language model, returns non-\/zero if {\ttfamily set\+\_\+wid} corresponds to a known word in that language model. Otherwise, returns non-\/zero if {\ttfamily set\+\_\+wid} corresponds to a known word in any language model. 
\end{DoxyReturn}


Definition at line 468 of file ngram\+\_\+model\+\_\+set.\+c.



References ngram\+\_\+model\+\_\+s\+::n\+\_\+words.

\mbox{\label{ngram__model__set_8c_a3e06e5d47a9c35186644cc1310924630}} 
\index{ngram\+\_\+model\+\_\+set.\+c@{ngram\+\_\+model\+\_\+set.\+c}!ngram\+\_\+model\+\_\+set\+\_\+lookup@{ngram\+\_\+model\+\_\+set\+\_\+lookup}}
\index{ngram\+\_\+model\+\_\+set\+\_\+lookup@{ngram\+\_\+model\+\_\+set\+\_\+lookup}!ngram\+\_\+model\+\_\+set.\+c@{ngram\+\_\+model\+\_\+set.\+c}}
\subsubsection{ngram\+\_\+model\+\_\+set\+\_\+lookup()}
{\footnotesize\ttfamily \textbf{ ngram\+\_\+model\+\_\+t}$\ast$ ngram\+\_\+model\+\_\+set\+\_\+lookup (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{set,  }\item[{const char $\ast$}]{name }\end{DoxyParamCaption})}



Look up a language model by name from a set. 

\begin{DoxyReturn}{Returns}
language model corresponding to {\ttfamily name}, or N\+U\+LL if no language model by that name exists. 
\end{DoxyReturn}


Definition at line 405 of file ngram\+\_\+model\+\_\+set.\+c.

\mbox{\label{ngram__model__set_8c_a1389a90bf32110fd7e56a73b6d39fa07}} 
\index{ngram\+\_\+model\+\_\+set.\+c@{ngram\+\_\+model\+\_\+set.\+c}!ngram\+\_\+model\+\_\+set\+\_\+read@{ngram\+\_\+model\+\_\+set\+\_\+read}}
\index{ngram\+\_\+model\+\_\+set\+\_\+read@{ngram\+\_\+model\+\_\+set\+\_\+read}!ngram\+\_\+model\+\_\+set.\+c@{ngram\+\_\+model\+\_\+set.\+c}}
\subsubsection{ngram\+\_\+model\+\_\+set\+\_\+read()}
{\footnotesize\ttfamily \textbf{ ngram\+\_\+model\+\_\+t}$\ast$ ngram\+\_\+model\+\_\+set\+\_\+read (\begin{DoxyParamCaption}\item[{\textbf{ cmd\+\_\+ln\+\_\+t} $\ast$}]{config,  }\item[{const char $\ast$}]{lmctlfile,  }\item[{\textbf{ logmath\+\_\+t} $\ast$}]{lmath }\end{DoxyParamCaption})}



Read a set of language models from a control file. 

This file creates a language model set from a \char`\"{}control file\char`\"{} of the type used in Sphinx-\/\+II and Sphinx-\/\+I\+II. File format (optional stuff is indicated by enclosing in [])\+:


\begin{DoxyPre}
  [\{ LMClassFileName LMClassFilename ... \}]
  TrigramLMFileName LMName [\{ LMClassName LMClassName ... \}]
  TrigramLMFileName LMName [\{ LMClassName LMClassName ... \}]
  ...
(There should be whitespace around the \{ and \} delimiters.)
\end{DoxyPre}


This is an extension of the older format that had only Trigram\+L\+M\+Filen\+Name and L\+M\+Name pairs. The new format allows a set of L\+M\+Class files to be read in and referred to by the trigram L\+Ms.

No \char`\"{}comments\char`\"{} allowed in this file.


\begin{DoxyParams}{Parameters}
{\em config} & Configuration parameters. \\
\hline
{\em lmctlfile} & Path to the language model control file. \\
\hline
{\em lmath} & Log-\/math parameters to use for probability calculations. Ownership of this object is assumed by the newly created ngram\+\_\+model\+\_\+t, and you should not attempt to free it manually. If you wish to reuse it elsewhere, you must retain it with \doxyref{logmath\+\_\+retain()}{p.}{logmath_8h_a1c1b2ba3b137a39e9e835a8f3e27d381}. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
newly created language model set. 
\end{DoxyReturn}


Definition at line 182 of file ngram\+\_\+model\+\_\+set.\+c.

\mbox{\label{ngram__model__set_8c_a1fadaf8cdc6799869b74a39a8652a7e0}} 
\index{ngram\+\_\+model\+\_\+set.\+c@{ngram\+\_\+model\+\_\+set.\+c}!ngram\+\_\+model\+\_\+set\+\_\+remove@{ngram\+\_\+model\+\_\+set\+\_\+remove}}
\index{ngram\+\_\+model\+\_\+set\+\_\+remove@{ngram\+\_\+model\+\_\+set\+\_\+remove}!ngram\+\_\+model\+\_\+set.\+c@{ngram\+\_\+model\+\_\+set.\+c}}
\subsubsection{ngram\+\_\+model\+\_\+set\+\_\+remove()}
{\footnotesize\ttfamily \textbf{ ngram\+\_\+model\+\_\+t}$\ast$ ngram\+\_\+model\+\_\+set\+\_\+remove (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{set,  }\item[{const char $\ast$}]{name,  }\item[{int}]{reuse\+\_\+widmap }\end{DoxyParamCaption})}



Remove a language model from a set. 


\begin{DoxyParams}{Parameters}
{\em set} & The language model set to remove from. \\
\hline
{\em name} & The name associated with the model to remove. \\
\hline
{\em reuse\+\_\+widmap} & Reuse the existing word-\/\+ID mapping in {\ttfamily set}. \\
\hline
\end{DoxyParams}


Definition at line 580 of file ngram\+\_\+model\+\_\+set.\+c.

\mbox{\label{ngram__model__set_8c_a2cbeda856dd655c80f8dc6ba91f5d20b}} 
\index{ngram\+\_\+model\+\_\+set.\+c@{ngram\+\_\+model\+\_\+set.\+c}!ngram\+\_\+model\+\_\+set\+\_\+select@{ngram\+\_\+model\+\_\+set\+\_\+select}}
\index{ngram\+\_\+model\+\_\+set\+\_\+select@{ngram\+\_\+model\+\_\+set\+\_\+select}!ngram\+\_\+model\+\_\+set.\+c@{ngram\+\_\+model\+\_\+set.\+c}}
\subsubsection{ngram\+\_\+model\+\_\+set\+\_\+select()}
{\footnotesize\ttfamily \textbf{ ngram\+\_\+model\+\_\+t}$\ast$ ngram\+\_\+model\+\_\+set\+\_\+select (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{set,  }\item[{const char $\ast$}]{name }\end{DoxyParamCaption})}



Select a single language model from a set for scoring. 

\begin{DoxyReturn}{Returns}
the newly selected language model, or N\+U\+LL if no language model by that name exists. 
\end{DoxyReturn}


Definition at line 428 of file ngram\+\_\+model\+\_\+set.\+c.

