Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > 56b1fde4ed0e5f3d153fe0391e13cdf1 > files > 41

pocketsphinx-devel-0.7-1.fc14.x86_64.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>PocketSphinx: src/libpocketsphinx/fsg_lextree.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&#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="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('fsg__lextree_8h.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<h1>src/libpocketsphinx/fsg_lextree.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-2004 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"> *</span>
<a name="l00019"></a>00019 <span class="comment"> * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS&#39;&#39; AND </span>
<a name="l00020"></a>00020 <span class="comment"> * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, </span>
<a name="l00021"></a>00021 <span class="comment"> * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR</span>
<a name="l00022"></a>00022 <span class="comment"> * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY</span>
<a name="l00023"></a>00023 <span class="comment"> * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</span>
<a name="l00024"></a>00024 <span class="comment"> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT </span>
<a name="l00025"></a>00025 <span class="comment"> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, </span>
<a name="l00026"></a>00026 <span class="comment"> * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY </span>
<a name="l00027"></a>00027 <span class="comment"> * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT </span>
<a name="l00028"></a>00028 <span class="comment"> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE </span>
<a name="l00029"></a>00029 <span class="comment"> * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span>
<a name="l00030"></a>00030 <span class="comment"> *</span>
<a name="l00031"></a>00031 <span class="comment"> * ====================================================================</span>
<a name="l00032"></a>00032 <span class="comment"> *</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"> * fsg_lextree.h -- The collection of all the lextrees for the entire FSM.</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"> * CMU ARPA Speech Project</span>
<a name="l00039"></a>00039 <span class="comment"> *</span>
<a name="l00040"></a>00040 <span class="comment"> * Copyright (c) 2004 Carnegie Mellon University.</span>
<a name="l00041"></a>00041 <span class="comment"> * ALL RIGHTS RESERVED.</span>
<a name="l00042"></a>00042 <span class="comment"> * **********************************************</span>
<a name="l00043"></a>00043 <span class="comment"> * </span>
<a name="l00044"></a>00044 <span class="comment"> * HISTORY</span>
<a name="l00045"></a>00045 <span class="comment"> * </span>
<a name="l00046"></a>00046 <span class="comment"> * $Log: fsg_lextree.h,v $</span>
<a name="l00047"></a>00047 <span class="comment"> * Revision 1.1.1.1  2006/05/23 18:45:02  dhuggins</span>
<a name="l00048"></a>00048 <span class="comment"> * re-importation</span>
<a name="l00049"></a>00049 <span class="comment"> *</span>
<a name="l00050"></a>00050 <span class="comment"> * Revision 1.1  2004/07/16 00:57:12  egouvea</span>
<a name="l00051"></a>00051 <span class="comment"> * Added Ravi&#39;s implementation of FSG support.</span>
<a name="l00052"></a>00052 <span class="comment"> *</span>
<a name="l00053"></a>00053 <span class="comment"> * Revision 1.3  2004/06/23 20:32:16  rkm</span>
<a name="l00054"></a>00054 <span class="comment"> * *** empty log message ***</span>
<a name="l00055"></a>00055 <span class="comment"> *</span>
<a name="l00056"></a>00056 <span class="comment"> * Revision 1.2  2004/05/27 14:22:57  rkm</span>
<a name="l00057"></a>00057 <span class="comment"> * FSG cross-word triphones completed (but for single-phone words)</span>
<a name="l00058"></a>00058 <span class="comment"> *</span>
<a name="l00059"></a>00059 <span class="comment"> * Revision 1.1.1.1  2004/03/01 14:30:31  rkm</span>
<a name="l00060"></a>00060 <span class="comment"> *</span>
<a name="l00061"></a>00061 <span class="comment"> *</span>
<a name="l00062"></a>00062 <span class="comment"> * Revision 1.1  2004/02/23 15:53:45  rkm</span>
<a name="l00063"></a>00063 <span class="comment"> * Renamed from fst to fsg</span>
<a name="l00064"></a>00064 <span class="comment"> *</span>
<a name="l00065"></a>00065 <span class="comment"> * Revision 1.2  2004/02/19 21:16:54  rkm</span>
<a name="l00066"></a>00066 <span class="comment"> * Added fsg_search.{c,h}</span>
<a name="l00067"></a>00067 <span class="comment"> *</span>
<a name="l00068"></a>00068 <span class="comment"> * Revision 1.1  2004/02/18 15:02:34  rkm</span>
<a name="l00069"></a>00069 <span class="comment"> * Added fsg_lextree.{c,h}</span>
<a name="l00070"></a>00070 <span class="comment"> *</span>
<a name="l00071"></a>00071 <span class="comment"> * </span>
<a name="l00072"></a>00072 <span class="comment"> * 18-Feb-2004  M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon</span>
<a name="l00073"></a>00073 <span class="comment"> *              Started.</span>
<a name="l00074"></a>00074 <span class="comment"> */</span>
<a name="l00075"></a>00075 
<a name="l00076"></a>00076 
<a name="l00077"></a>00077 <span class="preprocessor">#ifndef __S2_FSG_LEXTREE_H__</span>
<a name="l00078"></a>00078 <span class="preprocessor"></span><span class="preprocessor">#define __S2_FSG_LEXTREE_H__</span>
<a name="l00079"></a>00079 <span class="preprocessor"></span>
<a name="l00080"></a>00080 <span class="comment">/* SphinxBase headers. */</span>
<a name="l00081"></a>00081 <span class="preprocessor">#include &lt;sphinxbase/cmd_ln.h&gt;</span>
<a name="l00082"></a>00082 <span class="preprocessor">#include &lt;sphinxbase/fsg_model.h&gt;</span>
<a name="l00083"></a>00083 
<a name="l00084"></a>00084 <span class="comment">/* Local headers. */</span>
<a name="l00085"></a>00085 <span class="preprocessor">#include &quot;<a class="code" href="hmm_8h.html" title="Implementation of HMM base structure.">hmm.h</a>&quot;</span>
<a name="l00086"></a>00086 <span class="preprocessor">#include &quot;<a class="code" href="dict_8h.html" title="Operations on dictionary.">dict.h</a>&quot;</span>
<a name="l00087"></a>00087 <span class="preprocessor">#include &quot;<a class="code" href="dict2pid_8h.html" title="Building triphones for a dictionary.">dict2pid.h</a>&quot;</span>
<a name="l00088"></a>00088 
<a name="l00089"></a>00089 <span class="comment">/*</span>
<a name="l00090"></a>00090 <span class="comment"> * **HACK-ALERT**!!  Compile-time constant determining the size of the</span>
<a name="l00091"></a>00091 <span class="comment"> * bitvector fsg_pnode_t.fsg_pnode_ctxt_t.bv.  (See below.)</span>
<a name="l00092"></a>00092 <span class="comment"> * But it makes memory allocation simpler and more efficient.</span>
<a name="l00093"></a>00093 <span class="comment"> */</span>
<a name="l00094"></a>00094 <span class="preprocessor">#define FSG_PNODE_CTXT_BVSZ     2</span>
<a name="l00095"></a>00095 <span class="preprocessor"></span>
<a name="l00096"></a><a class="code" href="structfsg__pnode__ctxt__t.html">00096</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
<a name="l00097"></a>00097     uint32 bv[FSG_PNODE_CTXT_BVSZ];
<a name="l00098"></a>00098 } <a class="code" href="structfsg__pnode__ctxt__t.html">fsg_pnode_ctxt_t</a>;
<a name="l00099"></a>00099 
<a name="l00100"></a>00100 
<a name="l00101"></a>00101 <span class="comment">/*</span>
<a name="l00102"></a>00102 <span class="comment"> * All transitions (words) out of any given FSG state represented are by a</span>
<a name="l00103"></a>00103 <span class="comment"> * phonetic prefix lextree (except for epsilon or null transitions; they</span>
<a name="l00104"></a>00104 <span class="comment"> * are not part of the lextree).  Lextree leaf nodes represent individual</span>
<a name="l00105"></a>00105 <span class="comment"> * FSG transitions, so no sharing is allowed at the leaf nodes.  The FSG</span>
<a name="l00106"></a>00106 <span class="comment"> * transition probs are distributed along the lextree: the prob at a node</span>
<a name="l00107"></a>00107 <span class="comment"> * is the max of the probs of all leaf nodes (and, hence, FSG transitions)</span>
<a name="l00108"></a>00108 <span class="comment"> * reachable from that node.</span>
<a name="l00109"></a>00109 <span class="comment"> * </span>
<a name="l00110"></a>00110 <span class="comment"> * To conserve memory, the underlying HMMs with state-level information are</span>
<a name="l00111"></a>00111 <span class="comment"> * allocated only as needed.  Root and leaf nodes must also account for all</span>
<a name="l00112"></a>00112 <span class="comment"> * the possible phonetic contexts, with an independent HMM for each distinct</span>
<a name="l00113"></a>00113 <span class="comment"> * context.</span>
<a name="l00114"></a>00114 <span class="comment"> */</span>
<a name="l00115"></a><a class="code" href="structfsg__pnode__s.html">00115</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structfsg__pnode__s.html">fsg_pnode_s</a> {
<a name="l00116"></a>00116     <span class="comment">/*</span>
<a name="l00117"></a>00117 <span class="comment">     * If this is not a leaf node, the first successor (child) node.  Otherwise</span>
<a name="l00118"></a>00118 <span class="comment">     * the parent FSG transition for which this is the leaf node (for figuring</span>
<a name="l00119"></a>00119 <span class="comment">     * the FSG destination state, and word emitted by the transition).  A node</span>
<a name="l00120"></a>00120 <span class="comment">     * may have several children.  The succ ptr gives just the first; the rest</span>
<a name="l00121"></a>00121 <span class="comment">     * are linked via the sibling ptr below.</span>
<a name="l00122"></a>00122 <span class="comment">     */</span>
<a name="l00123"></a>00123     <span class="keyword">union </span>{
<a name="l00124"></a>00124         <span class="keyword">struct </span><a class="code" href="structfsg__pnode__s.html">fsg_pnode_s</a> *succ;
<a name="l00125"></a>00125         fsg_link_t *fsglink;
<a name="l00126"></a>00126     } next;
<a name="l00127"></a>00127   
<a name="l00128"></a>00128     <span class="comment">/*</span>
<a name="l00129"></a>00129 <span class="comment">     * For simplicity of memory management (i.e., freeing the pnodes), all</span>
<a name="l00130"></a>00130 <span class="comment">     * pnodes allocated for all transitions out of a state are maintained in a</span>
<a name="l00131"></a>00131 <span class="comment">     * linear linked list through the alloc_next pointer.</span>
<a name="l00132"></a>00132 <span class="comment">     */</span>
<a name="l00133"></a>00133     <span class="keyword">struct </span><a class="code" href="structfsg__pnode__s.html">fsg_pnode_s</a> *alloc_next;
<a name="l00134"></a>00134   
<a name="l00135"></a>00135     <span class="comment">/*</span>
<a name="l00136"></a>00136 <span class="comment">     * The next node that is also a child of the parent of this node; NULL if</span>
<a name="l00137"></a>00137 <span class="comment">     * none.</span>
<a name="l00138"></a>00138 <span class="comment">     */</span>
<a name="l00139"></a>00139     <span class="keyword">struct </span><a class="code" href="structfsg__pnode__s.html">fsg_pnode_s</a> *sibling;
<a name="l00140"></a>00140 
<a name="l00141"></a>00141     <span class="comment">/*</span>
<a name="l00142"></a>00142 <span class="comment">     * The transition (log) probability to be incurred upon transitioning to</span>
<a name="l00143"></a>00143 <span class="comment">     * this node.  (Transition probabilities are really associated with the</span>
<a name="l00144"></a>00144 <span class="comment">     * transitions.  But a lextree node has exactly one incoming transition.</span>
<a name="l00145"></a>00145 <span class="comment">     * Hence, the prob can be associated with the node.)</span>
<a name="l00146"></a>00146 <span class="comment">     * This is a logs2(prob) value, and includes the language weight.</span>
<a name="l00147"></a>00147 <span class="comment">     */</span>
<a name="l00148"></a>00148     int32 logs2prob;
<a name="l00149"></a>00149   
<a name="l00150"></a>00150     <span class="comment">/*</span>
<a name="l00151"></a>00151 <span class="comment">     * The root and leaf positions associated with any transition have to deal</span>
<a name="l00152"></a>00152 <span class="comment">     * with multiple phonetic contexts.  However, different contexts may result</span>
<a name="l00153"></a>00153 <span class="comment">     * in the same SSID (senone-seq ID), and can share a single pnode with that</span>
<a name="l00154"></a>00154 <span class="comment">     * SSID.  But the pnode should track the set of context CI phones that share</span>
<a name="l00155"></a>00155 <span class="comment">     * it.  Hence the fsg_pnode_ctxt_t bit-vector set-representation.  (For</span>
<a name="l00156"></a>00156 <span class="comment">     * simplicity of implementation, its size is a compile-time constant for</span>
<a name="l00157"></a>00157 <span class="comment">     * now.)  Single phone words would need a 2-D array of context, but that&#39;s</span>
<a name="l00158"></a>00158 <span class="comment">     * too expensive.  For now, they simply use SIL as right context, so only</span>
<a name="l00159"></a>00159 <span class="comment">     * the left context is properly modelled.</span>
<a name="l00160"></a>00160 <span class="comment">     * (For word-internal phones, this field is unused, of course.)</span>
<a name="l00161"></a>00161 <span class="comment">     */</span>
<a name="l00162"></a>00162     <a class="code" href="structfsg__pnode__ctxt__t.html">fsg_pnode_ctxt_t</a> ctxt;
<a name="l00163"></a>00163   
<a name="l00164"></a>00164     uint16 ci_ext;      <span class="comment">/* This node&#39;s CIphone as viewed externally (context) */</span>
<a name="l00165"></a>00165     uint8 ppos; <span class="comment">/* Phoneme position in pronunciation */</span>
<a name="l00166"></a>00166     uint8 leaf; <span class="comment">/* Whether this is a leaf node */</span>
<a name="l00167"></a>00167   
<a name="l00168"></a>00168     <span class="comment">/* HMM-state-level stuff here */</span>
<a name="l00169"></a>00169     <a class="code" href="structhmm__context__t.html" title="Shared information between a set of HMMs.">hmm_context_t</a> *ctx;
<a name="l00170"></a>00170     <a class="code" href="structhmm__t.html" title="An individual HMM among the HMM search space.">hmm_t</a> hmm;
<a name="l00171"></a>00171 } <a class="code" href="structfsg__pnode__s.html">fsg_pnode_t</a>;
<a name="l00172"></a>00172 
<a name="l00173"></a>00173 <span class="comment">/* Access macros */</span>
<a name="l00174"></a>00174 <span class="preprocessor">#define fsg_pnode_leaf(p)       ((p)-&gt;leaf)</span>
<a name="l00175"></a>00175 <span class="preprocessor"></span><span class="preprocessor">#define fsg_pnode_logs2prob(p)  ((p)-&gt;logs2prob)</span>
<a name="l00176"></a>00176 <span class="preprocessor"></span><span class="preprocessor">#define fsg_pnode_succ(p)       ((p)-&gt;next.succ)</span>
<a name="l00177"></a>00177 <span class="preprocessor"></span><span class="preprocessor">#define fsg_pnode_fsglink(p)    ((p)-&gt;next.fsglink)</span>
<a name="l00178"></a>00178 <span class="preprocessor"></span><span class="preprocessor">#define fsg_pnode_sibling(p)    ((p)-&gt;sibling)</span>
<a name="l00179"></a>00179 <span class="preprocessor"></span><span class="preprocessor">#define fsg_pnode_hmmptr(p)     (&amp;((p)-&gt;hmm))</span>
<a name="l00180"></a>00180 <span class="preprocessor"></span><span class="preprocessor">#define fsg_pnode_ci_ext(p)     ((p)-&gt;ci_ext)</span>
<a name="l00181"></a>00181 <span class="preprocessor"></span><span class="preprocessor">#define fsg_pnode_ppos(p)       ((p)-&gt;ppos)</span>
<a name="l00182"></a>00182 <span class="preprocessor"></span><span class="preprocessor">#define fsg_pnode_leaf(p)       ((p)-&gt;leaf)</span>
<a name="l00183"></a>00183 <span class="preprocessor"></span><span class="preprocessor">#define fsg_pnode_ctxt(p)       ((p)-&gt;ctxt)</span>
<a name="l00184"></a>00184 <span class="preprocessor"></span>
<a name="l00185"></a>00185 <span class="preprocessor">#define fsg_pnode_add_ctxt(p,c) ((p)-&gt;ctxt.bv[(c)&gt;&gt;5] |= (1 &lt;&lt; ((c)&amp;0x001f)))</span>
<a name="l00186"></a>00186 <span class="preprocessor"></span>
<a name="l00187"></a>00187 <span class="comment">/*</span>
<a name="l00188"></a>00188 <span class="comment"> * The following is macroized because its called very frequently</span>
<a name="l00189"></a>00189 <span class="comment"> * ::: uint32 fsg_pnode_ctxt_sub (fsg_pnode_ctxt_t *src, fsg_pnode_ctxt_t *sub);</span>
<a name="l00190"></a>00190 <span class="comment"> */</span>
<a name="l00191"></a>00191 <span class="comment">/*</span>
<a name="l00192"></a>00192 <span class="comment"> * Subtract bitvector sub from bitvector src (src updated with the result).</span>
<a name="l00193"></a>00193 <span class="comment"> * Return 0 if result is all 0, non-zero otherwise.</span>
<a name="l00194"></a>00194 <span class="comment"> */</span>
<a name="l00195"></a>00195 
<a name="l00196"></a>00196 <span class="preprocessor">#if (FSG_PNODE_CTXT_BVSZ == 1)</span>
<a name="l00197"></a>00197 <span class="preprocessor"></span><span class="preprocessor">    #define FSG_PNODE_CTXT_SUB(src,sub) \</span>
<a name="l00198"></a>00198 <span class="preprocessor">    ((src)-&gt;bv[0] = (~((sub)-&gt;bv[0]) &amp; (src)-&gt;bv[0]))</span>
<a name="l00199"></a>00199 <span class="preprocessor"></span><span class="preprocessor">#elif (FSG_PNODE_CTXT_BVSZ == 2)</span>
<a name="l00200"></a>00200 <span class="preprocessor"></span><span class="preprocessor">    #define FSG_PNODE_CTXT_SUB(src,sub) \</span>
<a name="l00201"></a>00201 <span class="preprocessor">    (((src)-&gt;bv[0] = (~((sub)-&gt;bv[0]) &amp; (src)-&gt;bv[0])) | \</span>
<a name="l00202"></a>00202 <span class="preprocessor">     ((src)-&gt;bv[1] = (~((sub)-&gt;bv[1]) &amp; (src)-&gt;bv[1])))</span>
<a name="l00203"></a>00203 <span class="preprocessor"></span><span class="preprocessor">#elif (FSG_PNODE_CTXT_BVSZ == 4)</span>
<a name="l00204"></a>00204 <span class="preprocessor"></span><span class="preprocessor">    #define FSG_PNODE_CTXT_SUB(src,sub) \</span>
<a name="l00205"></a>00205 <span class="preprocessor">    (((src)-&gt;bv[0] = (~((sub)-&gt;bv[0]) &amp; (src)-&gt;bv[0]))  | \</span>
<a name="l00206"></a>00206 <span class="preprocessor">     ((src)-&gt;bv[1] = (~((sub)-&gt;bv[1]) &amp; (src)-&gt;bv[1]))  | \</span>
<a name="l00207"></a>00207 <span class="preprocessor">     ((src)-&gt;bv[2] = (~((sub)-&gt;bv[2]) &amp; (src)-&gt;bv[2]))  | \</span>
<a name="l00208"></a>00208 <span class="preprocessor">     ((src)-&gt;bv[3] = (~((sub)-&gt;bv[3]) &amp; (src)-&gt;bv[3])))</span>
<a name="l00209"></a>00209 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00210"></a>00210 <span class="preprocessor"></span>
<a name="l00214"></a><a class="code" href="structfsg__lextree__s.html">00214</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structfsg__lextree__s.html" title="Collection of lextrees for an FSG.">fsg_lextree_s</a> {
<a name="l00215"></a><a class="code" href="structfsg__lextree__s.html#a161ff35c65373388f18e51236bf7ef5f">00215</a>     fsg_model_t *<a class="code" href="structfsg__lextree__s.html#a161ff35c65373388f18e51236bf7ef5f" title="The fsg for which this lextree is built.">fsg</a>;   
<a name="l00216"></a><a class="code" href="structfsg__lextree__s.html#afbbd5d59a74dfb287289aa20a9a3979a">00216</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="structfsg__lextree__s.html#afbbd5d59a74dfb287289aa20a9a3979a" title="HMM context structure.">ctx</a>; 
<a name="l00217"></a><a class="code" href="structfsg__lextree__s.html#abf077af1c0dd1246b2032b917bfacba5">00217</a>     <a class="code" href="structdict__t.html" title="a structure for a dictionary.">dict_t</a> *<a class="code" href="structfsg__lextree__s.html#abf077af1c0dd1246b2032b917bfacba5" title="Pronunciation dictionary for this FSG.">dict</a>;     
<a name="l00218"></a><a class="code" href="structfsg__lextree__s.html#add12fb7151ebdecb74deaf6aca86d95e">00218</a>     <a class="code" href="structdict2pid__t.html" title="Building composite triphone (as well as word internal triphones) with the dictionary.">dict2pid_t</a> *<a class="code" href="structfsg__lextree__s.html#add12fb7151ebdecb74deaf6aca86d95e" title="Context-dependent phone mappings for this FSG.">d2p</a>;    
<a name="l00219"></a><a class="code" href="structfsg__lextree__s.html#ae2c059413a1cb4cda7068ab30a7a477c">00219</a>     <a class="code" href="structbin__mdef__s.html">bin_mdef_t</a> *<a class="code" href="structfsg__lextree__s.html#ae2c059413a1cb4cda7068ab30a7a477c" title="Model definition (triphone mappings).">mdef</a>;   
<a name="l00221"></a>00221     <span class="comment">/*</span>
<a name="l00222"></a>00222 <span class="comment">     * Left and right CIphone sets for each state.</span>
<a name="l00223"></a>00223 <span class="comment">     * Left context CIphones for a state S: If word W transitions into S, W&#39;s</span>
<a name="l00224"></a>00224 <span class="comment">     * final CIphone is in S&#39;s {lc}.  Words transitioning out of S must consider</span>
<a name="l00225"></a>00225 <span class="comment">     * these left context CIphones.</span>
<a name="l00226"></a>00226 <span class="comment">     * Similarly, right contexts for state S: If word W transitions out of S,</span>
<a name="l00227"></a>00227 <span class="comment">     * W&#39;s first CIphone is in S&#39;s {rc}.  Words transitioning into S must consider</span>
<a name="l00228"></a>00228 <span class="comment">     * these right contexts.</span>
<a name="l00229"></a>00229 <span class="comment">     * </span>
<a name="l00230"></a>00230 <span class="comment">     * NOTE: Words may transition into and out of S INDIRECTLY, with intermediate</span>
<a name="l00231"></a>00231 <span class="comment">     *   null transitions.</span>
<a name="l00232"></a>00232 <span class="comment">     * NOTE: Single-phone words are difficult; only SILENCE right context is</span>
<a name="l00233"></a>00233 <span class="comment">     *   modelled for them.</span>
<a name="l00234"></a>00234 <span class="comment">     * NOTE: Non-silence filler phones aren&#39;t included in these sets.  Filler</span>
<a name="l00235"></a>00235 <span class="comment">     *   words don&#39;t use context, and present the SILENCE phone as context to</span>
<a name="l00236"></a>00236 <span class="comment">     *   adjacent words.</span>
<a name="l00237"></a>00237 <span class="comment">     */</span>
<a name="l00238"></a><a class="code" href="structfsg__lextree__s.html#a0655f40ec98c9d971aba1fa8a894575d">00238</a>     int16 **<a class="code" href="structfsg__lextree__s.html#a0655f40ec98c9d971aba1fa8a894575d" title="Left context triphone mappings for FSG.">lc</a>;         
<a name="l00239"></a><a class="code" href="structfsg__lextree__s.html#a307d5351803d409aa51395333294c0f1">00239</a>     int16 **<a class="code" href="structfsg__lextree__s.html#a307d5351803d409aa51395333294c0f1" title="Right context triphone mappings for FSG.">rc</a>;         
<a name="l00241"></a>00241     <a class="code" href="structfsg__pnode__s.html">fsg_pnode_t</a> **root; <span class="comment">/* root[s] = lextree representing all transitions</span>
<a name="l00242"></a>00242 <span class="comment">                           out of state s.  Note that the &quot;tree&quot; for each</span>
<a name="l00243"></a>00243 <span class="comment">                           state is actually a collection of trees, linked</span>
<a name="l00244"></a>00244 <span class="comment">                           via fsg_pnode_t.sibling (root[s]-&gt;sibling) */</span>
<a name="l00245"></a>00245     <a class="code" href="structfsg__pnode__s.html">fsg_pnode_t</a> **alloc_head;   <span class="comment">/* alloc_head[s] = head of linear list of all</span>
<a name="l00246"></a>00246 <span class="comment">                                   pnodes allocated for state s */</span>
<a name="l00247"></a>00247     int32 n_pnode;      <span class="comment">/* #HMM nodes in search structure */</span>
<a name="l00248"></a>00248     int32 wip;
<a name="l00249"></a>00249     int32 pip;
<a name="l00250"></a>00250 } <a class="code" href="structfsg__lextree__s.html" title="Collection of lextrees for an FSG.">fsg_lextree_t</a>;
<a name="l00251"></a>00251 
<a name="l00252"></a>00252 <span class="comment">/* Access macros */</span>
<a name="l00253"></a>00253 <span class="preprocessor">#define fsg_lextree_root(lt,s)  ((lt)-&gt;root[s])</span>
<a name="l00254"></a>00254 <span class="preprocessor"></span><span class="preprocessor">#define fsg_lextree_n_pnode(lt) ((lt)-&gt;n_pnode)</span>
<a name="l00255"></a>00255 <span class="preprocessor"></span>
<a name="l00259"></a>00259 <a class="code" href="structfsg__lextree__s.html" title="Collection of lextrees for an FSG.">fsg_lextree_t</a> *<a class="code" href="fsg__lextree_8c.html#a8c47b2983b3952886a4c889a711e1d65" title="Create, initialize, and return a new phonetic lextree for the given FSG.">fsg_lextree_init</a>(fsg_model_t *fsg, <a class="code" href="structdict__t.html" title="a structure for a dictionary.">dict_t</a> *dict,
<a name="l00260"></a>00260                                 <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="l00261"></a>00261                                 <a class="code" href="structbin__mdef__s.html">bin_mdef_t</a> *mdef, <a class="code" href="structhmm__context__t.html" title="Shared information between a set of HMMs.">hmm_context_t</a> *ctx,
<a name="l00262"></a>00262                                 int32 wip, int32 pip);
<a name="l00263"></a>00263 
<a name="l00267"></a>00267 <span class="keywordtype">void</span> <a class="code" href="fsg__lextree_8c.html#a2f1ab965df1214f4d0e2008833aa20da" title="Free lextrees for an FSG.">fsg_lextree_free</a>(<a class="code" href="structfsg__lextree__s.html" title="Collection of lextrees for an FSG.">fsg_lextree_t</a> *fsg);
<a name="l00268"></a>00268 
<a name="l00272"></a>00272 <span class="keywordtype">void</span> <a class="code" href="fsg__lextree_8c.html#a5c267f09b8dc214dd7deb41232d84726" title="Print an FSG lextree to a file for debugging.">fsg_lextree_dump</a>(<a class="code" href="structfsg__lextree__s.html" title="Collection of lextrees for an FSG.">fsg_lextree_t</a> *fsg, FILE *fh);
<a name="l00273"></a>00273 
<a name="l00277"></a>00277 <span class="keywordtype">void</span> <a class="code" href="fsg__lextree_8c.html#a6dc55ff3873855fb7b2c0390aa072516" title="Mark the given pnode as inactive (for search).">fsg_psubtree_pnode_deactivate</a>(<a class="code" href="structfsg__pnode__s.html">fsg_pnode_t</a> *pnode);
<a name="l00278"></a>00278 
<a name="l00282"></a>00282 <span class="keywordtype">void</span> <a class="code" href="fsg__lextree_8c.html#a98fd94d024df264025e30c909c82cb56" title="Set all flags on in the given context bitvector.">fsg_pnode_add_all_ctxt</a>(<a class="code" href="structfsg__pnode__ctxt__t.html">fsg_pnode_ctxt_t</a> *ctxt);
<a name="l00283"></a>00283 
<a name="l00284"></a>00284 
<a name="l00285"></a>00285 
<a name="l00286"></a>00286 <span class="preprocessor">#endif</span>
</pre></div></div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><b>fsg_lextree.h</b>      </li>
      <li class="footer">Generated on Wed Apr 20 2011 for PocketSphinx 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>