<!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/dict2pid.h File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript"> $(document).ready(initResizable); </script> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.7.3 --> <div id="top"> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">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('dict2pid_8h.html',''); </script> <div id="doc-content"> <div class="header"> <div class="summary"> <a href="#nested-classes">Data Structures</a> | <a href="#define-members">Defines</a> | <a href="#func-members">Functions</a> </div> <div class="headertitle"> <h1>src/libpocketsphinx/dict2pid.h File Reference</h1> </div> </div> <div class="contents"> <p>Building triphones for a dictionary. <a href="#_details">More...</a></p> <div class="textblock"><code>#include <stdio.h></code><br/> <code>#include <sphinxbase/logmath.h></code><br/> <code>#include <sphinxbase/bitvec.h></code><br/> <code>#include "<a class="el" href="s3types_8h_source.html">s3types.h</a>"</code><br/> <code>#include "<a class="el" href="bin__mdef_8h_source.html">bin_mdef.h</a>"</code><br/> <code>#include "<a class="el" href="dict_8h_source.html">dict.h</a>"</code><br/> </div> <p><a href="dict2pid_8h_source.html">Go to the source code of this file.</a></p> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="nested-classes"></a> Data Structures</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structxwdssid__t.html">xwdssid_t</a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">cross word triphone model structure <a href="structxwdssid__t.html#_details">More...</a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structdict2pid__t.html">dict2pid_t</a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Building composite triphone (as well as word internal triphones) with the dictionary. <a href="structdict2pid__t.html#_details">More...</a><br/></td></tr> <tr><td colspan="2"><h2><a name="define-members"></a> Defines</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a453a98931cad95a19b4c4ab770fc79f1"></a><!-- doxytag: member="dict2pid.h::dict2pid_rssid" ref="a453a98931cad95a19b4c4ab770fc79f1" args="(d, ci, lc)" --> #define </td><td class="memItemRight" valign="bottom"><a class="el" href="dict2pid_8h.html#a453a98931cad95a19b4c4ab770fc79f1">dict2pid_rssid</a>(d, ci, lc)   (&(d)->rssid[ci][lc])</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Access macros; not designed for arbitrary use. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af4c6cb32b7fcc477bb2ab7676985d364"></a><!-- doxytag: member="dict2pid.h::dict2pid_ldiph_lc" ref="af4c6cb32b7fcc477bb2ab7676985d364" args="(d, b, r, l)" --> #define </td><td class="memItemRight" valign="bottom"><b>dict2pid_ldiph_lc</b>(d, b, r, l)   ((d)->ldiph_lc[b][r][l])</td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab39429fde9a1d45e075d746f1511042e"></a><!-- doxytag: member="dict2pid.h::dict2pid_lrdiph_rc" ref="ab39429fde9a1d45e075d746f1511042e" args="(d, b, l, r)" --> #define </td><td class="memItemRight" valign="bottom"><b>dict2pid_lrdiph_rc</b>(d, b, l, r)   ((d)->lrdiph_rc[b][l][r])</td></tr> <tr><td colspan="2"><h2><a name="func-members"></a> Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structdict2pid__t.html">dict2pid_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="dict2pid_8h.html#addd541f2275b79e284575fb11b7986e1">dict2pid_build</a> (<a class="el" href="structbin__mdef__s.html">bin_mdef_t</a> *mdef, <a class="el" href="structdict__t.html">dict_t</a> *dict)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Build the dict2pid structure for the given model/dictionary. <a href="#addd541f2275b79e284575fb11b7986e1"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a85a8de8009445e1129766186ddaa949a"></a><!-- doxytag: member="dict2pid.h::dict2pid_retain" ref="a85a8de8009445e1129766186ddaa949a" args="(dict2pid_t *d2p)" --> <a class="el" href="structdict2pid__t.html">dict2pid_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="dict2pid_8h.html#a85a8de8009445e1129766186ddaa949a">dict2pid_retain</a> (<a class="el" href="structdict2pid__t.html">dict2pid_t</a> *d2p)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Retain a pointer to dict2pid. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="dict2pid_8h.html#a293253226550e812c448ae096b364d0d">dict2pid_free</a> (<a class="el" href="structdict2pid__t.html">dict2pid_t</a> *d2p)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Free the memory dict2pid structure. <a href="#a293253226550e812c448ae096b364d0d"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a720e15c92ef6930e722bccb014e11b7b"></a><!-- doxytag: member="dict2pid.h::dict2pid_internal" ref="a720e15c92ef6930e722bccb014e11b7b" args="(dict2pid_t *d2p, int32 wid, int pos)" --> s3ssid_t </td><td class="memItemRight" valign="bottom"><a class="el" href="dict2pid_8h.html#a720e15c92ef6930e722bccb014e11b7b">dict2pid_internal</a> (<a class="el" href="structdict2pid__t.html">dict2pid_t</a> *d2p, int32 wid, int pos)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Return the senone sequence ID for the given word position. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa94120dcea4b17807576e29484b8a008"></a><!-- doxytag: member="dict2pid.h::dict2pid_add_word" ref="aa94120dcea4b17807576e29484b8a008" args="(dict2pid_t *d2p, int32 wid)" --> int </td><td class="memItemRight" valign="bottom"><a class="el" href="dict2pid_8h.html#aa94120dcea4b17807576e29484b8a008">dict2pid_add_word</a> (<a class="el" href="structdict2pid__t.html">dict2pid_t</a> *d2p, int32 wid)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Add a word to the dict2pid structure (after adding it to dict). <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="dict2pid_8h.html#a32320cd5d020620ac913b46bafeb5cae">dict2pid_dump</a> (FILE *fp, <a class="el" href="structdict2pid__t.html">dict2pid_t</a> *d2p)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">For debugging. <a href="#a32320cd5d020620ac913b46bafeb5cae"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="dict2pid_8h.html#a36c486f1ac64991c95c4c0ef75ceaa46">dict2pid_report</a> (<a class="el" href="structdict2pid__t.html">dict2pid_t</a> *d2p)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Report a dict2pid data structure. <a href="#a36c486f1ac64991c95c4c0ef75ceaa46"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int32 </td><td class="memItemRight" valign="bottom"><a class="el" href="dict2pid_8h.html#aa77890032a2c171ed9944b1d81fd5cb0">get_rc_nssid</a> (<a class="el" href="structdict2pid__t.html">dict2pid_t</a> *d2p, s3wid_t w)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Get number of rc. <a href="#aa77890032a2c171ed9944b1d81fd5cb0"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="s3types_8h.html#ae5f70241ce62a79747f0611029a6409d">s3cipid_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="dict2pid_8h.html#a34aca68c98588e7e1a3f0e6d0800e1bf">dict2pid_get_rcmap</a> (<a class="el" href="structdict2pid__t.html">dict2pid_t</a> *d2p, s3wid_t w)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Get RC map. <a href="#a34aca68c98588e7e1a3f0e6d0800e1bf"></a><br/></td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <div class="textblock"><p>Building triphones for a dictionary. </p> <p>This is one of the more complicated parts of a cross-word triphone model decoder. The first and last phones of each word get their left and right contexts, respectively, from other words. For single-phone words, both its contexts are from other words, simultaneously. As these words are not known beforehand, life gets complicated. </p> <p>Definition in file <a class="el" href="dict2pid_8h_source.html">dict2pid.h</a>.</p> </div><hr/><h2>Function Documentation</h2> <a class="anchor" id="addd541f2275b79e284575fb11b7986e1"></a><!-- doxytag: member="dict2pid.h::dict2pid_build" ref="addd541f2275b79e284575fb11b7986e1" args="(bin_mdef_t *mdef, dict_t *dict)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="structdict2pid__t.html">dict2pid_t</a>* dict2pid_build </td> <td>(</td> <td class="paramtype"><a class="el" href="structbin__mdef__s.html">bin_mdef_t</a> * </td> <td class="paramname"><em>mdef</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="structdict__t.html">dict_t</a> * </td> <td class="paramname"><em>dict</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Build the dict2pid structure for the given model/dictionary. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">mdef</td><td>A model definition </td></tr> <tr><td class="paramname">dict</td><td>An initialized dictionary </td></tr> </table> </dd> </dl> <p>Definition at line <a class="el" href="dict2pid_8c_source.html#l00388">388</a> of file <a class="el" href="dict2pid_8c_source.html">dict2pid.c</a>.</p> <p>References <a class="el" href="s3types_8h_source.html#l00124">BAD_S3SSID</a>, <a class="el" href="dict2pid_8h_source.html#l00153">dict2pid_t::dict</a>, <a class="el" href="dict2pid_8c_source.html#l00533">dict2pid_report()</a>, <a class="el" href="dict_8h_source.html#l00168">dict_pron</a>, <a class="el" href="dict_8h_source.html#l00154">dict_size</a>, <a class="el" href="dict2pid_8h_source.html#l00159">dict2pid_t::ldiph_lc</a>, <a class="el" href="dict2pid_8h_source.html#l00169">dict2pid_t::lrdiph_rc</a>, <a class="el" href="dict2pid_8h_source.html#l00151">dict2pid_t::mdef</a>, <a class="el" href="bin__mdef_8h_source.html#l00121">bin_mdef_s::n_ciphone</a>, <a class="el" href="mdef_8h_source.html#l00077">WORD_POSN_BEGIN</a>, and <a class="el" href="mdef_8h_source.html#l00078">WORD_POSN_END</a>.</p> <p>Referenced by <a class="el" href="pocketsphinx_8c_source.html#l00456">ps_load_dict()</a>, and <a class="el" href="pocketsphinx_8c_source.html#l00193">ps_reinit()</a>.</p> </div> </div> <a class="anchor" id="a32320cd5d020620ac913b46bafeb5cae"></a><!-- doxytag: member="dict2pid.h::dict2pid_dump" ref="a32320cd5d020620ac913b46bafeb5cae" args="(FILE *fp, dict2pid_t *d2p)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void dict2pid_dump </td> <td>(</td> <td class="paramtype">FILE * </td> <td class="paramname"><em>fp</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="structdict2pid__t.html">dict2pid_t</a> * </td> <td class="paramname"><em>d2p</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>For debugging. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">fp</td><td>In: a file pointer </td></tr> <tr><td class="paramname">d2p</td><td>In: a <a class="el" href="structdict2pid__t.html" title="Building composite triphone (as well as word internal triphones) with the dictionary.">dict2pid_t</a> structure </td></tr> </table> </dd> </dl> <p>Definition at line <a class="el" href="dict2pid_8c_source.html#l00538">538</a> of file <a class="el" href="dict2pid_8c_source.html">dict2pid.c</a>.</p> <p>References <a class="el" href="dict2pid_8h_source.html#l00153">dict2pid_t::dict</a>, <a class="el" href="dict2pid_8c_source.html#l00367">dict2pid_internal()</a>, <a class="el" href="dict_8h_source.html#l00154">dict_size</a>, <a class="el" href="dict2pid_8h_source.html#l00159">dict2pid_t::ldiph_lc</a>, <a class="el" href="dict2pid_8h_source.html#l00151">dict2pid_t::mdef</a>, <a class="el" href="bin__mdef_8h_source.html#l00127">bin_mdef_s::n_sseq</a>, and <a class="el" href="bin__mdef_8h_source.html#l00136">bin_mdef_s::sseq</a>.</p> </div> </div> <a class="anchor" id="a293253226550e812c448ae096b364d0d"></a><!-- doxytag: member="dict2pid.h::dict2pid_free" ref="a293253226550e812c448ae096b364d0d" args="(dict2pid_t *d2p)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int dict2pid_free </td> <td>(</td> <td class="paramtype"><a class="el" href="structdict2pid__t.html">dict2pid_t</a> * </td> <td class="paramname"><em>d2p</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Free the memory dict2pid structure. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">d2p</td><td>In: the d2p </td></tr> </table> </dd> </dl> <p>Definition at line <a class="el" href="dict2pid_8c_source.html#l00507">507</a> of file <a class="el" href="dict2pid_8c_source.html">dict2pid.c</a>.</p> <p>References <a class="el" href="dict2pid_8h_source.html#l00153">dict2pid_t::dict</a>, <a class="el" href="dict2pid_8h_source.html#l00159">dict2pid_t::ldiph_lc</a>, <a class="el" href="dict2pid_8h_source.html#l00169">dict2pid_t::lrdiph_rc</a>, <a class="el" href="dict2pid_8h_source.html#l00172">dict2pid_t::lrssid</a>, <a class="el" href="dict2pid_8h_source.html#l00151">dict2pid_t::mdef</a>, and <a class="el" href="dict2pid_8h_source.html#l00163">dict2pid_t::rssid</a>.</p> <p>Referenced by <a class="el" href="ps__alignment_8c_source.html#l00059">ps_alignment_free()</a>, <a class="el" href="pocketsphinx_8c_source.html#l00326">ps_free()</a>, <a class="el" href="pocketsphinx_8c_source.html#l00456">ps_load_dict()</a>, <a class="el" href="pocketsphinx_8c_source.html#l01069">ps_search_base_reinit()</a>, and <a class="el" href="pocketsphinx_8c_source.html#l01095">ps_search_deinit()</a>.</p> </div> </div> <a class="anchor" id="a34aca68c98588e7e1a3f0e6d0800e1bf"></a><!-- doxytag: member="dict2pid.h::dict2pid_get_rcmap" ref="a34aca68c98588e7e1a3f0e6d0800e1bf" args="(dict2pid_t *d2p, s3wid_t w)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="s3types_8h.html#ae5f70241ce62a79747f0611029a6409d">s3cipid_t</a>* dict2pid_get_rcmap </td> <td>(</td> <td class="paramtype"><a class="el" href="structdict2pid__t.html">dict2pid_t</a> * </td> <td class="paramname"><em>d2p</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">s3wid_t </td> <td class="paramname"><em>w</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Get RC map. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">d2p</td><td>In: a dict2pid </td></tr> <tr><td class="paramname">w</td><td>In: a wid </td></tr> </table> </dd> </dl> <p>Definition at line <a class="el" href="dict2pid_8c_source.html#l00229">229</a> of file <a class="el" href="dict2pid_8c_source.html">dict2pid.c</a>.</p> <p>References <a class="el" href="dict2pid_8h_source.html#l00139">xwdssid_t::cimap</a>, <a class="el" href="dict_8h_source.html#l00068">dictword_t::ciphone</a>, <a class="el" href="dict2pid_8h_source.html#l00153">dict2pid_t::dict</a>, <a class="el" href="dict2pid_8h_source.html#l00172">dict2pid_t::lrssid</a>, <a class="el" href="dict_8h_source.html#l00069">dictword_t::pronlen</a>, <a class="el" href="dict2pid_8h_source.html#l00163">dict2pid_t::rssid</a>, and <a class="el" href="dict_8h_source.html#l00082">dict_t::word</a>.</p> </div> </div> <a class="anchor" id="a36c486f1ac64991c95c4c0ef75ceaa46"></a><!-- doxytag: member="dict2pid.h::dict2pid_report" ref="a36c486f1ac64991c95c4c0ef75ceaa46" args="(dict2pid_t *d2p)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void dict2pid_report </td> <td>(</td> <td class="paramtype"><a class="el" href="structdict2pid__t.html">dict2pid_t</a> * </td> <td class="paramname"><em>d2p</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Report a dict2pid data structure. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">d2p</td><td>In: a <a class="el" href="structdict2pid__t.html" title="Building composite triphone (as well as word internal triphones) with the dictionary.">dict2pid_t</a> structure </td></tr> </table> </dd> </dl> <p>Definition at line <a class="el" href="dict2pid_8c_source.html#l00533">533</a> of file <a class="el" href="dict2pid_8c_source.html">dict2pid.c</a>.</p> <p>Referenced by <a class="el" href="dict2pid_8c_source.html#l00388">dict2pid_build()</a>.</p> </div> </div> <a class="anchor" id="aa77890032a2c171ed9944b1d81fd5cb0"></a><!-- doxytag: member="dict2pid.h::get_rc_nssid" ref="aa77890032a2c171ed9944b1d81fd5cb0" args="(dict2pid_t *d2p, s3wid_t w)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int32 get_rc_nssid </td> <td>(</td> <td class="paramtype"><a class="el" href="structdict2pid__t.html">dict2pid_t</a> * </td> <td class="paramname"><em>d2p</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">s3wid_t </td> <td class="paramname"><em>w</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Get number of rc. </p> <p>Get number of rc.</p> <p>I doubt whether it is correct because the compressed map has not been checked. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">d2p</td><td>In: a dict2pid </td></tr> <tr><td class="paramname">w</td><td>In: a wid </td></tr> </table> </dd> </dl> <p>Definition at line <a class="el" href="dict2pid_8c_source.html#l00204">204</a> of file <a class="el" href="dict2pid_8c_source.html">dict2pid.c</a>.</p> <p>References <a class="el" href="dict_8h_source.html#l00068">dictword_t::ciphone</a>, <a class="el" href="dict2pid_8h_source.html#l00153">dict2pid_t::dict</a>, <a class="el" href="dict2pid_8h_source.html#l00172">dict2pid_t::lrssid</a>, <a class="el" href="dict2pid_8h_source.html#l00140">xwdssid_t::n_ssid</a>, <a class="el" href="dict_8h_source.html#l00069">dictword_t::pronlen</a>, <a class="el" href="dict2pid_8h_source.html#l00163">dict2pid_t::rssid</a>, and <a class="el" href="dict_8h_source.html#l00082">dict_t::word</a>.</p> </div> </div> </div> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="dict2pid_8h.html">dict2pid.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>