Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > 0b420d0fce195cf4115dc6a3be5c2da2 > files > 302

sphinxbase-devel-0.7-1.fc14.i686.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>SphinxBase: src/libsphinxbase/lm/ngram_model_set.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.3 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">SphinxBase&#160;<span id="projectnumber">0.6</span></div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('ngram__model__set_8c.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<h1>src/libsphinxbase/lm/ngram_model_set.c File Reference</h1>  </div>
</div>
<div class="contents">

<p>Set of language models.  
<a href="#_details">More...</a></p>
<div class="textblock"><code>#include &lt;string.h&gt;</code><br/>
<code>#include &lt;stdlib.h&gt;</code><br/>
<code>#include &quot;sphinxbase/err.h&quot;</code><br/>
<code>#include &quot;sphinxbase/ckd_alloc.h&quot;</code><br/>
<code>#include &quot;sphinxbase/strfuncs.h&quot;</code><br/>
<code>#include &quot;sphinxbase/filename.h&quot;</code><br/>
<code>#include &quot;<a class="el" href="ngram__model__set_8h_source.html">ngram_model_set.h</a>&quot;</code><br/>
</div>
<p><a href="ngram__model__set_8c_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structngram__model__s.html">ngram_model_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ngram__model__set_8c.html#aa4cc619035ac8091759c07d6a3b2fb7c">ngram_model_set_init</a> (<a class="el" href="structcmd__ln__t.html">cmd_ln_t</a> *config, <a class="el" href="structngram__model__s.html">ngram_model_t</a> **models, char **names, const float32 *weights, int32 n_models)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a set of language models sharing a common space of word IDs.  <a href="#aa4cc619035ac8091759c07d6a3b2fb7c"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structngram__model__s.html">ngram_model_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ngram__model__set_8c.html#a1389a90bf32110fd7e56a73b6d39fa07">ngram_model_set_read</a> (<a class="el" href="structcmd__ln__t.html">cmd_ln_t</a> *config, const char *lmctlfile, <a class="el" href="structlogmath__s.html">logmath_t</a> *lmath)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Read a set of language models from a control file.  <a href="#a1389a90bf32110fd7e56a73b6d39fa07"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="afa38d4e0f6cd64cc2875000fcef487f0"></a><!-- doxytag: member="ngram_model_set.c::ngram_model_set_count" ref="afa38d4e0f6cd64cc2875000fcef487f0" args="(ngram_model_t *base)" -->
int32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ngram__model__set_8c.html#afa38d4e0f6cd64cc2875000fcef487f0">ngram_model_set_count</a> (<a class="el" href="structngram__model__s.html">ngram_model_t</a> *base)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the number of language models in a set. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structngram__model__set__iter__s.html">ngram_model_set_iter_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ngram__model__set_8c.html#a5a1593344017a1210569beb63e4089d3">ngram_model_set_iter</a> (<a class="el" href="structngram__model__s.html">ngram_model_t</a> *base)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Begin iterating over language models in a set.  <a href="#a5a1593344017a1210569beb63e4089d3"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structngram__model__set__iter__s.html">ngram_model_set_iter_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ngram__model__set_8c.html#a13893e41e56962f6f237aa1305337b7a">ngram_model_set_iter_next</a> (<a class="el" href="structngram__model__set__iter__s.html">ngram_model_set_iter_t</a> *itor)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Move to the next language model in a set.  <a href="#a13893e41e56962f6f237aa1305337b7a"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a532787b5b709d0c5f0ad57e3df0d1d73"></a><!-- doxytag: member="ngram_model_set.c::ngram_model_set_iter_free" ref="a532787b5b709d0c5f0ad57e3df0d1d73" args="(ngram_model_set_iter_t *itor)" -->
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ngram__model__set_8c.html#a532787b5b709d0c5f0ad57e3df0d1d73">ngram_model_set_iter_free</a> (<a class="el" href="structngram__model__set__iter__s.html">ngram_model_set_iter_t</a> *itor)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Finish iteration over a langauge model set. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structngram__model__s.html">ngram_model_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ngram__model__set_8c.html#abec0455e59945b910d86c2f825ab0894">ngram_model_set_iter_model</a> (<a class="el" href="structngram__model__set__iter__s.html">ngram_model_set_iter_t</a> *itor, char const **lmname)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Get language model and associated name from an iterator.  <a href="#abec0455e59945b910d86c2f825ab0894"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structngram__model__s.html">ngram_model_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ngram__model__set_8c.html#a3e06e5d47a9c35186644cc1310924630">ngram_model_set_lookup</a> (<a class="el" href="structngram__model__s.html">ngram_model_t</a> *base, const char *name)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Look up a language model by name from a set.  <a href="#a3e06e5d47a9c35186644cc1310924630"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structngram__model__s.html">ngram_model_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ngram__model__set_8c.html#a2cbeda856dd655c80f8dc6ba91f5d20b">ngram_model_set_select</a> (<a class="el" href="structngram__model__s.html">ngram_model_t</a> *base, const char *name)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Select a single language model from a set for scoring.  <a href="#a2cbeda856dd655c80f8dc6ba91f5d20b"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3a4f2bb40d10e9420e6291e2706b6865"></a><!-- doxytag: member="ngram_model_set.c::ngram_model_set_current" ref="a3a4f2bb40d10e9420e6291e2706b6865" args="(ngram_model_t *base)" -->
const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ngram__model__set_8c.html#a3a4f2bb40d10e9420e6291e2706b6865">ngram_model_set_current</a> (<a class="el" href="structngram__model__s.html">ngram_model_t</a> *base)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the current language model name, if any. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ngram__model__set_8c.html#aa6239b58f333177839a15de79bae6146">ngram_model_set_current_wid</a> (<a class="el" href="structngram__model__s.html">ngram_model_t</a> *base, int32 set_wid)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Query the word-ID mapping for the current language model.  <a href="#aa6239b58f333177839a15de79bae6146"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ngram__model__set_8c.html#af30197146b9b2d6c143914240dee3c04">ngram_model_set_known_wid</a> (<a class="el" href="structngram__model__s.html">ngram_model_t</a> *base, int32 set_wid)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Test whether a word ID corresponds to a known word in the current state of the language model set.  <a href="#af30197146b9b2d6c143914240dee3c04"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structngram__model__s.html">ngram_model_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ngram__model__set_8c.html#a3a926714c60e2b8308d4c88d11d17d7e">ngram_model_set_interp</a> (<a class="el" href="structngram__model__s.html">ngram_model_t</a> *base, const char **names, const float32 *weights)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Set interpolation weights for a set and enables interpolation.  <a href="#a3a926714c60e2b8308d4c88d11d17d7e"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structngram__model__s.html">ngram_model_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ngram__model__set_8c.html#a53071575bca9465361740c809666349d">ngram_model_set_add</a> (<a class="el" href="structngram__model__s.html">ngram_model_t</a> *base, <a class="el" href="structngram__model__s.html">ngram_model_t</a> *model, const char *name, float32 weight, int reuse_widmap)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a language model to a set.  <a href="#a53071575bca9465361740c809666349d"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structngram__model__s.html">ngram_model_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ngram__model__set_8c.html#a1fadaf8cdc6799869b74a39a8652a7e0">ngram_model_set_remove</a> (<a class="el" href="structngram__model__s.html">ngram_model_t</a> *base, const char *name, int reuse_widmap)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Remove a language model from a set.  <a href="#a1fadaf8cdc6799869b74a39a8652a7e0"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af3ac3bbec3eed0b9638c4e64c8b75949"></a><!-- doxytag: member="ngram_model_set.c::ngram_model_set_map_words" ref="af3ac3bbec3eed0b9638c4e64c8b75949" args="(ngram_model_t *base, const char **words, int32 n_words)" -->
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ngram__model__set_8c.html#af3ac3bbec3eed0b9638c4e64c8b75949">ngram_model_set_map_words</a> (<a class="el" href="structngram__model__s.html">ngram_model_t</a> *base, const char **words, int32 n_words)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the word-to-ID mapping for this model set. <br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Set of language models. </p>
<dl class="author"><dt><b>Author:</b></dt><dd>David Huggins-Daines &lt;<a href="mailto:dhuggins@cs.cmu.edu">dhuggins@cs.cmu.edu</a>&gt; </dd></dl>

<p>Definition in file <a class="el" href="ngram__model__set_8c_source.html">ngram_model_set.c</a>.</p>
</div><hr/><h2>Function Documentation</h2>
<a class="anchor" id="a53071575bca9465361740c809666349d"></a><!-- doxytag: member="ngram_model_set.c::ngram_model_set_add" ref="a53071575bca9465361740c809666349d" args="(ngram_model_t *base, ngram_model_t *model, const char *name, float32 weight, int reuse_widmap)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structngram__model__s.html">ngram_model_t</a>* ngram_model_set_add </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structngram__model__s.html">ngram_model_t</a> *&#160;</td>
          <td class="paramname"><em>set</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structngram__model__s.html">ngram_model_t</a> *&#160;</td>
          <td class="paramname"><em>model</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float32&#160;</td>
          <td class="paramname"><em>weight</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>reuse_widmap</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Add a language model to a set. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">set</td><td>The language model set to add to. </td></tr>
    <tr><td class="paramname">model</td><td>The language model to add. </td></tr>
    <tr><td class="paramname">name</td><td>The name to associate with this model. </td></tr>
    <tr><td class="paramname">weight</td><td>Interpolation weight for this model, relative to the uniform distribution. 1.0 is a safe value. </td></tr>
    <tr><td class="paramname">reuse_widmap</td><td>Reuse the existing word-ID mapping in <code>set</code>. Any new words present in <code>model</code> will not be added to the word-ID mapping in this case. </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="ngram__model__set_8c_source.html#l00520">520</a> of file <a class="el" href="ngram__model__set_8c_source.html">ngram_model_set.c</a>.</p>

<p>References <a class="el" href="ckd__alloc_8h_source.html#l00270">ckd_calloc_2d</a>, <a class="el" href="ckd__alloc_8c_source.html#l00252">ckd_free_2d()</a>, <a class="el" href="ckd__alloc_8h_source.html#l00258">ckd_realloc</a>, <a class="el" href="ckd__alloc_8h_source.html#l00264">ckd_salloc</a>, <a class="el" href="ngram__model__internal_8h_source.html#l00066">ngram_model_s::lmath</a>, <a class="el" href="logmath_8c_source.html#l00447">logmath_log()</a>, <a class="el" href="ngram__model__internal_8h_source.html#l00061">ngram_model_s::n</a>, <a class="el" href="ngram__model__internal_8h_source.html#l00059">ngram_model_s::n_words</a>, <a class="el" href="ngram__model_8c_source.html#l00771">ngram_wid()</a>, and <a class="el" href="ngram__model__internal_8h_source.html#l00073">ngram_model_s::word_str</a>.</p>

</div>
</div>
<a class="anchor" id="aa6239b58f333177839a15de79bae6146"></a><!-- doxytag: member="ngram_model_set.c::ngram_model_set_current_wid" ref="aa6239b58f333177839a15de79bae6146" args="(ngram_model_t *base, int32 set_wid)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32 ngram_model_set_current_wid </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structngram__model__s.html">ngram_model_t</a> *&#160;</td>
          <td class="paramname"><em>set</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32&#160;</td>
          <td class="paramname"><em>set_wid</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Query the word-ID mapping for the current language model. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>the local word ID in the current language model, or NGRAM_INVALID_WID if <code>set_wid</code> is invalid or interpolation is enabled. </dd></dl>

<p>Definition at line <a class="el" href="ngram__model__set_8c_source.html#l00456">456</a> of file <a class="el" href="ngram__model__set_8c_source.html">ngram_model_set.c</a>.</p>

<p>References <a class="el" href="ngram__model__internal_8h_source.html#l00059">ngram_model_s::n_words</a>, and <a class="el" href="ngram__model_8h_source.html#l00084">NGRAM_INVALID_WID</a>.</p>

</div>
</div>
<a class="anchor" id="aa4cc619035ac8091759c07d6a3b2fb7c"></a><!-- doxytag: member="ngram_model_set.c::ngram_model_set_init" ref="aa4cc619035ac8091759c07d6a3b2fb7c" args="(cmd_ln_t *config, ngram_model_t **models, char **names, const float32 *weights, int32 n_models)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structngram__model__s.html">ngram_model_t</a>* ngram_model_set_init </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcmd__ln__t.html">cmd_ln_t</a> *&#160;</td>
          <td class="paramname"><em>config</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structngram__model__s.html">ngram_model_t</a> **&#160;</td>
          <td class="paramname"><em>models</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char **&#160;</td>
          <td class="paramname"><em>names</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const float32 *&#160;</td>
          <td class="paramname"><em>weights</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32&#160;</td>
          <td class="paramname"><em>n_models</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Create a set of language models sharing a common space of word IDs. </p>
<p>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 <a class="el" href="ngram__model_8h.html#a5e7a3fd20d32783ce07b760781f658f8" title="Select a single language model from a set for scoring.">ngram_model_set_select()</a>, or interpolate between scores from all models. To do the latter, you can either pass a non-NULL value of the <code>weights</code> parameter, or re-activate interpolation later on by calling <a class="el" href="ngram__model_8h.html#a8a4c853e77c6b48face3a781480e77d6" title="Set interpolation weights for a set and enables interpolation.">ngram_model_set_interp()</a>.</p>
<p>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 <b>must</b> all share the same log-math parameters.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">config</td><td>Any configuration parameters to be shared between models. </td></tr>
    <tr><td class="paramname">models</td><td>Array of pointers to previously created language models. </td></tr>
    <tr><td class="paramname">names</td><td>Array of strings to use as unique identifiers for LMs. </td></tr>
    <tr><td class="paramname">weights</td><td>Array of weights to use in interpolating LMs, or NULL for no interpolation. </td></tr>
    <tr><td class="paramname">n_models</td><td>Number of elements in the arrays passed to this function. </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="ngram__model__set_8c_source.html#l00121">121</a> of file <a class="el" href="ngram__model__set_8c_source.html">ngram_model_set.c</a>.</p>

<p>References <a class="el" href="ngram__model__set_8h_source.html#l00052">ngram_model_set_s::base</a>, <a class="el" href="ckd__alloc_8h_source.html#l00248">ckd_calloc</a>, <a class="el" href="ckd__alloc_8h_source.html#l00264">ckd_salloc</a>, <a class="el" href="ngram__model__set_8h_source.html#l00055">ngram_model_set_s::cur</a>, <a class="el" href="err_8h_source.html#l00169">E_ERROR</a>, <a class="el" href="ngram__model__internal_8h_source.html#l00066">ngram_model_s::lmath</a>, <a class="el" href="ngram__model__set_8h_source.html#l00056">ngram_model_set_s::lms</a>, <a class="el" href="logmath_8c_source.html#l00368">logmath_get_base()</a>, <a class="el" href="logmath_8c_source.html#l00386">logmath_get_shift()</a>, <a class="el" href="logmath_8c_source.html#l00447">logmath_log()</a>, <a class="el" href="ngram__model__set_8h_source.html#l00058">ngram_model_set_s::lweights</a>, <a class="el" href="ngram__model__set_8h_source.html#l00060">ngram_model_set_s::maphist</a>, <a class="el" href="ngram__model__internal_8h_source.html#l00061">ngram_model_s::n</a>, <a class="el" href="ngram__model__set_8h_source.html#l00054">ngram_model_set_s::n_models</a>, and <a class="el" href="ngram__model__set_8h_source.html#l00057">ngram_model_set_s::names</a>.</p>

<p>Referenced by <a class="el" href="ngram__model__set_8c_source.html#l00182">ngram_model_set_read()</a>.</p>

</div>
</div>
<a class="anchor" id="a3a926714c60e2b8308d4c88d11d17d7e"></a><!-- doxytag: member="ngram_model_set.c::ngram_model_set_interp" ref="a3a926714c60e2b8308d4c88d11d17d7e" args="(ngram_model_t *base, const char **names, const float32 *weights)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structngram__model__s.html">ngram_model_t</a>* ngram_model_set_interp </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structngram__model__s.html">ngram_model_t</a> *&#160;</td>
          <td class="paramname"><em>set</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char **&#160;</td>
          <td class="paramname"><em>names</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const float32 *&#160;</td>
          <td class="paramname"><em>weights</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Set interpolation weights for a set and enables interpolation. </p>
<p>If <code>weights</code> is NULL, any previously initialized set of weights will be used. If no weights were specified to <a class="el" href="ngram__model_8h.html#a02310e01a48928e1d430aef0ea3c9a99" title="Create a set of language models sharing a common space of word IDs.">ngram_model_set_init()</a>, then a uniform distribution will be used. </p>

<p>Definition at line <a class="el" href="ngram__model__set_8c_source.html#l00489">489</a> of file <a class="el" href="ngram__model__set_8c_source.html">ngram_model_set.c</a>.</p>

<p>References <a class="el" href="err_8h_source.html#l00169">E_ERROR</a>, <a class="el" href="ngram__model__internal_8h_source.html#l00066">ngram_model_s::lmath</a>, and <a class="el" href="logmath_8c_source.html#l00447">logmath_log()</a>.</p>

</div>
</div>
<a class="anchor" id="a5a1593344017a1210569beb63e4089d3"></a><!-- doxytag: member="ngram_model_set.c::ngram_model_set_iter" ref="a5a1593344017a1210569beb63e4089d3" args="(ngram_model_t *base)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structngram__model__set__iter__s.html">ngram_model_set_iter_t</a>* ngram_model_set_iter </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structngram__model__s.html">ngram_model_t</a> *&#160;</td>
          <td class="paramname"><em>set</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Begin iterating over language models in a set. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>iterator pointing to the first language model, or NULL if no models remain. </dd></dl>

<p>Definition at line <a class="el" href="ngram__model__set_8c_source.html#l00368">368</a> of file <a class="el" href="ngram__model__set_8c_source.html">ngram_model_set.c</a>.</p>

<p>References <a class="el" href="ckd__alloc_8h_source.html#l00248">ckd_calloc</a>.</p>

</div>
</div>
<a class="anchor" id="abec0455e59945b910d86c2f825ab0894"></a><!-- doxytag: member="ngram_model_set.c::ngram_model_set_iter_model" ref="abec0455e59945b910d86c2f825ab0894" args="(ngram_model_set_iter_t *itor, char const **lmname)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structngram__model__s.html">ngram_model_t</a>* ngram_model_set_iter_model </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structngram__model__set__iter__s.html">ngram_model_set_iter_t</a> *&#160;</td>
          <td class="paramname"><em>itor</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char const **&#160;</td>
          <td class="paramname"><em>lmname</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Get language model and associated name from an iterator. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">itor</td><td>the iterator </td></tr>
    <tr><td class="paramname">lmname</td><td>Output: string name associated with this language model. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Language model pointed to by this iterator. </dd></dl>

<p>Definition at line <a class="el" href="ngram__model__set_8c_source.html#l00397">397</a> of file <a class="el" href="ngram__model__set_8c_source.html">ngram_model_set.c</a>.</p>

<p>References <a class="el" href="ngram__model__set_8h_source.html#l00056">ngram_model_set_s::lms</a>, and <a class="el" href="ngram__model__set_8h_source.html#l00057">ngram_model_set_s::names</a>.</p>

</div>
</div>
<a class="anchor" id="a13893e41e56962f6f237aa1305337b7a"></a><!-- doxytag: member="ngram_model_set.c::ngram_model_set_iter_next" ref="a13893e41e56962f6f237aa1305337b7a" args="(ngram_model_set_iter_t *itor)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structngram__model__set__iter__s.html">ngram_model_set_iter_t</a>* ngram_model_set_iter_next </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structngram__model__set__iter__s.html">ngram_model_set_iter_t</a> *&#160;</td>
          <td class="paramname"><em>itor</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Move to the next language model in a set. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>iterator pointing to the next language model, or NULL if no models remain. </dd></dl>

<p>Definition at line <a class="el" href="ngram__model__set_8c_source.html#l00381">381</a> of file <a class="el" href="ngram__model__set_8c_source.html">ngram_model_set.c</a>.</p>

<p>References <a class="el" href="ngram__model__set_8h_source.html#l00054">ngram_model_set_s::n_models</a>, and <a class="el" href="ngram__model__set_8c_source.html#l00391">ngram_model_set_iter_free()</a>.</p>

</div>
</div>
<a class="anchor" id="af30197146b9b2d6c143914240dee3c04"></a><!-- doxytag: member="ngram_model_set.c::ngram_model_set_known_wid" ref="af30197146b9b2d6c143914240dee3c04" args="(ngram_model_t *base, int32 set_wid)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32 ngram_model_set_known_wid </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structngram__model__s.html">ngram_model_t</a> *&#160;</td>
          <td class="paramname"><em>set</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32&#160;</td>
          <td class="paramname"><em>set_wid</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Test whether a word ID corresponds to a known word in the current state of the language model set. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>If there is a current language model, returns non-zero if <code>set_wid</code> corresponds to a known word in that language model. Otherwise, returns non-zero if <code>set_wid</code> corresponds to a known word in any language model. </dd></dl>

<p>Definition at line <a class="el" href="ngram__model__set_8c_source.html#l00468">468</a> of file <a class="el" href="ngram__model__set_8c_source.html">ngram_model_set.c</a>.</p>

<p>References <a class="el" href="ngram__model__internal_8h_source.html#l00059">ngram_model_s::n_words</a>, and <a class="el" href="ngram__model_8c_source.html#l00644">ngram_unknown_wid()</a>.</p>

</div>
</div>
<a class="anchor" id="a3e06e5d47a9c35186644cc1310924630"></a><!-- doxytag: member="ngram_model_set.c::ngram_model_set_lookup" ref="a3e06e5d47a9c35186644cc1310924630" args="(ngram_model_t *base, const char *name)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structngram__model__s.html">ngram_model_t</a>* ngram_model_set_lookup </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structngram__model__s.html">ngram_model_t</a> *&#160;</td>
          <td class="paramname"><em>set</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Look up a language model by name from a set. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>language model corresponding to <code>name</code>, or NULL if no language model by that name exists. </dd></dl>

<p>Definition at line <a class="el" href="ngram__model__set_8c_source.html#l00405">405</a> of file <a class="el" href="ngram__model__set_8c_source.html">ngram_model_set.c</a>.</p>

</div>
</div>
<a class="anchor" id="a1389a90bf32110fd7e56a73b6d39fa07"></a><!-- doxytag: member="ngram_model_set.c::ngram_model_set_read" ref="a1389a90bf32110fd7e56a73b6d39fa07" args="(cmd_ln_t *config, const char *lmctlfile, logmath_t *lmath)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structngram__model__s.html">ngram_model_t</a>* ngram_model_set_read </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcmd__ln__t.html">cmd_ln_t</a> *&#160;</td>
          <td class="paramname"><em>config</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>lmctlfile</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structlogmath__s.html">logmath_t</a> *&#160;</td>
          <td class="paramname"><em>lmath</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Read a set of language models from a control file. </p>
<p>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 []):</p>
<pre>
   [{ LMClassFileName LMClassFilename ... }]
   TrigramLMFileName LMName [{ LMClassName LMClassName ... }]
   TrigramLMFileName LMName [{ LMClassName LMClassName ... }]
   ...
 (There should be whitespace around the { and } delimiters.)
 </pre><p>This is an extension of the older format that had only TrigramLMFilenName and LMName pairs. The new format allows a set of LMClass files to be read in and referred to by the trigram LMs.</p>
<p>No "comments" allowed in this file.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">config</td><td>Configuration parameters. </td></tr>
    <tr><td class="paramname">lmctlfile</td><td>Path to the language model control file. </td></tr>
    <tr><td class="paramname">lmath</td><td>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 <a class="el" href="logmath_8h.html#a1c1b2ba3b137a39e9e835a8f3e27d381" title="Retain ownership of a log table.">logmath_retain()</a>. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>newly created language model set. </dd></dl>

<p>Definition at line <a class="el" href="ngram__model__set_8c_source.html#l00182">182</a> of file <a class="el" href="ngram__model__set_8c_source.html">ngram_model_set.c</a>.</p>

<p>References <a class="el" href="ckd__alloc_8h_source.html#l00248">ckd_calloc</a>, <a class="el" href="ckd__alloc_8c_source.html#l00241">ckd_free()</a>, <a class="el" href="ckd__alloc_8h_source.html#l00264">ckd_salloc</a>, <a class="el" href="err_8h_source.html#l00169">E_ERROR</a>, <a class="el" href="err_8h_source.html#l00142">E_ERROR_SYSTEM</a>, <a class="el" href="err_8h_source.html#l00147">E_INFO</a>, <a class="el" href="glist_8c_source.html#l00074">glist_add_ptr()</a>, <a class="el" href="glist_8c_source.html#l00145">glist_count()</a>, <a class="el" href="glist_8c_source.html#l00133">glist_free()</a>, <a class="el" href="glist_8c_source.html#l00169">glist_reverse()</a>, <a class="el" href="glist_8h_source.html#l00109">gnode_ptr</a>, <a class="el" href="hash__table_8c_source.html#l00694">hash_table_free()</a>, <a class="el" href="hash__table_8c_source.html#l00309">hash_table_lookup()</a>, <a class="el" href="hash__table_8c_source.html#l00158">hash_table_new()</a>, <a class="el" href="hash__table_8c_source.html#l00622">hash_table_tolist()</a>, <a class="el" href="ngram__model_8h_source.html#l00078">NGRAM_AUTO</a>, <a class="el" href="ngram__model_8c_source.html#l01000">ngram_model_add_class()</a>, <a class="el" href="ngram__model_8c_source.html#l00254">ngram_model_free()</a>, <a class="el" href="ngram__model_8c_source.html#l00121">ngram_model_read()</a>, <a class="el" href="ngram__model__set_8c_source.html#l00121">ngram_model_set_init()</a>, <a class="el" href="filename_8c_source.html#l00126">path_is_absolute()</a>, <a class="el" href="strfuncs_8c_source.html#l00062">string_join()</a>, and <a class="el" href="hash__table_8h_source.html#l00155">hash_entry_s::val</a>.</p>

</div>
</div>
<a class="anchor" id="a1fadaf8cdc6799869b74a39a8652a7e0"></a><!-- doxytag: member="ngram_model_set.c::ngram_model_set_remove" ref="a1fadaf8cdc6799869b74a39a8652a7e0" args="(ngram_model_t *base, const char *name, int reuse_widmap)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structngram__model__s.html">ngram_model_t</a>* ngram_model_set_remove </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structngram__model__s.html">ngram_model_t</a> *&#160;</td>
          <td class="paramname"><em>set</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>reuse_widmap</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Remove a language model from a set. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">set</td><td>The language model set to remove from. </td></tr>
    <tr><td class="paramname">name</td><td>The name associated with the model to remove. </td></tr>
    <tr><td class="paramname">reuse_widmap</td><td>Reuse the existing word-ID mapping in <code>set</code>. </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="ngram__model__set_8c_source.html#l00580">580</a> of file <a class="el" href="ngram__model__set_8c_source.html">ngram_model_set.c</a>.</p>

<p>References <a class="el" href="ckd__alloc_8c_source.html#l00241">ckd_free()</a>, <a class="el" href="ngram__model__internal_8h_source.html#l00066">ngram_model_s::lmath</a>, <a class="el" href="ngram__model__internal_8h_source.html#l00072">ngram_model_s::log_zero</a>, <a class="el" href="logmath_8c_source.html#l00456">logmath_exp()</a>, <a class="el" href="logmath_8c_source.html#l00447">logmath_log()</a>, and <a class="el" href="ngram__model__internal_8h_source.html#l00059">ngram_model_s::n_words</a>.</p>

</div>
</div>
<a class="anchor" id="a2cbeda856dd655c80f8dc6ba91f5d20b"></a><!-- doxytag: member="ngram_model_set.c::ngram_model_set_select" ref="a2cbeda856dd655c80f8dc6ba91f5d20b" args="(ngram_model_t *base, const char *name)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structngram__model__s.html">ngram_model_t</a>* ngram_model_set_select </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structngram__model__s.html">ngram_model_t</a> *&#160;</td>
          <td class="paramname"><em>set</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Select a single language model from a set for scoring. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>the newly selected language model, or NULL if no language model by that name exists. </dd></dl>

<p>Definition at line <a class="el" href="ngram__model__set_8c_source.html#l00428">428</a> of file <a class="el" href="ngram__model__set_8c_source.html">ngram_model_set.c</a>.</p>

</div>
</div>
</div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="ngram__model__set_8c.html">ngram_model_set.c</a>      </li>
      <li class="footer">Generated on Tue Apr 19 2011 for SphinxBase by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </li>
    </ul>
  </div>

</body>
</html>