Sophie

Sophie

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

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_internal.h Source File</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__internal_8h.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<h1>src/libsphinxbase/lm/ngram_model_internal.h</h1>  </div>
</div>
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */</span>
<a name="l00002"></a>00002 <span class="comment">/* ====================================================================</span>
<a name="l00003"></a>00003 <span class="comment"> * Copyright (c) 1999-2007 Carnegie Mellon University.  All rights</span>
<a name="l00004"></a>00004 <span class="comment"> * reserved.</span>
<a name="l00005"></a>00005 <span class="comment"> *</span>
<a name="l00006"></a>00006 <span class="comment"> * Redistribution and use in source and binary forms, with or without</span>
<a name="l00007"></a>00007 <span class="comment"> * modification, are permitted provided that the following conditions</span>
<a name="l00008"></a>00008 <span class="comment"> * are met:</span>
<a name="l00009"></a>00009 <span class="comment"> *</span>
<a name="l00010"></a>00010 <span class="comment"> * 1. Redistributions of source code must retain the above copyright</span>
<a name="l00011"></a>00011 <span class="comment"> *    notice, this list of conditions and the following disclaimer. </span>
<a name="l00012"></a>00012 <span class="comment"> *</span>
<a name="l00013"></a>00013 <span class="comment"> * 2. Redistributions in binary form must reproduce the above copyright</span>
<a name="l00014"></a>00014 <span class="comment"> *    notice, this list of conditions and the following disclaimer in</span>
<a name="l00015"></a>00015 <span class="comment"> *    the documentation and/or other materials provided with the</span>
<a name="l00016"></a>00016 <span class="comment"> *    distribution.</span>
<a name="l00017"></a>00017 <span class="comment"> *</span>
<a name="l00018"></a>00018 <span class="comment"> * This work was supported in part by funding from the Defense Advanced </span>
<a name="l00019"></a>00019 <span class="comment"> * Research Projects Agency and the National Science Foundation of the </span>
<a name="l00020"></a>00020 <span class="comment"> * United States of America, and the CMU Sphinx Speech Consortium.</span>
<a name="l00021"></a>00021 <span class="comment"> *</span>
<a name="l00022"></a>00022 <span class="comment"> * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS&#39;&#39; AND </span>
<a name="l00023"></a>00023 <span class="comment"> * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, </span>
<a name="l00024"></a>00024 <span class="comment"> * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR</span>
<a name="l00025"></a>00025 <span class="comment"> * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY</span>
<a name="l00026"></a>00026 <span class="comment"> * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</span>
<a name="l00027"></a>00027 <span class="comment"> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT </span>
<a name="l00028"></a>00028 <span class="comment"> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, </span>
<a name="l00029"></a>00029 <span class="comment"> * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY </span>
<a name="l00030"></a>00030 <span class="comment"> * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT </span>
<a name="l00031"></a>00031 <span class="comment"> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE </span>
<a name="l00032"></a>00032 <span class="comment"> * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span>
<a name="l00033"></a>00033 <span class="comment"> *</span>
<a name="l00034"></a>00034 <span class="comment"> * ====================================================================</span>
<a name="l00035"></a>00035 <span class="comment"> *</span>
<a name="l00036"></a>00036 <span class="comment"> */</span>
<a name="l00037"></a>00037 <span class="comment">/*</span>
<a name="l00038"></a>00038 <span class="comment"> * \file ngram_model_internal.h Internal structures for N-Gram models</span>
<a name="l00039"></a>00039 <span class="comment"> *</span>
<a name="l00040"></a>00040 <span class="comment"> * Author: David Huggins-Daines &lt;dhuggins@cs.cmu.edu&gt;</span>
<a name="l00041"></a>00041 <span class="comment"> */</span>
<a name="l00042"></a>00042 
<a name="l00043"></a>00043 <span class="preprocessor">#ifndef __NGRAM_MODEL_INTERNAL_H__</span>
<a name="l00044"></a>00044 <span class="preprocessor"></span><span class="preprocessor">#define __NGRAM_MODEL_INTERNAL_H__</span>
<a name="l00045"></a>00045 <span class="preprocessor"></span>
<a name="l00046"></a>00046 <span class="preprocessor">#include &quot;sphinxbase/ngram_model.h&quot;</span>
<a name="l00047"></a>00047 <span class="preprocessor">#include &quot;sphinxbase/hash_table.h&quot;</span>
<a name="l00048"></a>00048 
<a name="l00055"></a><a class="code" href="structngram__model__s.html">00055</a> <span class="keyword">struct </span><a class="code" href="structngram__model__s.html" title="Common implementation of ngram_model_t.">ngram_model_s</a> {
<a name="l00056"></a><a class="code" href="structngram__model__s.html#a3b14986e4dc40ccec1f7e206b7f41d06">00056</a>     <span class="keywordtype">int</span> <a class="code" href="structngram__model__s.html#a3b14986e4dc40ccec1f7e206b7f41d06" title="Reference count.">refcount</a>;       
<a name="l00057"></a><a class="code" href="structngram__model__s.html#a9dcba9b49cc1cd189b257e5838da0eee">00057</a>     int32 *<a class="code" href="structngram__model__s.html#a9dcba9b49cc1cd189b257e5838da0eee" title="Counts for 1, 2, 3, ...">n_counts</a>;    
<a name="l00058"></a><a class="code" href="structngram__model__s.html#a3e41109b30668bdfc077614c1ef49960">00058</a>     int32 <a class="code" href="structngram__model__s.html#a3e41109b30668bdfc077614c1ef49960" title="Number of allocated word strings (for new word addition)">n_1g_alloc</a>;   
<a name="l00059"></a><a class="code" href="structngram__model__s.html#a74f85927ef0d5513a1e6c02d13864be3">00059</a>     int32 <a class="code" href="structngram__model__s.html#a74f85927ef0d5513a1e6c02d13864be3" title="Number of actual word strings (NOT the same as the number of unigrams, due to class words)...">n_words</a>;      
<a name="l00061"></a><a class="code" href="structngram__model__s.html#a3c87bc1b678662a2c8930b3b8c33a80f">00061</a>     uint8 <a class="code" href="structngram__model__s.html#a3c87bc1b678662a2c8930b3b8c33a80f" title="This is an n-gram model (1, 2, 3, ...).">n</a>;            
<a name="l00062"></a><a class="code" href="structngram__model__s.html#adeb914f8e9f011a5c960f5ee9cd33919">00062</a>     uint8 <a class="code" href="structngram__model__s.html#adeb914f8e9f011a5c960f5ee9cd33919" title="Number of classes (maximum 128)">n_classes</a>;    
<a name="l00063"></a><a class="code" href="structngram__model__s.html#a78a3253febced2cae4732044da466ee6">00063</a>     uint8 <a class="code" href="structngram__model__s.html#a78a3253febced2cae4732044da466ee6" title="Are word strings writable?">writable</a>;     
<a name="l00064"></a><a class="code" href="structngram__model__s.html#ac609a2f867496d6ca719351d566db328">00064</a>     uint8 <a class="code" href="structngram__model__s.html#ac609a2f867496d6ca719351d566db328" title="Any other flags we might care about (FIXME: Merge this and writable)">flags</a>;        
<a name="l00066"></a><a class="code" href="structngram__model__s.html#a2ca373109c651ac998b33153eb38fd95">00066</a>     <a class="code" href="structlogmath__s.html">logmath_t</a> *<a class="code" href="structngram__model__s.html#a2ca373109c651ac998b33153eb38fd95" title="Log-math object.">lmath</a>;   
<a name="l00067"></a><a class="code" href="structngram__model__s.html#a76ea0c65b23de80091e7c602bdb43bde">00067</a>     float32 <a class="code" href="structngram__model__s.html#a76ea0c65b23de80091e7c602bdb43bde" title="Language model scaling factor.">lw</a>;         
<a name="l00068"></a><a class="code" href="structngram__model__s.html#a3d6bf5632760a16e52cb881d7010d774">00068</a>     int32 <a class="code" href="structngram__model__s.html#a3d6bf5632760a16e52cb881d7010d774" title="Log of word insertion penalty.">log_wip</a>;      
<a name="l00069"></a><a class="code" href="structngram__model__s.html#a6f0ec7b8b9d13d590bbe4b59df573abc">00069</a>     int32 <a class="code" href="structngram__model__s.html#a6f0ec7b8b9d13d590bbe4b59df573abc" title="Log of unigram weight.">log_uw</a>;       
<a name="l00070"></a><a class="code" href="structngram__model__s.html#a616bf871a67f9cedce17d6b589ee33ea">00070</a>     int32 <a class="code" href="structngram__model__s.html#a616bf871a67f9cedce17d6b589ee33ea" title="Log of uniform (0-gram) probability.">log_uniform</a>;  
<a name="l00071"></a><a class="code" href="structngram__model__s.html#aa38c5fdecaefd9a2f43b69f26ae492c1">00071</a>     int32 <a class="code" href="structngram__model__s.html#aa38c5fdecaefd9a2f43b69f26ae492c1" title="Log of uniform weight (i.e.">log_uniform_weight</a>; 
<a name="l00072"></a><a class="code" href="structngram__model__s.html#a65425a599c4bcc4dda809d81149b8fc0">00072</a>     int32 <a class="code" href="structngram__model__s.html#a65425a599c4bcc4dda809d81149b8fc0" title="Zero probability, cached here for quick lookup.">log_zero</a>;     
<a name="l00073"></a><a class="code" href="structngram__model__s.html#ae625e779e340845f03fb3da164e93039">00073</a>     <span class="keywordtype">char</span> **<a class="code" href="structngram__model__s.html#ae625e779e340845f03fb3da164e93039" title="Unigram names.">word_str</a>;    
<a name="l00074"></a><a class="code" href="structngram__model__s.html#a75567419a8002ef6e916c81f5d9ee9ed">00074</a>     <a class="code" href="structhash__table__t.html">hash_table_t</a> *<a class="code" href="structngram__model__s.html#a75567419a8002ef6e916c81f5d9ee9ed" title="Mapping of unigram names to word IDs.">wid</a>;  
<a name="l00075"></a><a class="code" href="structngram__model__s.html#a4f910ab2c18b0e68dce92816a27fb139">00075</a>     int32 *<a class="code" href="structngram__model__s.html#a4f910ab2c18b0e68dce92816a27fb139" title="Temporary array of word IDs for ngram_model_get_ngram()">tmp_wids</a>;    
<a name="l00076"></a><a class="code" href="structngram__model__s.html#a39384af3e6b53591d433436db011ac8d">00076</a>     <span class="keyword">struct </span><a class="code" href="structngram__class__s.html" title="Implementation of ngram_class_t.">ngram_class_s</a> **<a class="code" href="structngram__model__s.html#a39384af3e6b53591d433436db011ac8d" title="Word class definitions.">classes</a>; 
<a name="l00077"></a><a class="code" href="structngram__model__s.html#ad3d9d8ad9773f958a89534220eda6fb9">00077</a>     <span class="keyword">struct </span><a class="code" href="structngram__funcs__s.html" title="Implementation-specific functions for operating on ngram_model_t objects.">ngram_funcs_s</a> *<a class="code" href="structngram__model__s.html#ad3d9d8ad9773f958a89534220eda6fb9" title="Implementation-specific methods.">funcs</a>;   
<a name="l00078"></a>00078 };
<a name="l00079"></a>00079 
<a name="l00083"></a><a class="code" href="structngram__class__s.html">00083</a> <span class="keyword">struct </span><a class="code" href="structngram__class__s.html" title="Implementation of ngram_class_t.">ngram_class_s</a> {
<a name="l00084"></a><a class="code" href="structngram__class__s.html#ab5f3cc0142c9fd91b3c3d0e59906b556">00084</a>     int32 <a class="code" href="structngram__class__s.html#ab5f3cc0142c9fd91b3c3d0e59906b556" title="Base word ID for this class tag.">tag_wid</a>;  
<a name="l00085"></a><a class="code" href="structngram__class__s.html#a370c88602c7c1f7e3ff1a767c027f5cb">00085</a>     int32 <a class="code" href="structngram__class__s.html#a370c88602c7c1f7e3ff1a767c027f5cb" title="Starting base word ID for this class&amp;#39; words.">start_wid</a>; 
<a name="l00086"></a><a class="code" href="structngram__class__s.html#af13562cbc44647435f315b18df5688dc">00086</a>     int32 <a class="code" href="structngram__class__s.html#af13562cbc44647435f315b18df5688dc" title="Number of base words for this class.">n_words</a>;   
<a name="l00087"></a><a class="code" href="structngram__class__s.html#a50077f48f135f1c666745a21574e4205">00087</a>     int32 *<a class="code" href="structngram__class__s.html#a50077f48f135f1c666745a21574e4205" title="Probability table for base words.">prob1</a>;    
<a name="l00091"></a><a class="code" href="structngram__class__s_1_1ngram__hash__s.html">00091</a>     <span class="keyword">struct </span><a class="code" href="structngram__class__s_1_1ngram__hash__s.html" title="Custom hash table for additional words.">ngram_hash_s</a> {
<a name="l00092"></a><a class="code" href="structngram__class__s_1_1ngram__hash__s.html#ad0178b5a86ec23ce790b6b7cb64db0b9">00092</a>         int32 <a class="code" href="structngram__class__s_1_1ngram__hash__s.html#ad0178b5a86ec23ce790b6b7cb64db0b9" title="Word ID of this bucket.">wid</a>;    
<a name="l00093"></a><a class="code" href="structngram__class__s_1_1ngram__hash__s.html#a6ac4c01b0c8d29f770f4780e38ab0923">00093</a>         int32 <a class="code" href="structngram__class__s_1_1ngram__hash__s.html#a6ac4c01b0c8d29f770f4780e38ab0923" title="Probability for this word.">prob1</a>;  
<a name="l00094"></a><a class="code" href="structngram__class__s_1_1ngram__hash__s.html#a88ede5798cadc2bece12c49fa038b090">00094</a>         int32 <a class="code" href="structngram__class__s_1_1ngram__hash__s.html#a88ede5798cadc2bece12c49fa038b090" title="Index of next bucket (or -1 for no collision)">next</a>;   
<a name="l00095"></a>00095     } *nword_hash;
<a name="l00096"></a><a class="code" href="structngram__class__s.html#a7f450019eb6dc2e31b18eb3ab6009920">00096</a>     int32 <a class="code" href="structngram__class__s.html#a7f450019eb6dc2e31b18eb3ab6009920" title="Number of buckets in nword_hash (power of 2)">n_hash</a>;       
<a name="l00097"></a><a class="code" href="structngram__class__s.html#a79438cd582363800bc05da31a9ca49d6">00097</a>     int32 <a class="code" href="structngram__class__s.html#a79438cd582363800bc05da31a9ca49d6" title="Number of words in nword_hash.">n_hash_inuse</a>; 
<a name="l00098"></a>00098 };
<a name="l00099"></a>00099 
<a name="l00100"></a>00100 <span class="preprocessor">#define NGRAM_HASH_SIZE 128</span>
<a name="l00101"></a>00101 <span class="preprocessor"></span>
<a name="l00102"></a>00102 <span class="preprocessor">#define NGRAM_BASEWID(wid) ((wid)&amp;0xffffff)</span>
<a name="l00103"></a>00103 <span class="preprocessor"></span><span class="preprocessor">#define NGRAM_CLASSID(wid) (((wid)&gt;&gt;24) &amp; 0x7f)</span>
<a name="l00104"></a>00104 <span class="preprocessor"></span><span class="preprocessor">#define NGRAM_CLASSWID(wid,classid) (((classid)&lt;&lt;24) | 0x80000000 | (wid))</span>
<a name="l00105"></a>00105 <span class="preprocessor"></span><span class="preprocessor">#define NGRAM_IS_CLASSWID(wid) ((wid)&amp;0x80000000)</span>
<a name="l00106"></a>00106 <span class="preprocessor"></span>
<a name="l00107"></a>00107 <span class="preprocessor">#define UG_ALLOC_STEP 10</span>
<a name="l00108"></a>00108 <span class="preprocessor"></span>
<a name="l00110"></a><a class="code" href="structngram__funcs__s.html">00110</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structngram__funcs__s.html" title="Implementation-specific functions for operating on ngram_model_t objects.">ngram_funcs_s</a> {
<a name="l00114"></a><a class="code" href="structngram__funcs__s.html#a4211130880131f38e16022985816952f">00114</a>     void (*<a class="code" href="structngram__funcs__s.html#a4211130880131f38e16022985816952f" title="Implementation-specific function for freeing an ngram_model_t.">free</a>)(<a class="code" href="structngram__model__s.html" title="Common implementation of ngram_model_t.">ngram_model_t</a> *model);
<a name="l00118"></a><a class="code" href="structngram__funcs__s.html#abfd7e53c672aef5a34ec5114ec475916">00118</a>     int (*<a class="code" href="structngram__funcs__s.html#abfd7e53c672aef5a34ec5114ec475916" title="Implementation-specific function for applying language model weights.">apply_weights</a>)(<a class="code" href="structngram__model__s.html" title="Common implementation of ngram_model_t.">ngram_model_t</a> *model,
<a name="l00119"></a>00119                          float32 lw,
<a name="l00120"></a>00120                          float32 wip,
<a name="l00121"></a>00121                          float32 uw);
<a name="l00125"></a><a class="code" href="structngram__funcs__s.html#a81b0c7948179c2572fb274401b82278e">00125</a>     int32 (*<a class="code" href="structngram__funcs__s.html#a81b0c7948179c2572fb274401b82278e" title="Implementation-specific function for querying language model score.">score</a>)(<a class="code" href="structngram__model__s.html" title="Common implementation of ngram_model_t.">ngram_model_t</a> *model,
<a name="l00126"></a>00126                    int32 wid,
<a name="l00127"></a>00127                    int32 *history,
<a name="l00128"></a>00128                    int32 n_hist,
<a name="l00129"></a>00129                    int32 *n_used);
<a name="l00134"></a><a class="code" href="structngram__funcs__s.html#a2a64c66491914168bd830237cc93b16c">00134</a>     int32 (*<a class="code" href="structngram__funcs__s.html#a2a64c66491914168bd830237cc93b16c" title="Implementation-specific function for querying raw language model probability.">raw_score</a>)(<a class="code" href="structngram__model__s.html" title="Common implementation of ngram_model_t.">ngram_model_t</a> *model,
<a name="l00135"></a>00135                        int32 wid,
<a name="l00136"></a>00136                        int32 *history,
<a name="l00137"></a>00137                        int32 n_hist,
<a name="l00138"></a>00138                        int32 *n_used);
<a name="l00150"></a><a class="code" href="structngram__funcs__s.html#a6d553c95c7f4da4993f2b9df757ac016">00150</a>     int32 (*<a class="code" href="structngram__funcs__s.html#a6d553c95c7f4da4993f2b9df757ac016" title="Implementation-specific function for adding unigrams.">add_ug</a>)(<a class="code" href="structngram__model__s.html" title="Common implementation of ngram_model_t.">ngram_model_t</a> *model,
<a name="l00151"></a>00151                     int32 wid, int32 lweight);
<a name="l00155"></a><a class="code" href="structngram__funcs__s.html#a7abf2864db9c8e8d1d5909ea92144ffe">00155</a>     void (*<a class="code" href="structngram__funcs__s.html#a7abf2864db9c8e8d1d5909ea92144ffe" title="Implementation-specific function for purging N-Gram cache.">flush</a>)(<a class="code" href="structngram__model__s.html" title="Common implementation of ngram_model_t.">ngram_model_t</a> *model);
<a name="l00156"></a>00156 
<a name="l00160"></a><a class="code" href="structngram__funcs__s.html#a8148f132a986660ff500e46f9b2ea1c1">00160</a>     <a class="code" href="structngram__iter__s.html" title="Base iterator structure for N-grams.">ngram_iter_t</a> * (*iter)(<a class="code" href="structngram__model__s.html" title="Common implementation of ngram_model_t.">ngram_model_t</a> *model, int32 wid, int32 *history, int32 n_hist);
<a name="l00161"></a>00161 
<a name="l00165"></a><a class="code" href="structngram__funcs__s.html#a3a264fcbdbe8b4b342c533af090cfe8f">00165</a>     <a class="code" href="structngram__iter__s.html" title="Base iterator structure for N-grams.">ngram_iter_t</a> * (*mgrams)(<a class="code" href="structngram__model__s.html" title="Common implementation of ngram_model_t.">ngram_model_t</a> *model, int32 m);
<a name="l00166"></a>00166 
<a name="l00170"></a><a class="code" href="structngram__funcs__s.html#af83b5620eb7bc37984ad522b66e266ad">00170</a>     <a class="code" href="structngram__iter__s.html" title="Base iterator structure for N-grams.">ngram_iter_t</a> * (*successors)(<a class="code" href="structngram__iter__s.html" title="Base iterator structure for N-grams.">ngram_iter_t</a> *itor);
<a name="l00171"></a>00171 
<a name="l00175"></a><a class="code" href="structngram__funcs__s.html#ac515e6ad9a1afbda6b74e8204fd460b5">00175</a>     int32 <span class="keyword">const</span> * (*iter_get)(<a class="code" href="structngram__iter__s.html" title="Base iterator structure for N-grams.">ngram_iter_t</a> *itor,
<a name="l00176"></a>00176                               int32 *out_score,
<a name="l00177"></a>00177                               int32 *out_bowt);
<a name="l00178"></a>00178 
<a name="l00182"></a><a class="code" href="structngram__funcs__s.html#a57777056985f8adc3494e859c1102f3e">00182</a>     <a class="code" href="structngram__iter__s.html" title="Base iterator structure for N-grams.">ngram_iter_t</a> * (*iter_next)(<a class="code" href="structngram__iter__s.html" title="Base iterator structure for N-grams.">ngram_iter_t</a> *itor);
<a name="l00183"></a>00183 
<a name="l00187"></a><a class="code" href="structngram__funcs__s.html#ad7031e996c16516cf7f52e7a4adee4bb">00187</a>     void (*<a class="code" href="structngram__funcs__s.html#ad7031e996c16516cf7f52e7a4adee4bb" title="Implementation-specific function for iterating.">iter_free</a>)(<a class="code" href="structngram__iter__s.html" title="Base iterator structure for N-grams.">ngram_iter_t</a> *itor);
<a name="l00188"></a>00188 } <a class="code" href="structngram__funcs__s.html" title="Implementation-specific functions for operating on ngram_model_t objects.">ngram_funcs_t</a>;
<a name="l00189"></a>00189 
<a name="l00193"></a><a class="code" href="structngram__iter__s.html">00193</a> <span class="keyword">struct </span><a class="code" href="structngram__iter__s.html" title="Base iterator structure for N-grams.">ngram_iter_s</a> {
<a name="l00194"></a>00194     <a class="code" href="structngram__model__s.html" title="Common implementation of ngram_model_t.">ngram_model_t</a> *model;
<a name="l00195"></a><a class="code" href="structngram__iter__s.html#a1362ebe2dcf1c441929c845fc97958cb">00195</a>     int32 *<a class="code" href="structngram__iter__s.html#a1362ebe2dcf1c441929c845fc97958cb" title="Scratch space for word IDs.">wids</a>;      
<a name="l00196"></a><a class="code" href="structngram__iter__s.html#a80bce30ba5b180f85ca84d7288715858">00196</a>     int16 <a class="code" href="structngram__iter__s.html#a80bce30ba5b180f85ca84d7288715858" title="Order of history.">m</a>;          
<a name="l00197"></a><a class="code" href="structngram__iter__s.html#a7802a7883b1cc246b1bff629cd2cfb08">00197</a>     int16 <a class="code" href="structngram__iter__s.html#a7802a7883b1cc246b1bff629cd2cfb08" title="Is this a successor iterator?">successor</a>;  
<a name="l00198"></a>00198 };
<a name="l00199"></a>00199 
<a name="l00203"></a><a class="code" href="structclassdef__s.html">00203</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structclassdef__s.html" title="One class definition from a classdef file.">classdef_s</a> {
<a name="l00204"></a>00204     <span class="keywordtype">char</span> **words;
<a name="l00205"></a>00205     float32 *weights;
<a name="l00206"></a>00206     int32 n_words;
<a name="l00207"></a>00207 } <a class="code" href="structclassdef__s.html" title="One class definition from a classdef file.">classdef_t</a>;
<a name="l00208"></a>00208 
<a name="l00212"></a>00212 int32
<a name="l00213"></a>00213 ngram_model_init(<a class="code" href="structngram__model__s.html" title="Common implementation of ngram_model_t.">ngram_model_t</a> *model,
<a name="l00214"></a>00214                  <a class="code" href="structngram__funcs__s.html" title="Implementation-specific functions for operating on ngram_model_t objects.">ngram_funcs_t</a> *funcs,
<a name="l00215"></a>00215                  <a class="code" href="structlogmath__s.html">logmath_t</a> *lmath,
<a name="l00216"></a>00216                  int32 n, int32 n_unigram);
<a name="l00217"></a>00217 
<a name="l00221"></a>00221 <a class="code" href="structngram__model__s.html" title="Common implementation of ngram_model_t.">ngram_model_t</a> *ngram_model_arpa_read(<a class="code" href="structcmd__ln__t.html" title="Opaque structure used to hold the results of command-line parsing.">cmd_ln_t</a> *config,
<a name="l00222"></a>00222                                      <span class="keyword">const</span> <span class="keywordtype">char</span> *file_name,
<a name="l00223"></a>00223                                      <a class="code" href="structlogmath__s.html">logmath_t</a> *lmath);
<a name="l00227"></a>00227 <a class="code" href="structngram__model__s.html" title="Common implementation of ngram_model_t.">ngram_model_t</a> *ngram_model_dmp_read(<a class="code" href="structcmd__ln__t.html" title="Opaque structure used to hold the results of command-line parsing.">cmd_ln_t</a> *config,
<a name="l00228"></a>00228                                     <span class="keyword">const</span> <span class="keywordtype">char</span> *file_name,
<a name="l00229"></a>00229                                     <a class="code" href="structlogmath__s.html">logmath_t</a> *lmath);
<a name="l00233"></a>00233 <a class="code" href="structngram__model__s.html" title="Common implementation of ngram_model_t.">ngram_model_t</a> *ngram_model_dmp32_read(<a class="code" href="structcmd__ln__t.html" title="Opaque structure used to hold the results of command-line parsing.">cmd_ln_t</a> *config,
<a name="l00234"></a>00234                                      <span class="keyword">const</span> <span class="keywordtype">char</span> *file_name,
<a name="l00235"></a>00235                                      <a class="code" href="structlogmath__s.html">logmath_t</a> *lmath);
<a name="l00236"></a>00236 
<a name="l00240"></a>00240 <span class="keywordtype">int</span> ngram_model_arpa_write(<a class="code" href="structngram__model__s.html" title="Common implementation of ngram_model_t.">ngram_model_t</a> *model,
<a name="l00241"></a>00241                            <span class="keyword">const</span> <span class="keywordtype">char</span> *file_name);
<a name="l00245"></a>00245 <span class="keywordtype">int</span> ngram_model_dmp_write(<a class="code" href="structngram__model__s.html" title="Common implementation of ngram_model_t.">ngram_model_t</a> *model,
<a name="l00246"></a>00246                           <span class="keyword">const</span> <span class="keywordtype">char</span> *file_name);
<a name="l00247"></a>00247 
<a name="l00251"></a>00251 int32 read_classdef_file(<a class="code" href="structhash__table__t.html">hash_table_t</a> *classes, <span class="keyword">const</span> <span class="keywordtype">char</span> *classdef_file);
<a name="l00252"></a>00252 
<a name="l00256"></a>00256 <span class="keywordtype">void</span> classdef_free(<a class="code" href="structclassdef__s.html" title="One class definition from a classdef file.">classdef_t</a> *classdef);
<a name="l00257"></a>00257 
<a name="l00261"></a>00261 <a class="code" href="structngram__class__s.html" title="Implementation of ngram_class_t.">ngram_class_t</a> *ngram_class_new(<a class="code" href="structngram__model__s.html" title="Common implementation of ngram_model_t.">ngram_model_t</a> *model, int32 tag_wid,
<a name="l00262"></a>00262                                int32 start_wid, <a class="code" href="structgnode__s.html" title="A node in a generic list.">glist_t</a> classwords);
<a name="l00263"></a>00263 
<a name="l00267"></a>00267 <span class="keywordtype">void</span> ngram_class_free(<a class="code" href="structngram__class__s.html" title="Implementation of ngram_class_t.">ngram_class_t</a> *lmclass);
<a name="l00268"></a>00268 
<a name="l00274"></a>00274 int32 ngram_class_prob(<a class="code" href="structngram__class__s.html" title="Implementation of ngram_class_t.">ngram_class_t</a> *lmclass, int32 wid);
<a name="l00275"></a>00275 
<a name="l00279"></a>00279 <span class="keywordtype">void</span> ngram_iter_init(<a class="code" href="structngram__iter__s.html" title="Base iterator structure for N-grams.">ngram_iter_t</a> *itor, <a class="code" href="structngram__model__s.html" title="Common implementation of ngram_model_t.">ngram_model_t</a> *model,
<a name="l00280"></a>00280                      <span class="keywordtype">int</span> m, <span class="keywordtype">int</span> successor);
<a name="l00281"></a>00281 
<a name="l00282"></a>00282 <span class="preprocessor">#endif </span><span class="comment">/* __NGRAM_MODEL_INTERNAL_H__ */</span>
</pre></div></div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><b>ngram_model_internal.h</b>      </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>