\doxysection{include/sphinxbase/ngram\+\_\+model.h File Reference}
\label{ngram__model_8h}\index{include/sphinxbase/ngram\_model.h@{include/sphinxbase/ngram\_model.h}}


N-\/\+Gram language models.  


{\ttfamily \#include $<$stdarg.\+h$>$}\newline
{\ttfamily \#include $<$sphinxbase/sphinxbase\+\_\+export.\+h$>$}\newline
{\ttfamily \#include $<$sphinxbase/prim\+\_\+type.\+h$>$}\newline
{\ttfamily \#include $<$sphinxbase/cmd\+\_\+ln.\+h$>$}\newline
{\ttfamily \#include $<$sphinxbase/logmath.\+h$>$}\newline
{\ttfamily \#include $<$sphinxbase/mmio.\+h$>$}\newline
\doxysubsubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \textbf{ NGRAM\+\_\+\+INVALID\+\_\+\+WID}~-\/1
\begin{DoxyCompactList}\small\item\em Impossible word ID. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsubsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
typedef struct \textbf{ ngram\+\_\+model\+\_\+s} \textbf{ ngram\+\_\+model\+\_\+t}
\begin{DoxyCompactList}\small\item\em Abstract type representing an N-\/\+Gram based language model. \end{DoxyCompactList}\item 
typedef struct \textbf{ ngram\+\_\+class\+\_\+s} \textbf{ ngram\+\_\+class\+\_\+t}
\begin{DoxyCompactList}\small\item\em Abstract type representing a word class in an N-\/\+Gram model. \end{DoxyCompactList}\item 
\label{ngram__model_8h_ac3bc97ce5f4139db88d4360b19497f97} 
typedef enum \textbf{ ngram\+\_\+file\+\_\+type\+\_\+e} {\bfseries ngram\+\_\+file\+\_\+type\+\_\+t}
\begin{DoxyCompactList}\small\item\em File types for N-\/\+Gram files. \end{DoxyCompactList}\item 
\label{ngram__model_8h_afbe3bcb7dd0de6bc550cc7d4e75de403} 
typedef enum \textbf{ ngram\+\_\+case\+\_\+e} {\bfseries ngram\+\_\+case\+\_\+t}
\begin{DoxyCompactList}\small\item\em Constants for case folding. \end{DoxyCompactList}\item 
typedef struct \textbf{ ngram\+\_\+iter\+\_\+s} \textbf{ ngram\+\_\+iter\+\_\+t}
\begin{DoxyCompactList}\small\item\em M-\/gram iterator object. \end{DoxyCompactList}\item 
typedef struct \textbf{ ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+s} \textbf{ ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+t}
\begin{DoxyCompactList}\small\item\em Iterator over language models in a set. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsubsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum \textbf{ ngram\+\_\+file\+\_\+type\+\_\+e} \{ \newline
\textbf{ NGRAM\+\_\+\+INVALID} = -\/1
, \textbf{ NGRAM\+\_\+\+AUTO}
, \textbf{ NGRAM\+\_\+\+ARPA}
, \textbf{ NGRAM\+\_\+\+DMP}
, \newline
\textbf{ NGRAM\+\_\+\+DMP32}
 \}
\begin{DoxyCompactList}\small\item\em File types for N-\/\+Gram files. \end{DoxyCompactList}\item 
enum \textbf{ ngram\+\_\+case\+\_\+e} \{ {\bfseries NGRAM\+\_\+\+UPPER}
, {\bfseries NGRAM\+\_\+\+LOWER}
 \}
\begin{DoxyCompactList}\small\item\em Constants for case folding. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
SPHINXBASE\+\_\+\+EXPORT \textbf{ ngram\+\_\+model\+\_\+t} $\ast$ \textbf{ ngram\+\_\+model\+\_\+read} (\textbf{ cmd\+\_\+ln\+\_\+t} $\ast$config, const char $\ast$file\+\_\+name, \textbf{ ngram\+\_\+file\+\_\+type\+\_\+t} file\+\_\+type, \textbf{ logmath\+\_\+t} $\ast$lmath)
\begin{DoxyCompactList}\small\item\em Read an N-\/\+Gram model from a file on disk. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int \textbf{ ngram\+\_\+model\+\_\+write} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$model, const char $\ast$file\+\_\+name, \textbf{ ngram\+\_\+file\+\_\+type\+\_\+t} format)
\begin{DoxyCompactList}\small\item\em Write an N-\/\+Gram model to disk. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT \textbf{ ngram\+\_\+file\+\_\+type\+\_\+t} \textbf{ ngram\+\_\+file\+\_\+name\+\_\+to\+\_\+type} (const char $\ast$file\+\_\+name)
\begin{DoxyCompactList}\small\item\em Guess the file type for an N-\/\+Gram model from the filename. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT \textbf{ ngram\+\_\+file\+\_\+type\+\_\+t} \textbf{ ngram\+\_\+str\+\_\+to\+\_\+type} (const char $\ast$str\+\_\+name)
\begin{DoxyCompactList}\small\item\em Get the N-\/\+Gram file type from a string. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT char const $\ast$ \textbf{ ngram\+\_\+type\+\_\+to\+\_\+str} (int type)
\begin{DoxyCompactList}\small\item\em Get the canonical name for an N-\/\+Gram file type. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT \textbf{ ngram\+\_\+model\+\_\+t} $\ast$ \textbf{ ngram\+\_\+model\+\_\+retain} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$model)
\begin{DoxyCompactList}\small\item\em Retain ownership of an N-\/\+Gram model. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int \textbf{ ngram\+\_\+model\+\_\+free} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$model)
\begin{DoxyCompactList}\small\item\em Release memory associated with an N-\/\+Gram model. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int \textbf{ ngram\+\_\+model\+\_\+recode} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$model, const char $\ast$from, const char $\ast$to)
\begin{DoxyCompactList}\small\item\em Re-\/encode word strings in an N-\/\+Gram model. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int \textbf{ ngram\+\_\+model\+\_\+casefold} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$model, int kase)
\begin{DoxyCompactList}\small\item\em Case-\/fold word strings in an N-\/\+Gram model. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int \textbf{ ngram\+\_\+model\+\_\+apply\+\_\+weights} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$model, float32 lw, float32 wip, float32 uw)
\begin{DoxyCompactList}\small\item\em Apply a language weight, insertion penalty, and unigram weight to a language model. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT float32 \textbf{ ngram\+\_\+model\+\_\+get\+\_\+weights} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$model, int32 $\ast$out\+\_\+log\+\_\+wip, int32 $\ast$out\+\_\+log\+\_\+uw)
\begin{DoxyCompactList}\small\item\em Get the current weights from a language model. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int32 \textbf{ ngram\+\_\+score} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$model, const char $\ast$word,...)
\begin{DoxyCompactList}\small\item\em Get the score (scaled, interpolated log-\/probability) for a general N-\/\+Gram. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int32 \textbf{ ngram\+\_\+tg\+\_\+score} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$model, int32 w3, int32 w2, int32 w1, int32 $\ast$n\+\_\+used)
\begin{DoxyCompactList}\small\item\em Quick trigram score lookup. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int32 \textbf{ ngram\+\_\+bg\+\_\+score} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$model, int32 w2, int32 w1, int32 $\ast$n\+\_\+used)
\begin{DoxyCompactList}\small\item\em Quick bigram score lookup. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int32 \textbf{ ngram\+\_\+ng\+\_\+score} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$model, int32 wid, int32 $\ast$history, int32 n\+\_\+hist, int32 $\ast$n\+\_\+used)
\begin{DoxyCompactList}\small\item\em Quick general N-\/\+Gram score lookup. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int32 \textbf{ ngram\+\_\+prob} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$model, const char $\ast$word,...)
\begin{DoxyCompactList}\small\item\em Get the "{}raw"{} log-\/probability for a general N-\/\+Gram. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int32 \textbf{ ngram\+\_\+ng\+\_\+prob} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$model, int32 wid, int32 $\ast$history, int32 n\+\_\+hist, int32 $\ast$n\+\_\+used)
\begin{DoxyCompactList}\small\item\em Quick "{}raw"{} probability lookup for a general N-\/\+Gram. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int32 \textbf{ ngram\+\_\+score\+\_\+to\+\_\+prob} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$model, int32 score)
\begin{DoxyCompactList}\small\item\em Convert score to "{}raw"{} log-\/probability. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int32 \textbf{ ngram\+\_\+wid} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$model, const char $\ast$word)
\begin{DoxyCompactList}\small\item\em Look up numerical word ID. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT const char $\ast$ \textbf{ ngram\+\_\+word} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$model, int32 wid)
\begin{DoxyCompactList}\small\item\em Look up word string for numerical word ID. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int32 \textbf{ ngram\+\_\+unknown\+\_\+wid} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$model)
\begin{DoxyCompactList}\small\item\em Get the unknown word ID for a language model. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int32 \textbf{ ngram\+\_\+zero} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$model)
\begin{DoxyCompactList}\small\item\em Get the "{}zero"{} log-\/probability value for a language model. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int32 \textbf{ ngram\+\_\+model\+\_\+get\+\_\+size} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$model)
\begin{DoxyCompactList}\small\item\em Get the order of the N-\/gram model (i.\+e. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int32 const $\ast$ \textbf{ ngram\+\_\+model\+\_\+get\+\_\+counts} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$model)
\begin{DoxyCompactList}\small\item\em Get the counts of the various N-\/grams in the model. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT \textbf{ ngram\+\_\+iter\+\_\+t} $\ast$ \textbf{ ngram\+\_\+model\+\_\+mgrams} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$model, int m)
\begin{DoxyCompactList}\small\item\em Iterate over all M-\/grams. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT \textbf{ ngram\+\_\+iter\+\_\+t} $\ast$ \textbf{ ngram\+\_\+iter} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$model, const char $\ast$word,...)
\begin{DoxyCompactList}\small\item\em Get an iterator over M-\/grams pointing to the specified M-\/gram. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT \textbf{ ngram\+\_\+iter\+\_\+t} $\ast$ \textbf{ ngram\+\_\+ng\+\_\+iter} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$model, int32 wid, int32 $\ast$history, int32 n\+\_\+hist)
\begin{DoxyCompactList}\small\item\em Get an iterator over M-\/grams pointing to the specified M-\/gram. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int32 const $\ast$ \textbf{ ngram\+\_\+iter\+\_\+get} (\textbf{ ngram\+\_\+iter\+\_\+t} $\ast$itor, int32 $\ast$out\+\_\+score, int32 $\ast$out\+\_\+bowt)
\begin{DoxyCompactList}\small\item\em Get information from the current M-\/gram in an iterator. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT \textbf{ ngram\+\_\+iter\+\_\+t} $\ast$ \textbf{ ngram\+\_\+iter\+\_\+successors} (\textbf{ ngram\+\_\+iter\+\_\+t} $\ast$itor)
\begin{DoxyCompactList}\small\item\em Iterate over all M-\/gram successors of an M-\/1-\/gram. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT \textbf{ ngram\+\_\+iter\+\_\+t} $\ast$ \textbf{ ngram\+\_\+iter\+\_\+next} (\textbf{ ngram\+\_\+iter\+\_\+t} $\ast$itor)
\begin{DoxyCompactList}\small\item\em Advance an M-\/gram iterator. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT void \textbf{ ngram\+\_\+iter\+\_\+free} (\textbf{ ngram\+\_\+iter\+\_\+t} $\ast$itor)
\begin{DoxyCompactList}\small\item\em Terminate an M-\/gram iterator. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int32 \textbf{ ngram\+\_\+model\+\_\+add\+\_\+word} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$model, const char $\ast$word, float32 weight)
\begin{DoxyCompactList}\small\item\em Add a word (unigram) to the language model. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int32 \textbf{ ngram\+\_\+model\+\_\+read\+\_\+classdef} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$model, const char $\ast$file\+\_\+name)
\begin{DoxyCompactList}\small\item\em Read a class definition file and add classes to a language model. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int32 \textbf{ ngram\+\_\+model\+\_\+add\+\_\+class} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$model, const char $\ast$classname, float32 classweight, char $\ast$$\ast$words, const float32 $\ast$weights, int32 n\+\_\+words)
\begin{DoxyCompactList}\small\item\em Add a new class to a language model. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int32 \textbf{ ngram\+\_\+model\+\_\+add\+\_\+class\+\_\+word} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$model, const char $\ast$classname, const char $\ast$word, float32 weight)
\begin{DoxyCompactList}\small\item\em Add a word to a class in a language model. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT \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 IDs. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT \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 
SPHINXBASE\+\_\+\+EXPORT int32 \textbf{ ngram\+\_\+model\+\_\+set\+\_\+count} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$set)
\begin{DoxyCompactList}\small\item\em Returns the number of language models in a set. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT \textbf{ ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+t} $\ast$ \textbf{ ngram\+\_\+model\+\_\+set\+\_\+iter} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$set)
\begin{DoxyCompactList}\small\item\em Begin iterating over language models in a set. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT \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 
SPHINXBASE\+\_\+\+EXPORT 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 
SPHINXBASE\+\_\+\+EXPORT \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 
SPHINXBASE\+\_\+\+EXPORT \textbf{ ngram\+\_\+model\+\_\+t} $\ast$ \textbf{ ngram\+\_\+model\+\_\+set\+\_\+select} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$set, const char $\ast$name)
\begin{DoxyCompactList}\small\item\em Select a single language model from a set for scoring. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT \textbf{ ngram\+\_\+model\+\_\+t} $\ast$ \textbf{ ngram\+\_\+model\+\_\+set\+\_\+lookup} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$set, const char $\ast$name)
\begin{DoxyCompactList}\small\item\em Look up a language model by name from a set. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT const char $\ast$ \textbf{ ngram\+\_\+model\+\_\+set\+\_\+current} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$set)
\begin{DoxyCompactList}\small\item\em Get the current language model name, if any. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT \textbf{ ngram\+\_\+model\+\_\+t} $\ast$ \textbf{ ngram\+\_\+model\+\_\+set\+\_\+interp} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$set, 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 
SPHINXBASE\+\_\+\+EXPORT \textbf{ ngram\+\_\+model\+\_\+t} $\ast$ \textbf{ ngram\+\_\+model\+\_\+set\+\_\+add} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$set, \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 
SPHINXBASE\+\_\+\+EXPORT \textbf{ ngram\+\_\+model\+\_\+t} $\ast$ \textbf{ ngram\+\_\+model\+\_\+set\+\_\+remove} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$set, const char $\ast$name, int reuse\+\_\+widmap)
\begin{DoxyCompactList}\small\item\em Remove a language model from a set. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT void \textbf{ ngram\+\_\+model\+\_\+set\+\_\+map\+\_\+words} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$set, 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}\item 
SPHINXBASE\+\_\+\+EXPORT int32 \textbf{ ngram\+\_\+model\+\_\+set\+\_\+current\+\_\+wid} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$set, int32 set\+\_\+wid)
\begin{DoxyCompactList}\small\item\em Query the word-\/\+ID mapping for the current language model. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int32 \textbf{ ngram\+\_\+model\+\_\+set\+\_\+known\+\_\+wid} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$set, 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 
SPHINXBASE\+\_\+\+EXPORT void \textbf{ ngram\+\_\+model\+\_\+flush} (\textbf{ ngram\+\_\+model\+\_\+t} $\ast$lm)
\begin{DoxyCompactList}\small\item\em Flush any cached N-\/\+Gram information. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
N-\/\+Gram language models. 

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


Definition in file \textbf{ ngram\+\_\+model.\+h}.



\doxysubsection{Macro Definition Documentation}
\label{ngram__model_8h_a3d4b3dddd0ff67e13d30c9bf053d01ab} 
\index{ngram\_model.h@{ngram\_model.h}!NGRAM\_INVALID\_WID@{NGRAM\_INVALID\_WID}}
\index{NGRAM\_INVALID\_WID@{NGRAM\_INVALID\_WID}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{NGRAM\_INVALID\_WID}
{\footnotesize\ttfamily \#define NGRAM\+\_\+\+INVALID\+\_\+\+WID~-\/1}



Impossible word ID. 



Definition at line \textbf{ 84} of file \textbf{ ngram\+\_\+model.\+h}.



\doxysubsection{Typedef Documentation}
\label{ngram__model_8h_ae36b2f037b2ea751dff23f082379c264} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_class\_t@{ngram\_class\_t}}
\index{ngram\_class\_t@{ngram\_class\_t}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_class\_t}
{\footnotesize\ttfamily typedef struct \textbf{ ngram\+\_\+class\+\_\+s} \textbf{ ngram\+\_\+class\+\_\+t}}



Abstract type representing a word class in an N-\/\+Gram model. 



Definition at line \textbf{ 71} of file \textbf{ ngram\+\_\+model.\+h}.

\label{ngram__model_8h_ac7de090a02fa12a8bba84abb4d5236aa} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_iter\_t@{ngram\_iter\_t}}
\index{ngram\_iter\_t@{ngram\_iter\_t}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_iter\_t}
{\footnotesize\ttfamily typedef struct \textbf{ ngram\+\_\+iter\+\_\+s} \textbf{ ngram\+\_\+iter\+\_\+t}}



M-\/gram iterator object. 



Definition at line \textbf{ 369} of file \textbf{ ngram\+\_\+model.\+h}.

\label{ngram__model_8h_afffd75c5bde8dd84107449468be48547} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_set\_iter\_t@{ngram\_model\_set\_iter\_t}}
\index{ngram\_model\_set\_iter\_t@{ngram\_model\_set\_iter\_t}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_set\_iter\_t}
{\footnotesize\ttfamily typedef struct \textbf{ ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+s} \textbf{ ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+t}}



Iterator over language models in a set. 



Definition at line \textbf{ 566} of file \textbf{ ngram\+\_\+model.\+h}.

\label{ngram__model_8h_afaaf0c00e20056d97efcd97e4cae4ea7} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_t@{ngram\_model\_t}}
\index{ngram\_model\_t@{ngram\_model\_t}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_t}
{\footnotesize\ttfamily typedef struct \textbf{ ngram\+\_\+model\+\_\+s} \textbf{ ngram\+\_\+model\+\_\+t}}



Abstract type representing an N-\/\+Gram based language model. 



Definition at line \textbf{ 66} of file \textbf{ ngram\+\_\+model.\+h}.



\doxysubsection{Enumeration Type Documentation}
\label{ngram__model_8h_aad16a0a1edf29ba8c0df43959c0c4771} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_case\_e@{ngram\_case\_e}}
\index{ngram\_case\_e@{ngram\_case\_e}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_case\_e}
{\footnotesize\ttfamily enum \textbf{ ngram\+\_\+case\+\_\+e}}



Constants for case folding. 



Definition at line \textbf{ 184} of file \textbf{ ngram\+\_\+model.\+h}.

\label{ngram__model_8h_a406c0d64c15a9d1749d07c8ab6e0ae74} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_file\_type\_e@{ngram\_file\_type\_e}}
\index{ngram\_file\_type\_e@{ngram\_file\_type\_e}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_file\_type\_e}
{\footnotesize\ttfamily enum \textbf{ ngram\+\_\+file\+\_\+type\+\_\+e}}



File types for N-\/\+Gram files. 

\begin{DoxyEnumFields}{Enumerator}
\raisebox{\heightof{T}}[0pt][0pt]{\index{NGRAM\_INVALID@{NGRAM\_INVALID}!ngram\_model.h@{ngram\_model.h}}\index{ngram\_model.h@{ngram\_model.h}!NGRAM\_INVALID@{NGRAM\_INVALID}}}\label{ngram__model_8h_a406c0d64c15a9d1749d07c8ab6e0ae74a2cf596c8b0c63a3a0ba1fe33326cc796} 
NGRAM\+\_\+\+INVALID&Not a valid file type. \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{NGRAM\_AUTO@{NGRAM\_AUTO}!ngram\_model.h@{ngram\_model.h}}\index{ngram\_model.h@{ngram\_model.h}!NGRAM\_AUTO@{NGRAM\_AUTO}}}\label{ngram__model_8h_a406c0d64c15a9d1749d07c8ab6e0ae74a441701bf8ae0a2b79716feb31b5f257a} 
NGRAM\+\_\+\+AUTO&Determine file type automatically. \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{NGRAM\_ARPA@{NGRAM\_ARPA}!ngram\_model.h@{ngram\_model.h}}\index{ngram\_model.h@{ngram\_model.h}!NGRAM\_ARPA@{NGRAM\_ARPA}}}\label{ngram__model_8h_a406c0d64c15a9d1749d07c8ab6e0ae74a77ef2341d826b3cc8b836e3af1efba99} 
NGRAM\+\_\+\+ARPA&ARPABO text format (the standard). \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{NGRAM\_DMP@{NGRAM\_DMP}!ngram\_model.h@{ngram\_model.h}}\index{ngram\_model.h@{ngram\_model.h}!NGRAM\_DMP@{NGRAM\_DMP}}}\label{ngram__model_8h_a406c0d64c15a9d1749d07c8ab6e0ae74addfc3620d0fbc6f05f7f8e455245dd92} 
NGRAM\+\_\+\+DMP&Sphinx .DMP format. \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{NGRAM\_DMP32@{NGRAM\_DMP32}!ngram\_model.h@{ngram\_model.h}}\index{ngram\_model.h@{ngram\_model.h}!NGRAM\_DMP32@{NGRAM\_DMP32}}}\label{ngram__model_8h_a406c0d64c15a9d1749d07c8ab6e0ae74ab8fe83d2dec88c1c8cb4d82a8a528bb8} 
NGRAM\+\_\+\+DMP32&Sphinx .DMP32 format (NOT SUPPORTED) \\
\hline

\end{DoxyEnumFields}


Definition at line \textbf{ 76} of file \textbf{ ngram\+\_\+model.\+h}.



\doxysubsection{Function Documentation}
\label{ngram__model_8h_a8c06698fbcb0ef82420088ace045ae81} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_bg\_score@{ngram\_bg\_score}}
\index{ngram\_bg\_score@{ngram\_bg\_score}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_bg\_score()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int32 ngram\+\_\+bg\+\_\+score (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{model,  }\item[{int32}]{w2,  }\item[{int32}]{w1,  }\item[{int32 $\ast$}]{n\+\_\+used }\end{DoxyParamCaption})}



Quick bigram score lookup. 



Definition at line \textbf{ 564} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ ngram\+\_\+bg\+\_\+score()}, and \textbf{ ngram\+\_\+ng\+\_\+score()}.



Referenced by \textbf{ ngram\+\_\+bg\+\_\+score()}.

\label{ngram__model_8h_ad758d3f491d501bdec2ada8088e9b656} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_file\_name\_to\_type@{ngram\_file\_name\_to\_type}}
\index{ngram\_file\_name\_to\_type@{ngram\_file\_name\_to\_type}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_file\_name\_to\_type()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \textbf{ ngram\+\_\+file\+\_\+type\+\_\+t} ngram\+\_\+file\+\_\+name\+\_\+to\+\_\+type (\begin{DoxyParamCaption}\item[{const char $\ast$}]{file\+\_\+name }\end{DoxyParamCaption})}



Guess the file type for an N-\/\+Gram model from the filename. 

\begin{DoxyReturn}{Returns}
the guessed file type, or NGRAM\+\_\+\+INVALID if none could be guessed. 
\end{DoxyReturn}


Definition at line \textbf{ 64} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ NGRAM\+\_\+\+ARPA}, \textbf{ NGRAM\+\_\+\+DMP}, \textbf{ ngram\+\_\+file\+\_\+name\+\_\+to\+\_\+type()}, \textbf{ NGRAM\+\_\+\+INVALID}, \textbf{ strcmp\+\_\+nocase()}, and \textbf{ strncmp\+\_\+nocase()}.



Referenced by \textbf{ ngram\+\_\+file\+\_\+name\+\_\+to\+\_\+type()}, and \textbf{ ngram\+\_\+model\+\_\+write()}.

\label{ngram__model_8h_a24cb7b12a26032e8a03cba537b91a81e} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_iter@{ngram\_iter}}
\index{ngram\_iter@{ngram\_iter}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_iter()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \textbf{ ngram\+\_\+iter\+\_\+t} $\ast$ ngram\+\_\+iter (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{model,  }\item[{const char $\ast$}]{word,  }\item[{}]{... }\end{DoxyParamCaption})}



Get an iterator over M-\/grams pointing to the specified M-\/gram. 



Definition at line \textbf{ 702} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ ckd\+\_\+calloc}, \textbf{ ckd\+\_\+free()}, \textbf{ ngram\+\_\+iter()}, \textbf{ ngram\+\_\+ng\+\_\+iter()}, and \textbf{ ngram\+\_\+wid()}.



Referenced by \textbf{ ngram\+\_\+iter()}.

\label{ngram__model_8h_ac9f746c8a5db78ef8b2fb7c312be4a22} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_iter\_free@{ngram\_iter\_free}}
\index{ngram\_iter\_free@{ngram\_iter\_free}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_iter\_free()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void ngram\+\_\+iter\+\_\+free (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+iter\+\_\+t} $\ast$}]{itor }\end{DoxyParamCaption})}



Terminate an M-\/gram iterator. 



Definition at line \textbf{ 764} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ ckd\+\_\+free()}, \textbf{ ngram\+\_\+model\+\_\+s\+::funcs}, \textbf{ ngram\+\_\+funcs\+\_\+s\+::iter\+\_\+free}, \textbf{ ngram\+\_\+iter\+\_\+free()}, and \textbf{ ngram\+\_\+iter\+\_\+s\+::wids}.



Referenced by \textbf{ ngram\+\_\+iter\+\_\+free()}.

\label{ngram__model_8h_a82fb3f306fd5ed55a0f2f20621e4f556} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_iter\_get@{ngram\_iter\_get}}
\index{ngram\_iter\_get@{ngram\_iter\_get}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_iter\_get()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int32 const  $\ast$ ngram\+\_\+iter\+\_\+get (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+iter\+\_\+t} $\ast$}]{itor,  }\item[{int32 $\ast$}]{out\+\_\+score,  }\item[{int32 $\ast$}]{out\+\_\+bowt }\end{DoxyParamCaption})}



Get information from the current M-\/gram in an iterator. 


\begin{DoxyParams}{Parameters}
{\em out\+\_\+score} & Output\+: Score for this M-\/gram (including any word penalty and language weight). \\
\hline
{\em out\+\_\+bowt} & Output\+: Backoff weight for this M-\/gram. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
read-\/only array of word IDs. 
\end{DoxyReturn}


Definition at line \textbf{ 750} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ ngram\+\_\+model\+\_\+s\+::funcs}, \textbf{ ngram\+\_\+funcs\+\_\+s\+::iter\+\_\+get}, and \textbf{ ngram\+\_\+iter\+\_\+get()}.



Referenced by \textbf{ ngram\+\_\+iter\+\_\+get()}.

\label{ngram__model_8h_af0b222ee5fa4964a65a68d0e37cd0e28} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_iter\_next@{ngram\_iter\_next}}
\index{ngram\_iter\_next@{ngram\_iter\_next}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_iter\_next()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \textbf{ ngram\+\_\+iter\+\_\+t} $\ast$ ngram\+\_\+iter\+\_\+next (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+iter\+\_\+t} $\ast$}]{itor }\end{DoxyParamCaption})}



Advance an M-\/gram iterator. 



Definition at line \textbf{ 758} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ ngram\+\_\+model\+\_\+s\+::funcs}, \textbf{ ngram\+\_\+funcs\+\_\+s\+::iter\+\_\+next}, and \textbf{ ngram\+\_\+iter\+\_\+next()}.



Referenced by \textbf{ ngram\+\_\+iter\+\_\+next()}.

\label{ngram__model_8h_a542795b296dc6a612a155e0685461a8b} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_iter\_successors@{ngram\_iter\_successors}}
\index{ngram\_iter\_successors@{ngram\_iter\_successors}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_iter\_successors()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \textbf{ ngram\+\_\+iter\+\_\+t} $\ast$ ngram\+\_\+iter\+\_\+successors (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+iter\+\_\+t} $\ast$}]{itor }\end{DoxyParamCaption})}



Iterate over all M-\/gram successors of an M-\/1-\/gram. 


\begin{DoxyParams}{Parameters}
{\em itor} & Iterator pointing to the M-\/1-\/gram to get successors of. \\
\hline
\end{DoxyParams}


Definition at line \textbf{ 741} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ ngram\+\_\+model\+\_\+s\+::funcs}, \textbf{ ngram\+\_\+iter\+\_\+s\+::m}, \textbf{ ngram\+\_\+model\+\_\+s\+::n}, \textbf{ ngram\+\_\+iter\+\_\+successors()}, and \textbf{ ngram\+\_\+funcs\+\_\+s\+::successors}.



Referenced by \textbf{ ngram\+\_\+iter\+\_\+successors()}.

\label{ngram__model_8h_a0481b03a2bf03ef0a197da0a1f7d1caa} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_add\_class@{ngram\_model\_add\_class}}
\index{ngram\_model\_add\_class@{ngram\_model\_add\_class}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_add\_class()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int32 ngram\+\_\+model\+\_\+add\+\_\+class (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{model,  }\item[{const char $\ast$}]{classname,  }\item[{float32}]{classweight,  }\item[{char $\ast$$\ast$}]{words,  }\item[{const float32 $\ast$}]{weights,  }\item[{int32}]{n\+\_\+words }\end{DoxyParamCaption})}



Add a new class to a language model. 

If {\ttfamily classname} already exists in the unigram set for {\ttfamily model}, then it will be converted to a class tag, and {\ttfamily classweight} will be ignored. Otherwise, a new unigram will be created as in \doxyref{ngram\+\_\+model\+\_\+add\+\_\+word()}{p.}{ngram__model_8h_a38e034d58ee0d6a4c0dd6f852cb71c3c}. 

Definition at line \textbf{ 1005} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ ckd\+\_\+calloc}, \textbf{ ckd\+\_\+realloc}, \textbf{ ngram\+\_\+model\+\_\+s\+::classes}, \textbf{ E\+\_\+\+ERROR}, \textbf{ glist\+\_\+add\+\_\+float32()}, \textbf{ glist\+\_\+free()}, \textbf{ glist\+\_\+reverse()}, \textbf{ ngram\+\_\+model\+\_\+s\+::n\+\_\+classes}, \textbf{ NGRAM\+\_\+\+INVALID\+\_\+\+WID}, \textbf{ ngram\+\_\+model\+\_\+add\+\_\+class()}, \textbf{ ngram\+\_\+model\+\_\+add\+\_\+word()}, \textbf{ ngram\+\_\+unknown\+\_\+wid()}, and \textbf{ ngram\+\_\+wid()}.



Referenced by \textbf{ ngram\+\_\+model\+\_\+add\+\_\+class()}, \textbf{ ngram\+\_\+model\+\_\+read\+\_\+classdef()}, and \textbf{ ngram\+\_\+model\+\_\+set\+\_\+read()}.

\label{ngram__model_8h_a39eabb4994cf99c4bc2116e12af0c9f1} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_add\_class\_word@{ngram\_model\_add\_class\_word}}
\index{ngram\_model\_add\_class\_word@{ngram\_model\_add\_class\_word}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_add\_class\_word()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int32 ngram\+\_\+model\+\_\+add\+\_\+class\+\_\+word (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{model,  }\item[{const char $\ast$}]{classname,  }\item[{const char $\ast$}]{word,  }\item[{float32}]{weight }\end{DoxyParamCaption})}



Add a word to a class in a language model. 


\begin{DoxyParams}{Parameters}
{\em model} & The model to add a word to. \\
\hline
{\em classname} & Name of the class to add this word to. \\
\hline
{\em word} & Text of the word to add. \\
\hline
{\em weight} & Weight of this word relative to the within-\/class uniform distribution. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The word ID for the new word. 
\end{DoxyReturn}


Definition at line \textbf{ 955} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ ngram\+\_\+model\+\_\+s\+::classes}, \textbf{ E\+\_\+\+ERROR}, \textbf{ ngram\+\_\+model\+\_\+s\+::lmath}, \textbf{ logmath\+\_\+log()}, \textbf{ ngram\+\_\+model\+\_\+s\+::n\+\_\+classes}, \textbf{ ngram\+\_\+class\+\_\+s\+::n\+\_\+hash}, \textbf{ ngram\+\_\+class\+\_\+s\+::n\+\_\+hash\+\_\+inuse}, \textbf{ ngram\+\_\+class\+\_\+s\+::n\+\_\+words}, \textbf{ NGRAM\+\_\+\+INVALID\+\_\+\+WID}, \textbf{ ngram\+\_\+model\+\_\+add\+\_\+class\+\_\+word()}, \textbf{ ngram\+\_\+wid()}, \textbf{ ngram\+\_\+class\+\_\+s\+::prob1}, \textbf{ ngram\+\_\+class\+\_\+s\+::ngram\+\_\+hash\+\_\+s\+::prob1}, \textbf{ ngram\+\_\+class\+\_\+s\+::tag\+\_\+wid}, and \textbf{ ngram\+\_\+class\+\_\+s\+::ngram\+\_\+hash\+\_\+s\+::wid}.



Referenced by \textbf{ ngram\+\_\+model\+\_\+add\+\_\+class\+\_\+word()}.

\label{ngram__model_8h_a38e034d58ee0d6a4c0dd6f852cb71c3c} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_add\_word@{ngram\_model\_add\_word}}
\index{ngram\_model\_add\_word@{ngram\_model\_add\_word}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_add\_word()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int32 ngram\+\_\+model\+\_\+add\+\_\+word (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{model,  }\item[{const char $\ast$}]{word,  }\item[{float32}]{weight }\end{DoxyParamCaption})}



Add a word (unigram) to the language model. 

\begin{DoxyNote}{Note}
The semantics of this are not particularly well-\/defined for model sets, and may be subject to change. Currently this will add the word to all of the submodels
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
{\em model} & The model to add a word to. \\
\hline
{\em word} & Text of the word to add. \\
\hline
{\em weight} & Weight of this word relative to the uniform distribution. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The word ID for the new word. 
\end{DoxyReturn}


Definition at line \textbf{ 832} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ ngram\+\_\+funcs\+\_\+s\+::add\+\_\+ug}, \textbf{ E\+\_\+\+WARN}, \textbf{ ngram\+\_\+model\+\_\+s\+::funcs}, \textbf{ ngram\+\_\+model\+\_\+s\+::lmath}, \textbf{ ngram\+\_\+model\+\_\+s\+::log\+\_\+zero}, \textbf{ logmath\+\_\+log()}, \textbf{ NGRAM\+\_\+\+INVALID\+\_\+\+WID}, \textbf{ ngram\+\_\+model\+\_\+add\+\_\+word()}, and \textbf{ ngram\+\_\+model\+\_\+s\+::writable}.



Referenced by \textbf{ ngram\+\_\+model\+\_\+add\+\_\+class()}, and \textbf{ ngram\+\_\+model\+\_\+add\+\_\+word()}.

\label{ngram__model_8h_aa4b8d7c1f3d873b8458c0cfee13af4da} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_apply\_weights@{ngram\_model\_apply\_weights}}
\index{ngram\_model\_apply\_weights@{ngram\_model\_apply\_weights}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_apply\_weights()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int ngram\+\_\+model\+\_\+apply\+\_\+weights (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{model,  }\item[{float32}]{lw,  }\item[{float32}]{wip,  }\item[{float32}]{uw }\end{DoxyParamCaption})}



Apply a language weight, insertion penalty, and unigram weight to a language model. 

This will change the values output by \doxyref{ngram\+\_\+score()}{p.}{ngram__model_8h_a9c23d79885af400e17ac2a1b7169660d} and friends. This is done for efficiency since in decoding, these are the only values we actually need. Call \doxyref{ngram\+\_\+prob()}{p.}{ngram__model_8h_a68cfda3f503e1a4a87f08aa5a3a5ea88} if you want the "{}raw"{} N-\/\+Gram probability estimate.

To remove all weighting, call ngram\+\_\+apply\+\_\+weights(model, 1.\+0, 1.\+0, 1.\+0). 

Definition at line \textbf{ 477} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ ngram\+\_\+funcs\+\_\+s\+::apply\+\_\+weights}, \textbf{ ngram\+\_\+model\+\_\+s\+::funcs}, and \textbf{ ngram\+\_\+model\+\_\+apply\+\_\+weights()}.



Referenced by \textbf{ ngram\+\_\+model\+\_\+apply\+\_\+weights()}, and \textbf{ ngram\+\_\+model\+\_\+read()}.

\label{ngram__model_8h_a41b938a2c4b129dc0df37b2312d65506} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_casefold@{ngram\_model\_casefold}}
\index{ngram\_model\_casefold@{ngram\_model\_casefold}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_casefold()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int ngram\+\_\+model\+\_\+casefold (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{model,  }\item[{int}]{kase }\end{DoxyParamCaption})}



Case-\/fold word strings in an N-\/\+Gram model. 

WARNING\+: This is not Unicode aware, so any non-\/\+ASCII characters will not be converted. 

Definition at line \textbf{ 299} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ ckd\+\_\+salloc}, \textbf{ E\+\_\+\+WARN}, \textbf{ hash\+\_\+table\+\_\+enter\+\_\+int32}, \textbf{ hash\+\_\+table\+\_\+free()}, \textbf{ hash\+\_\+table\+\_\+new()}, \textbf{ lcase()}, \textbf{ ngram\+\_\+model\+\_\+s\+::n\+\_\+words}, \textbf{ ngram\+\_\+model\+\_\+casefold()}, \textbf{ ucase()}, \textbf{ ngram\+\_\+model\+\_\+s\+::wid}, \textbf{ ngram\+\_\+model\+\_\+s\+::word\+\_\+str}, and \textbf{ ngram\+\_\+model\+\_\+s\+::writable}.



Referenced by \textbf{ ngram\+\_\+model\+\_\+casefold()}.

\label{ngram__model_8h_a8304f56d82278824b0a94c254d7235aa} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_flush@{ngram\_model\_flush}}
\index{ngram\_model\_flush@{ngram\_model\_flush}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_flush()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void ngram\+\_\+model\+\_\+flush (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{lm }\end{DoxyParamCaption})}



Flush any cached N-\/\+Gram information. 

Some types of models cache trigram or other N-\/\+Gram information to speed repeated access to N-\/\+Grams with shared histories. This function flushes the cache so as to avoid dynamic memory leaks. 

Definition at line \textbf{ 247} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ ngram\+\_\+funcs\+\_\+s\+::flush}, \textbf{ ngram\+\_\+model\+\_\+s\+::funcs}, and \textbf{ ngram\+\_\+model\+\_\+flush()}.



Referenced by \textbf{ ngram\+\_\+model\+\_\+flush()}.

\label{ngram__model_8h_aec73d28e7285e539a0b44a7ac0cbe489} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_free@{ngram\_model\_free}}
\index{ngram\_model\_free@{ngram\_model\_free}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_free()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int ngram\+\_\+model\+\_\+free (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{model }\end{DoxyParamCaption})}



Release memory associated with an N-\/\+Gram model. 

\begin{DoxyReturn}{Returns}
new reference count (0 if freed completely) 
\end{DoxyReturn}


Definition at line \textbf{ 254} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ ckd\+\_\+free()}, \textbf{ ngram\+\_\+model\+\_\+s\+::classes}, \textbf{ ngram\+\_\+funcs\+\_\+s\+::free}, \textbf{ ngram\+\_\+model\+\_\+s\+::funcs}, \textbf{ hash\+\_\+table\+\_\+free()}, \textbf{ ngram\+\_\+model\+\_\+s\+::n\+\_\+classes}, \textbf{ ngram\+\_\+model\+\_\+s\+::n\+\_\+counts}, \textbf{ ngram\+\_\+class\+\_\+s\+::n\+\_\+hash}, \textbf{ ngram\+\_\+model\+\_\+s\+::n\+\_\+words}, \textbf{ ngram\+\_\+class\+\_\+s\+::n\+\_\+words}, \textbf{ ngram\+\_\+model\+\_\+free()}, \textbf{ ngram\+\_\+model\+\_\+s\+::refcount}, \textbf{ ngram\+\_\+class\+\_\+s\+::start\+\_\+wid}, \textbf{ ngram\+\_\+model\+\_\+s\+::wid}, \textbf{ ngram\+\_\+class\+\_\+s\+::ngram\+\_\+hash\+\_\+s\+::wid}, \textbf{ ngram\+\_\+model\+\_\+s\+::word\+\_\+str}, and \textbf{ ngram\+\_\+model\+\_\+s\+::writable}.



Referenced by \textbf{ ngram\+\_\+model\+\_\+free()}, and \textbf{ ngram\+\_\+model\+\_\+set\+\_\+read()}.

\label{ngram__model_8h_a3c3d9a5a90beb644474d3f28508e24a2} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_get\_counts@{ngram\_model\_get\_counts}}
\index{ngram\_model\_get\_counts@{ngram\_model\_get\_counts}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_get\_counts()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int32 const  $\ast$ ngram\+\_\+model\+\_\+get\+\_\+counts (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{model }\end{DoxyParamCaption})}



Get the counts of the various N-\/grams in the model. 



Definition at line \textbf{ 671} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ ngram\+\_\+model\+\_\+s\+::n\+\_\+counts}, and \textbf{ ngram\+\_\+model\+\_\+get\+\_\+counts()}.



Referenced by \textbf{ ngram\+\_\+model\+\_\+get\+\_\+counts()}.

\label{ngram__model_8h_a462d374099a4fe8b3c3195b5e2013545} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_get\_size@{ngram\_model\_get\_size}}
\index{ngram\_model\_get\_size@{ngram\_model\_get\_size}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_get\_size()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int32 ngram\+\_\+model\+\_\+get\+\_\+size (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{model }\end{DoxyParamCaption})}



Get the order of the N-\/gram model (i.\+e. 

the "{}\+N"{} in "{}\+N-\/gram"{}) 

Definition at line \textbf{ 663} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ ngram\+\_\+model\+\_\+s\+::n}, and \textbf{ ngram\+\_\+model\+\_\+get\+\_\+size()}.



Referenced by \textbf{ ngram\+\_\+model\+\_\+get\+\_\+size()}.

\label{ngram__model_8h_a30170c1307e065e1f7159a04f75df304} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_get\_weights@{ngram\_model\_get\_weights}}
\index{ngram\_model\_get\_weights@{ngram\_model\_get\_weights}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_get\_weights()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT float32 ngram\+\_\+model\+\_\+get\+\_\+weights (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{model,  }\item[{int32 $\ast$}]{out\+\_\+log\+\_\+wip,  }\item[{int32 $\ast$}]{out\+\_\+log\+\_\+uw }\end{DoxyParamCaption})}



Get the current weights from a language model. 


\begin{DoxyParams}{Parameters}
{\em model} & The model in question. \\
\hline
{\em out\+\_\+log\+\_\+wip} & Output\+: (optional) logarithm of word insertion penalty. \\
\hline
{\em out\+\_\+log\+\_\+uw} & Output\+: (optional) logarithm of unigram weight. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
language weight. 
\end{DoxyReturn}


Definition at line \textbf{ 484} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ ngram\+\_\+model\+\_\+s\+::log\+\_\+uw}, \textbf{ ngram\+\_\+model\+\_\+s\+::log\+\_\+wip}, \textbf{ ngram\+\_\+model\+\_\+s\+::lw}, and \textbf{ ngram\+\_\+model\+\_\+get\+\_\+weights()}.



Referenced by \textbf{ ngram\+\_\+model\+\_\+get\+\_\+weights()}.

\label{ngram__model_8h_ae2df14a6cdc29edc8f550fa6156cc1ba} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_mgrams@{ngram\_model\_mgrams}}
\index{ngram\_model\_mgrams@{ngram\_model\_mgrams}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_mgrams()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \textbf{ ngram\+\_\+iter\+\_\+t} $\ast$ ngram\+\_\+model\+\_\+mgrams (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{model,  }\item[{int}]{m }\end{DoxyParamCaption})}



Iterate over all M-\/grams. 


\begin{DoxyParams}{Parameters}
{\em model} & Language model to query. \\
\hline
{\em m} & Order of the M-\/\+Grams requested minus one (i.\+e. order of the history) \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
An iterator over the requested M, or NULL if no N-\/grams of order M+1 exist. 
\end{DoxyReturn}


Definition at line \textbf{ 689} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ ngram\+\_\+model\+\_\+s\+::funcs}, \textbf{ ngram\+\_\+funcs\+\_\+s\+::mgrams}, \textbf{ ngram\+\_\+model\+\_\+s\+::n}, and \textbf{ ngram\+\_\+model\+\_\+mgrams()}.



Referenced by \textbf{ ngram\+\_\+model\+\_\+mgrams()}.

\label{ngram__model_8h_a809010539601085cba9e4a336dbff5bb} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_read@{ngram\_model\_read}}
\index{ngram\_model\_read@{ngram\_model\_read}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_read()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \textbf{ ngram\+\_\+model\+\_\+t} $\ast$ ngram\+\_\+model\+\_\+read (\begin{DoxyParamCaption}\item[{\textbf{ cmd\+\_\+ln\+\_\+t} $\ast$}]{config,  }\item[{const char $\ast$}]{file\+\_\+name,  }\item[{\textbf{ ngram\+\_\+file\+\_\+type\+\_\+t}}]{file\+\_\+type,  }\item[{\textbf{ logmath\+\_\+t} $\ast$}]{lmath }\end{DoxyParamCaption})}



Read an N-\/\+Gram model from a file on disk. 


\begin{DoxyParams}{Parameters}
{\em config} & Optional pointer to a set of command-\/line arguments. Recognized arguments are\+:\\
\hline
\end{DoxyParams}

\begin{DoxyItemize}
\item -\/mmap (boolean) whether to use memory-\/mapped I/O
\item -\/lw (float32) language weight to apply to the model
\item -\/wip (float32) word insertion penalty to apply to the model
\item -\/uw (float32) unigram weight to apply to the model
\end{DoxyItemize}


\begin{DoxyParams}{Parameters}
{\em file\+\_\+name} & path to the file to read. \\
\hline
{\em file\+\_\+type} & type of the file, or NGRAM\+\_\+\+AUTO to determine automatically. \\
\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_adad8494649ef2e49cde1c5ad3ccbe072}. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
newly created ngram\+\_\+model\+\_\+t. 
\end{DoxyReturn}


Definition at line \textbf{ 121} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ cmd\+\_\+ln\+\_\+exists\+\_\+r()}, \textbf{ E\+\_\+\+ERROR}, \textbf{ NGRAM\+\_\+\+ARPA}, \textbf{ NGRAM\+\_\+\+AUTO}, \textbf{ NGRAM\+\_\+\+DMP}, \textbf{ ngram\+\_\+model\+\_\+apply\+\_\+weights()}, and \textbf{ ngram\+\_\+model\+\_\+read()}.



Referenced by \textbf{ ngram\+\_\+model\+\_\+read()}, and \textbf{ ngram\+\_\+model\+\_\+set\+\_\+read()}.

\label{ngram__model_8h_a9b2a86c23543158754373c5456fe890d} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_read\_classdef@{ngram\_model\_read\_classdef}}
\index{ngram\_model\_read\_classdef@{ngram\_model\_read\_classdef}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_read\_classdef()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int32 ngram\+\_\+model\+\_\+read\+\_\+classdef (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{model,  }\item[{const char $\ast$}]{file\+\_\+name }\end{DoxyParamCaption})}



Read a class definition file and add classes to a language model. 

This function assumes that the class tags have already been defined as unigrams in the language model. All words in the class definition will be added to the lexicon as special in-\/class words. For this reason is is necessary that they not have the same names as any words in the general unigram distribution. The convention is to suffix them with "{}\+:class\+\_\+tag"{}, where class\+\_\+tag is the class tag minus the enclosing square brackets.

\begin{DoxyReturn}{Returns}
0 for success, $<$0 for error 
\end{DoxyReturn}


Definition at line \textbf{ 1199} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ ckd\+\_\+free()}, \textbf{ glist\+\_\+free()}, \textbf{ gnode\+\_\+ptr}, \textbf{ hash\+\_\+table\+\_\+free()}, \textbf{ hash\+\_\+table\+\_\+new()}, \textbf{ hash\+\_\+table\+\_\+tolist()}, \textbf{ ngram\+\_\+model\+\_\+add\+\_\+class()}, \textbf{ ngram\+\_\+model\+\_\+read\+\_\+classdef()}, and \textbf{ hash\+\_\+entry\+\_\+s\+::val}.



Referenced by \textbf{ ngram\+\_\+model\+\_\+read\+\_\+classdef()}.

\label{ngram__model_8h_aac2b3fd054597c2fdfbb59db97d72ec0} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_recode@{ngram\_model\_recode}}
\index{ngram\_model\_recode@{ngram\_model\_recode}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_recode()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int ngram\+\_\+model\+\_\+recode (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{model,  }\item[{const char $\ast$}]{from,  }\item[{const char $\ast$}]{to }\end{DoxyParamCaption})}



Re-\/encode word strings in an N-\/\+Gram model. 

Character set names are the same as those passed to iconv(1). If your system does not have iconv, this function may fail. Also, because all file formats consist of 8-\/bit character streams, attempting to convert to or from UTF-\/16 (or any other encoding which contains null bytes) is a recipe for total desaster.

We have no interest in supporting UTF-\/16, so don\textquotesingle{}t ask.

Note that this does not affect any pronunciation dictionary you might currently be using in conjunction with this N-\/\+Gram model, so the effect of calling this during decoding is undefined. That\textquotesingle{}s a bug! 

Definition at line \textbf{ 470} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ ngram\+\_\+model\+\_\+recode()}.



Referenced by \textbf{ ngram\+\_\+model\+\_\+recode()}.

\label{ngram__model_8h_aed0f2c24935670273ab026d0afa87e5e} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_retain@{ngram\_model\_retain}}
\index{ngram\_model\_retain@{ngram\_model\_retain}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_retain()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \textbf{ ngram\+\_\+model\+\_\+t} $\ast$ ngram\+\_\+model\+\_\+retain (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{model }\end{DoxyParamCaption})}



Retain ownership of an N-\/\+Gram model. 

\begin{DoxyReturn}{Returns}
Pointer to retained model. 
\end{DoxyReturn}


Definition at line \textbf{ 239} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ ngram\+\_\+model\+\_\+retain()}, and \textbf{ ngram\+\_\+model\+\_\+s\+::refcount}.



Referenced by \textbf{ ngram\+\_\+model\+\_\+retain()}.

\label{ngram__model_8h_ab2ed6f84df46991d2b86bdf22731b55d} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_set\_add@{ngram\_model\_set\_add}}
\index{ngram\_model\_set\_add@{ngram\_model\_set\_add}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_set\_add()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \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 \textbf{ 520} of file \textbf{ ngram\+\_\+model\+\_\+set.\+c}.



References \textbf{ ckd\+\_\+calloc\+\_\+2d}, \textbf{ ckd\+\_\+free\+\_\+2d()}, \textbf{ ckd\+\_\+realloc}, \textbf{ ckd\+\_\+salloc}, \textbf{ ngram\+\_\+model\+\_\+s\+::lmath}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::lms}, \textbf{ logmath\+\_\+log()}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::lweights}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::maphist}, \textbf{ ngram\+\_\+model\+\_\+s\+::n}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::n\+\_\+models}, \textbf{ ngram\+\_\+model\+\_\+s\+::n\+\_\+words}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::names}, \textbf{ ngram\+\_\+wid()}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::widmap}, and \textbf{ ngram\+\_\+model\+\_\+s\+::word\+\_\+str}.

\label{ngram__model_8h_a22b8f5f49231b4aef3d5a166ea7155b6} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_set\_count@{ngram\_model\_set\_count}}
\index{ngram\_model\_set\_count@{ngram\_model\_set\_count}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_set\_count()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int32 ngram\+\_\+model\+\_\+set\+\_\+count (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{set }\end{DoxyParamCaption})}



Returns the number of language models in a set. 



Definition at line \textbf{ 361} of file \textbf{ ngram\+\_\+model\+\_\+set.\+c}.



References \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::n\+\_\+models}.

\label{ngram__model_8h_a3a2a8af08fa47df239f28889b6e1ef57} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_set\_current@{ngram\_model\_set\_current}}
\index{ngram\_model\_set\_current@{ngram\_model\_set\_current}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_set\_current()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT const char $\ast$ ngram\+\_\+model\+\_\+set\+\_\+current (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{set }\end{DoxyParamCaption})}



Get the current language model name, if any. 



Definition at line \textbf{ 445} of file \textbf{ ngram\+\_\+model\+\_\+set.\+c}.



References \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::cur}, and \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::names}.

\label{ngram__model_8h_af783553aa7527b7544d093aaea74d97a} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_set\_current\_wid@{ngram\_model\_set\_current\_wid}}
\index{ngram\_model\_set\_current\_wid@{ngram\_model\_set\_current\_wid}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_set\_current\_wid()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT 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 NGRAM\+\_\+\+INVALID\+\_\+\+WID if {\ttfamily set\+\_\+wid} is invalid or interpolation is enabled. 
\end{DoxyReturn}


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



References \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::cur}, \textbf{ ngram\+\_\+model\+\_\+s\+::n\+\_\+words}, \textbf{ NGRAM\+\_\+\+INVALID\+\_\+\+WID}, and \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::widmap}.

\label{ngram__model_8h_a591eee716c0f8eb3cdea62276a616f64} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_set\_init@{ngram\_model\_set\_init}}
\index{ngram\_model\_set\_init@{ngram\_model\_set\_init}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_set\_init()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \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 IDs. 

This function creates a meta-\/language model which groups together a set of language models, synchronizing word IDs 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_aceac963816f86190d835838f27f94569}, or interpolate between scores from all models. To do the latter, you can either pass a non-\/\+NULL value of the {\ttfamily weights} parameter, or re-\/activate interpolation later on by calling \doxyref{ngram\+\_\+model\+\_\+set\+\_\+interp()}{p.}{ngram__model_8h_acdf2c7991417a4bf175fe37404a6764c}.

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 LMs. \\
\hline
{\em weights} & Array of weights to use in interpolating LMs, or NULL for no interpolation. \\
\hline
{\em n\+\_\+models} & Number of elements in the arrays passed to this function. \\
\hline
\end{DoxyParams}


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



References \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::base}, \textbf{ ckd\+\_\+calloc}, \textbf{ ckd\+\_\+salloc}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::cur}, \textbf{ E\+\_\+\+ERROR}, \textbf{ ngram\+\_\+model\+\_\+s\+::lmath}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::lms}, \textbf{ logmath\+\_\+get\+\_\+base()}, \textbf{ logmath\+\_\+get\+\_\+shift()}, \textbf{ logmath\+\_\+log()}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::lweights}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::maphist}, \textbf{ ngram\+\_\+model\+\_\+s\+::n}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::n\+\_\+models}, and \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::names}.



Referenced by \textbf{ ngram\+\_\+model\+\_\+set\+\_\+read()}.

\label{ngram__model_8h_acdf2c7991417a4bf175fe37404a6764c} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_set\_interp@{ngram\_model\_set\_interp}}
\index{ngram\_model\_set\_interp@{ngram\_model\_set\_interp}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_set\_interp()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \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 NULL, any previously initialized set of weights will be used. If no weights were specified to \doxyref{ngram\+\_\+model\+\_\+set\+\_\+init()}{p.}{ngram__model_8h_a591eee716c0f8eb3cdea62276a616f64}, then a uniform distribution will be used. 

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



References \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::cur}, \textbf{ E\+\_\+\+ERROR}, \textbf{ ngram\+\_\+model\+\_\+s\+::lmath}, \textbf{ logmath\+\_\+log()}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::lweights}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::n\+\_\+models}, and \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::names}.

\label{ngram__model_8h_a6da40994c9e2bd87f24aa58c1e18c299} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_set\_iter@{ngram\_model\_set\_iter}}
\index{ngram\_model\_set\_iter@{ngram\_model\_set\_iter}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_set\_iter()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \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 NULL if no models remain. 
\end{DoxyReturn}


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



References \textbf{ ckd\+\_\+calloc}, and \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::n\+\_\+models}.

\label{ngram__model_8h_ae5b58f360ab6432528ffaead1d2b2a2d} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_set\_iter\_free@{ngram\_model\_set\_iter\_free}}
\index{ngram\_model\_set\_iter\_free@{ngram\_model\_set\_iter\_free}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_set\_iter\_free()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+free (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+t} $\ast$}]{itor }\end{DoxyParamCaption})}



Finish iteration over a langauge model set. 



Definition at line \textbf{ 391} of file \textbf{ ngram\+\_\+model\+\_\+set.\+c}.



References \textbf{ ckd\+\_\+free()}.



Referenced by \textbf{ ngram\+\_\+model\+\_\+set\+\_\+iter\+\_\+next()}.

\label{ngram__model_8h_abac4f5ac6c901791bf733e9f468efd4b} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_set\_iter\_model@{ngram\_model\_set\_iter\_model}}
\index{ngram\_model\_set\_iter\_model@{ngram\_model\_set\_iter\_model}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_set\_iter\_model()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \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 \textbf{ 397} of file \textbf{ ngram\+\_\+model\+\_\+set.\+c}.



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

\label{ngram__model_8h_aa2c5c7be9a177248982167780abffbd0} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_set\_iter\_next@{ngram\_model\_set\_iter\_next}}
\index{ngram\_model\_set\_iter\_next@{ngram\_model\_set\_iter\_next}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_set\_iter\_next()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \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 NULL if no models remain. 
\end{DoxyReturn}


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



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

\label{ngram__model_8h_ad87975912cfe1ac5d0c3ebe12de79209} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_set\_known\_wid@{ngram\_model\_set\_known\_wid}}
\index{ngram\_model\_set\_known\_wid@{ngram\_model\_set\_known\_wid}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_set\_known\_wid()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT 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 \textbf{ 468} of file \textbf{ ngram\+\_\+model\+\_\+set.\+c}.



References \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::cur}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::lms}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::n\+\_\+models}, \textbf{ ngram\+\_\+model\+\_\+s\+::n\+\_\+words}, \textbf{ ngram\+\_\+unknown\+\_\+wid()}, and \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::widmap}.

\label{ngram__model_8h_a094578952fcb27f91882fd33dfc41dbc} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_set\_lookup@{ngram\_model\_set\_lookup}}
\index{ngram\_model\_set\_lookup@{ngram\_model\_set\_lookup}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_set\_lookup()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \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 NULL if no language model by that name exists. 
\end{DoxyReturn}


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



References \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::cur}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::lms}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::n\+\_\+models}, and \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::names}.

\label{ngram__model_8h_a3e8abe87ae12cfbe1b79fd99213abe2d} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_set\_map\_words@{ngram\_model\_set\_map\_words}}
\index{ngram\_model\_set\_map\_words@{ngram\_model\_set\_map\_words}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_set\_map\_words()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void ngram\+\_\+model\+\_\+set\+\_\+map\+\_\+words (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{set,  }\item[{const char $\ast$$\ast$}]{words,  }\item[{int32}]{n\+\_\+words }\end{DoxyParamCaption})}



Set the word-\/to-\/\+ID mapping for this model set. 



Definition at line \textbf{ 637} of file \textbf{ ngram\+\_\+model\+\_\+set.\+c}.



References \textbf{ ckd\+\_\+calloc}, \textbf{ ckd\+\_\+calloc\+\_\+2d}, \textbf{ ckd\+\_\+free()}, \textbf{ ckd\+\_\+free\+\_\+2d()}, \textbf{ ckd\+\_\+salloc}, \textbf{ hash\+\_\+table\+\_\+empty()}, \textbf{ hash\+\_\+table\+\_\+enter\+\_\+int32}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::lms}, \textbf{ ngram\+\_\+model\+\_\+s\+::n\+\_\+1g\+\_\+alloc}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::n\+\_\+models}, \textbf{ ngram\+\_\+model\+\_\+s\+::n\+\_\+words}, \textbf{ ngram\+\_\+wid()}, \textbf{ ngram\+\_\+model\+\_\+s\+::wid}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::widmap}, \textbf{ ngram\+\_\+model\+\_\+s\+::word\+\_\+str}, and \textbf{ ngram\+\_\+model\+\_\+s\+::writable}.

\label{ngram__model_8h_a2604c0a8b4a0482ca552950ea5685108} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_set\_read@{ngram\_model\_set\_read}}
\index{ngram\_model\_set\_read@{ngram\_model\_set\_read}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_set\_read()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \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 "{}control file"{} of the type used in Sphinx-\/\+II and Sphinx-\/\+III. 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\+LMFilen\+Name and LMName pairs. The new format allows a set of LMClass files to be read in and referred to by the trigram LMs.

No "{}comments"{} 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_adad8494649ef2e49cde1c5ad3ccbe072}. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
newly created language model set. 
\end{DoxyReturn}


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



References \textbf{ ckd\+\_\+calloc}, \textbf{ ckd\+\_\+free()}, \textbf{ ckd\+\_\+salloc}, \textbf{ E\+\_\+\+ERROR}, \textbf{ E\+\_\+\+ERROR\+\_\+\+SYSTEM}, \textbf{ E\+\_\+\+INFO}, \textbf{ glist\+\_\+add\+\_\+ptr()}, \textbf{ glist\+\_\+count()}, \textbf{ glist\+\_\+free()}, \textbf{ glist\+\_\+reverse()}, \textbf{ gnode\+\_\+ptr}, \textbf{ hash\+\_\+table\+\_\+free()}, \textbf{ hash\+\_\+table\+\_\+lookup()}, \textbf{ hash\+\_\+table\+\_\+new()}, \textbf{ hash\+\_\+table\+\_\+tolist()}, \textbf{ NGRAM\+\_\+\+AUTO}, \textbf{ ngram\+\_\+model\+\_\+add\+\_\+class()}, \textbf{ ngram\+\_\+model\+\_\+free()}, \textbf{ ngram\+\_\+model\+\_\+read()}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+init()}, \textbf{ path\+\_\+is\+\_\+absolute()}, \textbf{ string\+\_\+join()}, and \textbf{ hash\+\_\+entry\+\_\+s\+::val}.

\label{ngram__model_8h_adbf6a18ce619ca944c6bd3f0174bc8ba} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_set\_remove@{ngram\_model\_set\_remove}}
\index{ngram\_model\_set\_remove@{ngram\_model\_set\_remove}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_set\_remove()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \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 \textbf{ 580} of file \textbf{ ngram\+\_\+model\+\_\+set.\+c}.



References \textbf{ ckd\+\_\+free()}, \textbf{ ngram\+\_\+model\+\_\+s\+::lmath}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::lms}, \textbf{ ngram\+\_\+model\+\_\+s\+::log\+\_\+zero}, \textbf{ logmath\+\_\+exp()}, \textbf{ logmath\+\_\+log()}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::lweights}, \textbf{ ngram\+\_\+model\+\_\+s\+::n}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::n\+\_\+models}, \textbf{ ngram\+\_\+model\+\_\+s\+::n\+\_\+words}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::names}, and \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::widmap}.

\label{ngram__model_8h_aceac963816f86190d835838f27f94569} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_set\_select@{ngram\_model\_set\_select}}
\index{ngram\_model\_set\_select@{ngram\_model\_set\_select}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_set\_select()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \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 NULL if no language model by that name exists. 
\end{DoxyReturn}


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



References \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::cur}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::lms}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::n\+\_\+models}, and \textbf{ ngram\+\_\+model\+\_\+set\+\_\+s\+::names}.

\label{ngram__model_8h_ac8ff04e1bccbef23bde9e81fb61c57fe} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_model\_write@{ngram\_model\_write}}
\index{ngram\_model\_write@{ngram\_model\_write}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_model\_write()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int ngram\+\_\+model\+\_\+write (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{model,  }\item[{const char $\ast$}]{file\+\_\+name,  }\item[{\textbf{ ngram\+\_\+file\+\_\+type\+\_\+t}}]{format }\end{DoxyParamCaption})}



Write an N-\/\+Gram model to disk. 

\begin{DoxyReturn}{Returns}
0 for success, $<$0 on error 
\end{DoxyReturn}


Definition at line \textbf{ 167} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ E\+\_\+\+ERROR}, \textbf{ NGRAM\+\_\+\+ARPA}, \textbf{ NGRAM\+\_\+\+AUTO}, \textbf{ NGRAM\+\_\+\+DMP}, \textbf{ ngram\+\_\+file\+\_\+name\+\_\+to\+\_\+type()}, \textbf{ NGRAM\+\_\+\+INVALID}, and \textbf{ ngram\+\_\+model\+\_\+write()}.



Referenced by \textbf{ ngram\+\_\+model\+\_\+write()}.

\label{ngram__model_8h_a351ef5d95359bfd5a863fae1b4dbba94} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_ng\_iter@{ngram\_ng\_iter}}
\index{ngram\_ng\_iter@{ngram\_ng\_iter}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_ng\_iter()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \textbf{ ngram\+\_\+iter\+\_\+t} $\ast$ ngram\+\_\+ng\+\_\+iter (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{model,  }\item[{int32}]{wid,  }\item[{int32 $\ast$}]{history,  }\item[{int32}]{n\+\_\+hist }\end{DoxyParamCaption})}



Get an iterator over M-\/grams pointing to the specified M-\/gram. 



Definition at line \textbf{ 731} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ ngram\+\_\+model\+\_\+s\+::funcs}, \textbf{ ngram\+\_\+funcs\+\_\+s\+::iter}, \textbf{ ngram\+\_\+model\+\_\+s\+::n}, and \textbf{ ngram\+\_\+ng\+\_\+iter()}.



Referenced by \textbf{ ngram\+\_\+iter()}, and \textbf{ ngram\+\_\+ng\+\_\+iter()}.

\label{ngram__model_8h_a218d8d140b93d3d8008f8933f9e04ec6} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_ng\_prob@{ngram\_ng\_prob}}
\index{ngram\_ng\_prob@{ngram\_ng\_prob}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_ng\_prob()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int32 ngram\+\_\+ng\+\_\+prob (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{model,  }\item[{int32}]{wid,  }\item[{int32 $\ast$}]{history,  }\item[{int32}]{n\+\_\+hist,  }\item[{int32 $\ast$}]{n\+\_\+used }\end{DoxyParamCaption})}



Quick "{}raw"{} probability lookup for a general N-\/\+Gram. 

See documentation for \doxyref{ngram\+\_\+ng\+\_\+score()}{p.}{ngram__model_8h_a6ac5799e78ea4ad82a11e2439016471e} and ngram\+\_\+apply\+\_\+weights() for an explanation of this. 

Definition at line \textbf{ 570} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ ngram\+\_\+model\+\_\+s\+::classes}, \textbf{ ngram\+\_\+model\+\_\+s\+::funcs}, \textbf{ ngram\+\_\+model\+\_\+s\+::log\+\_\+zero}, \textbf{ NGRAM\+\_\+\+INVALID\+\_\+\+WID}, \textbf{ ngram\+\_\+ng\+\_\+prob()}, \textbf{ ngram\+\_\+funcs\+\_\+s\+::raw\+\_\+score}, and \textbf{ ngram\+\_\+class\+\_\+s\+::tag\+\_\+wid}.



Referenced by \textbf{ ngram\+\_\+ng\+\_\+prob()}, and \textbf{ ngram\+\_\+prob()}.

\label{ngram__model_8h_a6ac5799e78ea4ad82a11e2439016471e} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_ng\_score@{ngram\_ng\_score}}
\index{ngram\_ng\_score@{ngram\_ng\_score}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_ng\_score()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int32 ngram\+\_\+ng\+\_\+score (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{model,  }\item[{int32}]{wid,  }\item[{int32 $\ast$}]{history,  }\item[{int32}]{n\+\_\+hist,  }\item[{int32 $\ast$}]{n\+\_\+used }\end{DoxyParamCaption})}



Quick general N-\/\+Gram score lookup. 



Definition at line \textbf{ 494} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ ngram\+\_\+model\+\_\+s\+::classes}, \textbf{ ngram\+\_\+model\+\_\+s\+::funcs}, \textbf{ ngram\+\_\+model\+\_\+s\+::log\+\_\+zero}, \textbf{ NGRAM\+\_\+\+INVALID\+\_\+\+WID}, \textbf{ ngram\+\_\+ng\+\_\+score()}, \textbf{ ngram\+\_\+funcs\+\_\+s\+::score}, and \textbf{ ngram\+\_\+class\+\_\+s\+::tag\+\_\+wid}.



Referenced by \textbf{ ngram\+\_\+bg\+\_\+score()}, \textbf{ ngram\+\_\+ng\+\_\+score()}, \textbf{ ngram\+\_\+score()}, and \textbf{ ngram\+\_\+tg\+\_\+score()}.

\label{ngram__model_8h_a68cfda3f503e1a4a87f08aa5a3a5ea88} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_prob@{ngram\_prob}}
\index{ngram\_prob@{ngram\_prob}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_prob()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int32 ngram\+\_\+prob (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{model,  }\item[{const char $\ast$}]{word,  }\item[{}]{... }\end{DoxyParamCaption})}



Get the "{}raw"{} log-\/probability for a general N-\/\+Gram. 

This returns the log-\/probability of an N-\/\+Gram, as defined in the language model file, before any language weighting, interpolation, or insertion penalty has been applied.

\begin{DoxyNote}{Note}
When backing off to a unigram from a bigram or trigram, the unigram weight (interpolation with uniform) is not removed. 
\end{DoxyNote}


Definition at line \textbf{ 600} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ ckd\+\_\+calloc}, \textbf{ ckd\+\_\+free()}, \textbf{ ngram\+\_\+ng\+\_\+prob()}, \textbf{ ngram\+\_\+prob()}, and \textbf{ ngram\+\_\+wid()}.



Referenced by \textbf{ ngram\+\_\+prob()}.

\label{ngram__model_8h_a9c23d79885af400e17ac2a1b7169660d} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_score@{ngram\_score}}
\index{ngram\_score@{ngram\_score}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_score()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int32 ngram\+\_\+score (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{model,  }\item[{const char $\ast$}]{word,  }\item[{}]{... }\end{DoxyParamCaption})}



Get the score (scaled, interpolated log-\/probability) for a general N-\/\+Gram. 

The argument list consists of the history words (as null-\/terminated strings) of the N-\/\+Gram, {\bfseries{in reverse order}}, followed by NULL. Therefore, if you wanted to get the N-\/\+Gram score for "{}a whole joy"{}, you would call\+:


\begin{DoxyPre}
 score = ngram\_score(model, "{}joy"{}, "{}whole"{}, "{}a"{}, NULL);
\end{DoxyPre}


This is not the function to use in decoding, because it has some overhead for looking up words. Use \doxyref{ngram\+\_\+ng\+\_\+score()}{p.}{ngram__model_8h_a6ac5799e78ea4ad82a11e2439016471e}, \doxyref{ngram\+\_\+tg\+\_\+score()}{p.}{ngram__model_8h_a0f8ad53c1a7cab528113b74aad00f15a}, or \doxyref{ngram\+\_\+bg\+\_\+score()}{p.}{ngram__model_8h_a8c06698fbcb0ef82420088ace045ae81} instead. In the future there will probably be a version that takes a general language model state object, to support suffix-\/array LM and things like that.

If one of the words is not in the LM\textquotesingle{}s vocabulary, the result will depend on whether this is an open or closed vocabulary language model. For an open-\/vocabulary model, unknown words are all mapped to the unigram $<$UNK$>$ which has a non-\/zero probability and also participates in higher-\/order N-\/\+Grams. Therefore, you will get a score of some sort in this case.

For a closed-\/vocabulary model, unknown words are impossible and thus have zero probability. Therefore, if {\ttfamily word} is unknown, this function will return a "{}zero"{} log-\/probability, i.\+e. a large negative number. To obtain this number for comparison, call \doxyref{ngram\+\_\+zero()}{p.}{ngram__model_8h_ae401a87ad55ae64f286dcd83170f7100}. 

Definition at line \textbf{ 524} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ ckd\+\_\+calloc}, \textbf{ ckd\+\_\+free()}, \textbf{ ngram\+\_\+ng\+\_\+score()}, \textbf{ ngram\+\_\+score()}, and \textbf{ ngram\+\_\+wid()}.



Referenced by \textbf{ ngram\+\_\+score()}.

\label{ngram__model_8h_ae0cf3a94128927e2be6422d2de34f49b} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_score\_to\_prob@{ngram\_score\_to\_prob}}
\index{ngram\_score\_to\_prob@{ngram\_score\_to\_prob}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_score\_to\_prob()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int32 ngram\+\_\+score\+\_\+to\+\_\+prob (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{model,  }\item[{int32}]{score }\end{DoxyParamCaption})}



Convert score to "{}raw"{} log-\/probability. 

\begin{DoxyNote}{Note}
The unigram weight (interpolation with uniform) is not removed, since there is no way to know which order of N-\/\+Gram generated {\ttfamily score}.
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
{\em model} & The N-\/\+Gram model from which score was obtained. \\
\hline
{\em score} & The N-\/\+Gram score to convert \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The raw log-\/probability value. 
\end{DoxyReturn}


Definition at line \textbf{ 631} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ ngram\+\_\+model\+\_\+s\+::log\+\_\+wip}, \textbf{ ngram\+\_\+model\+\_\+s\+::lw}, and \textbf{ ngram\+\_\+score\+\_\+to\+\_\+prob()}.



Referenced by \textbf{ ngram\+\_\+score\+\_\+to\+\_\+prob()}.

\label{ngram__model_8h_affb3d938049e58c191e72858a7191e9c} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_str\_to\_type@{ngram\_str\_to\_type}}
\index{ngram\_str\_to\_type@{ngram\_str\_to\_type}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_str\_to\_type()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \textbf{ ngram\+\_\+file\+\_\+type\+\_\+t} ngram\+\_\+str\+\_\+to\+\_\+type (\begin{DoxyParamCaption}\item[{const char $\ast$}]{str\+\_\+name }\end{DoxyParamCaption})}



Get the N-\/\+Gram file type from a string. 

\begin{DoxyReturn}{Returns}
file type, or NGRAM\+\_\+\+INVALID if no such file type exists. 
\end{DoxyReturn}


Definition at line \textbf{ 97} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ NGRAM\+\_\+\+ARPA}, \textbf{ NGRAM\+\_\+\+DMP}, \textbf{ NGRAM\+\_\+\+INVALID}, \textbf{ ngram\+\_\+str\+\_\+to\+\_\+type()}, and \textbf{ strcmp\+\_\+nocase()}.



Referenced by \textbf{ ngram\+\_\+str\+\_\+to\+\_\+type()}.

\label{ngram__model_8h_a0f8ad53c1a7cab528113b74aad00f15a} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_tg\_score@{ngram\_tg\_score}}
\index{ngram\_tg\_score@{ngram\_tg\_score}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_tg\_score()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int32 ngram\+\_\+tg\+\_\+score (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{model,  }\item[{int32}]{w3,  }\item[{int32}]{w2,  }\item[{int32}]{w1,  }\item[{int32 $\ast$}]{n\+\_\+used }\end{DoxyParamCaption})}



Quick trigram score lookup. 



Definition at line \textbf{ 555} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ ngram\+\_\+ng\+\_\+score()}, and \textbf{ ngram\+\_\+tg\+\_\+score()}.



Referenced by \textbf{ ngram\+\_\+tg\+\_\+score()}.

\label{ngram__model_8h_a83a027d267b0d1aa5ff4ac6a231d4464} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_type\_to\_str@{ngram\_type\_to\_str}}
\index{ngram\_type\_to\_str@{ngram\_type\_to\_str}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_type\_to\_str()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT char const  $\ast$ ngram\+\_\+type\+\_\+to\+\_\+str (\begin{DoxyParamCaption}\item[{int}]{type }\end{DoxyParamCaption})}



Get the canonical name for an N-\/\+Gram file type. 

\begin{DoxyReturn}{Returns}
read-\/only string with the name for this file type, or NULL if no such type exists. 
\end{DoxyReturn}


Definition at line \textbf{ 107} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ NGRAM\+\_\+\+ARPA}, \textbf{ NGRAM\+\_\+\+DMP}, and \textbf{ ngram\+\_\+type\+\_\+to\+\_\+str()}.



Referenced by \textbf{ ngram\+\_\+type\+\_\+to\+\_\+str()}.

\label{ngram__model_8h_a1469e9e1c8516a77c9ac1e248a61ef4e} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_unknown\_wid@{ngram\_unknown\_wid}}
\index{ngram\_unknown\_wid@{ngram\_unknown\_wid}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_unknown\_wid()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int32 ngram\+\_\+unknown\+\_\+wid (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{model }\end{DoxyParamCaption})}



Get the unknown word ID for a language model. 

Language models can be either "{}open vocabulary"{} or "{}closed vocabulary"{}. The difference is that the former assigns a fixed non-\/zero unigram probability to unknown words, while the latter does not allow unknown words (or, equivalently, it assigns them zero probability). If this is a closed vocabulary model, this function will return NGRAM\+\_\+\+INVALID\+\_\+\+WID.

\begin{DoxyReturn}{Returns}
The ID for the unknown word, or NGRAM\+\_\+\+INVALID\+\_\+\+WID if none exists. 
\end{DoxyReturn}


Definition at line \textbf{ 644} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ hash\+\_\+table\+\_\+lookup\+\_\+int32()}, \textbf{ NGRAM\+\_\+\+INVALID\+\_\+\+WID}, \textbf{ ngram\+\_\+unknown\+\_\+wid()}, and \textbf{ ngram\+\_\+model\+\_\+s\+::wid}.



Referenced by \textbf{ ngram\+\_\+model\+\_\+add\+\_\+class()}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+known\+\_\+wid()}, \textbf{ ngram\+\_\+unknown\+\_\+wid()}, and \textbf{ ngram\+\_\+wid()}.

\label{ngram__model_8h_ad03d4355d4ea659815dc25bce8d83880} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_wid@{ngram\_wid}}
\index{ngram\_wid@{ngram\_wid}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_wid()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int32 ngram\+\_\+wid (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{model,  }\item[{const char $\ast$}]{word }\end{DoxyParamCaption})}



Look up numerical word ID. 



Definition at line \textbf{ 771} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ hash\+\_\+table\+\_\+lookup\+\_\+int32()}, \textbf{ ngram\+\_\+unknown\+\_\+wid()}, \textbf{ ngram\+\_\+wid()}, and \textbf{ ngram\+\_\+model\+\_\+s\+::wid}.



Referenced by \textbf{ ngram\+\_\+iter()}, \textbf{ ngram\+\_\+model\+\_\+add\+\_\+class()}, \textbf{ ngram\+\_\+model\+\_\+add\+\_\+class\+\_\+word()}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+add()}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+map\+\_\+words()}, \textbf{ ngram\+\_\+prob()}, \textbf{ ngram\+\_\+score()}, and \textbf{ ngram\+\_\+wid()}.

\label{ngram__model_8h_a37f99ba8a07a0e0d4ff101cf5c9a2e26} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_word@{ngram\_word}}
\index{ngram\_word@{ngram\_word}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_word()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT const char $\ast$ ngram\+\_\+word (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{model,  }\item[{int32}]{wid }\end{DoxyParamCaption})}



Look up word string for numerical word ID. 



Definition at line \textbf{ 782} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ ngram\+\_\+model\+\_\+s\+::n\+\_\+words}, \textbf{ ngram\+\_\+word()}, and \textbf{ ngram\+\_\+model\+\_\+s\+::word\+\_\+str}.



Referenced by \textbf{ ngram\+\_\+word()}.

\label{ngram__model_8h_ae401a87ad55ae64f286dcd83170f7100} 
\index{ngram\_model.h@{ngram\_model.h}!ngram\_zero@{ngram\_zero}}
\index{ngram\_zero@{ngram\_zero}!ngram\_model.h@{ngram\_model.h}}
\doxysubsubsection{ngram\_zero()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int32 ngram\+\_\+zero (\begin{DoxyParamCaption}\item[{\textbf{ ngram\+\_\+model\+\_\+t} $\ast$}]{model }\end{DoxyParamCaption})}



Get the "{}zero"{} log-\/probability value for a language model. 



Definition at line \textbf{ 657} of file \textbf{ ngram\+\_\+model.\+c}.



References \textbf{ ngram\+\_\+model\+\_\+s\+::log\+\_\+zero}, and \textbf{ ngram\+\_\+zero()}.



Referenced by \textbf{ ngram\+\_\+zero()}.

