<!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"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>tesseract: cube/lang_mod_edge.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">tesseract
   &#160;<span id="projectnumber">3.05.02</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('a01004_source.html','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">lang_mod_edge.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="a01004.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/**********************************************************************</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * File:        lang_mod_edge.h</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * Description: Declaration of the Language Model Edge Base Class</span></div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * Author:    Ahmad Abdulkader</span></div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> * Created:   2007</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> * (C) Copyright 2008, Google Inc.</span></div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"> ** Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span></div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> ** you may not use this file except in compliance with the License.</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> ** You may obtain a copy of the License at</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> ** http://www.apache.org/licenses/LICENSE-2.0</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment"> ** Unless required by applicable law or agreed to in writing, software</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment"> ** distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment"> ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment"> ** See the License for the specific language governing permissions and</span></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment"> ** limitations under the License.</span></div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment"> **********************************************************************/</span></div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;</div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment">// The LangModEdge abstracts an Edge in the language model trie</span></div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment">// This is an abstract class that any Language Model Edge should inherit from</span></div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="comment">// It provides methods for:</span></div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="comment">// 1- Returns the class ID corresponding to the edge</span></div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="comment">// 2- If the edge is a valid EndOfWord (EOW)</span></div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="comment">// 3- If the edge is coming from a OutOfDictionary (OOF) state machine</span></div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="comment">// 4- If the edge is a Terminal (has no children)</span></div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="comment">// 5- A Hash of the edge that will be used to retrieve the edge</span></div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="comment">// quickly from the BeamSearch lattice</span></div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="comment">// 6- If two edges are identcial</span></div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="comment">// 7- Returns a verbal description of the edge (use by debuggers)</span></div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="comment">// 8- the language model cost of the edge (if any)</span></div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="comment">// 9- The string corresponding to this edge</span></div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="comment">// 10- Getting and setting the &quot;Root&quot; status of the edge</span></div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;</div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="preprocessor">#ifndef LANG_MOD_EDGE_H</span></div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;<span class="preprocessor">#define LANG_MOD_EDGE_H</span></div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="a00968.html">cube_tuning_params.h</a>&quot;</span></div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="a00914.html">char_set.h</a>&quot;</span></div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;</div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;<span class="keyword">namespace </span><a class="code" href="a01738.html">tesseract</a> {</div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;</div><div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="a04453.html">   43</a></span>&#160;<span class="keyword">class </span><a class="code" href="a04453.html">LangModEdge</a> {</div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160; <span class="keyword">public</span>:</div><div class="line"><a name="l00045"></a><span class="lineno"><a class="line" href="a04453.html#a5c4257a3d783cdc89dee21741786bf6e">   45</a></span>&#160;   <a class="code" href="a04453.html#a5c4257a3d783cdc89dee21741786bf6e">LangModEdge</a>() {}</div><div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="a04453.html#ac8d2c121e28ba3e7415f01b8de806528">   46</a></span>&#160;  <span class="keyword">virtual</span> <a class="code" href="a04453.html#ac8d2c121e28ba3e7415f01b8de806528">~LangModEdge</a>() {}</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;  <span class="comment">// The string corresponding to this edge</span></div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;  <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="a01738.html#aea2c6172b0ca77907e29cd018595b425">char_32</a> * <a class="code" href="a04453.html#a4187741ff5fb8fced6176e83b16b928d">EdgeString</a>() <span class="keyword">const</span> = 0;</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;  <span class="comment">// Returns the class ID corresponding to the edge</span></div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="a04453.html#a4caf57394d94e96f11d02a97293a443b">ClassID</a>() <span class="keyword">const</span> = 0;</div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;  <span class="comment">// If the edge is the root edge</span></div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="a04453.html#acdcbac70bbb421c944e500da45563fe0">IsRoot</a>() <span class="keyword">const</span> = 0;</div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;  <span class="comment">// Set the Root flag</span></div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="a04453.html#a4dbb34a133e3ca37fb9c5190f2807848">SetRoot</a>(<span class="keywordtype">bool</span> flag) = 0;</div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;  <span class="comment">// If the edge is a valid EndOfWord (EOW)</span></div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="a04453.html#ab107cb811bdbfda4fbd7b2af0bfb505e">IsEOW</a>() <span class="keyword">const</span> = 0;</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;  <span class="comment">// is the edge is coming from a OutOfDictionary (OOF) state machine</span></div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="a04453.html#a24d556ce36d63307c9a7195a4da29e0c">IsOOD</a>() <span class="keyword">const</span> = 0;</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;  <span class="comment">// Is the edge is a Terminal (has no children)</span></div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="a04453.html#a8041893a12c0805b34ea50c311460518">IsTerminal</a>() <span class="keyword">const</span> = 0;</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;  <span class="comment">// Returns A hash of the edge that will be used to retrieve the edge</span></div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="a04453.html#a04c2882fb2e15c7fd38050d3e9fd0020">Hash</a>() <span class="keyword">const</span> = 0;</div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;  <span class="comment">// Are the two edges identcial?</span></div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="a04453.html#ac1676b68bb4e4433fbe183d3f3322998">IsIdentical</a>(<a class="code" href="a04453.html">LangModEdge</a> *edge) <span class="keyword">const</span> = 0;</div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;  <span class="comment">// a verbal description of the edge (use by debuggers)</span></div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">char</span> *<a class="code" href="a04453.html#ab5669c47ce83226077fbd3f8492e5bd2">Description</a>() <span class="keyword">const</span> = 0;</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;  <span class="comment">// the language model cost of the edge (if any)</span></div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="a04453.html#a970086075acc5f211b53825db505ee1d">PathCost</a>() <span class="keyword">const</span> = 0;</div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;};</div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;}</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;<span class="preprocessor">#endif  // LANG_MOD_EDGE_H</span></div><div class="ttc" id="a00968_html"><div class="ttname"><a href="a00968.html">cube_tuning_params.h</a></div></div>
<div class="ttc" id="a04453_html_a5c4257a3d783cdc89dee21741786bf6e"><div class="ttname"><a href="a04453.html#a5c4257a3d783cdc89dee21741786bf6e">tesseract::LangModEdge::LangModEdge</a></div><div class="ttdeci">LangModEdge()</div><div class="ttdef"><b>Definition:</b> <a href="a01004_source.html#l00045">lang_mod_edge.h:45</a></div></div>
<div class="ttc" id="a04453_html_a4caf57394d94e96f11d02a97293a443b"><div class="ttname"><a href="a04453.html#a4caf57394d94e96f11d02a97293a443b">tesseract::LangModEdge::ClassID</a></div><div class="ttdeci">virtual int ClassID() const =0</div></div>
<div class="ttc" id="a04453_html_a4187741ff5fb8fced6176e83b16b928d"><div class="ttname"><a href="a04453.html#a4187741ff5fb8fced6176e83b16b928d">tesseract::LangModEdge::EdgeString</a></div><div class="ttdeci">virtual const char_32 * EdgeString() const =0</div></div>
<div class="ttc" id="a04453_html_ac1676b68bb4e4433fbe183d3f3322998"><div class="ttname"><a href="a04453.html#ac1676b68bb4e4433fbe183d3f3322998">tesseract::LangModEdge::IsIdentical</a></div><div class="ttdeci">virtual bool IsIdentical(LangModEdge *edge) const =0</div></div>
<div class="ttc" id="a04453_html_a24d556ce36d63307c9a7195a4da29e0c"><div class="ttname"><a href="a04453.html#a24d556ce36d63307c9a7195a4da29e0c">tesseract::LangModEdge::IsOOD</a></div><div class="ttdeci">virtual bool IsOOD() const =0</div></div>
<div class="ttc" id="a04453_html_ab5669c47ce83226077fbd3f8492e5bd2"><div class="ttname"><a href="a04453.html#ab5669c47ce83226077fbd3f8492e5bd2">tesseract::LangModEdge::Description</a></div><div class="ttdeci">virtual char * Description() const =0</div></div>
<div class="ttc" id="a00914_html"><div class="ttname"><a href="a00914.html">char_set.h</a></div></div>
<div class="ttc" id="a04453_html_a4dbb34a133e3ca37fb9c5190f2807848"><div class="ttname"><a href="a04453.html#a4dbb34a133e3ca37fb9c5190f2807848">tesseract::LangModEdge::SetRoot</a></div><div class="ttdeci">virtual void SetRoot(bool flag)=0</div></div>
<div class="ttc" id="a01738_html"><div class="ttname"><a href="a01738.html">tesseract</a></div><div class="ttdef"><b>Definition:</b> <a href="a00005_source.html#l00081">baseapi.cpp:81</a></div></div>
<div class="ttc" id="a04453_html_a970086075acc5f211b53825db505ee1d"><div class="ttname"><a href="a04453.html#a970086075acc5f211b53825db505ee1d">tesseract::LangModEdge::PathCost</a></div><div class="ttdeci">virtual int PathCost() const =0</div></div>
<div class="ttc" id="a04453_html_a04c2882fb2e15c7fd38050d3e9fd0020"><div class="ttname"><a href="a04453.html#a04c2882fb2e15c7fd38050d3e9fd0020">tesseract::LangModEdge::Hash</a></div><div class="ttdeci">virtual unsigned int Hash() const =0</div></div>
<div class="ttc" id="a04453_html_a8041893a12c0805b34ea50c311460518"><div class="ttname"><a href="a04453.html#a8041893a12c0805b34ea50c311460518">tesseract::LangModEdge::IsTerminal</a></div><div class="ttdeci">virtual bool IsTerminal() const =0</div></div>
<div class="ttc" id="a01738_html_aea2c6172b0ca77907e29cd018595b425"><div class="ttname"><a href="a01738.html#aea2c6172b0ca77907e29cd018595b425">tesseract::char_32</a></div><div class="ttdeci">signed int char_32</div><div class="ttdef"><b>Definition:</b> <a href="a01025_source.html#l00040">string_32.h:40</a></div></div>
<div class="ttc" id="a04453_html_ab107cb811bdbfda4fbd7b2af0bfb505e"><div class="ttname"><a href="a04453.html#ab107cb811bdbfda4fbd7b2af0bfb505e">tesseract::LangModEdge::IsEOW</a></div><div class="ttdeci">virtual bool IsEOW() const =0</div></div>
<div class="ttc" id="a04453_html_acdcbac70bbb421c944e500da45563fe0"><div class="ttname"><a href="a04453.html#acdcbac70bbb421c944e500da45563fe0">tesseract::LangModEdge::IsRoot</a></div><div class="ttdeci">virtual bool IsRoot() const =0</div></div>
<div class="ttc" id="a04453_html_ac8d2c121e28ba3e7415f01b8de806528"><div class="ttname"><a href="a04453.html#ac8d2c121e28ba3e7415f01b8de806528">tesseract::LangModEdge::~LangModEdge</a></div><div class="ttdeci">virtual ~LangModEdge()</div><div class="ttdef"><b>Definition:</b> <a href="a01004_source.html#l00046">lang_mod_edge.h:46</a></div></div>
<div class="ttc" id="a04453_html"><div class="ttname"><a href="a04453.html">tesseract::LangModEdge</a></div><div class="ttdef"><b>Definition:</b> <a href="a01004_source.html#l00043">lang_mod_edge.h:43</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_452bf2a1f165afdc57f378d186bca8c8.html">cube</a></li><li class="navelem"><a class="el" href="a01004.html">lang_mod_edge.h</a></li>
    <li class="footer">Generated on Mon Oct 29 2018 11:27:49 for tesseract by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.14 </li>
  </ul>
</div>
</body>
</html>