<!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>PocketSphinx: src/libpocketsphinx/ngram_search.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">PocketSphinx <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 Page</span></a></li> <li><a href="annotated.html"><span>Data 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 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__search_8h.html',''); </script> <div id="doc-content"> <div class="header"> <div class="headertitle"> <h1>src/libpocketsphinx/ngram_search.h</h1> </div> </div> <div class="contents"> <a href="ngram__search_8h.html">Go to the documentation of this file.</a><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) 2008 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'' 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 <a name="l00042"></a>00042 <span class="preprocessor">#ifndef __NGRAM_SEARCH_H__</span> <a name="l00043"></a>00043 <span class="preprocessor"></span><span class="preprocessor">#define __NGRAM_SEARCH_H__</span> <a name="l00044"></a>00044 <span class="preprocessor"></span> <a name="l00045"></a>00045 <span class="comment">/* SphinxBase headers. */</span> <a name="l00046"></a>00046 <span class="preprocessor">#include <sphinxbase/cmd_ln.h></span> <a name="l00047"></a>00047 <span class="preprocessor">#include <sphinxbase/logmath.h></span> <a name="l00048"></a>00048 <span class="preprocessor">#include <sphinxbase/ngram_model.h></span> <a name="l00049"></a>00049 <span class="preprocessor">#include <sphinxbase/listelem_alloc.h></span> <a name="l00050"></a>00050 <span class="preprocessor">#include <sphinxbase/err.h></span> <a name="l00051"></a>00051 <a name="l00052"></a>00052 <span class="comment">/* Local headers. */</span> <a name="l00053"></a>00053 <span class="preprocessor">#include "<a class="code" href="pocketsphinx__internal_8h.html" title="Internal implementation of PocketSphinx decoder.">pocketsphinx_internal.h</a>"</span> <a name="l00054"></a>00054 <span class="preprocessor">#include "<a class="code" href="hmm_8h.html" title="Implementation of HMM base structure.">hmm.h</a>"</span> <a name="l00055"></a>00055 <a name="l00064"></a><a class="code" href="structchan__s.html">00064</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structchan__s.html" title="Lexical tree node data type.">chan_s</a> { <a name="l00065"></a><a class="code" href="structchan__s.html#a742d6a125ac468b95a1ddd880a956e35">00065</a> <a class="code" href="structhmm__t.html" title="An individual HMM among the HMM search space.">hmm_t</a> <a class="code" href="structchan__s.html#a742d6a125ac468b95a1ddd880a956e35" title="Basic HMM structure.">hmm</a>; <a name="l00068"></a><a class="code" href="structchan__s.html#a260b68eff64150d0ae9ce4db7feb1300">00068</a> <span class="keyword">struct </span><a class="code" href="structchan__s.html" title="Lexical tree node data type.">chan_s</a> *<a class="code" href="structchan__s.html#a260b68eff64150d0ae9ce4db7feb1300" title="first descendant of this channel; or, in the case of the last phone of a word, the next alternative r...">next</a>; <a name="l00071"></a><a class="code" href="structchan__s.html#a52e85d037ca3a8b21ff1eed1d469ca15">00071</a> <span class="keyword">struct </span><a class="code" href="structchan__s.html" title="Lexical tree node data type.">chan_s</a> *<a class="code" href="structchan__s.html#a52e85d037ca3a8b21ff1eed1d469ca15" title="sibling; i.e., next descendant of parent HMM">alt</a>; <a name="l00073"></a><a class="code" href="structchan__s.html#a33da51d8524073abc792519d0738ca0b">00073</a> int32 <a class="code" href="structchan__s.html#a33da51d8524073abc792519d0738ca0b" title="ciphone for this node">ciphone</a>; <a name="l00074"></a>00074 <span class="keyword">union </span>{ <a name="l00075"></a><a class="code" href="structchan__s.html#a136796f6a13c0d6989120f9aa25b85f1">00075</a> int32 <a class="code" href="structchan__s.html#a136796f6a13c0d6989120f9aa25b85f1" title="list of words whose last phone follows this one; this field indicates the first of the list; the rest...">penult_phn_wid</a>; <a name="l00079"></a><a class="code" href="structchan__s.html#acf84a2fa662e7ff626769e7d8152a608">00079</a> int32 <a class="code" href="structchan__s.html#acf84a2fa662e7ff626769e7d8152a608" title="right-context id for last phone of words">rc_id</a>; <a name="l00080"></a>00080 } info; <a name="l00081"></a>00081 } <a class="code" href="ngram__search_8h.html#a2c5740fe4792d870b73f4100b32e9324" title="Lexical tree node data type.">chan_t</a>; <a name="l00082"></a>00082 <a name="l00090"></a><a class="code" href="structroot__chan__s.html">00090</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structroot__chan__s.html" title="Lexical tree node data type for the first phone (root) of each dynamic HMM tree structure.">root_chan_s</a> { <a name="l00091"></a><a class="code" href="structroot__chan__s.html#a9d4d92ffa8b4079202ddebe3ba0eb290">00091</a> <a class="code" href="structhmm__t.html" title="An individual HMM among the HMM search space.">hmm_t</a> <a class="code" href="structroot__chan__s.html#a9d4d92ffa8b4079202ddebe3ba0eb290" title="Basic HMM structure.">hmm</a>; <a name="l00094"></a><a class="code" href="structroot__chan__s.html#ae0f0b90a7cb2fcb54cd7b30502dd497e">00094</a> <a class="code" href="structchan__s.html" title="Lexical tree node data type.">chan_t</a> *<a class="code" href="structroot__chan__s.html#ae0f0b90a7cb2fcb54cd7b30502dd497e" title="first descendant of this channel">next</a>; <a name="l00096"></a>00096 int32 penult_phn_wid; <a name="l00097"></a><a class="code" href="structroot__chan__s.html#af5bb41f0c9a03211ab90919f65be1564">00097</a> int32 <a class="code" href="structroot__chan__s.html#af5bb41f0c9a03211ab90919f65be1564" title="list of words consisting of this single phone; actually the first of the list, like penult_phn_wid; -...">this_phn_wid</a>; <a name="l00100"></a><a class="code" href="structroot__chan__s.html#ad67c37bf4183f518acd7760c09a806f6">00100</a> int16 <a class="code" href="structroot__chan__s.html#ad67c37bf4183f518acd7760c09a806f6" title="first ciphone of this node; all words rooted at this node begin with this ciphone">ciphone</a>; <a name="l00102"></a><a class="code" href="structroot__chan__s.html#a0c0cf22caf4c97879af86865764f1675">00102</a> int16 <a class="code" href="structroot__chan__s.html#a0c0cf22caf4c97879af86865764f1675" title="second ciphone of this node; one root HMM for each unique right context">ci2phone</a>; <a name="l00104"></a>00104 } <a class="code" href="ngram__search_8h.html#aab8eee3f73f666d0e12c5b355a651cff" title="Lexical tree node data type for the first phone (root) of each dynamic HMM tree structure.">root_chan_t</a>; <a name="l00105"></a>00105 <a name="l00109"></a><a class="code" href="structbptbl__s.html">00109</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structbptbl__s.html" title="Back pointer table (forward pass lattice; actually a tree)">bptbl_s</a> { <a name="l00110"></a><a class="code" href="structbptbl__s.html#ad1f5831762cf337974ce243902364f42">00110</a> int16 <a class="code" href="structbptbl__s.html#ad1f5831762cf337974ce243902364f42" title="start or end frame">frame</a>; <a name="l00111"></a><a class="code" href="structbptbl__s.html#a4948439666e1e2204a6d1c6d9cfd1cd0">00111</a> uint8 <a class="code" href="structbptbl__s.html#a4948439666e1e2204a6d1c6d9cfd1cd0" title="For absolute pruning.">valid</a>; <a name="l00112"></a><a class="code" href="structbptbl__s.html#acdc7410a4069418879aa022f9b61c13d">00112</a> uint8 <a class="code" href="structbptbl__s.html#acdc7410a4069418879aa022f9b61c13d" title="Reference count (number of successors)">refcnt</a>; <a name="l00113"></a><a class="code" href="structbptbl__s.html#a143ff0891fafd471000df7c73123b8a7">00113</a> int32 <a class="code" href="structbptbl__s.html#a143ff0891fafd471000df7c73123b8a7" title="Word index.">wid</a>; <a name="l00114"></a><a class="code" href="structbptbl__s.html#a4ca45ebc4a1ac18fc0596195e7e03bc8">00114</a> int32 <a class="code" href="structbptbl__s.html#a4ca45ebc4a1ac18fc0596195e7e03bc8" title="Back Pointer.">bp</a>; <a name="l00115"></a><a class="code" href="structbptbl__s.html#aa5643c0c19ce4d39d51ddf7376f4d508">00115</a> int32 <a class="code" href="structbptbl__s.html#aa5643c0c19ce4d39d51ddf7376f4d508" title="Score (best among all right contexts)">score</a>; <a name="l00116"></a><a class="code" href="structbptbl__s.html#abf9e4bcf1927aa09fb2b30c59e99f551">00116</a> int32 <a class="code" href="structbptbl__s.html#abf9e4bcf1927aa09fb2b30c59e99f551" title="Start of BScoreStack for various right contexts.">s_idx</a>; <a name="l00117"></a><a class="code" href="structbptbl__s.html#a91247e4f807cf780afe8f5ac45e720b8">00117</a> int32 <a class="code" href="structbptbl__s.html#a91247e4f807cf780afe8f5ac45e720b8" title="wid of this or latest predecessor real word">real_wid</a>; <a name="l00118"></a><a class="code" href="structbptbl__s.html#a83784e3b0121bc365d485151ab277920">00118</a> int32 <a class="code" href="structbptbl__s.html#a83784e3b0121bc365d485151ab277920" title="wid of second-last real word">prev_real_wid</a>; <a name="l00119"></a><a class="code" href="structbptbl__s.html#aa7704ba76d3dcde6b8a24855362a4289">00119</a> int16 <a class="code" href="structbptbl__s.html#aa7704ba76d3dcde6b8a24855362a4289" title="last phone of this word">last_phone</a>; <a name="l00120"></a><a class="code" href="structbptbl__s.html#a27b8e54bb7552e6afc15e4f44f42e3b7">00120</a> int16 <a class="code" href="structbptbl__s.html#a27b8e54bb7552e6afc15e4f44f42e3b7" title="next-to-last phone of this word">last2_phone</a>; <a name="l00121"></a>00121 } <a class="code" href="ngram__search_8h.html#a81093c091a82066374627744595840e6" title="Back pointer table (forward pass lattice; actually a tree)">bptbl_t</a>; <a name="l00122"></a>00122 <a name="l00126"></a><a class="code" href="structbptbl__seg__s.html">00126</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structbptbl__seg__s.html" title="Segmentation &quot;iterator&quot; for backpointer table results.">bptbl_seg_s</a> { <a name="l00127"></a><a class="code" href="structbptbl__seg__s.html#ac21f715b189c7e452385252bfcee47fe">00127</a> <a class="code" href="structps__seg__s.html" title="Base structure for hypothesis segmentation iterator.">ps_seg_t</a> <a class="code" href="structbptbl__seg__s.html#ac21f715b189c7e452385252bfcee47fe" title="Base structure.">base</a>; <a name="l00128"></a><a class="code" href="structbptbl__seg__s.html#a81e3d422fb2307c1a83e9490525dce7f">00128</a> int32 *<a class="code" href="structbptbl__seg__s.html#a81e3d422fb2307c1a83e9490525dce7f" title="Sequence of backpointer IDs.">bpidx</a>; <a name="l00129"></a><a class="code" href="structbptbl__seg__s.html#a8d1f0aa7dd09e2d6321a00b68ab6a051">00129</a> int16 <a class="code" href="structbptbl__seg__s.html#a8d1f0aa7dd09e2d6321a00b68ab6a051" title="Number of backpointer IDs.">n_bpidx</a>; <a name="l00130"></a><a class="code" href="structbptbl__seg__s.html#a1649196a2c03fb61b31624086ee998b5">00130</a> int16 <a class="code" href="structbptbl__seg__s.html#a1649196a2c03fb61b31624086ee998b5" title="Current position in bpidx.">cur</a>; <a name="l00131"></a>00131 } <a class="code" href="ngram__search_8h.html#a89d7d2a948a3cc2d55c77120cbd35e0d" title="Segmentation &quot;iterator&quot; for backpointer table results.">bptbl_seg_t</a>; <a name="l00132"></a>00132 <a name="l00133"></a>00133 <span class="comment">/*</span> <a name="l00134"></a>00134 <span class="comment"> * Candidates words for entering their last phones. Cleared and rebuilt in each</span> <a name="l00135"></a>00135 <span class="comment"> * frame.</span> <a name="l00136"></a>00136 <span class="comment"> * NOTE: candidates can only be multi-phone, real dictionary words.</span> <a name="l00137"></a>00137 <span class="comment"> */</span> <a name="l00138"></a><a class="code" href="structlastphn__cand__s.html">00138</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structlastphn__cand__s.html">lastphn_cand_s</a> { <a name="l00139"></a>00139 int32 wid; <a name="l00140"></a>00140 int32 score; <a name="l00141"></a>00141 int32 bp; <a name="l00142"></a>00142 int32 next; <span class="comment">/* next candidate starting at the same frame */</span> <a name="l00143"></a>00143 } <a class="code" href="structlastphn__cand__s.html">lastphn_cand_t</a>; <a name="l00144"></a>00144 <a name="l00145"></a>00145 <span class="comment">/*</span> <a name="l00146"></a>00146 <span class="comment"> * Since the same instance of a word (i.e., <word,start-frame>) reaches its last</span> <a name="l00147"></a>00147 <span class="comment"> * phone several times, we can compute its best BP and LM transition score info</span> <a name="l00148"></a>00148 <span class="comment"> * just the first time and cache it for future occurrences. Structure for such</span> <a name="l00149"></a>00149 <span class="comment"> * a cache.</span> <a name="l00150"></a>00150 <span class="comment"> */</span> <a name="l00151"></a><a class="code" href="structlast__ltrans__t.html">00151</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{ <a name="l00152"></a>00152 int32 sf; <span class="comment">/* Start frame */</span> <a name="l00153"></a>00153 int32 dscr; <span class="comment">/* Delta-score upon entering last phone */</span> <a name="l00154"></a>00154 int32 bp; <span class="comment">/* Best BP */</span> <a name="l00155"></a>00155 } <a class="code" href="structlast__ltrans__t.html">last_ltrans_t</a>; <a name="l00156"></a>00156 <a name="l00157"></a>00157 <span class="preprocessor">#define CAND_SF_ALLOCSIZE 32</span> <a name="l00158"></a><a class="code" href="structcand__sf__t.html">00158</a> <span class="preprocessor"></span><span class="keyword">typedef</span> <span class="keyword">struct </span>{ <a name="l00159"></a>00159 int32 bp_ef; <a name="l00160"></a>00160 int32 cand; <a name="l00161"></a>00161 } <a class="code" href="structcand__sf__t.html">cand_sf_t</a>; <a name="l00162"></a>00162 <a name="l00163"></a>00163 <span class="comment">/*</span> <a name="l00164"></a>00164 <span class="comment"> * Structure for reorganizing the BP table entries in the current frame according</span> <a name="l00165"></a>00165 <span class="comment"> * to distinct right context ci-phones. Each entry contains the best BP entry for</span> <a name="l00166"></a>00166 <span class="comment"> * a given right context. Each successor word will pick up the correct entry based</span> <a name="l00167"></a>00167 <span class="comment"> * on its first ci-phone.</span> <a name="l00168"></a>00168 <span class="comment"> */</span> <a name="l00169"></a><a class="code" href="structbestbp__rc__s.html">00169</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structbestbp__rc__s.html">bestbp_rc_s</a> { <a name="l00170"></a>00170 int32 score; <a name="l00171"></a>00171 int32 path; <span class="comment">/* BP table index corresponding to this entry */</span> <a name="l00172"></a>00172 int32 lc; <span class="comment">/* right most ci-phone of above BP entry word */</span> <a name="l00173"></a>00173 } <a class="code" href="structbestbp__rc__s.html">bestbp_rc_t</a>; <a name="l00174"></a>00174 <a name="l00175"></a>00175 <span class="preprocessor">#define NO_BP -1</span> <a name="l00176"></a>00176 <span class="preprocessor"></span> <a name="l00180"></a><a class="code" href="structngram__search__stats__s.html">00180</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structngram__search__stats__s.html" title="Various statistics for profiling.">ngram_search_stats_s</a> { <a name="l00181"></a>00181 int32 n_phone_eval; <a name="l00182"></a>00182 int32 n_root_chan_eval; <a name="l00183"></a>00183 int32 n_nonroot_chan_eval; <a name="l00184"></a>00184 int32 n_last_chan_eval; <a name="l00185"></a>00185 int32 n_word_lastchan_eval; <a name="l00186"></a>00186 int32 n_lastphn_cand_utt; <a name="l00187"></a>00187 int32 n_fwdflat_chan; <a name="l00188"></a>00188 int32 n_fwdflat_words; <a name="l00189"></a>00189 int32 n_fwdflat_word_transition; <a name="l00190"></a>00190 int32 n_senone_active_utt; <a name="l00191"></a>00191 } <a class="code" href="ngram__search_8h.html#ae68375016e7d208d22042a7dd4a0f37c" title="Various statistics for profiling.">ngram_search_stats_t</a>; <a name="l00192"></a>00192 <a name="l00193"></a>00193 <a name="l00197"></a><a class="code" href="structngram__search__s.html">00197</a> <span class="keyword">struct </span><a class="code" href="structngram__search__s.html" title="N-Gram search module structure.">ngram_search_s</a> { <a name="l00198"></a>00198 <a class="code" href="structps__search__s.html" title="Base structure for search module.">ps_search_t</a> base; <a name="l00199"></a><a class="code" href="structngram__search__s.html#a6127a6d8fb53832e67456c11aa6ad9c4">00199</a> ngram_model_t *<a class="code" href="structngram__search__s.html#a6127a6d8fb53832e67456c11aa6ad9c4" title="Set of language models.">lmset</a>; <a name="l00200"></a><a class="code" href="structngram__search__s.html#acfbdd34e3dadbaa384818402f1dd59bf">00200</a> <a class="code" href="structhmm__context__t.html" title="Shared information between a set of HMMs.">hmm_context_t</a> *<a class="code" href="structngram__search__s.html#acfbdd34e3dadbaa384818402f1dd59bf" title="HMM context.">hmmctx</a>; <a name="l00202"></a>00202 <span class="comment">/* Flags to quickly indicate which passes are enabled. */</span> <a name="l00203"></a>00203 uint8 fwdtree; <a name="l00204"></a>00204 uint8 fwdflat; <a name="l00205"></a>00205 uint8 bestpath; <a name="l00206"></a>00206 <a name="l00207"></a>00207 <span class="comment">/* State of procesing. */</span> <a name="l00208"></a>00208 uint8 done; <a name="l00209"></a>00209 <a name="l00210"></a>00210 <span class="comment">/* Allocators */</span> <a name="l00211"></a><a class="code" href="structngram__search__s.html#abe9fe60f6e48b9a6e3d41856bb1dc109">00211</a> listelem_alloc_t *<a class="code" href="structngram__search__s.html#abe9fe60f6e48b9a6e3d41856bb1dc109" title="For chan_t.">chan_alloc</a>; <a name="l00212"></a><a class="code" href="structngram__search__s.html#a576470858bfa44c671f0e677902ab424">00212</a> listelem_alloc_t *<a class="code" href="structngram__search__s.html#a576470858bfa44c671f0e677902ab424" title="For root_chan_t.">root_chan_alloc</a>; <a name="l00213"></a><a class="code" href="structngram__search__s.html#a21600dc2e23744f0be9c64a4db8d7e50">00213</a> listelem_alloc_t *<a class="code" href="structngram__search__s.html#a21600dc2e23744f0be9c64a4db8d7e50" title="For latnode_t.">latnode_alloc</a>; <a name="l00231"></a><a class="code" href="structngram__search__s.html#ae1b0a51cfcddc1e4b6ac94fa1e48887a">00231</a> <a class="code" href="structroot__chan__s.html" title="Lexical tree node data type for the first phone (root) of each dynamic HMM tree structure.">root_chan_t</a> *<a class="code" href="structngram__search__s.html#ae1b0a51cfcddc1e4b6ac94fa1e48887a" title="Search structure of HMM instances.">root_chan</a>; <a name="l00232"></a><a class="code" href="structngram__search__s.html#abc8a67e3f64adc470c78dfdd23be4126">00232</a> int32 <a class="code" href="structngram__search__s.html#abc8a67e3f64adc470c78dfdd23be4126" title="Number of root_chan allocated.">n_root_chan_alloc</a>; <a name="l00233"></a><a class="code" href="structngram__search__s.html#a297d8bdb856617490ee8ccd99df70e68">00233</a> int32 <a class="code" href="structngram__search__s.html#a297d8bdb856617490ee8ccd99df70e68" title="Number of valid root_chan.">n_root_chan</a>; <a name="l00234"></a><a class="code" href="structngram__search__s.html#a043723786367f5026dce99c261f7086d">00234</a> int32 <a class="code" href="structngram__search__s.html#a043723786367f5026dce99c261f7086d" title="Number of valid non-root channels.">n_nonroot_chan</a>; <a name="l00235"></a><a class="code" href="structngram__search__s.html#a4b2b42349e9e3df7e93b4a7d6994f63f">00235</a> int32 <a class="code" href="structngram__search__s.html#a4b2b42349e9e3df7e93b4a7d6994f63f" title="Maximum possible number of non-root channels.">max_nonroot_chan</a>; <a name="l00236"></a><a class="code" href="structngram__search__s.html#a1ffa3c9100252122ae8a2a713c50b527">00236</a> <a class="code" href="structroot__chan__s.html" title="Lexical tree node data type for the first phone (root) of each dynamic HMM tree structure.">root_chan_t</a> *<a class="code" href="structngram__search__s.html#a1ffa3c9100252122ae8a2a713c50b527" title="Root HMMs for single-phone words.">rhmm_1ph</a>; <a name="l00246"></a><a class="code" href="structngram__search__s.html#a79deb7295a261cd82d2a6b48cb119e77">00246</a> <a class="code" href="structchan__s.html" title="Lexical tree node data type.">chan_t</a> **<a class="code" href="structngram__search__s.html#a79deb7295a261cd82d2a6b48cb119e77" title="Channels associated with a given word (only used for right contexts, single-phone words in fwdtree se...">word_chan</a>; <a name="l00247"></a><a class="code" href="structngram__search__s.html#aeb4c98851bf9b239ca607ca59f59ff4c">00247</a> bitvec_t *<a class="code" href="structngram__search__s.html#aeb4c98851bf9b239ca607ca59f59ff4c" title="array of active flags for all words.">word_active</a>; <a name="l00263"></a><a class="code" href="structngram__search__s.html#ab251bb3d0ddd33dd99ed390b61e481f2">00263</a> int32 *<a class="code" href="structngram__search__s.html#ab251bb3d0ddd33dd99ed390b61e481f2" title="Each node in the HMM tree structure may point to a set of words whose last phone would follow that no...">homophone_set</a>; <a name="l00264"></a><a class="code" href="structngram__search__s.html#a1157923e0060b947e05caa819c8abe2c">00264</a> int32 *<a class="code" href="structngram__search__s.html#a1157923e0060b947e05caa819c8abe2c" title="list of single-phone word ids">single_phone_wid</a>; <a name="l00265"></a><a class="code" href="structngram__search__s.html#a9168184c862d6f63bd7926e6581b25d9">00265</a> int32 <a class="code" href="structngram__search__s.html#a9168184c862d6f63bd7926e6581b25d9" title="Number single phone words in dict (total)">n_1ph_words</a>; <a name="l00266"></a><a class="code" href="structngram__search__s.html#a988672d895f1ee61dbf790b2065df4df">00266</a> int32 <a class="code" href="structngram__search__s.html#a988672d895f1ee61dbf790b2065df4df" title="Number single phone dict words also in LM; these come first in single_phone_wid.">n_1ph_LMwords</a>; <a name="l00275"></a><a class="code" href="structngram__search__s.html#a83731bf0e2234e632c5e78f2321f5b2d">00275</a> <a class="code" href="structchan__s.html" title="Lexical tree node data type.">chan_t</a> ***<a class="code" href="structngram__search__s.html#a83731bf0e2234e632c5e78f2321f5b2d" title="Array of active channels for current and next frame.">active_chan_list</a>; <a name="l00276"></a><a class="code" href="structngram__search__s.html#ac33f60894871671ec5c2173ca56d600f">00276</a> int32 <a class="code" href="structngram__search__s.html#ac33f60894871671ec5c2173ca56d600f" title="Number entries in active_chan_list.">n_active_chan</a>[2]; <a name="l00287"></a><a class="code" href="structngram__search__s.html#a5056573bf95990cc28c97a56cd76ce9a">00287</a> int32 **<a class="code" href="structngram__search__s.html#a5056573bf95990cc28c97a56cd76ce9a" title="Array of active multi-phone words for current and next frame.">active_word_list</a>; <a name="l00288"></a><a class="code" href="structngram__search__s.html#a5c864f1fe331fc95c04e0d87a5bdf9ee">00288</a> int32 <a class="code" href="structngram__search__s.html#a5c864f1fe331fc95c04e0d87a5bdf9ee" title="Number entries in active_word_list.">n_active_word</a>[2]; <a name="l00290"></a>00290 <span class="comment">/*</span> <a name="l00291"></a>00291 <span class="comment"> * FIXME: Document all of these bits.</span> <a name="l00292"></a>00292 <span class="comment"> */</span> <a name="l00293"></a>00293 <a class="code" href="structlastphn__cand__s.html">lastphn_cand_t</a> *lastphn_cand; <a name="l00294"></a>00294 int32 n_lastphn_cand; <a name="l00295"></a>00295 <a class="code" href="structlast__ltrans__t.html">last_ltrans_t</a> *last_ltrans; <span class="comment">/* one per word */</span> <a name="l00296"></a>00296 int32 cand_sf_alloc; <a name="l00297"></a>00297 <a class="code" href="structcand__sf__t.html">cand_sf_t</a> *cand_sf; <a name="l00298"></a>00298 <a class="code" href="structbestbp__rc__s.html">bestbp_rc_t</a> *bestbp_rc; <a name="l00299"></a>00299 <a name="l00300"></a>00300 <a class="code" href="structbptbl__s.html" title="Back pointer table (forward pass lattice; actually a tree)">bptbl_t</a> *bp_table; <span class="comment">/* Forward pass lattice */</span> <a name="l00301"></a>00301 int32 bpidx; <span class="comment">/* First free BPTable entry */</span> <a name="l00302"></a>00302 int32 bp_table_size; <a name="l00303"></a>00303 int32 *bscore_stack; <span class="comment">/* Score stack for all possible right contexts */</span> <a name="l00304"></a>00304 int32 bss_head; <span class="comment">/* First free BScoreStack entry */</span> <a name="l00305"></a>00305 int32 bscore_stack_size; <a name="l00306"></a>00306 <a name="l00307"></a><a class="code" href="structngram__search__s.html#a38ea5de504b3d7ad2390a3f8966d502f">00307</a> int32 <a class="code" href="structngram__search__s.html#a38ea5de504b3d7ad2390a3f8966d502f" title="Number of frames allocated in bp_table_idx and friends.">n_frame_alloc</a>; <a name="l00308"></a><a class="code" href="structngram__search__s.html#a5255e56d28c239a4e1d9b1721e8a2f8d">00308</a> int32 <a class="code" href="structngram__search__s.html#a5255e56d28c239a4e1d9b1721e8a2f8d" title="Number of frames actually present.">n_frame</a>; <a name="l00309"></a>00309 int32 *bp_table_idx; <span class="comment">/* First BPTable entry for each frame */</span> <a name="l00310"></a>00310 int32 *word_lat_idx; <span class="comment">/* BPTable index for any word in current frame;</span> <a name="l00311"></a>00311 <span class="comment"> cleared before each frame */</span> <a name="l00312"></a>00312 <a name="l00313"></a>00313 <span class="comment">/*</span> <a name="l00314"></a>00314 <span class="comment"> * Flat lexicon (2nd pass) search stuff.</span> <a name="l00315"></a>00315 <span class="comment"> */</span> <a name="l00316"></a><a class="code" href="structngram__search__s.html#aa54544457c363ccccb87fc7ec63a5f3e">00316</a> <a class="code" href="structps__latnode__s.html" title="DAG nodes.">ps_latnode_t</a> **<a class="code" href="structngram__search__s.html#aa54544457c363ccccb87fc7ec63a5f3e" title="List of active words in each frame.">frm_wordlist</a>; <a name="l00317"></a><a class="code" href="structngram__search__s.html#a774f1640c5ece856f4bef98d98e7c959">00317</a> int32 *<a class="code" href="structngram__search__s.html#a774f1640c5ece856f4bef98d98e7c959" title="List of active word IDs for utterance.">fwdflat_wordlist</a>; <a name="l00318"></a>00318 bitvec_t *expand_word_flag; <a name="l00319"></a>00319 int32 *expand_word_list; <a name="l00320"></a>00320 int32 n_expand_words; <a name="l00321"></a>00321 int32 min_ef_width; <a name="l00322"></a>00322 int32 max_sf_win; <a name="l00323"></a>00323 float32 fwdflat_fwdtree_lw_ratio; <a name="l00324"></a>00324 <a name="l00325"></a><a class="code" href="structngram__search__s.html#a150d99157e2f37a6f0dbb4b02682d9c3">00325</a> int32 <a class="code" href="structngram__search__s.html#a150d99157e2f37a6f0dbb4b02682d9c3" title="Best Viterbi path score.">best_score</a>; <a name="l00326"></a><a class="code" href="structngram__search__s.html#a81ee45f3c184568e2b5f8b79c58e0b9e">00326</a> int32 <a class="code" href="structngram__search__s.html#a81ee45f3c184568e2b5f8b79c58e0b9e" title="Best Viterbi path score for last phone.">last_phone_best_score</a>; <a name="l00327"></a>00327 int32 renormalized; <a name="l00328"></a>00328 <a name="l00329"></a>00329 <span class="comment">/*</span> <a name="l00330"></a>00330 <span class="comment"> * DAG (3rd pass) search stuff.</span> <a name="l00331"></a>00331 <span class="comment"> */</span> <a name="l00332"></a>00332 float32 bestpath_fwdtree_lw_ratio; <a name="l00333"></a><a class="code" href="structngram__search__s.html#a1e3d4b67e4b11c6c11ebe16552d53d2d">00333</a> float32 <a class="code" href="structngram__search__s.html#a1e3d4b67e4b11c6c11ebe16552d53d2d" title="Acoustic score scale for posterior probabilities.">ascale</a>; <a name="l00335"></a><a class="code" href="structngram__search__s.html#a5758d167fbb48e824a6a58186620e06d">00335</a> <a class="code" href="structngram__search__stats__s.html" title="Various statistics for profiling.">ngram_search_stats_t</a> <a class="code" href="structngram__search__s.html#a5758d167fbb48e824a6a58186620e06d" title="Various statistics for profiling.">st</a>; <a name="l00336"></a>00336 ptmr_t fwdtree_perf; <a name="l00337"></a>00337 ptmr_t fwdflat_perf; <a name="l00338"></a>00338 ptmr_t bestpath_perf; <a name="l00339"></a>00339 int32 n_tot_frame; <a name="l00340"></a>00340 <a name="l00341"></a>00341 <span class="comment">/* A collection of beam widths. */</span> <a name="l00342"></a>00342 int32 beam; <a name="l00343"></a>00343 int32 dynamic_beam; <a name="l00344"></a>00344 int32 pbeam; <a name="l00345"></a>00345 int32 wbeam; <a name="l00346"></a>00346 int32 lpbeam; <a name="l00347"></a>00347 int32 lponlybeam; <a name="l00348"></a>00348 int32 fwdflatbeam; <a name="l00349"></a>00349 int32 fwdflatwbeam; <a name="l00350"></a>00350 int32 fillpen; <a name="l00351"></a>00351 int32 silpen; <a name="l00352"></a>00352 int32 wip; <a name="l00353"></a>00353 int32 nwpen; <a name="l00354"></a>00354 int32 pip; <a name="l00355"></a>00355 int32 maxwpf; <a name="l00356"></a>00356 int32 maxhmmpf; <a name="l00357"></a>00357 }; <a name="l00358"></a>00358 <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structngram__search__s.html" title="N-Gram search module structure.">ngram_search_s</a> <a class="code" href="structngram__search__s.html" title="N-Gram search module structure.">ngram_search_t</a>; <a name="l00359"></a>00359 <a name="l00363"></a>00363 <a class="code" href="structps__search__s.html" title="Base structure for search module.">ps_search_t</a> *<a class="code" href="ngram__search_8c.html#afa0dcbb86340083bce1412c9309742bc" title="Initialize the N-Gram search module.">ngram_search_init</a>(cmd_ln_t *config, <a name="l00364"></a>00364 <a class="code" href="structacmod__s.html" title="Acoustic model structure.">acmod_t</a> *acmod, <a name="l00365"></a>00365 <a class="code" href="structdict__t.html" title="a structure for a dictionary.">dict_t</a> *dict, <a name="l00366"></a>00366 <a class="code" href="structdict2pid__t.html" title="Building composite triphone (as well as word internal triphones) with the dictionary.">dict2pid_t</a> *d2p); <a name="l00367"></a>00367 <a name="l00371"></a>00371 <span class="keywordtype">void</span> <a class="code" href="ngram__search_8c.html#aeaf140dc2bbeaa5c274f73480b5328f3" title="Finalize the N-Gram search module.">ngram_search_free</a>(<a class="code" href="structps__search__s.html" title="Base structure for search module.">ps_search_t</a> *ngs); <a name="l00372"></a>00372 <a name="l00378"></a>00378 <span class="keywordtype">int</span> <a class="code" href="ngram__search_8c.html#a7772e007b7d7fdf437c87aeb08b59c71" title="Record the current frame&#39;s index in the backpointer table.">ngram_search_mark_bptable</a>(<a class="code" href="structngram__search__s.html" title="N-Gram search module structure.">ngram_search_t</a> *ngs, <span class="keywordtype">int</span> frame_idx); <a name="l00379"></a>00379 <a name="l00383"></a>00383 <span class="keywordtype">void</span> <a class="code" href="ngram__search_8c.html#ae36649be6f5a2190e759e7ed13bd7b6b" title="Enter a word in the backpointer table.">ngram_search_save_bp</a>(<a class="code" href="structngram__search__s.html" title="N-Gram search module structure.">ngram_search_t</a> *ngs, <span class="keywordtype">int</span> frame_idx, int32 w, <a name="l00384"></a>00384 int32 score, int32 path, int32 rc); <a name="l00385"></a>00385 <a name="l00389"></a>00389 <span class="keywordtype">void</span> <a class="code" href="ngram__search_8c.html#a1ddcc1a9cb3e164ceb2140097ed23a3e" title="Allocate last phone channels for all possible right contexts for word w.">ngram_search_alloc_all_rc</a>(<a class="code" href="structngram__search__s.html" title="N-Gram search module structure.">ngram_search_t</a> *ngs, int32 w); <a name="l00390"></a>00390 <a name="l00394"></a>00394 <span class="keywordtype">void</span> <a class="code" href="ngram__search_8c.html#a15477192481dffcb29e9c4167eff6c3c" title="Allocate last phone channels for all possible right contexts for word w.">ngram_search_free_all_rc</a>(<a class="code" href="structngram__search__s.html" title="N-Gram search module structure.">ngram_search_t</a> *ngs, int32 w); <a name="l00395"></a>00395 <a name="l00401"></a>00401 <span class="keywordtype">int</span> <a class="code" href="ngram__search_8c.html#aa4b308f06bdf75b2f5eb0f0559f775ae" title="Find the best word exit for the current frame in the backpointer table.">ngram_search_find_exit</a>(<a class="code" href="structngram__search__s.html" title="N-Gram search module structure.">ngram_search_t</a> *ngs, <span class="keywordtype">int</span> frame_idx, int32 *out_best_score); <a name="l00402"></a>00402 <a name="l00408"></a>00408 <span class="keywordtype">char</span> <span class="keyword">const</span> *<a class="code" href="ngram__search_8c.html#aee393a136f8f7e8b98161e6eed7b1dd9" title="Backtrace from a given backpointer index to obtain a word hypothesis.">ngram_search_bp_hyp</a>(<a class="code" href="structngram__search__s.html" title="N-Gram search module structure.">ngram_search_t</a> *ngs, <span class="keywordtype">int</span> bpidx); <a name="l00409"></a>00409 <a name="l00413"></a>00413 <span class="keywordtype">void</span> <a class="code" href="ngram__search_8h.html#a2fa760c99f77eb075157304f4359941e" title="Compute language and acoustic scores for backpointer table entries.">ngram_compute_seg_scores</a>(<a class="code" href="structngram__search__s.html" title="N-Gram search module structure.">ngram_search_t</a> *ngs, float32 lwf); <a name="l00414"></a>00414 <a name="l00418"></a>00418 <a class="code" href="structps__lattice__s.html" title="Word graph structure used in bestpath/nbest search.">ps_lattice_t</a> *<a class="code" href="ngram__search_8c.html#ac30e7dec4bbfeee9f5163abf4bbd1014" title="Construct a word lattice from the current hypothesis.">ngram_search_lattice</a>(<a class="code" href="structps__search__s.html" title="Base structure for search module.">ps_search_t</a> *search); <a name="l00419"></a>00419 <a name="l00423"></a>00423 int32 <a class="code" href="ngram__search_8c.html#a25a80e488425b2bd4e24eb753c9295a5" title="Get the exit score for a backpointer entry with a given right context.">ngram_search_exit_score</a>(<a class="code" href="structngram__search__s.html" title="N-Gram search module structure.">ngram_search_t</a> *ngs, <a class="code" href="structbptbl__s.html" title="Back pointer table (forward pass lattice; actually a tree)">bptbl_t</a> *pbe, <span class="keywordtype">int</span> rcphone); <a name="l00424"></a>00424 <a name="l00425"></a>00425 <span class="preprocessor">#endif </span><span class="comment">/* __NGRAM_SEARCH_H__ */</span> </pre></div></div> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="ngram__search_8h.html">ngram_search.h</a> </li> <li class="footer">Generated on Wed Apr 20 2011 for PocketSphinx by  <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>