-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy patha00068_source.html
248 lines (246 loc) · 179 KB
/
a00068_source.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
<!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: /usr/src/tesseract-ocr.master/src/ccmain/applybox.cpp 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&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
 <span id="projectnumber">4.0.0-1-g2a2b</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&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&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&dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('a00068_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">applybox.cpp</div> </div>
</div><!--header-->
<div class="contents">
<a href="a00068.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/**********************************************************************</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"> * File: applybox.cpp (Formerly applybox.c)</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> * Description: Re segment rows according to box file data</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"> * Author: Phil Cheatle</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> * Created: Wed Nov 24 09:11:23 GMT 1993</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> *</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"> * (C) Copyright 1993, Hewlett-Packard Ltd.</span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> ** Licensed under the Apache License, Version 2.0 (the "License");</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <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> <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> <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> <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> <span class="comment"> ** distributed under the License is distributed on an "AS IS" BASIS,</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <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> <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> <span class="comment"> ** limitations under the License.</span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="comment"> *</span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="comment"> **********************************************************************/</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> </div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="preprocessor">#include <cctype></span></div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="preprocessor">#include <cerrno></span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="preprocessor">#include <cstring></span></div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="preprocessor">#include "allheaders.h"</span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="preprocessor">#include "<a class="code" href="a00242.html">boxread.h</a>"</span></div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="preprocessor">#ifndef DISABLED_LEGACY_ENGINE</span></div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="preprocessor">#include "<a class="code" href="a01538.html">chopper.h</a>"</span></div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="preprocessor">#include "<a class="code" href="a00344.html">pageres.h</a>"</span></div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span> <span class="preprocessor">#include "<a class="code" href="a00605.html">unichar.h</a>"</span></div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span> <span class="preprocessor">#include "<a class="code" href="a00623.html">unicharset.h</a>"</span></div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span> <span class="preprocessor">#include "<a class="code" href="a00191.html">tesseractclass.h</a>"</span></div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span> <span class="preprocessor">#include "<a class="code" href="a00518.html">genericvector.h</a>"</span></div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span> </div><div class="line"><a name="l00035"></a><span class="lineno"><a class="line" href="a00068.html#a1ecfbb8dde381ffc9c672e569cb1a1d2"> 35</a></span> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="a00068.html#a1ecfbb8dde381ffc9c672e569cb1a1d2">kMaxGroupSize</a> = 4;</div><div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="a00068.html#a7c746c8c99aa2b6f10f7c26838290da0"> 38</a></span> <span class="keyword">const</span> <span class="keywordtype">double</span> <a class="code" href="a00068.html#a7c746c8c99aa2b6f10f7c26838290da0">kMaxXHeightDeviationFraction</a> = 0.125;</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span> </div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span> <span class="keyword">namespace </span><a class="code" href="a01629.html">tesseract</a> {</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span> </div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span> <span class="preprocessor">#ifndef DISABLED_LEGACY_ENGINE</span></div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span> <span class="keyword">static</span> <span class="keywordtype">void</span> clear_any_old_text(BLOCK_LIST *block_list) {</div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  BLOCK_IT block_it(block_list);</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  <span class="keywordflow">for</span> (block_it.mark_cycle_pt();</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  !block_it.cycled_list(); block_it.forward()) {</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  ROW_IT row_it(block_it.data()->row_list());</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  <span class="keywordflow">for</span> (row_it.mark_cycle_pt(); !row_it.cycled_list(); row_it.forward()) {</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  WERD_IT word_it(row_it.data()->word_list());</div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  <span class="keywordflow">for</span> (word_it.mark_cycle_pt();</div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  !word_it.cycled_list(); word_it.forward()) {</div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  word_it.data()->set_text(<span class="stringliteral">""</span>);</div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  }</div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  }</div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  }</div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span> }</div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span> </div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span> <span class="comment">// Applies the box file based on the image name fname, and resegments</span></div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span> <span class="comment">// the words in the block_list (page), with:</span></div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span> <span class="comment">// blob-mode: one blob per line in the box file, words as input.</span></div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span> <span class="comment">// word/line-mode: one blob per space-delimited unit after the #, and one word</span></div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span> <span class="comment">// per line in the box file. (See comment above for box file format.)</span></div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span> <span class="comment">// If find_segmentation is true, (word/line mode) then the classifier is used</span></div><div class="line"><a name="l00099"></a><span class="lineno"> 99</span> <span class="comment">// to re-segment words/lines to match the space-delimited truth string for</span></div><div class="line"><a name="l00100"></a><span class="lineno"> 100</span> <span class="comment">// each box. In this case, the input box may be for a word or even a whole</span></div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span> <span class="comment">// text line, and the output words will contain multiple blobs corresponding</span></div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span> <span class="comment">// to the space-delimited input string.</span></div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span> <span class="comment">// With find_segmentation false, no classifier is needed, but the chopper</span></div><div class="line"><a name="l00104"></a><span class="lineno"> 104</span> <span class="comment">// can still be used to correctly segment touching characters with the help</span></div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span> <span class="comment">// of the input boxes.</span></div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span> <span class="comment">// In the returned PAGE_RES, the WERD_RES are setup as they would be returned</span></div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span> <span class="comment">// from normal classification, ie. with a word, chopped_word, rebuild_word,</span></div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span> <span class="comment">// seam_array, denorm, box_word, and best_state, but NO best_choice or</span></div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span> <span class="comment">// raw_choice, as they would require a UNICHARSET, which we aim to avoid.</span></div><div class="line"><a name="l00110"></a><span class="lineno"> 110</span> <span class="comment">// Instead, the correct_text member of WERD_RES is set, and this may be later</span></div><div class="line"><a name="l00111"></a><span class="lineno"> 111</span> <span class="comment">// converted to a best_choice using CorrectClassifyWords. CorrectClassifyWords</span></div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span> <span class="comment">// is not required before calling ApplyBoxTraining.</span></div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span> <a class="code" href="a02530.html">PAGE_RES</a>* <a class="code" href="a02358.html#a211f8d8d25bf615c44e117a93c40017c">Tesseract::ApplyBoxes</a>(<span class="keyword">const</span> <a class="code" href="a02834.html">STRING</a>& fname,</div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  <span class="keywordtype">bool</span> find_segmentation,</div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  BLOCK_LIST *block_list) {</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  <a class="code" href="a02182.html">GenericVector<TBOX></a> boxes;</div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  <a class="code" href="a02182.html">GenericVector<STRING></a> texts, full_texts;</div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  <span class="keywordflow">if</span> (!<a class="code" href="a00239.html#ab3161d7c887ead295045650e34d690fc">ReadAllBoxes</a>(<a class="code" href="a02358.html#a9d658579df984564e7365166c3dade8d">applybox_page</a>, <span class="keyword">true</span>, fname, &boxes, &texts, &full_texts,</div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  <span class="keyword">nullptr</span>)) {</div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  <span class="keywordflow">return</span> <span class="keyword">nullptr</span>; <span class="comment">// Can't do it.</span></div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  }</div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span> </div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> box_count = boxes.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>();</div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span>  <span class="keywordtype">int</span> box_failures = 0;</div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span> </div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  <span class="comment">// In word mode, we use the boxes to make a word for each box, but</span></div><div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  <span class="comment">// in blob mode we use the existing words and maximally chop them first.</span></div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  <a class="code" href="a02530.html">PAGE_RES</a>* page_res = find_segmentation ?</div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  nullptr : <a class="code" href="a02358.html#adee618f35a90de376370cb6f7930bc84">SetupApplyBoxes</a>(boxes, block_list);</div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  clear_any_old_text(block_list);</div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span> </div><div class="line"><a name="l00132"></a><span class="lineno"> 132</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < box_count; i++) {</div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  <span class="keywordtype">bool</span> foundit = <span class="keyword">false</span>;</div><div class="line"><a name="l00134"></a><span class="lineno"> 134</span>  <span class="keywordflow">if</span> (page_res != <span class="keyword">nullptr</span>) {</div><div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  foundit = <a class="code" href="a02358.html#a5f57aa97065aaf9fe6496c5af8de7c35">ResegmentCharBox</a>(page_res,</div><div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  (i == 0) ? <span class="keyword">nullptr</span> : &boxes[i - 1],</div><div class="line"><a name="l00137"></a><span class="lineno"> 137</span>  boxes[i],</div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  (i == box_count - 1) ? <span class="keyword">nullptr</span> : &boxes[i + 1],</div><div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  full_texts[i].<span class="keywordtype">string</span>());</div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span>  foundit = <a class="code" href="a02358.html#a352411d09d5b2dec65d5629bb684320a">ResegmentWordBox</a>(block_list, boxes[i],</div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  (i == box_count - 1) ? <span class="keyword">nullptr</span> : &boxes[i + 1],</div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  texts[i].<span class="keywordtype">string</span>());</div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span>  }</div><div class="line"><a name="l00145"></a><span class="lineno"> 145</span>  <span class="keywordflow">if</span> (!foundit) {</div><div class="line"><a name="l00146"></a><span class="lineno"> 146</span>  box_failures++;</div><div class="line"><a name="l00147"></a><span class="lineno"> 147</span>  <a class="code" href="a02358.html#ac465a51dfce59ff3bc7a20bdfa8850a4">ReportFailedBox</a>(i, boxes[i], texts[i].<span class="keywordtype">string</span>(),</div><div class="line"><a name="l00148"></a><span class="lineno"> 148</span>  <span class="stringliteral">"FAILURE! Couldn't find a matching blob"</span>);</div><div class="line"><a name="l00149"></a><span class="lineno"> 149</span>  }</div><div class="line"><a name="l00150"></a><span class="lineno"> 150</span>  }</div><div class="line"><a name="l00151"></a><span class="lineno"> 151</span> </div><div class="line"><a name="l00152"></a><span class="lineno"> 152</span>  <span class="keywordflow">if</span> (page_res == <span class="keyword">nullptr</span>) {</div><div class="line"><a name="l00153"></a><span class="lineno"> 153</span>  <span class="comment">// In word/line mode, we now maximally chop all the words and resegment</span></div><div class="line"><a name="l00154"></a><span class="lineno"> 154</span>  <span class="comment">// them with the classifier.</span></div><div class="line"><a name="l00155"></a><span class="lineno"> 155</span>  page_res = <a class="code" href="a02358.html#adee618f35a90de376370cb6f7930bc84">SetupApplyBoxes</a>(boxes, block_list);</div><div class="line"><a name="l00156"></a><span class="lineno"> 156</span>  <a class="code" href="a02358.html#a6193fb469b62b12c1b999194fc5cd569">ReSegmentByClassification</a>(page_res);</div><div class="line"><a name="l00157"></a><span class="lineno"> 157</span>  }</div><div class="line"><a name="l00158"></a><span class="lineno"> 158</span>  <span class="keywordflow">if</span> (<a class="code" href="a02358.html#ae8491b2f13cc276896ed93e74cd32ef6">applybox_debug</a> > 0) {</div><div class="line"><a name="l00159"></a><span class="lineno"> 159</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"APPLY_BOXES:\n"</span>);</div><div class="line"><a name="l00160"></a><span class="lineno"> 160</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">" Boxes read from boxfile: %6d\n"</span>, box_count);</div><div class="line"><a name="l00161"></a><span class="lineno"> 161</span>  <span class="keywordflow">if</span> (box_failures > 0)</div><div class="line"><a name="l00162"></a><span class="lineno"> 162</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">" Boxes failed resegmentation: %6d\n"</span>, box_failures);</div><div class="line"><a name="l00163"></a><span class="lineno"> 163</span>  }</div><div class="line"><a name="l00164"></a><span class="lineno"> 164</span>  <a class="code" href="a02358.html#a420654e409a9d28fd133515b5f3ed2c3">TidyUp</a>(page_res);</div><div class="line"><a name="l00165"></a><span class="lineno"> 165</span>  <span class="keywordflow">return</span> page_res;</div><div class="line"><a name="l00166"></a><span class="lineno"> 166</span> }</div><div class="line"><a name="l00167"></a><span class="lineno"> 167</span> <span class="preprocessor">#endif // ndef DISABLED_LEGACY_ENGINE</span></div><div class="line"><a name="l00168"></a><span class="lineno"> 168</span> </div><div class="line"><a name="l00169"></a><span class="lineno"> 169</span> <span class="comment">// Helper computes median xheight in the image.</span></div><div class="line"><a name="l00170"></a><span class="lineno"> 170</span> <span class="keyword">static</span> <span class="keywordtype">double</span> MedianXHeight(BLOCK_LIST *block_list) {</div><div class="line"><a name="l00171"></a><span class="lineno"> 171</span>  BLOCK_IT block_it(block_list);</div><div class="line"><a name="l00172"></a><span class="lineno"> 172</span>  <a class="code" href="a02630.html">STATS</a> xheights(0, block_it.data()->pdblk.bounding_box().height());</div><div class="line"><a name="l00173"></a><span class="lineno"> 173</span>  <span class="keywordflow">for</span> (block_it.mark_cycle_pt();</div><div class="line"><a name="l00174"></a><span class="lineno"> 174</span>  !block_it.cycled_list(); block_it.forward()) {</div><div class="line"><a name="l00175"></a><span class="lineno"> 175</span>  ROW_IT row_it(block_it.data()->row_list());</div><div class="line"><a name="l00176"></a><span class="lineno"> 176</span>  <span class="keywordflow">for</span> (row_it.mark_cycle_pt(); !row_it.cycled_list(); row_it.forward()) {</div><div class="line"><a name="l00177"></a><span class="lineno"> 177</span>  xheights.<a class="code" href="a02630.html#a5ce26a26c81c69a3e27616669998abe2">add</a>(<a class="code" href="a00527.html#ab60e4f82956a1f5fdb54d0d8303e95b7">IntCastRounded</a>(row_it.data()->x_height()), 1);</div><div class="line"><a name="l00178"></a><span class="lineno"> 178</span>  }</div><div class="line"><a name="l00179"></a><span class="lineno"> 179</span>  }</div><div class="line"><a name="l00180"></a><span class="lineno"> 180</span>  <span class="keywordflow">return</span> xheights.median();</div><div class="line"><a name="l00181"></a><span class="lineno"> 181</span> }</div><div class="line"><a name="l00182"></a><span class="lineno"> 182</span> </div><div class="line"><a name="l00185"></a><span class="lineno"> 185</span> <span class="keywordtype">void</span> <a class="code" href="a02358.html#a9cdc0e4ef9b85ed1b047764e9560196d">Tesseract::PreenXHeights</a>(BLOCK_LIST *block_list) {</div><div class="line"><a name="l00186"></a><span class="lineno"> 186</span>  <span class="keyword">const</span> <span class="keywordtype">double</span> median_xheight = MedianXHeight(block_list);</div><div class="line"><a name="l00187"></a><span class="lineno"> 187</span>  <span class="keyword">const</span> <span class="keywordtype">double</span> max_deviation = <a class="code" href="a00068.html#a7c746c8c99aa2b6f10f7c26838290da0">kMaxXHeightDeviationFraction</a> * median_xheight;</div><div class="line"><a name="l00188"></a><span class="lineno"> 188</span>  <span class="comment">// Strip all fuzzy space markers to simplify the PAGE_RES.</span></div><div class="line"><a name="l00189"></a><span class="lineno"> 189</span>  BLOCK_IT b_it(block_list);</div><div class="line"><a name="l00190"></a><span class="lineno"> 190</span>  <span class="keywordflow">for</span> (b_it.mark_cycle_pt(); !b_it.cycled_list(); b_it.forward()) {</div><div class="line"><a name="l00191"></a><span class="lineno"> 191</span>  <a class="code" href="a02514.html">BLOCK</a>* block = b_it.data();</div><div class="line"><a name="l00192"></a><span class="lineno"> 192</span>  ROW_IT r_it(block-><a class="code" href="a02514.html#ae9826e422b0bf17a7592dee8db3fe058">row_list</a>());</div><div class="line"><a name="l00193"></a><span class="lineno"> 193</span>  <span class="keywordflow">for</span> (r_it.mark_cycle_pt(); !r_it.cycled_list(); r_it.forward ()) {</div><div class="line"><a name="l00194"></a><span class="lineno"> 194</span>  <a class="code" href="a02526.html">ROW</a>* row = r_it.data();</div><div class="line"><a name="l00195"></a><span class="lineno"> 195</span>  <span class="keyword">const</span> <span class="keywordtype">double</span> diff = fabs(row-><a class="code" href="a02526.html#aced2e98c94f532c5c5809d63aef4b9de">x_height</a>() - median_xheight);</div><div class="line"><a name="l00196"></a><span class="lineno"> 196</span>  <span class="keywordflow">if</span> (diff > max_deviation) {</div><div class="line"><a name="l00197"></a><span class="lineno"> 197</span>  <span class="keywordflow">if</span> (<a class="code" href="a02358.html#ae8491b2f13cc276896ed93e74cd32ef6">applybox_debug</a>) {</div><div class="line"><a name="l00198"></a><span class="lineno"> 198</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"row xheight=%g, but median xheight = %g\n"</span>,</div><div class="line"><a name="l00199"></a><span class="lineno"> 199</span>  row-><a class="code" href="a02526.html#aced2e98c94f532c5c5809d63aef4b9de">x_height</a>(), median_xheight);</div><div class="line"><a name="l00200"></a><span class="lineno"> 200</span>  }</div><div class="line"><a name="l00201"></a><span class="lineno"> 201</span>  row-><a class="code" href="a02526.html#a90b980cd6ebbc47e80c0e2ea55ff14a2">set_x_height</a>(static_cast<float>(median_xheight));</div><div class="line"><a name="l00202"></a><span class="lineno"> 202</span>  }</div><div class="line"><a name="l00203"></a><span class="lineno"> 203</span>  }</div><div class="line"><a name="l00204"></a><span class="lineno"> 204</span>  }</div><div class="line"><a name="l00205"></a><span class="lineno"> 205</span> }</div><div class="line"><a name="l00206"></a><span class="lineno"> 206</span> </div><div class="line"><a name="l00207"></a><span class="lineno"> 207</span> <span class="preprocessor">#ifndef DISABLED_LEGACY_ENGINE</span></div><div class="line"><a name="l00208"></a><span class="lineno"> 208</span> </div><div class="line"><a name="l00211"></a><span class="lineno"> 211</span> <a class="code" href="a02530.html">PAGE_RES</a>* <a class="code" href="a02358.html#adee618f35a90de376370cb6f7930bc84">Tesseract::SetupApplyBoxes</a>(<span class="keyword">const</span> <a class="code" href="a02182.html">GenericVector<TBOX></a>& boxes,</div><div class="line"><a name="l00212"></a><span class="lineno"> 212</span>  BLOCK_LIST *block_list) {</div><div class="line"><a name="l00213"></a><span class="lineno"> 213</span>  <a class="code" href="a02358.html#a9cdc0e4ef9b85ed1b047764e9560196d">PreenXHeights</a>(block_list);</div><div class="line"><a name="l00214"></a><span class="lineno"> 214</span>  <span class="comment">// Strip all fuzzy space markers to simplify the PAGE_RES.</span></div><div class="line"><a name="l00215"></a><span class="lineno"> 215</span>  BLOCK_IT b_it(block_list);</div><div class="line"><a name="l00216"></a><span class="lineno"> 216</span>  <span class="keywordflow">for</span> (b_it.mark_cycle_pt(); !b_it.cycled_list(); b_it.forward()) {</div><div class="line"><a name="l00217"></a><span class="lineno"> 217</span>  <a class="code" href="a02514.html">BLOCK</a>* block = b_it.data();</div><div class="line"><a name="l00218"></a><span class="lineno"> 218</span>  ROW_IT r_it(block-><a class="code" href="a02514.html#ae9826e422b0bf17a7592dee8db3fe058">row_list</a>());</div><div class="line"><a name="l00219"></a><span class="lineno"> 219</span>  <span class="keywordflow">for</span> (r_it.mark_cycle_pt(); !r_it.cycled_list(); r_it.forward ()) {</div><div class="line"><a name="l00220"></a><span class="lineno"> 220</span>  <a class="code" href="a02526.html">ROW</a>* row = r_it.data();</div><div class="line"><a name="l00221"></a><span class="lineno"> 221</span>  WERD_IT w_it(row-><a class="code" href="a02526.html#ac9d07f978420b3564bf5508ad294fb70">word_list</a>());</div><div class="line"><a name="l00222"></a><span class="lineno"> 222</span>  <span class="keywordflow">for</span> (w_it.mark_cycle_pt(); !w_it.cycled_list(); w_it.forward()) {</div><div class="line"><a name="l00223"></a><span class="lineno"> 223</span>  <a class="code" href="a02638.html">WERD</a>* word = w_it.data();</div><div class="line"><a name="l00224"></a><span class="lineno"> 224</span>  <span class="keywordflow">if</span> (word-><a class="code" href="a02638.html#a174baefaa99afbfdbf444e4199f3b529">cblob_list</a>()->empty()) {</div><div class="line"><a name="l00225"></a><span class="lineno"> 225</span>  <span class="keyword">delete</span> w_it.extract();</div><div class="line"><a name="l00226"></a><span class="lineno"> 226</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00227"></a><span class="lineno"> 227</span>  word-><a class="code" href="a02638.html#aa84fa612a8864def8df4b7df26168aca">set_flag</a>(<a class="code" href="a00449.html#ad6968adbf8f2cc44adf333ec96efb0bea3580884b5b0335502fb928db4a0a2024">W_FUZZY_SP</a>, <span class="keyword">false</span>);</div><div class="line"><a name="l00228"></a><span class="lineno"> 228</span>  word-><a class="code" href="a02638.html#aa84fa612a8864def8df4b7df26168aca">set_flag</a>(<a class="code" href="a00449.html#ad6968adbf8f2cc44adf333ec96efb0bea675eadd051ea82d1f288751799bfa31c">W_FUZZY_NON</a>, <span class="keyword">false</span>);</div><div class="line"><a name="l00229"></a><span class="lineno"> 229</span>  }</div><div class="line"><a name="l00230"></a><span class="lineno"> 230</span>  }</div><div class="line"><a name="l00231"></a><span class="lineno"> 231</span>  }</div><div class="line"><a name="l00232"></a><span class="lineno"> 232</span>  }</div><div class="line"><a name="l00233"></a><span class="lineno"> 233</span>  <a class="code" href="a02530.html">PAGE_RES</a>* page_res = <span class="keyword">new</span> <a class="code" href="a02530.html">PAGE_RES</a>(<span class="keyword">false</span>, block_list, <span class="keyword">nullptr</span>);</div><div class="line"><a name="l00234"></a><span class="lineno"> 234</span>  <a class="code" href="a02546.html">PAGE_RES_IT</a> pr_it(page_res);</div><div class="line"><a name="l00235"></a><span class="lineno"> 235</span>  <a class="code" href="a02542.html">WERD_RES</a>* word_res;</div><div class="line"><a name="l00236"></a><span class="lineno"> 236</span>  <span class="keywordflow">while</span> ((word_res = pr_it.<a class="code" href="a02546.html#a6cdcdaa4b0b1250ab7e14760d4b5f113">word</a>()) != <span class="keyword">nullptr</span>) {</div><div class="line"><a name="l00237"></a><span class="lineno"> 237</span>  <a class="code" href="a02358.html#aab153649250a4b8bd6ffb4e22f44f79f">MaximallyChopWord</a>(boxes, pr_it.<a class="code" href="a02546.html#a997c382ddd2cf2f539532a1d91780963">block</a>()-><a class="code" href="a02534.html#ae7c240d4878247ebdfe78433446751bf">block</a>,</div><div class="line"><a name="l00238"></a><span class="lineno"> 238</span>  pr_it.<a class="code" href="a02546.html#a2038f4bd5c4c0eac4dba7f1d6bcdb5bf">row</a>()-><a class="code" href="a02538.html#ad3a856f3e9217c47b8f2f54cd3908721">row</a>, word_res);</div><div class="line"><a name="l00239"></a><span class="lineno"> 239</span>  pr_it.<a class="code" href="a02546.html#ab29005f235cc738eebafb7d9ed6fe70b">forward</a>();</div><div class="line"><a name="l00240"></a><span class="lineno"> 240</span>  }</div><div class="line"><a name="l00241"></a><span class="lineno"> 241</span>  <span class="keywordflow">return</span> page_res;</div><div class="line"><a name="l00242"></a><span class="lineno"> 242</span> }</div><div class="line"><a name="l00243"></a><span class="lineno"> 243</span> </div><div class="line"><a name="l00247"></a><span class="lineno"> 247</span> <span class="keywordtype">void</span> <a class="code" href="a02358.html#aab153649250a4b8bd6ffb4e22f44f79f">Tesseract::MaximallyChopWord</a>(<span class="keyword">const</span> <a class="code" href="a02182.html">GenericVector<TBOX></a>& boxes,</div><div class="line"><a name="l00248"></a><span class="lineno"> 248</span>  <a class="code" href="a02514.html">BLOCK</a>* block, <a class="code" href="a02526.html">ROW</a>* row,</div><div class="line"><a name="l00249"></a><span class="lineno"> 249</span>  <a class="code" href="a02542.html">WERD_RES</a>* word_res) {</div><div class="line"><a name="l00250"></a><span class="lineno"> 250</span>  <span class="keywordflow">if</span> (!word_res-><a class="code" href="a02542.html#adac960c00c2ae389886c91af9882ae00">SetupForRecognition</a>(<a class="code" href="a02666.html#a69c5179ac5f10a24f3f97e16ca09460f">unicharset</a>, <span class="keyword">this</span>, <a class="code" href="a02358.html#aec5d4e081fee6da40258b0b074342205">BestPix</a>(),</div><div class="line"><a name="l00251"></a><span class="lineno"> 251</span>  <a class="code" href="a02358.html#a889d9ac1b8ff48124d41e0d2254fad32">tessedit_ocr_engine_mode</a>, <span class="keyword">nullptr</span>,</div><div class="line"><a name="l00252"></a><span class="lineno"> 252</span>  <a class="code" href="a03998.html#a57e449d38b255fe82e61d88ded8b0020">classify_bln_numeric_mode</a>,</div><div class="line"><a name="l00253"></a><span class="lineno"> 253</span>  <a class="code" href="a02358.html#a5873c7054e8cba3e64fc3f20b2a93ca3">textord_use_cjk_fp_model</a>,</div><div class="line"><a name="l00254"></a><span class="lineno"> 254</span>  <a class="code" href="a02358.html#ae1206c0c4b63a008cc01650004fb7b03">poly_allow_detailed_fx</a>,</div><div class="line"><a name="l00255"></a><span class="lineno"> 255</span>  row, block)) {</div><div class="line"><a name="l00256"></a><span class="lineno"> 256</span>  word_res-><a class="code" href="a02542.html#a1c0bbe4f9ec71150e1e06a5023a84707">CloneChoppedToRebuild</a>();</div><div class="line"><a name="l00257"></a><span class="lineno"> 257</span>  <span class="keywordflow">return</span>;</div><div class="line"><a name="l00258"></a><span class="lineno"> 258</span>  }</div><div class="line"><a name="l00259"></a><span class="lineno"> 259</span>  <span class="keywordflow">if</span> (<a class="code" href="a04866.html#a3f1c04cfbc1650eae6fc981984717248">chop_debug</a>) {</div><div class="line"><a name="l00260"></a><span class="lineno"> 260</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"Maximally chopping word at:"</span>);</div><div class="line"><a name="l00261"></a><span class="lineno"> 261</span>  word_res-><a class="code" href="a02542.html#afc15fa7c1b5ad55d6772dea0d6865df1">word</a>-><a class="code" href="a02638.html#ad35a2fd78555195a3dedcdd01094d0d4">bounding_box</a>().<a class="code" href="a02610.html#a61af64df548c7638bf005fcd8343c435">print</a>();</div><div class="line"><a name="l00262"></a><span class="lineno"> 262</span>  }</div><div class="line"><a name="l00263"></a><span class="lineno"> 263</span>  <a class="code" href="a02182.html">GenericVector<BLOB_CHOICE*></a> blob_choices;</div><div class="line"><a name="l00264"></a><span class="lineno"> 264</span>  <a class="code" href="a00503.html#a93a603f4063a6b9403d81caa245a583b">ASSERT_HOST</a>(!word_res-><a class="code" href="a02542.html#ad1d449f93bb0150bc7ef0d9b59ed27ba">chopped_word</a>-><a class="code" href="a02402.html#a52fba22521039a79d8c1c8182f602dcc">blobs</a>.<a class="code" href="a02182.html#a172c4aa23ba397e24319ae095281cbcc">empty</a>());</div><div class="line"><a name="l00265"></a><span class="lineno"> 265</span>  <span class="keywordtype">float</span> rating = <span class="keyword">static_cast<</span><span class="keywordtype">float</span><span class="keyword">></span>(INT8_MAX);</div><div class="line"><a name="l00266"></a><span class="lineno"> 266</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < word_res-><a class="code" href="a02542.html#ad1d449f93bb0150bc7ef0d9b59ed27ba">chopped_word</a>-><a class="code" href="a02402.html#a0d5347723ece084faf8f3d0dba6dd219">NumBlobs</a>(); ++i) {</div><div class="line"><a name="l00267"></a><span class="lineno"> 267</span>  <span class="comment">// The rating and certainty are not quite arbitrary. Since</span></div><div class="line"><a name="l00268"></a><span class="lineno"> 268</span>  <span class="comment">// select_blob_to_chop uses the worst certainty to choose, they all have</span></div><div class="line"><a name="l00269"></a><span class="lineno"> 269</span>  <span class="comment">// to be different, so starting with INT8_MAX, subtract 1/8 for each blob</span></div><div class="line"><a name="l00270"></a><span class="lineno"> 270</span>  <span class="comment">// in here, and then divide by e each time they are chopped, which</span></div><div class="line"><a name="l00271"></a><span class="lineno"> 271</span>  <span class="comment">// should guarantee a set of unequal values for the whole tree of blobs</span></div><div class="line"><a name="l00272"></a><span class="lineno"> 272</span>  <span class="comment">// produced, however much chopping is required. The chops are thus only</span></div><div class="line"><a name="l00273"></a><span class="lineno"> 273</span>  <span class="comment">// limited by the ability of the chopper to find suitable chop points,</span></div><div class="line"><a name="l00274"></a><span class="lineno"> 274</span>  <span class="comment">// and not by the value of the certainties.</span></div><div class="line"><a name="l00275"></a><span class="lineno"> 275</span>  <a class="code" href="a02602.html">BLOB_CHOICE</a>* choice =</div><div class="line"><a name="l00276"></a><span class="lineno"> 276</span>  <span class="keyword">new</span> <a class="code" href="a02602.html">BLOB_CHOICE</a>(0, rating, -rating, -1, 0.0f, 0.0f, 0.0f, <a class="code" href="a00401.html#ac7c62d4383ee54bc9c16ef51a0ec3207a5d1ababd7ec62c799477a1ff0c33723f">BCC_FAKE</a>);</div><div class="line"><a name="l00277"></a><span class="lineno"> 277</span>  blob_choices.<a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(choice);</div><div class="line"><a name="l00278"></a><span class="lineno"> 278</span>  rating -= 0.125f;</div><div class="line"><a name="l00279"></a><span class="lineno"> 279</span>  }</div><div class="line"><a name="l00280"></a><span class="lineno"> 280</span>  <span class="keyword">const</span> <span class="keywordtype">double</span> e = exp(1.0); <span class="comment">// The base of natural logs.</span></div><div class="line"><a name="l00281"></a><span class="lineno"> 281</span>  <span class="keywordtype">int</span> blob_number;</div><div class="line"><a name="l00282"></a><span class="lineno"> 282</span>  <span class="keywordtype">int</span> right_chop_index = 0;</div><div class="line"><a name="l00283"></a><span class="lineno"> 283</span>  <span class="keywordflow">if</span> (!<a class="code" href="a04866.html#a613a7dc22729f2cb084bc7093a0a4088">assume_fixed_pitch_char_segment</a>) {</div><div class="line"><a name="l00284"></a><span class="lineno"> 284</span>  <span class="comment">// We only chop if the language is not fixed pitch like CJK.</span></div><div class="line"><a name="l00285"></a><span class="lineno"> 285</span>  <a class="code" href="a02622.html">SEAM</a>* seam = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00286"></a><span class="lineno"> 286</span>  <span class="keywordflow">while</span> ((seam = <a class="code" href="a04866.html#aaf38d21ed09a3ebf5da70ecd3c19739f">chop_one_blob</a>(boxes, blob_choices, word_res,</div><div class="line"><a name="l00287"></a><span class="lineno"> 287</span>  &blob_number)) != <span class="keyword">nullptr</span>) {</div><div class="line"><a name="l00288"></a><span class="lineno"> 288</span>  word_res-><a class="code" href="a02542.html#ae322fbf32d8be7d9a22bd860ae08b38f">InsertSeam</a>(blob_number, seam);</div><div class="line"><a name="l00289"></a><span class="lineno"> 289</span>  <a class="code" href="a02602.html">BLOB_CHOICE</a>* left_choice = blob_choices[blob_number];</div><div class="line"><a name="l00290"></a><span class="lineno"> 290</span>  rating = left_choice-><a class="code" href="a02602.html#ab90b9f9f303420fee80622acd9d268f2">rating</a>() / e;</div><div class="line"><a name="l00291"></a><span class="lineno"> 291</span>  left_choice-><a class="code" href="a02602.html#a20cb2e28102e9a34e5eb098f8c57ff64">set_rating</a>(rating);</div><div class="line"><a name="l00292"></a><span class="lineno"> 292</span>  left_choice-><a class="code" href="a02602.html#ae3331f9e390403bdf37c6e98fa067742">set_certainty</a>(-rating);</div><div class="line"><a name="l00293"></a><span class="lineno"> 293</span>  <span class="comment">// combine confidence w/ serial #</span></div><div class="line"><a name="l00294"></a><span class="lineno"> 294</span>  <a class="code" href="a02602.html">BLOB_CHOICE</a>* right_choice = <span class="keyword">new</span> <a class="code" href="a02602.html">BLOB_CHOICE</a>(++right_chop_index,</div><div class="line"><a name="l00295"></a><span class="lineno"> 295</span>  rating - 0.125f, -rating, -1,</div><div class="line"><a name="l00296"></a><span class="lineno"> 296</span>  0.0f, 0.0f, 0.0f, <a class="code" href="a00401.html#ac7c62d4383ee54bc9c16ef51a0ec3207a5d1ababd7ec62c799477a1ff0c33723f">BCC_FAKE</a>);</div><div class="line"><a name="l00297"></a><span class="lineno"> 297</span>  blob_choices.<a class="code" href="a02182.html#a5a31e95e16034993019e946298aa9b77">insert</a>(right_choice, blob_number + 1);</div><div class="line"><a name="l00298"></a><span class="lineno"> 298</span>  }</div><div class="line"><a name="l00299"></a><span class="lineno"> 299</span>  }</div><div class="line"><a name="l00300"></a><span class="lineno"> 300</span>  word_res-><a class="code" href="a02542.html#a1c0bbe4f9ec71150e1e06a5023a84707">CloneChoppedToRebuild</a>();</div><div class="line"><a name="l00301"></a><span class="lineno"> 301</span>  word_res-><a class="code" href="a02542.html#a20305480067627e7ba7a6c0e0d536018">FakeClassifyWord</a>(blob_choices.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>(), &blob_choices[0]);</div><div class="line"><a name="l00302"></a><span class="lineno"> 302</span> }</div><div class="line"><a name="l00303"></a><span class="lineno"> 303</span> </div><div class="line"><a name="l00304"></a><span class="lineno"> 304</span> <span class="preprocessor">#endif // ndef DISABLED_LEGACY_ENGINE</span></div><div class="line"><a name="l00305"></a><span class="lineno"> 305</span> </div><div class="line"><a name="l00317"></a><span class="lineno"> 317</span> <span class="keyword">static</span> <span class="keywordtype">double</span> BoxMissMetric(<span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& box1, <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& box2) {</div><div class="line"><a name="l00318"></a><span class="lineno"> 318</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> overlap_area = box1.<a class="code" href="a02610.html#abaa57ee82b89cfab6b80d3ac3d31bd60">intersection</a>(box2).<a class="code" href="a02610.html#a72bb2351fe7ecf04469c50179f625965">area</a>();</div><div class="line"><a name="l00319"></a><span class="lineno"> 319</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> a = box1.<a class="code" href="a02610.html#a72bb2351fe7ecf04469c50179f625965">area</a>();</div><div class="line"><a name="l00320"></a><span class="lineno"> 320</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> b = box2.<a class="code" href="a02610.html#a72bb2351fe7ecf04469c50179f625965">area</a>();</div><div class="line"><a name="l00321"></a><span class="lineno"> 321</span>  <a class="code" href="a00503.html#a93a603f4063a6b9403d81caa245a583b">ASSERT_HOST</a>(a != 0 && b != 0);</div><div class="line"><a name="l00322"></a><span class="lineno"> 322</span>  <span class="keywordflow">return</span> 1.0 * (a - overlap_area) * (b - overlap_area) / a / b;</div><div class="line"><a name="l00323"></a><span class="lineno"> 323</span> }</div><div class="line"><a name="l00324"></a><span class="lineno"> 324</span> </div><div class="line"><a name="l00325"></a><span class="lineno"> 325</span> <span class="preprocessor">#ifndef DISABLED_LEGACY_ENGINE</span></div><div class="line"><a name="l00326"></a><span class="lineno"> 326</span> </div><div class="line"><a name="l00337"></a><span class="lineno"> 337</span> <span class="keywordtype">bool</span> <a class="code" href="a02358.html#a5f57aa97065aaf9fe6496c5af8de7c35">Tesseract::ResegmentCharBox</a>(<a class="code" href="a02530.html">PAGE_RES</a>* page_res, <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>* prev_box,</div><div class="line"><a name="l00338"></a><span class="lineno"> 338</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& box, <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>* next_box,</div><div class="line"><a name="l00339"></a><span class="lineno"> 339</span>  <span class="keyword">const</span> <span class="keywordtype">char</span>* correct_text) {</div><div class="line"><a name="l00340"></a><span class="lineno"> 340</span>  <span class="keywordflow">if</span> (<a class="code" href="a02358.html#ae8491b2f13cc276896ed93e74cd32ef6">applybox_debug</a> > 1) {</div><div class="line"><a name="l00341"></a><span class="lineno"> 341</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"\nAPPLY_BOX: in ResegmentCharBox() for %s\n"</span>, correct_text);</div><div class="line"><a name="l00342"></a><span class="lineno"> 342</span>  }</div><div class="line"><a name="l00343"></a><span class="lineno"> 343</span>  <a class="code" href="a02546.html">PAGE_RES_IT</a> page_res_it(page_res);</div><div class="line"><a name="l00344"></a><span class="lineno"> 344</span>  <a class="code" href="a02542.html">WERD_RES</a>* word_res;</div><div class="line"><a name="l00345"></a><span class="lineno"> 345</span>  <span class="keywordflow">for</span> (word_res = page_res_it.<a class="code" href="a02546.html#a6cdcdaa4b0b1250ab7e14760d4b5f113">word</a>(); word_res != <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00346"></a><span class="lineno"> 346</span>  word_res = page_res_it.<a class="code" href="a02546.html#ab29005f235cc738eebafb7d9ed6fe70b">forward</a>()) {</div><div class="line"><a name="l00347"></a><span class="lineno"> 347</span>  <span class="keywordflow">if</span> (!word_res-><a class="code" href="a02542.html#a3a92c8c9750d78631d75998f008f366a">box_word</a>-><a class="code" href="a02410.html#a6bad9bc5492723019a2ad03b00cb7738">bounding_box</a>().<a class="code" href="a02610.html#a79f654ae8a2a33cbb2a1985cb97d143c">major_overlap</a>(box))</div><div class="line"><a name="l00348"></a><span class="lineno"> 348</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l00349"></a><span class="lineno"> 349</span>  <span class="keywordflow">if</span> (<a class="code" href="a02358.html#ae8491b2f13cc276896ed93e74cd32ef6">applybox_debug</a> > 1) {</div><div class="line"><a name="l00350"></a><span class="lineno"> 350</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"Checking word box:"</span>);</div><div class="line"><a name="l00351"></a><span class="lineno"> 351</span>  word_res-><a class="code" href="a02542.html#a3a92c8c9750d78631d75998f008f366a">box_word</a>-><a class="code" href="a02410.html#a6bad9bc5492723019a2ad03b00cb7738">bounding_box</a>().<a class="code" href="a02610.html#a61af64df548c7638bf005fcd8343c435">print</a>();</div><div class="line"><a name="l00352"></a><span class="lineno"> 352</span>  }</div><div class="line"><a name="l00353"></a><span class="lineno"> 353</span>  <span class="keywordtype">int</span> word_len = word_res-><a class="code" href="a02542.html#a3a92c8c9750d78631d75998f008f366a">box_word</a>-><a class="code" href="a02410.html#a2505cb916ecbd87e4ba1a44654b1e078">length</a>();</div><div class="line"><a name="l00354"></a><span class="lineno"> 354</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < word_len; ++i) {</div><div class="line"><a name="l00355"></a><span class="lineno"> 355</span>  <a class="code" href="a02610.html">TBOX</a> char_box = <a class="code" href="a02610.html">TBOX</a>();</div><div class="line"><a name="l00356"></a><span class="lineno"> 356</span>  <span class="keywordtype">int</span> blob_count = 0;</div><div class="line"><a name="l00357"></a><span class="lineno"> 357</span>  <span class="keywordflow">for</span> (blob_count = 0; i + blob_count < word_len; ++blob_count) {</div><div class="line"><a name="l00358"></a><span class="lineno"> 358</span>  <a class="code" href="a02610.html">TBOX</a> blob_box = word_res-><a class="code" href="a02542.html#a3a92c8c9750d78631d75998f008f366a">box_word</a>-><a class="code" href="a02410.html#a94891d405fd3837d235bb8916df1c89e">BlobBox</a>(i + blob_count);</div><div class="line"><a name="l00359"></a><span class="lineno"> 359</span>  <span class="keywordflow">if</span> (!blob_box.<a class="code" href="a02610.html#a79f654ae8a2a33cbb2a1985cb97d143c">major_overlap</a>(box))</div><div class="line"><a name="l00360"></a><span class="lineno"> 360</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l00361"></a><span class="lineno"> 361</span>  <span class="keywordflow">if</span> (word_res-><a class="code" href="a02542.html#ae524416d2398009c92a5678105f3cbfb">correct_text</a>[i + blob_count].<a class="code" href="a02182.html#a6af4e0a2a30dda267d19bf783ae22eb7">length</a>() > 0)</div><div class="line"><a name="l00362"></a><span class="lineno"> 362</span>  <span class="keywordflow">break</span>; <span class="comment">// Blob is claimed already.</span></div><div class="line"><a name="l00363"></a><span class="lineno"> 363</span>  <span class="keywordflow">if</span> (next_box != <span class="keyword">nullptr</span>) {</div><div class="line"><a name="l00364"></a><span class="lineno"> 364</span>  <span class="keyword">const</span> <span class="keywordtype">double</span> current_box_miss_metric = BoxMissMetric(blob_box, box);</div><div class="line"><a name="l00365"></a><span class="lineno"> 365</span>  <span class="keyword">const</span> <span class="keywordtype">double</span> next_box_miss_metric = BoxMissMetric(blob_box, *next_box);</div><div class="line"><a name="l00366"></a><span class="lineno"> 366</span>  <span class="keywordflow">if</span> (<a class="code" href="a02358.html#ae8491b2f13cc276896ed93e74cd32ef6">applybox_debug</a> > 2) {</div><div class="line"><a name="l00367"></a><span class="lineno"> 367</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"Checking blob:"</span>);</div><div class="line"><a name="l00368"></a><span class="lineno"> 368</span>  blob_box.<a class="code" href="a02610.html#a61af64df548c7638bf005fcd8343c435">print</a>();</div><div class="line"><a name="l00369"></a><span class="lineno"> 369</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"Current miss metric = %g, next = %g\n"</span>,</div><div class="line"><a name="l00370"></a><span class="lineno"> 370</span>  current_box_miss_metric, next_box_miss_metric);</div><div class="line"><a name="l00371"></a><span class="lineno"> 371</span>  }</div><div class="line"><a name="l00372"></a><span class="lineno"> 372</span>  <span class="keywordflow">if</span> (current_box_miss_metric > next_box_miss_metric)</div><div class="line"><a name="l00373"></a><span class="lineno"> 373</span>  <span class="keywordflow">break</span>; <span class="comment">// Blob is a better match for next box.</span></div><div class="line"><a name="l00374"></a><span class="lineno"> 374</span>  }</div><div class="line"><a name="l00375"></a><span class="lineno"> 375</span>  char_box += blob_box;</div><div class="line"><a name="l00376"></a><span class="lineno"> 376</span>  }</div><div class="line"><a name="l00377"></a><span class="lineno"> 377</span>  <span class="keywordflow">if</span> (blob_count > 0) {</div><div class="line"><a name="l00378"></a><span class="lineno"> 378</span>  <span class="keywordflow">if</span> (<a class="code" href="a02358.html#ae8491b2f13cc276896ed93e74cd32ef6">applybox_debug</a> > 1) {</div><div class="line"><a name="l00379"></a><span class="lineno"> 379</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"Index [%d, %d) seem good.\n"</span>, i, i + blob_count);</div><div class="line"><a name="l00380"></a><span class="lineno"> 380</span>  }</div><div class="line"><a name="l00381"></a><span class="lineno"> 381</span>  <span class="keywordflow">if</span> (!char_box.<a class="code" href="a02610.html#a1e3f13b685badb5ae93bc7b894282abb">almost_equal</a>(box, 3) &&</div><div class="line"><a name="l00382"></a><span class="lineno"> 382</span>  ((next_box != <span class="keyword">nullptr</span> && box.<a class="code" href="a02610.html#aee399b6542ff4856b2ea343bf202d2a3">x_gap</a>(*next_box) < -3)||</div><div class="line"><a name="l00383"></a><span class="lineno"> 383</span>  (prev_box != <span class="keyword">nullptr</span> && prev_box-><a class="code" href="a02610.html#aee399b6542ff4856b2ea343bf202d2a3">x_gap</a>(box) < -3))) {</div><div class="line"><a name="l00384"></a><span class="lineno"> 384</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00385"></a><span class="lineno"> 385</span>  }</div><div class="line"><a name="l00386"></a><span class="lineno"> 386</span>  <span class="comment">// We refine just the box_word, best_state and correct_text here.</span></div><div class="line"><a name="l00387"></a><span class="lineno"> 387</span>  <span class="comment">// The rebuild_word is made in TidyUp.</span></div><div class="line"><a name="l00388"></a><span class="lineno"> 388</span>  <span class="comment">// blob_count blobs are put together to match the box. Merge the</span></div><div class="line"><a name="l00389"></a><span class="lineno"> 389</span>  <span class="comment">// box_word boxes, save the blob_count in the state and the text.</span></div><div class="line"><a name="l00390"></a><span class="lineno"> 390</span>  word_res-><a class="code" href="a02542.html#a3a92c8c9750d78631d75998f008f366a">box_word</a>-><a class="code" href="a02410.html#a3a7da282c5432576b36cd7a8ec9702d8">MergeBoxes</a>(i, i + blob_count);</div><div class="line"><a name="l00391"></a><span class="lineno"> 391</span>  word_res-><a class="code" href="a02542.html#ab3c9354a32a99c3283f4ac411b5f9b93">best_state</a>[i] = blob_count;</div><div class="line"><a name="l00392"></a><span class="lineno"> 392</span>  word_res-><a class="code" href="a02542.html#ae524416d2398009c92a5678105f3cbfb">correct_text</a>[i] = correct_text;</div><div class="line"><a name="l00393"></a><span class="lineno"> 393</span>  <span class="keywordflow">if</span> (<a class="code" href="a02358.html#ae8491b2f13cc276896ed93e74cd32ef6">applybox_debug</a> > 2) {</div><div class="line"><a name="l00394"></a><span class="lineno"> 394</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"%d Blobs match: blob box:"</span>, blob_count);</div><div class="line"><a name="l00395"></a><span class="lineno"> 395</span>  word_res-><a class="code" href="a02542.html#a3a92c8c9750d78631d75998f008f366a">box_word</a>-><a class="code" href="a02410.html#a94891d405fd3837d235bb8916df1c89e">BlobBox</a>(i).<a class="code" href="a02610.html#a61af64df548c7638bf005fcd8343c435">print</a>();</div><div class="line"><a name="l00396"></a><span class="lineno"> 396</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"Matches box:"</span>);</div><div class="line"><a name="l00397"></a><span class="lineno"> 397</span>  box.<a class="code" href="a02610.html#a61af64df548c7638bf005fcd8343c435">print</a>();</div><div class="line"><a name="l00398"></a><span class="lineno"> 398</span>  <span class="keywordflow">if</span> (next_box != <span class="keyword">nullptr</span>) {</div><div class="line"><a name="l00399"></a><span class="lineno"> 399</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"With next box:"</span>);</div><div class="line"><a name="l00400"></a><span class="lineno"> 400</span>  next_box-><a class="code" href="a02610.html#a61af64df548c7638bf005fcd8343c435">print</a>();</div><div class="line"><a name="l00401"></a><span class="lineno"> 401</span>  }</div><div class="line"><a name="l00402"></a><span class="lineno"> 402</span>  }</div><div class="line"><a name="l00403"></a><span class="lineno"> 403</span>  <span class="comment">// Eliminated best_state and correct_text entries for the consumed</span></div><div class="line"><a name="l00404"></a><span class="lineno"> 404</span>  <span class="comment">// blobs.</span></div><div class="line"><a name="l00405"></a><span class="lineno"> 405</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 1; j < blob_count; ++j) {</div><div class="line"><a name="l00406"></a><span class="lineno"> 406</span>  word_res-><a class="code" href="a02542.html#ab3c9354a32a99c3283f4ac411b5f9b93">best_state</a>.<a class="code" href="a02182.html#a3fd37a240a42f1c3052e8d28614d3702">remove</a>(i + 1);</div><div class="line"><a name="l00407"></a><span class="lineno"> 407</span>  word_res-><a class="code" href="a02542.html#ae524416d2398009c92a5678105f3cbfb">correct_text</a>.<a class="code" href="a02182.html#a3fd37a240a42f1c3052e8d28614d3702">remove</a>(i + 1);</div><div class="line"><a name="l00408"></a><span class="lineno"> 408</span>  }</div><div class="line"><a name="l00409"></a><span class="lineno"> 409</span>  <span class="comment">// Assume that no box spans multiple source words, so we are done with</span></div><div class="line"><a name="l00410"></a><span class="lineno"> 410</span>  <span class="comment">// this box.</span></div><div class="line"><a name="l00411"></a><span class="lineno"> 411</span>  <span class="keywordflow">if</span> (<a class="code" href="a02358.html#ae8491b2f13cc276896ed93e74cd32ef6">applybox_debug</a> > 1) {</div><div class="line"><a name="l00412"></a><span class="lineno"> 412</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"Best state = "</span>);</div><div class="line"><a name="l00413"></a><span class="lineno"> 413</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j < word_res-><a class="code" href="a02542.html#ab3c9354a32a99c3283f4ac411b5f9b93">best_state</a>.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>(); ++j) {</div><div class="line"><a name="l00414"></a><span class="lineno"> 414</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"%d "</span>, word_res-><a class="code" href="a02542.html#ab3c9354a32a99c3283f4ac411b5f9b93">best_state</a>[j]);</div><div class="line"><a name="l00415"></a><span class="lineno"> 415</span>  }</div><div class="line"><a name="l00416"></a><span class="lineno"> 416</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"\n"</span>);</div><div class="line"><a name="l00417"></a><span class="lineno"> 417</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"Correct text = [[ "</span>);</div><div class="line"><a name="l00418"></a><span class="lineno"> 418</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j < word_res-><a class="code" href="a02542.html#ae524416d2398009c92a5678105f3cbfb">correct_text</a>.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>(); ++j) {</div><div class="line"><a name="l00419"></a><span class="lineno"> 419</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"%s "</span>, word_res-><a class="code" href="a02542.html#ae524416d2398009c92a5678105f3cbfb">correct_text</a>[j].string());</div><div class="line"><a name="l00420"></a><span class="lineno"> 420</span>  }</div><div class="line"><a name="l00421"></a><span class="lineno"> 421</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"]]\n"</span>);</div><div class="line"><a name="l00422"></a><span class="lineno"> 422</span>  }</div><div class="line"><a name="l00423"></a><span class="lineno"> 423</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00424"></a><span class="lineno"> 424</span>  }</div><div class="line"><a name="l00425"></a><span class="lineno"> 425</span>  }</div><div class="line"><a name="l00426"></a><span class="lineno"> 426</span>  }</div><div class="line"><a name="l00427"></a><span class="lineno"> 427</span>  <span class="keywordflow">if</span> (<a class="code" href="a02358.html#ae8491b2f13cc276896ed93e74cd32ef6">applybox_debug</a> > 0) {</div><div class="line"><a name="l00428"></a><span class="lineno"> 428</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"FAIL!\n"</span>);</div><div class="line"><a name="l00429"></a><span class="lineno"> 429</span>  }</div><div class="line"><a name="l00430"></a><span class="lineno"> 430</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>; <span class="comment">// Failure.</span></div><div class="line"><a name="l00431"></a><span class="lineno"> 431</span> }</div><div class="line"><a name="l00432"></a><span class="lineno"> 432</span> </div><div class="line"><a name="l00439"></a><span class="lineno"> 439</span> <span class="keywordtype">bool</span> <a class="code" href="a02358.html#a352411d09d5b2dec65d5629bb684320a">Tesseract::ResegmentWordBox</a>(BLOCK_LIST *block_list,</div><div class="line"><a name="l00440"></a><span class="lineno"> 440</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& box, <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>* next_box,</div><div class="line"><a name="l00441"></a><span class="lineno"> 441</span>  <span class="keyword">const</span> <span class="keywordtype">char</span>* correct_text) {</div><div class="line"><a name="l00442"></a><span class="lineno"> 442</span>  <span class="keywordflow">if</span> (<a class="code" href="a02358.html#ae8491b2f13cc276896ed93e74cd32ef6">applybox_debug</a> > 1) {</div><div class="line"><a name="l00443"></a><span class="lineno"> 443</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"\nAPPLY_BOX: in ResegmentWordBox() for %s\n"</span>, correct_text);</div><div class="line"><a name="l00444"></a><span class="lineno"> 444</span>  }</div><div class="line"><a name="l00445"></a><span class="lineno"> 445</span>  <a class="code" href="a02638.html">WERD</a>* new_word = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00446"></a><span class="lineno"> 446</span>  BLOCK_IT b_it(block_list);</div><div class="line"><a name="l00447"></a><span class="lineno"> 447</span>  <span class="keywordflow">for</span> (b_it.mark_cycle_pt(); !b_it.cycled_list(); b_it.forward()) {</div><div class="line"><a name="l00448"></a><span class="lineno"> 448</span>  <a class="code" href="a02514.html">BLOCK</a>* block = b_it.data();</div><div class="line"><a name="l00449"></a><span class="lineno"> 449</span>  <span class="keywordflow">if</span> (!box.<a class="code" href="a02610.html#a79f654ae8a2a33cbb2a1985cb97d143c">major_overlap</a>(block-><a class="code" href="a02514.html#a9e4346e037f2cc01c3c51d888531da74">pdblk</a>.<a class="code" href="a02558.html#a3f06f8e34fc5962f342daff9623463e9">bounding_box</a>()))</div><div class="line"><a name="l00450"></a><span class="lineno"> 450</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l00451"></a><span class="lineno"> 451</span>  ROW_IT r_it(block-><a class="code" href="a02514.html#ae9826e422b0bf17a7592dee8db3fe058">row_list</a>());</div><div class="line"><a name="l00452"></a><span class="lineno"> 452</span>  <span class="keywordflow">for</span> (r_it.mark_cycle_pt(); !r_it.cycled_list(); r_it.forward()) {</div><div class="line"><a name="l00453"></a><span class="lineno"> 453</span>  <a class="code" href="a02526.html">ROW</a>* row = r_it.data();</div><div class="line"><a name="l00454"></a><span class="lineno"> 454</span>  <span class="keywordflow">if</span> (!box.<a class="code" href="a02610.html#a79f654ae8a2a33cbb2a1985cb97d143c">major_overlap</a>(row-><a class="code" href="a02526.html#aa79de9c912a3875be44fdc3131fdc687">bounding_box</a>()))</div><div class="line"><a name="l00455"></a><span class="lineno"> 455</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l00456"></a><span class="lineno"> 456</span>  WERD_IT w_it(row-><a class="code" href="a02526.html#ac9d07f978420b3564bf5508ad294fb70">word_list</a>());</div><div class="line"><a name="l00457"></a><span class="lineno"> 457</span>  <span class="keywordflow">for</span> (w_it.mark_cycle_pt(); !w_it.cycled_list(); w_it.forward()) {</div><div class="line"><a name="l00458"></a><span class="lineno"> 458</span>  <a class="code" href="a02638.html">WERD</a>* word = w_it.data();</div><div class="line"><a name="l00459"></a><span class="lineno"> 459</span>  <span class="keywordflow">if</span> (<a class="code" href="a02358.html#ae8491b2f13cc276896ed93e74cd32ef6">applybox_debug</a> > 2) {</div><div class="line"><a name="l00460"></a><span class="lineno"> 460</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"Checking word:"</span>);</div><div class="line"><a name="l00461"></a><span class="lineno"> 461</span>  word-><a class="code" href="a02638.html#ad35a2fd78555195a3dedcdd01094d0d4">bounding_box</a>().<a class="code" href="a02610.html#a61af64df548c7638bf005fcd8343c435">print</a>();</div><div class="line"><a name="l00462"></a><span class="lineno"> 462</span>  }</div><div class="line"><a name="l00463"></a><span class="lineno"> 463</span>  <span class="keywordflow">if</span> (word-><a class="code" href="a02638.html#a8aabc91a932f2da3779ff920bea8389a">text</a>() != <span class="keyword">nullptr</span> && word-><a class="code" href="a02638.html#a8aabc91a932f2da3779ff920bea8389a">text</a>()[0] != <span class="charliteral">'\0'</span>)</div><div class="line"><a name="l00464"></a><span class="lineno"> 464</span>  <span class="keywordflow">continue</span>; <span class="comment">// Ignore words that are already done.</span></div><div class="line"><a name="l00465"></a><span class="lineno"> 465</span>  <span class="keywordflow">if</span> (!box.<a class="code" href="a02610.html#a79f654ae8a2a33cbb2a1985cb97d143c">major_overlap</a>(word-><a class="code" href="a02638.html#ad35a2fd78555195a3dedcdd01094d0d4">bounding_box</a>()))</div><div class="line"><a name="l00466"></a><span class="lineno"> 466</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l00467"></a><span class="lineno"> 467</span>  C_BLOB_IT blob_it(word-><a class="code" href="a02638.html#a174baefaa99afbfdbf444e4199f3b529">cblob_list</a>());</div><div class="line"><a name="l00468"></a><span class="lineno"> 468</span>  <span class="keywordflow">for</span> (blob_it.mark_cycle_pt(); !blob_it.cycled_list();</div><div class="line"><a name="l00469"></a><span class="lineno"> 469</span>  blob_it.forward()) {</div><div class="line"><a name="l00470"></a><span class="lineno"> 470</span>  <a class="code" href="a02634.html">C_BLOB</a>* blob = blob_it.data();</div><div class="line"><a name="l00471"></a><span class="lineno"> 471</span>  <a class="code" href="a02610.html">TBOX</a> blob_box = blob-><a class="code" href="a02634.html#a50bd7e9c66492bebdba6aadcc806bf93">bounding_box</a>();</div><div class="line"><a name="l00472"></a><span class="lineno"> 472</span>  <span class="keywordflow">if</span> (!blob_box.<a class="code" href="a02610.html#a79f654ae8a2a33cbb2a1985cb97d143c">major_overlap</a>(box))</div><div class="line"><a name="l00473"></a><span class="lineno"> 473</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l00474"></a><span class="lineno"> 474</span>  <span class="keywordflow">if</span> (next_box != <span class="keyword">nullptr</span>) {</div><div class="line"><a name="l00475"></a><span class="lineno"> 475</span>  <span class="keyword">const</span> <span class="keywordtype">double</span> current_box_miss_metric = BoxMissMetric(blob_box, box);</div><div class="line"><a name="l00476"></a><span class="lineno"> 476</span>  <span class="keyword">const</span> <span class="keywordtype">double</span> next_box_miss_metric = BoxMissMetric(blob_box, *next_box);</div><div class="line"><a name="l00477"></a><span class="lineno"> 477</span>  <span class="keywordflow">if</span> (<a class="code" href="a02358.html#ae8491b2f13cc276896ed93e74cd32ef6">applybox_debug</a> > 2) {</div><div class="line"><a name="l00478"></a><span class="lineno"> 478</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"Checking blob:"</span>);</div><div class="line"><a name="l00479"></a><span class="lineno"> 479</span>  blob_box.<a class="code" href="a02610.html#a61af64df548c7638bf005fcd8343c435">print</a>();</div><div class="line"><a name="l00480"></a><span class="lineno"> 480</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"Current miss metric = %g, next = %g\n"</span>,</div><div class="line"><a name="l00481"></a><span class="lineno"> 481</span>  current_box_miss_metric, next_box_miss_metric);</div><div class="line"><a name="l00482"></a><span class="lineno"> 482</span>  }</div><div class="line"><a name="l00483"></a><span class="lineno"> 483</span>  <span class="keywordflow">if</span> (current_box_miss_metric > next_box_miss_metric)</div><div class="line"><a name="l00484"></a><span class="lineno"> 484</span>  <span class="keywordflow">continue</span>; <span class="comment">// Blob is a better match for next box.</span></div><div class="line"><a name="l00485"></a><span class="lineno"> 485</span>  }</div><div class="line"><a name="l00486"></a><span class="lineno"> 486</span>  <span class="keywordflow">if</span> (<a class="code" href="a02358.html#ae8491b2f13cc276896ed93e74cd32ef6">applybox_debug</a> > 2) {</div><div class="line"><a name="l00487"></a><span class="lineno"> 487</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"Blob match: blob:"</span>);</div><div class="line"><a name="l00488"></a><span class="lineno"> 488</span>  blob_box.<a class="code" href="a02610.html#a61af64df548c7638bf005fcd8343c435">print</a>();</div><div class="line"><a name="l00489"></a><span class="lineno"> 489</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"Matches box:"</span>);</div><div class="line"><a name="l00490"></a><span class="lineno"> 490</span>  box.<a class="code" href="a02610.html#a61af64df548c7638bf005fcd8343c435">print</a>();</div><div class="line"><a name="l00491"></a><span class="lineno"> 491</span>  <span class="keywordflow">if</span> (next_box != <span class="keyword">nullptr</span>) {</div><div class="line"><a name="l00492"></a><span class="lineno"> 492</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"With next box:"</span>);</div><div class="line"><a name="l00493"></a><span class="lineno"> 493</span>  next_box-><a class="code" href="a02610.html#a61af64df548c7638bf005fcd8343c435">print</a>();</div><div class="line"><a name="l00494"></a><span class="lineno"> 494</span>  }</div><div class="line"><a name="l00495"></a><span class="lineno"> 495</span>  }</div><div class="line"><a name="l00496"></a><span class="lineno"> 496</span>  <span class="keywordflow">if</span> (new_word == <span class="keyword">nullptr</span>) {</div><div class="line"><a name="l00497"></a><span class="lineno"> 497</span>  <span class="comment">// Make a new word with a single blob.</span></div><div class="line"><a name="l00498"></a><span class="lineno"> 498</span>  new_word = word-><a class="code" href="a02638.html#a338086c2fee2164c3bf82add310631b4">shallow_copy</a>();</div><div class="line"><a name="l00499"></a><span class="lineno"> 499</span>  new_word-><a class="code" href="a02638.html#a5decd0b33533bf908c26ad4b10336fb0">set_text</a>(correct_text);</div><div class="line"><a name="l00500"></a><span class="lineno"> 500</span>  w_it.add_to_end(new_word);</div><div class="line"><a name="l00501"></a><span class="lineno"> 501</span>  }</div><div class="line"><a name="l00502"></a><span class="lineno"> 502</span>  C_BLOB_IT new_blob_it(new_word-><a class="code" href="a02638.html#a174baefaa99afbfdbf444e4199f3b529">cblob_list</a>());</div><div class="line"><a name="l00503"></a><span class="lineno"> 503</span>  new_blob_it.add_to_end(blob_it.extract());</div><div class="line"><a name="l00504"></a><span class="lineno"> 504</span>  }</div><div class="line"><a name="l00505"></a><span class="lineno"> 505</span>  }</div><div class="line"><a name="l00506"></a><span class="lineno"> 506</span>  }</div><div class="line"><a name="l00507"></a><span class="lineno"> 507</span>  }</div><div class="line"><a name="l00508"></a><span class="lineno"> 508</span>  <span class="keywordflow">if</span> (new_word == <span class="keyword">nullptr</span> && <a class="code" href="a02358.html#ae8491b2f13cc276896ed93e74cd32ef6">applybox_debug</a> > 0) <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"FAIL!\n"</span>);</div><div class="line"><a name="l00509"></a><span class="lineno"> 509</span>  <span class="keywordflow">return</span> new_word != <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00510"></a><span class="lineno"> 510</span> }</div><div class="line"><a name="l00511"></a><span class="lineno"> 511</span> </div><div class="line"><a name="l00514"></a><span class="lineno"> 514</span> <span class="keywordtype">void</span> <a class="code" href="a02358.html#a6193fb469b62b12c1b999194fc5cd569">Tesseract::ReSegmentByClassification</a>(<a class="code" href="a02530.html">PAGE_RES</a>* page_res) {</div><div class="line"><a name="l00515"></a><span class="lineno"> 515</span>  <a class="code" href="a02546.html">PAGE_RES_IT</a> pr_it(page_res);</div><div class="line"><a name="l00516"></a><span class="lineno"> 516</span>  <a class="code" href="a02542.html">WERD_RES</a>* word_res;</div><div class="line"><a name="l00517"></a><span class="lineno"> 517</span>  <span class="keywordflow">for</span> (; (word_res = pr_it.<a class="code" href="a02546.html#a6cdcdaa4b0b1250ab7e14760d4b5f113">word</a>()) != <span class="keyword">nullptr</span>; pr_it.<a class="code" href="a02546.html#ab29005f235cc738eebafb7d9ed6fe70b">forward</a>()) {</div><div class="line"><a name="l00518"></a><span class="lineno"> 518</span>  <span class="keyword">const</span> <a class="code" href="a02638.html">WERD</a>* word = word_res-><a class="code" href="a02542.html#afc15fa7c1b5ad55d6772dea0d6865df1">word</a>;</div><div class="line"><a name="l00519"></a><span class="lineno"> 519</span>  <span class="keywordflow">if</span> (word-><a class="code" href="a02638.html#a8aabc91a932f2da3779ff920bea8389a">text</a>() == <span class="keyword">nullptr</span> || word-><a class="code" href="a02638.html#a8aabc91a932f2da3779ff920bea8389a">text</a>()[0] == <span class="charliteral">'\0'</span>)</div><div class="line"><a name="l00520"></a><span class="lineno"> 520</span>  <span class="keywordflow">continue</span>; <span class="comment">// Ignore words that have no text.</span></div><div class="line"><a name="l00521"></a><span class="lineno"> 521</span>  <span class="comment">// Convert the correct text to a vector of UNICHAR_ID</span></div><div class="line"><a name="l00522"></a><span class="lineno"> 522</span>  <a class="code" href="a02182.html">GenericVector<UNICHAR_ID></a> target_text;</div><div class="line"><a name="l00523"></a><span class="lineno"> 523</span>  <span class="keywordflow">if</span> (!<a class="code" href="a02358.html#a29d34def0fb50890d45ed6d2b914bdd8">ConvertStringToUnichars</a>(word-><a class="code" href="a02638.html#a8aabc91a932f2da3779ff920bea8389a">text</a>(), &target_text)) {</div><div class="line"><a name="l00524"></a><span class="lineno"> 524</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"APPLY_BOX: FAILURE: can't find class_id for '%s'\n"</span>,</div><div class="line"><a name="l00525"></a><span class="lineno"> 525</span>  word-><a class="code" href="a02638.html#a8aabc91a932f2da3779ff920bea8389a">text</a>());</div><div class="line"><a name="l00526"></a><span class="lineno"> 526</span>  pr_it.<a class="code" href="a02546.html#afb987bf467ef552c49b962bf6872ad34">DeleteCurrentWord</a>();</div><div class="line"><a name="l00527"></a><span class="lineno"> 527</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l00528"></a><span class="lineno"> 528</span>  }</div><div class="line"><a name="l00529"></a><span class="lineno"> 529</span>  <span class="keywordflow">if</span> (!<a class="code" href="a02358.html#aa41485885750454f70de1bc1672ce04f">FindSegmentation</a>(target_text, word_res)) {</div><div class="line"><a name="l00530"></a><span class="lineno"> 530</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"APPLY_BOX: FAILURE: can't find segmentation for '%s'\n"</span>,</div><div class="line"><a name="l00531"></a><span class="lineno"> 531</span>  word-><a class="code" href="a02638.html#a8aabc91a932f2da3779ff920bea8389a">text</a>());</div><div class="line"><a name="l00532"></a><span class="lineno"> 532</span>  pr_it.<a class="code" href="a02546.html#afb987bf467ef552c49b962bf6872ad34">DeleteCurrentWord</a>();</div><div class="line"><a name="l00533"></a><span class="lineno"> 533</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l00534"></a><span class="lineno"> 534</span>  }</div><div class="line"><a name="l00535"></a><span class="lineno"> 535</span>  }</div><div class="line"><a name="l00536"></a><span class="lineno"> 536</span> }</div><div class="line"><a name="l00537"></a><span class="lineno"> 537</span> </div><div class="line"><a name="l00538"></a><span class="lineno"> 538</span> <span class="preprocessor">#endif // ndef DISABLED_LEGACY_ENGINE</span></div><div class="line"><a name="l00539"></a><span class="lineno"> 539</span> </div><div class="line"><a name="l00542"></a><span class="lineno"> 542</span> <span class="keywordtype">bool</span> <a class="code" href="a02358.html#a29d34def0fb50890d45ed6d2b914bdd8">Tesseract::ConvertStringToUnichars</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* utf8,</div><div class="line"><a name="l00543"></a><span class="lineno"> 543</span>  <a class="code" href="a02182.html">GenericVector<UNICHAR_ID></a>* class_ids) {</div><div class="line"><a name="l00544"></a><span class="lineno"> 544</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> step = 0; *utf8 != <span class="charliteral">'\0'</span>; utf8 += step) {</div><div class="line"><a name="l00545"></a><span class="lineno"> 545</span>  <span class="keyword">const</span> <span class="keywordtype">char</span>* next_space = strchr(utf8, <span class="charliteral">' '</span>);</div><div class="line"><a name="l00546"></a><span class="lineno"> 546</span>  <span class="keywordflow">if</span> (next_space == <span class="keyword">nullptr</span>)</div><div class="line"><a name="l00547"></a><span class="lineno"> 547</span>  next_space = utf8 + strlen(utf8);</div><div class="line"><a name="l00548"></a><span class="lineno"> 548</span>  step = next_space - utf8;</div><div class="line"><a name="l00549"></a><span class="lineno"> 549</span>  <a class="code" href="a00605.html#afedceee7ea132dae3d224db2cf8b5618">UNICHAR_ID</a> class_id = <a class="code" href="a02666.html#a69c5179ac5f10a24f3f97e16ca09460f">unicharset</a>.<a class="code" href="a03950.html#aeb2253dcb5f01c81fcba5f4af417eadf">unichar_to_id</a>(utf8, step);</div><div class="line"><a name="l00550"></a><span class="lineno"> 550</span>  <span class="keywordflow">if</span> (class_id == INVALID_UNICHAR_ID) {</div><div class="line"><a name="l00551"></a><span class="lineno"> 551</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00552"></a><span class="lineno"> 552</span>  }</div><div class="line"><a name="l00553"></a><span class="lineno"> 553</span>  <span class="keywordflow">while</span> (utf8[step] == <span class="charliteral">' '</span>)</div><div class="line"><a name="l00554"></a><span class="lineno"> 554</span>  ++step;</div><div class="line"><a name="l00555"></a><span class="lineno"> 555</span>  class_ids-><a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(class_id);</div><div class="line"><a name="l00556"></a><span class="lineno"> 556</span>  }</div><div class="line"><a name="l00557"></a><span class="lineno"> 557</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00558"></a><span class="lineno"> 558</span> }</div><div class="line"><a name="l00559"></a><span class="lineno"> 559</span> </div><div class="line"><a name="l00560"></a><span class="lineno"> 560</span> <span class="preprocessor">#ifndef DISABLED_LEGACY_ENGINE</span></div><div class="line"><a name="l00561"></a><span class="lineno"> 561</span> </div><div class="line"><a name="l00562"></a><span class="lineno"> 562</span> </div><div class="line"><a name="l00569"></a><span class="lineno"> 569</span> <span class="keywordtype">bool</span> <a class="code" href="a02358.html#aa41485885750454f70de1bc1672ce04f">Tesseract::FindSegmentation</a>(<span class="keyword">const</span> <a class="code" href="a02182.html">GenericVector<UNICHAR_ID></a>& target_text,</div><div class="line"><a name="l00570"></a><span class="lineno"> 570</span>  <a class="code" href="a02542.html">WERD_RES</a>* word_res) {</div><div class="line"><a name="l00571"></a><span class="lineno"> 571</span>  <span class="comment">// Classify all required combinations of blobs and save results in choices.</span></div><div class="line"><a name="l00572"></a><span class="lineno"> 572</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> word_length = word_res-><a class="code" href="a02542.html#a3a92c8c9750d78631d75998f008f366a">box_word</a>-><a class="code" href="a02410.html#a2505cb916ecbd87e4ba1a44654b1e078">length</a>();</div><div class="line"><a name="l00573"></a><span class="lineno"> 573</span>  <a class="code" href="a02182.html">GenericVector<BLOB_CHOICE_LIST*></a>* choices =</div><div class="line"><a name="l00574"></a><span class="lineno"> 574</span>  <span class="keyword">new</span> <a class="code" href="a02182.html">GenericVector<BLOB_CHOICE_LIST*></a>[word_length];</div><div class="line"><a name="l00575"></a><span class="lineno"> 575</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < word_length; ++i) {</div><div class="line"><a name="l00576"></a><span class="lineno"> 576</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 1; j <= <a class="code" href="a00068.html#a1ecfbb8dde381ffc9c672e569cb1a1d2">kMaxGroupSize</a> && i + j <= word_length; ++j) {</div><div class="line"><a name="l00577"></a><span class="lineno"> 577</span>  BLOB_CHOICE_LIST* match_result = <a class="code" href="a04866.html#aa5b9c5638c65d80fb426e540c700cfb4">classify_piece</a>(</div><div class="line"><a name="l00578"></a><span class="lineno"> 578</span>  word_res-><a class="code" href="a02542.html#a3d0de828a382a88581dafb5a304141f1">seam_array</a>, i, i + j - 1, <span class="stringliteral">"Applybox"</span>,</div><div class="line"><a name="l00579"></a><span class="lineno"> 579</span>  word_res-><a class="code" href="a02542.html#ad1d449f93bb0150bc7ef0d9b59ed27ba">chopped_word</a>, word_res-><a class="code" href="a02542.html#a267e5d5e9fe67117e47223c5d336b8ba">blamer_bundle</a>);</div><div class="line"><a name="l00580"></a><span class="lineno"> 580</span>  <span class="keywordflow">if</span> (<a class="code" href="a02358.html#ae8491b2f13cc276896ed93e74cd32ef6">applybox_debug</a> > 2) {</div><div class="line"><a name="l00581"></a><span class="lineno"> 581</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"%d+%d:"</span>, i, j);</div><div class="line"><a name="l00582"></a><span class="lineno"> 582</span>  <a class="code" href="a00398.html#a2de5b7d5a020bb9823091dbece4ea36e">print_ratings_list</a>(<span class="stringliteral">"Segment:"</span>, match_result, <a class="code" href="a02666.html#a69c5179ac5f10a24f3f97e16ca09460f">unicharset</a>);</div><div class="line"><a name="l00583"></a><span class="lineno"> 583</span>  }</div><div class="line"><a name="l00584"></a><span class="lineno"> 584</span>  choices[i].<a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(match_result);</div><div class="line"><a name="l00585"></a><span class="lineno"> 585</span>  }</div><div class="line"><a name="l00586"></a><span class="lineno"> 586</span>  }</div><div class="line"><a name="l00587"></a><span class="lineno"> 587</span>  <span class="comment">// Search the segmentation graph for the target text. Must be an exact</span></div><div class="line"><a name="l00588"></a><span class="lineno"> 588</span>  <span class="comment">// match. Using wildcards makes it difficult to find the correct</span></div><div class="line"><a name="l00589"></a><span class="lineno"> 589</span>  <span class="comment">// segmentation even when it is there.</span></div><div class="line"><a name="l00590"></a><span class="lineno"> 590</span>  word_res-><a class="code" href="a02542.html#ab3c9354a32a99c3283f4ac411b5f9b93">best_state</a>.<a class="code" href="a02182.html#a9cdbff49b186574b83e43afba606fdd9">clear</a>();</div><div class="line"><a name="l00591"></a><span class="lineno"> 591</span>  <a class="code" href="a02182.html">GenericVector<int></a> search_segmentation;</div><div class="line"><a name="l00592"></a><span class="lineno"> 592</span>  <span class="keywordtype">float</span> best_rating = 0.0f;</div><div class="line"><a name="l00593"></a><span class="lineno"> 593</span>  <a class="code" href="a02358.html#a3986c488d6851005b399d491dbde1eed">SearchForText</a>(choices, 0, word_length, target_text, 0, 0.0f,</div><div class="line"><a name="l00594"></a><span class="lineno"> 594</span>  &search_segmentation, &best_rating, &word_res-><a class="code" href="a02542.html#ab3c9354a32a99c3283f4ac411b5f9b93">best_state</a>);</div><div class="line"><a name="l00595"></a><span class="lineno"> 595</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < word_length; ++i)</div><div class="line"><a name="l00596"></a><span class="lineno"> 596</span>  choices[i].delete_data_pointers();</div><div class="line"><a name="l00597"></a><span class="lineno"> 597</span>  <span class="keyword">delete</span> [] choices;</div><div class="line"><a name="l00598"></a><span class="lineno"> 598</span>  <span class="keywordflow">if</span> (word_res-><a class="code" href="a02542.html#ab3c9354a32a99c3283f4ac411b5f9b93">best_state</a>.<a class="code" href="a02182.html#a172c4aa23ba397e24319ae095281cbcc">empty</a>()) {</div><div class="line"><a name="l00599"></a><span class="lineno"> 599</span>  <span class="comment">// Build the original segmentation and if it is the same length as the</span></div><div class="line"><a name="l00600"></a><span class="lineno"> 600</span>  <span class="comment">// truth, assume it will do.</span></div><div class="line"><a name="l00601"></a><span class="lineno"> 601</span>  <span class="keywordtype">int</span> blob_count = 1;</div><div class="line"><a name="l00602"></a><span class="lineno"> 602</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> s = 0; s < word_res-><a class="code" href="a02542.html#a3d0de828a382a88581dafb5a304141f1">seam_array</a>.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>(); ++s) {</div><div class="line"><a name="l00603"></a><span class="lineno"> 603</span>  <a class="code" href="a02622.html">SEAM</a>* seam = word_res-><a class="code" href="a02542.html#a3d0de828a382a88581dafb5a304141f1">seam_array</a>[s];</div><div class="line"><a name="l00604"></a><span class="lineno"> 604</span>  <span class="keywordflow">if</span> (!seam-><a class="code" href="a02622.html#a2c67b54ee80a063c0c0b976f3b22d5c6">HasAnySplits</a>()) {</div><div class="line"><a name="l00605"></a><span class="lineno"> 605</span>  word_res-><a class="code" href="a02542.html#ab3c9354a32a99c3283f4ac411b5f9b93">best_state</a>.<a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(blob_count);</div><div class="line"><a name="l00606"></a><span class="lineno"> 606</span>  blob_count = 1;</div><div class="line"><a name="l00607"></a><span class="lineno"> 607</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00608"></a><span class="lineno"> 608</span>  ++blob_count;</div><div class="line"><a name="l00609"></a><span class="lineno"> 609</span>  }</div><div class="line"><a name="l00610"></a><span class="lineno"> 610</span>  }</div><div class="line"><a name="l00611"></a><span class="lineno"> 611</span>  word_res-><a class="code" href="a02542.html#ab3c9354a32a99c3283f4ac411b5f9b93">best_state</a>.<a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(blob_count);</div><div class="line"><a name="l00612"></a><span class="lineno"> 612</span>  <span class="keywordflow">if</span> (word_res-><a class="code" href="a02542.html#ab3c9354a32a99c3283f4ac411b5f9b93">best_state</a>.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>() != target_text.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>()) {</div><div class="line"><a name="l00613"></a><span class="lineno"> 613</span>  word_res-><a class="code" href="a02542.html#ab3c9354a32a99c3283f4ac411b5f9b93">best_state</a>.<a class="code" href="a02182.html#a9cdbff49b186574b83e43afba606fdd9">clear</a>(); <span class="comment">// No good. Original segmentation bad size.</span></div><div class="line"><a name="l00614"></a><span class="lineno"> 614</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00615"></a><span class="lineno"> 615</span>  }</div><div class="line"><a name="l00616"></a><span class="lineno"> 616</span>  }</div><div class="line"><a name="l00617"></a><span class="lineno"> 617</span>  word_res-><a class="code" href="a02542.html#ae524416d2398009c92a5678105f3cbfb">correct_text</a>.<a class="code" href="a02182.html#a9cdbff49b186574b83e43afba606fdd9">clear</a>();</div><div class="line"><a name="l00618"></a><span class="lineno"> 618</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < target_text.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>(); ++i) {</div><div class="line"><a name="l00619"></a><span class="lineno"> 619</span>  word_res-><a class="code" href="a02542.html#ae524416d2398009c92a5678105f3cbfb">correct_text</a>.<a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(</div><div class="line"><a name="l00620"></a><span class="lineno"> 620</span>  <a class="code" href="a02834.html">STRING</a>(<a class="code" href="a02666.html#a69c5179ac5f10a24f3f97e16ca09460f">unicharset</a>.<a class="code" href="a03950.html#aa19fb595808fe4688c580334937dfa45">id_to_unichar</a>(target_text[i])));</div><div class="line"><a name="l00621"></a><span class="lineno"> 621</span>  }</div><div class="line"><a name="l00622"></a><span class="lineno"> 622</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00623"></a><span class="lineno"> 623</span> }</div><div class="line"><a name="l00624"></a><span class="lineno"> 624</span> </div><div class="line"><a name="l00639"></a><span class="lineno"> 639</span> <span class="keywordtype">void</span> <a class="code" href="a02358.html#a3986c488d6851005b399d491dbde1eed">Tesseract::SearchForText</a>(<span class="keyword">const</span> <a class="code" href="a02182.html">GenericVector<BLOB_CHOICE_LIST*></a>* choices,</div><div class="line"><a name="l00640"></a><span class="lineno"> 640</span>  <span class="keywordtype">int</span> choices_pos, <span class="keywordtype">int</span> choices_length,</div><div class="line"><a name="l00641"></a><span class="lineno"> 641</span>  <span class="keyword">const</span> <a class="code" href="a02182.html">GenericVector<UNICHAR_ID></a>& target_text,</div><div class="line"><a name="l00642"></a><span class="lineno"> 642</span>  <span class="keywordtype">int</span> text_index,</div><div class="line"><a name="l00643"></a><span class="lineno"> 643</span>  <span class="keywordtype">float</span> rating, <a class="code" href="a02182.html">GenericVector<int></a>* segmentation,</div><div class="line"><a name="l00644"></a><span class="lineno"> 644</span>  <span class="keywordtype">float</span>* best_rating,</div><div class="line"><a name="l00645"></a><span class="lineno"> 645</span>  <a class="code" href="a02182.html">GenericVector<int></a>* best_segmentation) {</div><div class="line"><a name="l00646"></a><span class="lineno"> 646</span>  <span class="keyword">const</span> <a class="code" href="a01629.html#a75c8b4558543aa0d0bebea769678bb65">UnicharAmbigsVector</a>& table = <a class="code" href="a02358.html#a67d107ceaab00c9e98d6473d4024d409">getDict</a>().<a class="code" href="a04290.html#abcb03b3de3664286db4a281e0a98fe05">getUnicharAmbigs</a>().<a class="code" href="a02650.html#a4c6dce5d139122c551eaa6a734d1230d">dang_ambigs</a>();</div><div class="line"><a name="l00647"></a><span class="lineno"> 647</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> length = 1; length <= choices[choices_pos].<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>(); ++length) {</div><div class="line"><a name="l00648"></a><span class="lineno"> 648</span>  <span class="comment">// Rating of matching choice or worst choice if no match.</span></div><div class="line"><a name="l00649"></a><span class="lineno"> 649</span>  <span class="keywordtype">float</span> choice_rating = 0.0f;</div><div class="line"><a name="l00650"></a><span class="lineno"> 650</span>  <span class="comment">// Find the corresponding best BLOB_CHOICE.</span></div><div class="line"><a name="l00651"></a><span class="lineno"> 651</span>  BLOB_CHOICE_IT choice_it(choices[choices_pos][length - 1]);</div><div class="line"><a name="l00652"></a><span class="lineno"> 652</span>  <span class="keywordflow">for</span> (choice_it.mark_cycle_pt(); !choice_it.cycled_list();</div><div class="line"><a name="l00653"></a><span class="lineno"> 653</span>  choice_it.forward()) {</div><div class="line"><a name="l00654"></a><span class="lineno"> 654</span>  <span class="keyword">const</span> <a class="code" href="a02602.html">BLOB_CHOICE</a>* choice = choice_it.data();</div><div class="line"><a name="l00655"></a><span class="lineno"> 655</span>  choice_rating = choice-><a class="code" href="a02602.html#ab90b9f9f303420fee80622acd9d268f2">rating</a>();</div><div class="line"><a name="l00656"></a><span class="lineno"> 656</span>  <a class="code" href="a00605.html#afedceee7ea132dae3d224db2cf8b5618">UNICHAR_ID</a> class_id = choice-><a class="code" href="a02602.html#ad448095b666bfb864211714ec2c2375e">unichar_id</a>();</div><div class="line"><a name="l00657"></a><span class="lineno"> 657</span>  <span class="keywordflow">if</span> (class_id == target_text[text_index]) {</div><div class="line"><a name="l00658"></a><span class="lineno"> 658</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l00659"></a><span class="lineno"> 659</span>  }</div><div class="line"><a name="l00660"></a><span class="lineno"> 660</span>  <span class="comment">// Search ambigs table.</span></div><div class="line"><a name="l00661"></a><span class="lineno"> 661</span>  <span class="keywordflow">if</span> (class_id < table.size() && table[class_id] != <span class="keyword">nullptr</span>) {</div><div class="line"><a name="l00662"></a><span class="lineno"> 662</span>  AmbigSpec_IT spec_it(table[class_id]);</div><div class="line"><a name="l00663"></a><span class="lineno"> 663</span>  <span class="keywordflow">for</span> (spec_it.mark_cycle_pt(); !spec_it.cycled_list();</div><div class="line"><a name="l00664"></a><span class="lineno"> 664</span>  spec_it.forward()) {</div><div class="line"><a name="l00665"></a><span class="lineno"> 665</span>  <span class="keyword">const</span> AmbigSpec *ambig_spec = spec_it.data();</div><div class="line"><a name="l00666"></a><span class="lineno"> 666</span>  <span class="comment">// We'll only do 1-1.</span></div><div class="line"><a name="l00667"></a><span class="lineno"> 667</span>  <span class="keywordflow">if</span> (ambig_spec->wrong_ngram[1] == INVALID_UNICHAR_ID &&</div><div class="line"><a name="l00668"></a><span class="lineno"> 668</span>  ambig_spec->correct_ngram_id == target_text[text_index])</div><div class="line"><a name="l00669"></a><span class="lineno"> 669</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l00670"></a><span class="lineno"> 670</span>  }</div><div class="line"><a name="l00671"></a><span class="lineno"> 671</span>  <span class="keywordflow">if</span> (!spec_it.cycled_list())</div><div class="line"><a name="l00672"></a><span class="lineno"> 672</span>  <span class="keywordflow">break</span>; <span class="comment">// Found an ambig.</span></div><div class="line"><a name="l00673"></a><span class="lineno"> 673</span>  }</div><div class="line"><a name="l00674"></a><span class="lineno"> 674</span>  }</div><div class="line"><a name="l00675"></a><span class="lineno"> 675</span>  <span class="keywordflow">if</span> (choice_it.cycled_list())</div><div class="line"><a name="l00676"></a><span class="lineno"> 676</span>  <span class="keywordflow">continue</span>; <span class="comment">// No match.</span></div><div class="line"><a name="l00677"></a><span class="lineno"> 677</span>  segmentation-><a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(length);</div><div class="line"><a name="l00678"></a><span class="lineno"> 678</span>  <span class="keywordflow">if</span> (choices_pos + length == choices_length &&</div><div class="line"><a name="l00679"></a><span class="lineno"> 679</span>  text_index + 1 == target_text.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>()) {</div><div class="line"><a name="l00680"></a><span class="lineno"> 680</span>  <span class="comment">// This is a complete match. If the rating is good record a new best.</span></div><div class="line"><a name="l00681"></a><span class="lineno"> 681</span>  <span class="keywordflow">if</span> (<a class="code" href="a02358.html#ae8491b2f13cc276896ed93e74cd32ef6">applybox_debug</a> > 2) {</div><div class="line"><a name="l00682"></a><span class="lineno"> 682</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"Complete match, rating = %g, best=%g, seglength=%d, best=%d\n"</span>,</div><div class="line"><a name="l00683"></a><span class="lineno"> 683</span>  rating + choice_rating, *best_rating, segmentation-><a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>(),</div><div class="line"><a name="l00684"></a><span class="lineno"> 684</span>  best_segmentation-><a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>());</div><div class="line"><a name="l00685"></a><span class="lineno"> 685</span>  }</div><div class="line"><a name="l00686"></a><span class="lineno"> 686</span>  <span class="keywordflow">if</span> (best_segmentation-><a class="code" href="a02182.html#a172c4aa23ba397e24319ae095281cbcc">empty</a>() || rating + choice_rating < *best_rating) {</div><div class="line"><a name="l00687"></a><span class="lineno"> 687</span>  *best_segmentation = *segmentation;</div><div class="line"><a name="l00688"></a><span class="lineno"> 688</span>  *best_rating = rating + choice_rating;</div><div class="line"><a name="l00689"></a><span class="lineno"> 689</span>  }</div><div class="line"><a name="l00690"></a><span class="lineno"> 690</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (choices_pos + length < choices_length &&</div><div class="line"><a name="l00691"></a><span class="lineno"> 691</span>  text_index + 1 < target_text.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>()) {</div><div class="line"><a name="l00692"></a><span class="lineno"> 692</span>  <span class="keywordflow">if</span> (<a class="code" href="a02358.html#ae8491b2f13cc276896ed93e74cd32ef6">applybox_debug</a> > 3) {</div><div class="line"><a name="l00693"></a><span class="lineno"> 693</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"Match found for %d=%s:%s, at %d+%d, recursing...\n"</span>,</div><div class="line"><a name="l00694"></a><span class="lineno"> 694</span>  target_text[text_index],</div><div class="line"><a name="l00695"></a><span class="lineno"> 695</span>  <a class="code" href="a02666.html#a69c5179ac5f10a24f3f97e16ca09460f">unicharset</a>.<a class="code" href="a03950.html#aa19fb595808fe4688c580334937dfa45">id_to_unichar</a>(target_text[text_index]),</div><div class="line"><a name="l00696"></a><span class="lineno"> 696</span>  choice_it.data()->unichar_id() == target_text[text_index]</div><div class="line"><a name="l00697"></a><span class="lineno"> 697</span>  ? <span class="stringliteral">"Match"</span> : <span class="stringliteral">"Ambig"</span>,</div><div class="line"><a name="l00698"></a><span class="lineno"> 698</span>  choices_pos, length);</div><div class="line"><a name="l00699"></a><span class="lineno"> 699</span>  }</div><div class="line"><a name="l00700"></a><span class="lineno"> 700</span>  <a class="code" href="a02358.html#a3986c488d6851005b399d491dbde1eed">SearchForText</a>(choices, choices_pos + length, choices_length, target_text,</div><div class="line"><a name="l00701"></a><span class="lineno"> 701</span>  text_index + 1, rating + choice_rating, segmentation,</div><div class="line"><a name="l00702"></a><span class="lineno"> 702</span>  best_rating, best_segmentation);</div><div class="line"><a name="l00703"></a><span class="lineno"> 703</span>  <span class="keywordflow">if</span> (<a class="code" href="a02358.html#ae8491b2f13cc276896ed93e74cd32ef6">applybox_debug</a> > 3) {</div><div class="line"><a name="l00704"></a><span class="lineno"> 704</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"End recursion for %d=%s\n"</span>, target_text[text_index],</div><div class="line"><a name="l00705"></a><span class="lineno"> 705</span>  <a class="code" href="a02666.html#a69c5179ac5f10a24f3f97e16ca09460f">unicharset</a>.<a class="code" href="a03950.html#aa19fb595808fe4688c580334937dfa45">id_to_unichar</a>(target_text[text_index]));</div><div class="line"><a name="l00706"></a><span class="lineno"> 706</span>  }</div><div class="line"><a name="l00707"></a><span class="lineno"> 707</span>  }</div><div class="line"><a name="l00708"></a><span class="lineno"> 708</span>  segmentation-><a class="code" href="a02182.html#a980882b5ebc3e72fdedbdbe345196f21">truncate</a>(segmentation-><a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>() - 1);</div><div class="line"><a name="l00709"></a><span class="lineno"> 709</span>  }</div><div class="line"><a name="l00710"></a><span class="lineno"> 710</span> }</div><div class="line"><a name="l00711"></a><span class="lineno"> 711</span> </div><div class="line"><a name="l00716"></a><span class="lineno"> 716</span> <span class="keywordtype">void</span> <a class="code" href="a02358.html#a420654e409a9d28fd133515b5f3ed2c3">Tesseract::TidyUp</a>(<a class="code" href="a02530.html">PAGE_RES</a>* page_res) {</div><div class="line"><a name="l00717"></a><span class="lineno"> 717</span>  <span class="keywordtype">int</span> ok_blob_count = 0;</div><div class="line"><a name="l00718"></a><span class="lineno"> 718</span>  <span class="keywordtype">int</span> bad_blob_count = 0;</div><div class="line"><a name="l00719"></a><span class="lineno"> 719</span>  <span class="keywordtype">int</span> ok_word_count = 0;</div><div class="line"><a name="l00720"></a><span class="lineno"> 720</span>  <span class="keywordtype">int</span> unlabelled_words = 0;</div><div class="line"><a name="l00721"></a><span class="lineno"> 721</span>  <a class="code" href="a02546.html">PAGE_RES_IT</a> pr_it(page_res);</div><div class="line"><a name="l00722"></a><span class="lineno"> 722</span>  <a class="code" href="a02542.html">WERD_RES</a>* word_res;</div><div class="line"><a name="l00723"></a><span class="lineno"> 723</span>  <span class="keywordflow">for</span> (; (word_res = pr_it.<a class="code" href="a02546.html#a6cdcdaa4b0b1250ab7e14760d4b5f113">word</a>()) != <span class="keyword">nullptr</span>; pr_it.<a class="code" href="a02546.html#ab29005f235cc738eebafb7d9ed6fe70b">forward</a>()) {</div><div class="line"><a name="l00724"></a><span class="lineno"> 724</span>  <span class="keywordtype">int</span> ok_in_word = 0;</div><div class="line"><a name="l00725"></a><span class="lineno"> 725</span>  <span class="keywordtype">int</span> blob_count = word_res-><a class="code" href="a02542.html#ae524416d2398009c92a5678105f3cbfb">correct_text</a>.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>();</div><div class="line"><a name="l00726"></a><span class="lineno"> 726</span>  <a class="code" href="a02606.html">WERD_CHOICE</a>* word_choice = <span class="keyword">new</span> <a class="code" href="a02606.html">WERD_CHOICE</a>(word_res-><a class="code" href="a02542.html#a053a2aeeddc26a93a41a04fa08dd688a">uch_set</a>, blob_count);</div><div class="line"><a name="l00727"></a><span class="lineno"> 727</span>  word_choice-><a class="code" href="a02606.html#a977bff5fc78c00ee6111d649a2b9a2b3">set_permuter</a>(<a class="code" href="a00401.html#a18e2c75cefe9e5b78e8ce41aa5fa25bca12d29cc139fe00da7420978c101d2889">TOP_CHOICE_PERM</a>);</div><div class="line"><a name="l00728"></a><span class="lineno"> 728</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> c = 0; c < blob_count; ++c) {</div><div class="line"><a name="l00729"></a><span class="lineno"> 729</span>  <span class="keywordflow">if</span> (word_res-><a class="code" href="a02542.html#ae524416d2398009c92a5678105f3cbfb">correct_text</a>[c].<a class="code" href="a02182.html#a6af4e0a2a30dda267d19bf783ae22eb7">length</a>() > 0) {</div><div class="line"><a name="l00730"></a><span class="lineno"> 730</span>  ++ok_in_word;</div><div class="line"><a name="l00731"></a><span class="lineno"> 731</span>  }</div><div class="line"><a name="l00732"></a><span class="lineno"> 732</span>  <span class="comment">// Since we only need a fake word_res->best_choice, the actual</span></div><div class="line"><a name="l00733"></a><span class="lineno"> 733</span>  <span class="comment">// unichar_ids do not matter. Which is fortunate, since TidyUp()</span></div><div class="line"><a name="l00734"></a><span class="lineno"> 734</span>  <span class="comment">// can be called while training Tesseract, at the stage where</span></div><div class="line"><a name="l00735"></a><span class="lineno"> 735</span>  <span class="comment">// unicharset is not meaningful yet.</span></div><div class="line"><a name="l00736"></a><span class="lineno"> 736</span>  word_choice-><a class="code" href="a02606.html#af6f7da15745fc51ea22e29364661166e">append_unichar_id_space_allocated</a>(</div><div class="line"><a name="l00737"></a><span class="lineno"> 737</span>  INVALID_UNICHAR_ID, word_res-><a class="code" href="a02542.html#ab3c9354a32a99c3283f4ac411b5f9b93">best_state</a>[c], 1.0f, -1.0f);</div><div class="line"><a name="l00738"></a><span class="lineno"> 738</span>  }</div><div class="line"><a name="l00739"></a><span class="lineno"> 739</span>  <span class="keywordflow">if</span> (ok_in_word > 0) {</div><div class="line"><a name="l00740"></a><span class="lineno"> 740</span>  ok_blob_count += ok_in_word;</div><div class="line"><a name="l00741"></a><span class="lineno"> 741</span>  bad_blob_count += word_res-><a class="code" href="a02542.html#ae524416d2398009c92a5678105f3cbfb">correct_text</a>.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>() - ok_in_word;</div><div class="line"><a name="l00742"></a><span class="lineno"> 742</span>  word_res-><a class="code" href="a02542.html#a30c86ecdeb8824b7ebfdbe57db2e6b81">LogNewRawChoice</a>(word_choice);</div><div class="line"><a name="l00743"></a><span class="lineno"> 743</span>  word_res-><a class="code" href="a02542.html#af365b5a873da178f9ef0bb3c14e6953f">LogNewCookedChoice</a>(1, <span class="keyword">false</span>, word_choice);</div><div class="line"><a name="l00744"></a><span class="lineno"> 744</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00745"></a><span class="lineno"> 745</span>  ++unlabelled_words;</div><div class="line"><a name="l00746"></a><span class="lineno"> 746</span>  <span class="keywordflow">if</span> (<a class="code" href="a02358.html#ae8491b2f13cc276896ed93e74cd32ef6">applybox_debug</a> > 0) {</div><div class="line"><a name="l00747"></a><span class="lineno"> 747</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"APPLY_BOXES: Unlabelled word at :"</span>);</div><div class="line"><a name="l00748"></a><span class="lineno"> 748</span>  word_res-><a class="code" href="a02542.html#afc15fa7c1b5ad55d6772dea0d6865df1">word</a>-><a class="code" href="a02638.html#ad35a2fd78555195a3dedcdd01094d0d4">bounding_box</a>().<a class="code" href="a02610.html#a61af64df548c7638bf005fcd8343c435">print</a>();</div><div class="line"><a name="l00749"></a><span class="lineno"> 749</span>  }</div><div class="line"><a name="l00750"></a><span class="lineno"> 750</span>  pr_it.<a class="code" href="a02546.html#afb987bf467ef552c49b962bf6872ad34">DeleteCurrentWord</a>();</div><div class="line"><a name="l00751"></a><span class="lineno"> 751</span>  <span class="keyword">delete</span> word_choice;</div><div class="line"><a name="l00752"></a><span class="lineno"> 752</span>  }</div><div class="line"><a name="l00753"></a><span class="lineno"> 753</span>  }</div><div class="line"><a name="l00754"></a><span class="lineno"> 754</span>  pr_it.<a class="code" href="a02546.html#a15febd45d0904bb3c5f7d506368177f0">restart_page</a>();</div><div class="line"><a name="l00755"></a><span class="lineno"> 755</span>  <span class="keywordflow">for</span> (; (word_res = pr_it.<a class="code" href="a02546.html#a6cdcdaa4b0b1250ab7e14760d4b5f113">word</a>()) != <span class="keyword">nullptr</span>; pr_it.<a class="code" href="a02546.html#ab29005f235cc738eebafb7d9ed6fe70b">forward</a>()) {</div><div class="line"><a name="l00756"></a><span class="lineno"> 756</span>  <span class="comment">// Denormalize back to a BoxWord.</span></div><div class="line"><a name="l00757"></a><span class="lineno"> 757</span>  word_res-><a class="code" href="a02542.html#ae57ef3e90db1cb0bcdf96f4b32dee362">RebuildBestState</a>();</div><div class="line"><a name="l00758"></a><span class="lineno"> 758</span>  word_res-><a class="code" href="a02542.html#a6efe07c079a04a91985f99c71258a193">SetupBoxWord</a>();</div><div class="line"><a name="l00759"></a><span class="lineno"> 759</span>  word_res-><a class="code" href="a02542.html#afc15fa7c1b5ad55d6772dea0d6865df1">word</a>-><a class="code" href="a02638.html#aa84fa612a8864def8df4b7df26168aca">set_flag</a>(<a class="code" href="a00449.html#ad6968adbf8f2cc44adf333ec96efb0beaff21d7c8c8992120fff35942408a00d2">W_BOL</a>, pr_it.<a class="code" href="a02546.html#a32f7ecd54106290053205cc118395d8d">prev_row</a>() != pr_it.<a class="code" href="a02546.html#a2038f4bd5c4c0eac4dba7f1d6bcdb5bf">row</a>());</div><div class="line"><a name="l00760"></a><span class="lineno"> 760</span>  word_res-><a class="code" href="a02542.html#afc15fa7c1b5ad55d6772dea0d6865df1">word</a>-><a class="code" href="a02638.html#aa84fa612a8864def8df4b7df26168aca">set_flag</a>(<a class="code" href="a00449.html#ad6968adbf8f2cc44adf333ec96efb0bea62efb985a62d85e014ee5ab039dd50ce">W_EOL</a>, pr_it.<a class="code" href="a02546.html#a1e2469796295fe3908ba358c87d2439e">next_row</a>() != pr_it.<a class="code" href="a02546.html#a2038f4bd5c4c0eac4dba7f1d6bcdb5bf">row</a>());</div><div class="line"><a name="l00761"></a><span class="lineno"> 761</span>  }</div><div class="line"><a name="l00762"></a><span class="lineno"> 762</span>  <span class="keywordflow">if</span> (<a class="code" href="a02358.html#ae8491b2f13cc276896ed93e74cd32ef6">applybox_debug</a> > 0) {</div><div class="line"><a name="l00763"></a><span class="lineno"> 763</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">" Found %d good blobs.\n"</span>, ok_blob_count);</div><div class="line"><a name="l00764"></a><span class="lineno"> 764</span>  <span class="keywordflow">if</span> (bad_blob_count > 0) {</div><div class="line"><a name="l00765"></a><span class="lineno"> 765</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">" Leaving %d unlabelled blobs in %d words.\n"</span>,</div><div class="line"><a name="l00766"></a><span class="lineno"> 766</span>  bad_blob_count, ok_word_count);</div><div class="line"><a name="l00767"></a><span class="lineno"> 767</span>  }</div><div class="line"><a name="l00768"></a><span class="lineno"> 768</span>  <span class="keywordflow">if</span> (unlabelled_words > 0)</div><div class="line"><a name="l00769"></a><span class="lineno"> 769</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">" %d remaining unlabelled words deleted.\n"</span>, unlabelled_words);</div><div class="line"><a name="l00770"></a><span class="lineno"> 770</span>  }</div><div class="line"><a name="l00771"></a><span class="lineno"> 771</span> }</div><div class="line"><a name="l00772"></a><span class="lineno"> 772</span> </div><div class="line"><a name="l00773"></a><span class="lineno"> 773</span> <span class="preprocessor">#endif // ndef DISABLED_LEGACY_ENGINE</span></div><div class="line"><a name="l00774"></a><span class="lineno"> 774</span> </div><div class="line"><a name="l00776"></a><span class="lineno"> 776</span> <span class="keywordtype">void</span> <a class="code" href="a02358.html#ac465a51dfce59ff3bc7a20bdfa8850a4">Tesseract::ReportFailedBox</a>(<span class="keywordtype">int</span> boxfile_lineno, <a class="code" href="a02610.html">TBOX</a> box,</div><div class="line"><a name="l00777"></a><span class="lineno"> 777</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *box_ch, <span class="keyword">const</span> <span class="keywordtype">char</span> *err_msg) {</div><div class="line"><a name="l00778"></a><span class="lineno"> 778</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"APPLY_BOXES: boxfile line %d/%s ((%d,%d),(%d,%d)): %s\n"</span>,</div><div class="line"><a name="l00779"></a><span class="lineno"> 779</span>  boxfile_lineno + 1, box_ch,</div><div class="line"><a name="l00780"></a><span class="lineno"> 780</span>  box.<a class="code" href="a02610.html#a8e9dce0d30d2213598cd4befe0028c99">left</a>(), box.<a class="code" href="a02610.html#a9fee4521e71300975cb34ebb21e3fca5">bottom</a>(), box.<a class="code" href="a02610.html#af74fa3bf628c9426cd6f1141a87dc2e0">right</a>(), box.<a class="code" href="a02610.html#a5dc64d0677b5d65385bc07a78cf49c4d">top</a>(), err_msg);</div><div class="line"><a name="l00781"></a><span class="lineno"> 781</span> }</div><div class="line"><a name="l00782"></a><span class="lineno"> 782</span> </div><div class="line"><a name="l00784"></a><span class="lineno"> 784</span> <span class="keywordtype">void</span> <a class="code" href="a02358.html#aaac7729b5dc17651a6b3ee44689302d5">Tesseract::CorrectClassifyWords</a>(<a class="code" href="a02530.html">PAGE_RES</a>* page_res) {</div><div class="line"><a name="l00785"></a><span class="lineno"> 785</span>  <a class="code" href="a02546.html">PAGE_RES_IT</a> pr_it(page_res);</div><div class="line"><a name="l00786"></a><span class="lineno"> 786</span>  <span class="keywordflow">for</span> (<a class="code" href="a02542.html">WERD_RES</a> *word_res = pr_it.<a class="code" href="a02546.html#a6cdcdaa4b0b1250ab7e14760d4b5f113">word</a>(); word_res != <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00787"></a><span class="lineno"> 787</span>  word_res = pr_it.<a class="code" href="a02546.html#ab29005f235cc738eebafb7d9ed6fe70b">forward</a>()) {</div><div class="line"><a name="l00788"></a><span class="lineno"> 788</span>  <a class="code" href="a02606.html">WERD_CHOICE</a>* choice = <span class="keyword">new</span> <a class="code" href="a02606.html">WERD_CHOICE</a>(word_res-><a class="code" href="a02542.html#a053a2aeeddc26a93a41a04fa08dd688a">uch_set</a>,</div><div class="line"><a name="l00789"></a><span class="lineno"> 789</span>  word_res-><a class="code" href="a02542.html#ae524416d2398009c92a5678105f3cbfb">correct_text</a>.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>());</div><div class="line"><a name="l00790"></a><span class="lineno"> 790</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < word_res-><a class="code" href="a02542.html#ae524416d2398009c92a5678105f3cbfb">correct_text</a>.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>(); ++i) {</div><div class="line"><a name="l00791"></a><span class="lineno"> 791</span>  <span class="comment">// The part before the first space is the real ground truth, and the</span></div><div class="line"><a name="l00792"></a><span class="lineno"> 792</span>  <span class="comment">// rest is the bounding box location and page number.</span></div><div class="line"><a name="l00793"></a><span class="lineno"> 793</span>  <a class="code" href="a02182.html">GenericVector<STRING></a> tokens;</div><div class="line"><a name="l00794"></a><span class="lineno"> 794</span>  word_res-><a class="code" href="a02542.html#ae524416d2398009c92a5678105f3cbfb">correct_text</a>[i].split(<span class="charliteral">' '</span>, &tokens);</div><div class="line"><a name="l00795"></a><span class="lineno"> 795</span>  <a class="code" href="a00605.html#afedceee7ea132dae3d224db2cf8b5618">UNICHAR_ID</a> char_id = <a class="code" href="a02666.html#a69c5179ac5f10a24f3f97e16ca09460f">unicharset</a>.<a class="code" href="a03950.html#aeb2253dcb5f01c81fcba5f4af417eadf">unichar_to_id</a>(tokens[0].<span class="keywordtype">string</span>());</div><div class="line"><a name="l00796"></a><span class="lineno"> 796</span>  choice-><a class="code" href="a02606.html#af6f7da15745fc51ea22e29364661166e">append_unichar_id_space_allocated</a>(char_id,</div><div class="line"><a name="l00797"></a><span class="lineno"> 797</span>  word_res-><a class="code" href="a02542.html#ab3c9354a32a99c3283f4ac411b5f9b93">best_state</a>[i],</div><div class="line"><a name="l00798"></a><span class="lineno"> 798</span>  0.0f, 0.0f);</div><div class="line"><a name="l00799"></a><span class="lineno"> 799</span>  }</div><div class="line"><a name="l00800"></a><span class="lineno"> 800</span>  word_res-><a class="code" href="a02542.html#a9f45bb44fc6a5b4870f134137bd3d970">ClearWordChoices</a>();</div><div class="line"><a name="l00801"></a><span class="lineno"> 801</span>  word_res-><a class="code" href="a02542.html#a30c86ecdeb8824b7ebfdbe57db2e6b81">LogNewRawChoice</a>(choice);</div><div class="line"><a name="l00802"></a><span class="lineno"> 802</span>  word_res-><a class="code" href="a02542.html#af365b5a873da178f9ef0bb3c14e6953f">LogNewCookedChoice</a>(1, <span class="keyword">false</span>, choice);</div><div class="line"><a name="l00803"></a><span class="lineno"> 803</span>  }</div><div class="line"><a name="l00804"></a><span class="lineno"> 804</span> }</div><div class="line"><a name="l00805"></a><span class="lineno"> 805</span> </div><div class="line"><a name="l00806"></a><span class="lineno"> 806</span> <span class="preprocessor">#ifndef DISABLED_LEGACY_ENGINE</span></div><div class="line"><a name="l00807"></a><span class="lineno"> 807</span> </div><div class="line"><a name="l00808"></a><span class="lineno"> 808</span> </div><div class="line"><a name="l00811"></a><span class="lineno"> 811</span> <span class="keywordtype">void</span> <a class="code" href="a02358.html#a689717c48a88c667883d31a5b03139bc">Tesseract::ApplyBoxTraining</a>(<span class="keyword">const</span> <a class="code" href="a02834.html">STRING</a>& fontname, <a class="code" href="a02530.html">PAGE_RES</a>* page_res) {</div><div class="line"><a name="l00812"></a><span class="lineno"> 812</span>  <a class="code" href="a02546.html">PAGE_RES_IT</a> pr_it(page_res);</div><div class="line"><a name="l00813"></a><span class="lineno"> 813</span>  <span class="keywordtype">int</span> word_count = 0;</div><div class="line"><a name="l00814"></a><span class="lineno"> 814</span>  <span class="keywordflow">for</span> (<a class="code" href="a02542.html">WERD_RES</a> *word_res = pr_it.<a class="code" href="a02546.html#a6cdcdaa4b0b1250ab7e14760d4b5f113">word</a>(); word_res != <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00815"></a><span class="lineno"> 815</span>  word_res = pr_it.<a class="code" href="a02546.html#ab29005f235cc738eebafb7d9ed6fe70b">forward</a>()) {</div><div class="line"><a name="l00816"></a><span class="lineno"> 816</span>  <a class="code" href="a03998.html#a2fc1971dc1e42946245c98a9312326ae">LearnWord</a>(fontname.<a class="code" href="a02834.html#abf0a7b3c6ae39a46e5441f28f61de5de">string</a>(), word_res);</div><div class="line"><a name="l00817"></a><span class="lineno"> 817</span>  ++word_count;</div><div class="line"><a name="l00818"></a><span class="lineno"> 818</span>  }</div><div class="line"><a name="l00819"></a><span class="lineno"> 819</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"Generated training data for %d words\n"</span>, word_count);</div><div class="line"><a name="l00820"></a><span class="lineno"> 820</span> }</div><div class="line"><a name="l00821"></a><span class="lineno"> 821</span> </div><div class="line"><a name="l00822"></a><span class="lineno"> 822</span> <span class="preprocessor">#endif // ndef DISABLED_LEGACY_ENGINE</span></div><div class="line"><a name="l00823"></a><span class="lineno"> 823</span> </div><div class="line"><a name="l00824"></a><span class="lineno"> 824</span> } <span class="comment">// namespace tesseract</span></div><div class="ttc" id="a02546_html_a997c382ddd2cf2f539532a1d91780963"><div class="ttname"><a href="a02546.html#a997c382ddd2cf2f539532a1d91780963">PAGE_RES_IT::block</a></div><div class="ttdeci">BLOCK_RES * block() const</div><div class="ttdef"><b>Definition:</b> <a href="a00344_source.html#l00757">pageres.h:757</a></div></div>
<div class="ttc" id="a02358_html_aab153649250a4b8bd6ffb4e22f44f79f"><div class="ttname"><a href="a02358.html#aab153649250a4b8bd6ffb4e22f44f79f">tesseract::Tesseract::MaximallyChopWord</a></div><div class="ttdeci">void MaximallyChopWord(const GenericVector< TBOX > &boxes, BLOCK *block, ROW *row, WERD_RES *word_res)</div></div>
<div class="ttc" id="a02358_html_a6193fb469b62b12c1b999194fc5cd569"><div class="ttname"><a href="a02358.html#a6193fb469b62b12c1b999194fc5cd569">tesseract::Tesseract::ReSegmentByClassification</a></div><div class="ttdeci">void ReSegmentByClassification(PAGE_RES *page_res)</div></div>
<div class="ttc" id="a00605_html_afedceee7ea132dae3d224db2cf8b5618"><div class="ttname"><a href="a00605.html#afedceee7ea132dae3d224db2cf8b5618">UNICHAR_ID</a></div><div class="ttdeci">int UNICHAR_ID</div><div class="ttdef"><b>Definition:</b> <a href="a00605_source.html#l00035">unichar.h:35</a></div></div>
<div class="ttc" id="a02182_html_a20cfad5c58c50cb85a9529d8ddbd96af"><div class="ttname"><a href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">GenericVector::size</a></div><div class="ttdeci">int size() const</div><div class="ttdef"><b>Definition:</b> <a href="a00518_source.html#l00071">genericvector.h:71</a></div></div>
<div class="ttc" id="a02358_html_a352411d09d5b2dec65d5629bb684320a"><div class="ttname"><a href="a02358.html#a352411d09d5b2dec65d5629bb684320a">tesseract::Tesseract::ResegmentWordBox</a></div><div class="ttdeci">bool ResegmentWordBox(BLOCK_LIST *block_list, const TBOX &box, const TBOX *next_box, const char *correct_text)</div></div>
<div class="ttc" id="a00191_html"><div class="ttname"><a href="a00191.html">tesseractclass.h</a></div></div>
<div class="ttc" id="a02602_html"><div class="ttname"><a href="a02602.html">BLOB_CHOICE</a></div><div class="ttdef"><b>Definition:</b> <a href="a00401_source.html#l00049">ratngs.h:49</a></div></div>
<div class="ttc" id="a02546_html_a2038f4bd5c4c0eac4dba7f1d6bcdb5bf"><div class="ttname"><a href="a02546.html#a2038f4bd5c4c0eac4dba7f1d6bcdb5bf">PAGE_RES_IT::row</a></div><div class="ttdeci">ROW_RES * row() const</div><div class="ttdef"><b>Definition:</b> <a href="a00344_source.html#l00754">pageres.h:754</a></div></div>
<div class="ttc" id="a00344_html"><div class="ttname"><a href="a00344.html">pageres.h</a></div></div>
<div class="ttc" id="a02358_html_a67d107ceaab00c9e98d6473d4024d409"><div class="ttname"><a href="a02358.html#a67d107ceaab00c9e98d6473d4024d409">tesseract::Tesseract::getDict</a></div><div class="ttdeci">Dict & getDict() override</div><div class="ttdef"><b>Definition:</b> <a href="a00188_source.html#l00556">tesseractclass.cpp:556</a></div></div>
<div class="ttc" id="a02610_html_a1e3f13b685badb5ae93bc7b894282abb"><div class="ttname"><a href="a02610.html#a1e3f13b685badb5ae93bc7b894282abb">TBOX::almost_equal</a></div><div class="ttdeci">bool almost_equal(const TBOX &box, int tolerance) const</div><div class="ttdef"><b>Definition:</b> <a href="a00404_source.html#l00258">rect.cpp:258</a></div></div>
<div class="ttc" id="a00242_html"><div class="ttname"><a href="a00242.html">boxread.h</a></div></div>
<div class="ttc" id="a02610_html_abaa57ee82b89cfab6b80d3ac3d31bd60"><div class="ttname"><a href="a02610.html#abaa57ee82b89cfab6b80d3ac3d31bd60">TBOX::intersection</a></div><div class="ttdeci">TBOX intersection(const TBOX &box) const</div><div class="ttdef"><b>Definition:</b> <a href="a00404_source.html#l00087">rect.cpp:87</a></div></div>
<div class="ttc" id="a04290_html_abcb03b3de3664286db4a281e0a98fe05"><div class="ttname"><a href="a04290.html#abcb03b3de3664286db4a281e0a98fe05">tesseract::Dict::getUnicharAmbigs</a></div><div class="ttdeci">const UnicharAmbigs & getUnicharAmbigs() const</div><div class="ttdef"><b>Definition:</b> <a href="a00908_source.html#l00104">dict.h:104</a></div></div>
<div class="ttc" id="a02610_html_a61af64df548c7638bf005fcd8343c435"><div class="ttname"><a href="a02610.html#a61af64df548c7638bf005fcd8343c435">TBOX::print</a></div><div class="ttdeci">void print() const</div><div class="ttdef"><b>Definition:</b> <a href="a00407_source.html#l00278">rect.h:278</a></div></div>
<div class="ttc" id="a02606_html_af6f7da15745fc51ea22e29364661166e"><div class="ttname"><a href="a02606.html#af6f7da15745fc51ea22e29364661166e">WERD_CHOICE::append_unichar_id_space_allocated</a></div><div class="ttdeci">void append_unichar_id_space_allocated(UNICHAR_ID unichar_id, int blob_count, float rating, float certainty)</div><div class="ttdef"><b>Definition:</b> <a href="a00401_source.html#l00452">ratngs.h:452</a></div></div>
<div class="ttc" id="a00449_html_ad6968adbf8f2cc44adf333ec96efb0bea675eadd051ea82d1f288751799bfa31c"><div class="ttname"><a href="a00449.html#ad6968adbf8f2cc44adf333ec96efb0bea675eadd051ea82d1f288751799bfa31c">W_FUZZY_NON</a></div><div class="ttdef"><b>Definition:</b> <a href="a00449_source.html#l00042">werd.h:42</a></div></div>
<div class="ttc" id="a02358_html_a889d9ac1b8ff48124d41e0d2254fad32"><div class="ttname"><a href="a02358.html#a889d9ac1b8ff48124d41e0d2254fad32">tesseract::Tesseract::tessedit_ocr_engine_mode</a></div><div class="ttdeci">int tessedit_ocr_engine_mode</div><div class="ttdef"><b>Definition:</b> <a href="a00191_source.html#l00828">tesseractclass.h:828</a></div></div>
<div class="ttc" id="a02834_html_abf0a7b3c6ae39a46e5441f28f61de5de"><div class="ttname"><a href="a02834.html#abf0a7b3c6ae39a46e5441f28f61de5de">STRING::string</a></div><div class="ttdeci">const char * string() const</div><div class="ttdef"><b>Definition:</b> <a href="a00581_source.html#l00196">strngs.cpp:196</a></div></div>
<div class="ttc" id="a02638_html_ad35a2fd78555195a3dedcdd01094d0d4"><div class="ttname"><a href="a02638.html#ad35a2fd78555195a3dedcdd01094d0d4">WERD::bounding_box</a></div><div class="ttdeci">TBOX bounding_box() const</div><div class="ttdef"><b>Definition:</b> <a href="a00446_source.html#l00159">werd.cpp:159</a></div></div>
<div class="ttc" id="a03998_html_a57e449d38b255fe82e61d88ded8b0020"><div class="ttname"><a href="a03998.html#a57e449d38b255fe82e61d88ded8b0020">tesseract::Classify::classify_bln_numeric_mode</a></div><div class="ttdeci">bool classify_bln_numeric_mode</div><div class="ttdef"><b>Definition:</b> <a href="a00659_source.html#l00541">classify.h:541</a></div></div>
<div class="ttc" id="a02622_html"><div class="ttname"><a href="a02622.html">SEAM</a></div><div class="ttdef"><b>Definition:</b> <a href="a00419_source.html#l00044">seam.h:44</a></div></div>
<div class="ttc" id="a02542_html_ae322fbf32d8be7d9a22bd860ae08b38f"><div class="ttname"><a href="a02542.html#ae322fbf32d8be7d9a22bd860ae08b38f">WERD_RES::InsertSeam</a></div><div class="ttdeci">void InsertSeam(int blob_number, SEAM *seam)</div><div class="ttdef"><b>Definition:</b> <a href="a00341_source.html#l00424">pageres.cpp:424</a></div></div>
<div class="ttc" id="a02410_html_a3a7da282c5432576b36cd7a8ec9702d8"><div class="ttname"><a href="a02410.html#a3a7da282c5432576b36cd7a8ec9702d8">tesseract::BoxWord::MergeBoxes</a></div><div class="ttdeci">void MergeBoxes(int start, int end)</div><div class="ttdef"><b>Definition:</b> <a href="a00245_source.html#l00131">boxword.cpp:131</a></div></div>
<div class="ttc" id="a02182_html_a3fd37a240a42f1c3052e8d28614d3702"><div class="ttname"><a href="a02182.html#a3fd37a240a42f1c3052e8d28614d3702">GenericVector::remove</a></div><div class="ttdeci">void remove(int index)</div><div class="ttdef"><b>Definition:</b> <a href="a00518_source.html#l00766">genericvector.h:766</a></div></div>
<div class="ttc" id="a02514_html_ae9826e422b0bf17a7592dee8db3fe058"><div class="ttname"><a href="a02514.html#ae9826e422b0bf17a7592dee8db3fe058">BLOCK::row_list</a></div><div class="ttdeci">ROW_LIST * row_list()</div><div class="ttdoc">get rows </div><div class="ttdef"><b>Definition:</b> <a href="a00320_source.html#l00118">ocrblock.h:118</a></div></div>
<div class="ttc" id="a02610_html"><div class="ttname"><a href="a02610.html">TBOX</a></div><div class="ttdef"><b>Definition:</b> <a href="a00407_source.html#l00034">rect.h:34</a></div></div>
<div class="ttc" id="a02638_html_a338086c2fee2164c3bf82add310631b4"><div class="ttname"><a href="a02638.html#a338086c2fee2164c3bf82add310631b4">WERD::shallow_copy</a></div><div class="ttdeci">WERD * shallow_copy()</div><div class="ttdef"><b>Definition:</b> <a href="a00446_source.html#l00351">werd.cpp:351</a></div></div>
<div class="ttc" id="a02402_html_a0d5347723ece084faf8f3d0dba6dd219"><div class="ttname"><a href="a02402.html#a0d5347723ece084faf8f3d0dba6dd219">TWERD::NumBlobs</a></div><div class="ttdeci">int NumBlobs() const</div><div class="ttdef"><b>Definition:</b> <a href="a00230_source.html#l00432">blobs.h:432</a></div></div>
<div class="ttc" id="a02526_html_ac9d07f978420b3564bf5508ad294fb70"><div class="ttname"><a href="a02526.html#ac9d07f978420b3564bf5508ad294fb70">ROW::word_list</a></div><div class="ttdeci">WERD_LIST * word_list()</div><div class="ttdef"><b>Definition:</b> <a href="a00332_source.html#l00055">ocrrow.h:55</a></div></div>
<div class="ttc" id="a00449_html_ad6968adbf8f2cc44adf333ec96efb0bea62efb985a62d85e014ee5ab039dd50ce"><div class="ttname"><a href="a00449.html#ad6968adbf8f2cc44adf333ec96efb0bea62efb985a62d85e014ee5ab039dd50ce">W_EOL</a></div><div class="ttdef"><b>Definition:</b> <a href="a00449_source.html#l00035">werd.h:35</a></div></div>
<div class="ttc" id="a00623_html"><div class="ttname"><a href="a00623.html">unicharset.h</a></div></div>
<div class="ttc" id="a02358_html_a689717c48a88c667883d31a5b03139bc"><div class="ttname"><a href="a02358.html#a689717c48a88c667883d31a5b03139bc">tesseract::Tesseract::ApplyBoxTraining</a></div><div class="ttdeci">void ApplyBoxTraining(const STRING &fontname, PAGE_RES *page_res)</div></div>
<div class="ttc" id="a00239_html_ab3161d7c887ead295045650e34d690fc"><div class="ttname"><a href="a00239.html#ab3161d7c887ead295045650e34d690fc">ReadAllBoxes</a></div><div class="ttdeci">bool ReadAllBoxes(int target_page, bool skip_blanks, const STRING &filename, GenericVector< TBOX > *boxes, GenericVector< STRING > *texts, GenericVector< STRING > *box_texts, GenericVector< int > *pages)</div><div class="ttdef"><b>Definition:</b> <a href="a00239_source.html#l00052">boxread.cpp:52</a></div></div>
<div class="ttc" id="a03950_html_aeb2253dcb5f01c81fcba5f4af417eadf"><div class="ttname"><a href="a03950.html#aeb2253dcb5f01c81fcba5f4af417eadf">UNICHARSET::unichar_to_id</a></div><div class="ttdeci">UNICHAR_ID unichar_to_id(const char *const unichar_repr) const</div><div class="ttdef"><b>Definition:</b> <a href="a00620_source.html#l00209">unicharset.cpp:209</a></div></div>
<div class="ttc" id="a02610_html_aee399b6542ff4856b2ea343bf202d2a3"><div class="ttname"><a href="a02610.html#aee399b6542ff4856b2ea343bf202d2a3">TBOX::x_gap</a></div><div class="ttdeci">int x_gap(const TBOX &box) const</div><div class="ttdef"><b>Definition:</b> <a href="a00407_source.html#l00225">rect.h:225</a></div></div>
<div class="ttc" id="a02542_html"><div class="ttname"><a href="a02542.html">WERD_RES</a></div><div class="ttdef"><b>Definition:</b> <a href="a00344_source.html#l00169">pageres.h:169</a></div></div>
<div class="ttc" id="a02638_html_a5decd0b33533bf908c26ad4b10336fb0"><div class="ttname"><a href="a02638.html#a5decd0b33533bf908c26ad4b10336fb0">WERD::set_text</a></div><div class="ttdeci">void set_text(const char *new_text)</div><div class="ttdef"><b>Definition:</b> <a href="a00449_source.html#l00124">werd.h:124</a></div></div>
<div class="ttc" id="a02638_html_aa84fa612a8864def8df4b7df26168aca"><div class="ttname"><a href="a02638.html#aa84fa612a8864def8df4b7df26168aca">WERD::set_flag</a></div><div class="ttdeci">void set_flag(WERD_FLAGS mask, bool value)</div><div class="ttdef"><b>Definition:</b> <a href="a00449_source.html#l00127">werd.h:127</a></div></div>
<div class="ttc" id="a02630_html"><div class="ttname"><a href="a02630.html">STATS</a></div><div class="ttdef"><b>Definition:</b> <a href="a00431_source.html#l00033">statistc.h:33</a></div></div>
<div class="ttc" id="a02530_html"><div class="ttname"><a href="a02530.html">PAGE_RES</a></div><div class="ttdef"><b>Definition:</b> <a href="a00344_source.html#l00077">pageres.h:77</a></div></div>
<div class="ttc" id="a02358_html_a9d658579df984564e7365166c3dade8d"><div class="ttname"><a href="a02358.html#a9d658579df984564e7365166c3dade8d">tesseract::Tesseract::applybox_page</a></div><div class="ttdeci">int applybox_page</div><div class="ttdef"><b>Definition:</b> <a href="a00191_source.html#l00851">tesseractclass.h:851</a></div></div>
<div class="ttc" id="a00518_html"><div class="ttname"><a href="a00518.html">genericvector.h</a></div></div>
<div class="ttc" id="a02358_html_aa41485885750454f70de1bc1672ce04f"><div class="ttname"><a href="a02358.html#aa41485885750454f70de1bc1672ce04f">tesseract::Tesseract::FindSegmentation</a></div><div class="ttdeci">bool FindSegmentation(const GenericVector< UNICHAR_ID > &target_text, WERD_RES *word_res)</div></div>
<div class="ttc" id="a02410_html_a94891d405fd3837d235bb8916df1c89e"><div class="ttname"><a href="a02410.html#a94891d405fd3837d235bb8916df1c89e">tesseract::BoxWord::BlobBox</a></div><div class="ttdeci">const TBOX & BlobBox(int index) const</div><div class="ttdef"><b>Definition:</b> <a href="a00248_source.html#l00084">boxword.h:84</a></div></div>
<div class="ttc" id="a02358_html_aec5d4e081fee6da40258b0b074342205"><div class="ttname"><a href="a02358.html#aec5d4e081fee6da40258b0b074342205">tesseract::Tesseract::BestPix</a></div><div class="ttdeci">Pix * BestPix() const</div><div class="ttdef"><b>Definition:</b> <a href="a00191_source.html#l00229">tesseractclass.h:229</a></div></div>
<div class="ttc" id="a02546_html_a1e2469796295fe3908ba358c87d2439e"><div class="ttname"><a href="a02546.html#a1e2469796295fe3908ba358c87d2439e">PAGE_RES_IT::next_row</a></div><div class="ttdeci">ROW_RES * next_row() const</div><div class="ttdef"><b>Definition:</b> <a href="a00344_source.html#l00763">pageres.h:763</a></div></div>
<div class="ttc" id="a02542_html_ae524416d2398009c92a5678105f3cbfb"><div class="ttname"><a href="a02542.html#ae524416d2398009c92a5678105f3cbfb">WERD_RES::correct_text</a></div><div class="ttdeci">GenericVector< STRING > correct_text</div><div class="ttdef"><b>Definition:</b> <a href="a00344_source.html#l00275">pageres.h:275</a></div></div>
<div class="ttc" id="a02182_html_a9cdbff49b186574b83e43afba606fdd9"><div class="ttname"><a href="a02182.html#a9cdbff49b186574b83e43afba606fdd9">GenericVector::clear</a></div><div class="ttdeci">void clear()</div><div class="ttdef"><b>Definition:</b> <a href="a00518_source.html#l00868">genericvector.h:868</a></div></div>
<div class="ttc" id="a02546_html_a15febd45d0904bb3c5f7d506368177f0"><div class="ttname"><a href="a02546.html#a15febd45d0904bb3c5f7d506368177f0">PAGE_RES_IT::restart_page</a></div><div class="ttdeci">WERD_RES * restart_page()</div><div class="ttdef"><b>Definition:</b> <a href="a00344_source.html#l00698">pageres.h:698</a></div></div>
<div class="ttc" id="a02534_html_ae7c240d4878247ebdfe78433446751bf"><div class="ttname"><a href="a02534.html#ae7c240d4878247ebdfe78433446751bf">BLOCK_RES::block</a></div><div class="ttdeci">BLOCK * block</div><div class="ttdef"><b>Definition:</b> <a href="a00344_source.html#l00117">pageres.h:117</a></div></div>
<div class="ttc" id="a02542_html_a6efe07c079a04a91985f99c71258a193"><div class="ttname"><a href="a02542.html#a6efe07c079a04a91985f99c71258a193">WERD_RES::SetupBoxWord</a></div><div class="ttdeci">void SetupBoxWord()</div><div class="ttdef"><b>Definition:</b> <a href="a00341_source.html#l00855">pageres.cpp:855</a></div></div>
<div class="ttc" id="a02358_html_adee618f35a90de376370cb6f7930bc84"><div class="ttname"><a href="a02358.html#adee618f35a90de376370cb6f7930bc84">tesseract::Tesseract::SetupApplyBoxes</a></div><div class="ttdeci">PAGE_RES * SetupApplyBoxes(const GenericVector< TBOX > &boxes, BLOCK_LIST *block_list)</div></div>
<div class="ttc" id="a02610_html_a8e9dce0d30d2213598cd4befe0028c99"><div class="ttname"><a href="a02610.html#a8e9dce0d30d2213598cd4befe0028c99">TBOX::left</a></div><div class="ttdeci">int16_t left() const</div><div class="ttdef"><b>Definition:</b> <a href="a00407_source.html#l00072">rect.h:72</a></div></div>
<div class="ttc" id="a02602_html_ae3331f9e390403bdf37c6e98fa067742"><div class="ttname"><a href="a02602.html#ae3331f9e390403bdf37c6e98fa067742">BLOB_CHOICE::set_certainty</a></div><div class="ttdeci">void set_certainty(float newrat)</div><div class="ttdef"><b>Definition:</b> <a href="a00401_source.html#l00151">ratngs.h:151</a></div></div>
<div class="ttc" id="a02182_html_a5a31e95e16034993019e946298aa9b77"><div class="ttname"><a href="a02182.html#a5a31e95e16034993019e946298aa9b77">GenericVector::insert</a></div><div class="ttdeci">void insert(const T &t, int index)</div><div class="ttdef"><b>Definition:</b> <a href="a00518_source.html#l00752">genericvector.h:752</a></div></div>
<div class="ttc" id="a00068_html_a7c746c8c99aa2b6f10f7c26838290da0"><div class="ttname"><a href="a00068.html#a7c746c8c99aa2b6f10f7c26838290da0">kMaxXHeightDeviationFraction</a></div><div class="ttdeci">const double kMaxXHeightDeviationFraction</div><div class="ttdef"><b>Definition:</b> <a href="a00068_source.html#l00038">applybox.cpp:38</a></div></div>
<div class="ttc" id="a02610_html_a5dc64d0677b5d65385bc07a78cf49c4d"><div class="ttname"><a href="a02610.html#a5dc64d0677b5d65385bc07a78cf49c4d">TBOX::top</a></div><div class="ttdeci">int16_t top() const</div><div class="ttdef"><b>Definition:</b> <a href="a00407_source.html#l00058">rect.h:58</a></div></div>
<div class="ttc" id="a00068_html_a1ecfbb8dde381ffc9c672e569cb1a1d2"><div class="ttname"><a href="a00068.html#a1ecfbb8dde381ffc9c672e569cb1a1d2">kMaxGroupSize</a></div><div class="ttdeci">const int kMaxGroupSize</div><div class="ttdef"><b>Definition:</b> <a href="a00068_source.html#l00035">applybox.cpp:35</a></div></div>
<div class="ttc" id="a02546_html_a32f7ecd54106290053205cc118395d8d"><div class="ttname"><a href="a02546.html#a32f7ecd54106290053205cc118395d8d">PAGE_RES_IT::prev_row</a></div><div class="ttdeci">ROW_RES * prev_row() const</div><div class="ttdef"><b>Definition:</b> <a href="a00344_source.html#l00745">pageres.h:745</a></div></div>
<div class="ttc" id="a00449_html_ad6968adbf8f2cc44adf333ec96efb0bea3580884b5b0335502fb928db4a0a2024"><div class="ttname"><a href="a00449.html#ad6968adbf8f2cc44adf333ec96efb0bea3580884b5b0335502fb928db4a0a2024">W_FUZZY_SP</a></div><div class="ttdef"><b>Definition:</b> <a href="a00449_source.html#l00041">werd.h:41</a></div></div>
<div class="ttc" id="a02526_html_a90b980cd6ebbc47e80c0e2ea55ff14a2"><div class="ttname"><a href="a02526.html#a90b980cd6ebbc47e80c0e2ea55ff14a2">ROW::set_x_height</a></div><div class="ttdeci">void set_x_height(float new_xheight)</div><div class="ttdef"><b>Definition:</b> <a href="a00332_source.html#l00067">ocrrow.h:67</a></div></div>
<div class="ttc" id="a02182_html"><div class="ttname"><a href="a02182.html">GenericVector< TBOX ></a></div></div>
<div class="ttc" id="a02526_html_aced2e98c94f532c5c5809d63aef4b9de"><div class="ttname"><a href="a02526.html#aced2e98c94f532c5c5809d63aef4b9de">ROW::x_height</a></div><div class="ttdeci">float x_height() const</div><div class="ttdef"><b>Definition:</b> <a href="a00332_source.html#l00064">ocrrow.h:64</a></div></div>
<div class="ttc" id="a02638_html_a8aabc91a932f2da3779ff920bea8389a"><div class="ttname"><a href="a02638.html#a8aabc91a932f2da3779ff920bea8389a">WERD::text</a></div><div class="ttdeci">const char * text() const</div><div class="ttdef"><b>Definition:</b> <a href="a00449_source.html#l00123">werd.h:123</a></div></div>
<div class="ttc" id="a02602_html_a20cb2e28102e9a34e5eb098f8c57ff64"><div class="ttname"><a href="a02602.html#a20cb2e28102e9a34e5eb098f8c57ff64">BLOB_CHOICE::set_rating</a></div><div class="ttdeci">void set_rating(float newrat)</div><div class="ttdef"><b>Definition:</b> <a href="a00401_source.html#l00148">ratngs.h:148</a></div></div>
<div class="ttc" id="a02666_html_a69c5179ac5f10a24f3f97e16ca09460f"><div class="ttname"><a href="a02666.html#a69c5179ac5f10a24f3f97e16ca09460f">tesseract::CCUtil::unicharset</a></div><div class="ttdeci">UNICHARSET unicharset</div><div class="ttdef"><b>Definition:</b> <a href="a00476_source.html#l00068">ccutil.h:68</a></div></div>
<div class="ttc" id="a02606_html"><div class="ttname"><a href="a02606.html">WERD_CHOICE</a></div><div class="ttdef"><b>Definition:</b> <a href="a00401_source.html#l00273">ratngs.h:273</a></div></div>
<div class="ttc" id="a02358_html_a5873c7054e8cba3e64fc3f20b2a93ca3"><div class="ttname"><a href="a02358.html#a5873c7054e8cba3e64fc3f20b2a93ca3">tesseract::Tesseract::textord_use_cjk_fp_model</a></div><div class="ttdeci">bool textord_use_cjk_fp_model</div><div class="ttdef"><b>Definition:</b> <a href="a00191_source.html#l01101">tesseractclass.h:1101</a></div></div>
<div class="ttc" id="a02610_html_a79f654ae8a2a33cbb2a1985cb97d143c"><div class="ttname"><a href="a02610.html#a79f654ae8a2a33cbb2a1985cb97d143c">TBOX::major_overlap</a></div><div class="ttdeci">bool major_overlap(const TBOX &box) const</div><div class="ttdef"><b>Definition:</b> <a href="a00407_source.html#l00368">rect.h:368</a></div></div>
<div class="ttc" id="a02358_html_ae8491b2f13cc276896ed93e74cd32ef6"><div class="ttname"><a href="a02358.html#ae8491b2f13cc276896ed93e74cd32ef6">tesseract::Tesseract::applybox_debug</a></div><div class="ttdeci">int applybox_debug</div><div class="ttdef"><b>Definition:</b> <a href="a00191_source.html#l00850">tesseractclass.h:850</a></div></div>
<div class="ttc" id="a02358_html_a211f8d8d25bf615c44e117a93c40017c"><div class="ttname"><a href="a02358.html#a211f8d8d25bf615c44e117a93c40017c">tesseract::Tesseract::ApplyBoxes</a></div><div class="ttdeci">PAGE_RES * ApplyBoxes(const STRING &fname, bool find_segmentation, BLOCK_LIST *block_list)</div></div>
<div class="ttc" id="a02542_html_a20305480067627e7ba7a6c0e0d536018"><div class="ttname"><a href="a02542.html#a20305480067627e7ba7a6c0e0d536018">WERD_RES::FakeClassifyWord</a></div><div class="ttdeci">void FakeClassifyWord(int blob_count, BLOB_CHOICE **choices)</div><div class="ttdef"><b>Definition:</b> <a href="a00341_source.html#l00883">pageres.cpp:883</a></div></div>
<div class="ttc" id="a02410_html_a6bad9bc5492723019a2ad03b00cb7738"><div class="ttname"><a href="a02410.html#a6bad9bc5492723019a2ad03b00cb7738">tesseract::BoxWord::bounding_box</a></div><div class="ttdeci">const TBOX & bounding_box() const</div><div class="ttdef"><b>Definition:</b> <a href="a00248_source.html#l00080">boxword.h:80</a></div></div>
<div class="ttc" id="a02542_html_a30c86ecdeb8824b7ebfdbe57db2e6b81"><div class="ttname"><a href="a02542.html#a30c86ecdeb8824b7ebfdbe57db2e6b81">WERD_RES::LogNewRawChoice</a></div><div class="ttdeci">bool LogNewRawChoice(WERD_CHOICE *word_choice)</div><div class="ttdef"><b>Definition:</b> <a href="a00341_source.html#l00610">pageres.cpp:610</a></div></div>
<div class="ttc" id="a00527_html_ab60e4f82956a1f5fdb54d0d8303e95b7"><div class="ttname"><a href="a00527.html#ab60e4f82956a1f5fdb54d0d8303e95b7">IntCastRounded</a></div><div class="ttdeci">int IntCastRounded(double x)</div><div class="ttdef"><b>Definition:</b> <a href="a00527_source.html#l00168">helpers.h:168</a></div></div>
<div class="ttc" id="a02358_html_a29d34def0fb50890d45ed6d2b914bdd8"><div class="ttname"><a href="a02358.html#a29d34def0fb50890d45ed6d2b914bdd8">tesseract::Tesseract::ConvertStringToUnichars</a></div><div class="ttdeci">bool ConvertStringToUnichars(const char *utf8, GenericVector< UNICHAR_ID > *class_ids)</div></div>
<div class="ttc" id="a00401_html_a18e2c75cefe9e5b78e8ce41aa5fa25bca12d29cc139fe00da7420978c101d2889"><div class="ttname"><a href="a00401.html#a18e2c75cefe9e5b78e8ce41aa5fa25bca12d29cc139fe00da7420978c101d2889">TOP_CHOICE_PERM</a></div><div class="ttdef"><b>Definition:</b> <a href="a00401_source.html#l00245">ratngs.h:245</a></div></div>
<div class="ttc" id="a01538_html"><div class="ttname"><a href="a01538.html">chopper.h</a></div></div>
<div class="ttc" id="a02650_html_a4c6dce5d139122c551eaa6a734d1230d"><div class="ttname"><a href="a02650.html#a4c6dce5d139122c551eaa6a734d1230d">tesseract::UnicharAmbigs::dang_ambigs</a></div><div class="ttdeci">const UnicharAmbigsVector & dang_ambigs() const</div><div class="ttdef"><b>Definition:</b> <a href="a00455_source.html#l00152">ambigs.h:152</a></div></div>
<div class="ttc" id="a02182_html_a6af4e0a2a30dda267d19bf783ae22eb7"><div class="ttname"><a href="a02182.html#a6af4e0a2a30dda267d19bf783ae22eb7">GenericVector::length</a></div><div class="ttdeci">int length() const</div><div class="ttdef"><b>Definition:</b> <a href="a00518_source.html#l00085">genericvector.h:85</a></div></div>
<div class="ttc" id="a02358_html_a3986c488d6851005b399d491dbde1eed"><div class="ttname"><a href="a02358.html#a3986c488d6851005b399d491dbde1eed">tesseract::Tesseract::SearchForText</a></div><div class="ttdeci">void SearchForText(const GenericVector< BLOB_CHOICE_LIST *> *choices, int choices_pos, int choices_length, const GenericVector< UNICHAR_ID > &target_text, int text_index, float rating, GenericVector< int > *segmentation, float *best_rating, GenericVector< int > *best_segmentation)</div></div>
<div class="ttc" id="a00605_html"><div class="ttname"><a href="a00605.html">unichar.h</a></div></div>
<div class="ttc" id="a02546_html_a6cdcdaa4b0b1250ab7e14760d4b5f113"><div class="ttname"><a href="a02546.html#a6cdcdaa4b0b1250ab7e14760d4b5f113">PAGE_RES_IT::word</a></div><div class="ttdeci">WERD_RES * word() const</div><div class="ttdef"><b>Definition:</b> <a href="a00344_source.html#l00751">pageres.h:751</a></div></div>
<div class="ttc" id="a02542_html_ab3c9354a32a99c3283f4ac411b5f9b93"><div class="ttname"><a href="a02542.html#ab3c9354a32a99c3283f4ac411b5f9b93">WERD_RES::best_state</a></div><div class="ttdeci">GenericVector< int > best_state</div><div class="ttdef"><b>Definition:</b> <a href="a00344_source.html#l00271">pageres.h:271</a></div></div>
<div class="ttc" id="a02542_html_adac960c00c2ae389886c91af9882ae00"><div class="ttname"><a href="a02542.html#adac960c00c2ae389886c91af9882ae00">WERD_RES::SetupForRecognition</a></div><div class="ttdeci">bool SetupForRecognition(const UNICHARSET &unicharset_in, tesseract::Tesseract *tesseract, Pix *pix, int norm_mode, const TBOX *norm_box, bool numeric_mode, bool use_body_size, bool allow_detailed_fx, ROW *row, const BLOCK *block)</div><div class="ttdef"><b>Definition:</b> <a href="a00341_source.html#l00308">pageres.cpp:308</a></div></div>
<div class="ttc" id="a02542_html_a1c0bbe4f9ec71150e1e06a5023a84707"><div class="ttname"><a href="a02542.html#a1c0bbe4f9ec71150e1e06a5023a84707">WERD_RES::CloneChoppedToRebuild</a></div><div class="ttdeci">void CloneChoppedToRebuild()</div><div class="ttdef"><b>Definition:</b> <a href="a00341_source.html#l00841">pageres.cpp:841</a></div></div>
<div class="ttc" id="a02638_html"><div class="ttname"><a href="a02638.html">WERD</a></div><div class="ttdef"><b>Definition:</b> <a href="a00449_source.html#l00059">werd.h:59</a></div></div>
<div class="ttc" id="a02526_html_aa79de9c912a3875be44fdc3131fdc687"><div class="ttname"><a href="a02526.html#aa79de9c912a3875be44fdc3131fdc687">ROW::bounding_box</a></div><div class="ttdeci">TBOX bounding_box() const</div><div class="ttdef"><b>Definition:</b> <a href="a00332_source.html#l00088">ocrrow.h:88</a></div></div>
<div class="ttc" id="a02526_html"><div class="ttname"><a href="a02526.html">ROW</a></div><div class="ttdef"><b>Definition:</b> <a href="a00332_source.html#l00036">ocrrow.h:36</a></div></div>
<div class="ttc" id="a02182_html_a172c4aa23ba397e24319ae095281cbcc"><div class="ttname"><a href="a02182.html#a172c4aa23ba397e24319ae095281cbcc">GenericVector::empty</a></div><div class="ttdeci">bool empty() const</div><div class="ttdef"><b>Definition:</b> <a href="a00518_source.html#l00090">genericvector.h:90</a></div></div>
<div class="ttc" id="a00596_html_a0c2bcd4462ec67ab0971b34a0f610f55"><div class="ttname"><a href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a></div><div class="ttdeci">DLLSYM void tprintf(const char *format,...)</div><div class="ttdef"><b>Definition:</b> <a href="a00596_source.html#l00037">tprintf.cpp:37</a></div></div>
<div class="ttc" id="a00449_html_ad6968adbf8f2cc44adf333ec96efb0beaff21d7c8c8992120fff35942408a00d2"><div class="ttname"><a href="a00449.html#ad6968adbf8f2cc44adf333ec96efb0beaff21d7c8c8992120fff35942408a00d2">W_BOL</a></div><div class="ttdef"><b>Definition:</b> <a href="a00449_source.html#l00034">werd.h:34</a></div></div>
<div class="ttc" id="a02514_html"><div class="ttname"><a href="a02514.html">BLOCK</a></div><div class="ttdef"><b>Definition:</b> <a href="a00320_source.html#l00030">ocrblock.h:30</a></div></div>
<div class="ttc" id="a02638_html_a174baefaa99afbfdbf444e4199f3b529"><div class="ttname"><a href="a02638.html#a174baefaa99afbfdbf444e4199f3b529">WERD::cblob_list</a></div><div class="ttdeci">C_BLOB_LIST * cblob_list()</div><div class="ttdef"><b>Definition:</b> <a href="a00449_source.html#l00098">werd.h:98</a></div></div>
<div class="ttc" id="a02610_html_a72bb2351fe7ecf04469c50179f625965"><div class="ttname"><a href="a02610.html#a72bb2351fe7ecf04469c50179f625965">TBOX::area</a></div><div class="ttdeci">int32_t area() const</div><div class="ttdef"><b>Definition:</b> <a href="a00407_source.html#l00122">rect.h:122</a></div></div>
<div class="ttc" id="a02542_html_a3d0de828a382a88581dafb5a304141f1"><div class="ttname"><a href="a02542.html#a3d0de828a382a88581dafb5a304141f1">WERD_RES::seam_array</a></div><div class="ttdeci">GenericVector< SEAM * > seam_array</div><div class="ttdef"><b>Definition:</b> <a href="a00344_source.html#l00217">pageres.h:217</a></div></div>
<div class="ttc" id="a01629_html"><div class="ttname"><a href="a01629.html">tesseract</a></div><div class="ttdef"><b>Definition:</b> <a href="a00005_source.html#l00094">baseapi.cpp:94</a></div></div>
<div class="ttc" id="a02358_html_a420654e409a9d28fd133515b5f3ed2c3"><div class="ttname"><a href="a02358.html#a420654e409a9d28fd133515b5f3ed2c3">tesseract::Tesseract::TidyUp</a></div><div class="ttdeci">void TidyUp(PAGE_RES *page_res)</div></div>
<div class="ttc" id="a02630_html_a5ce26a26c81c69a3e27616669998abe2"><div class="ttname"><a href="a02630.html#a5ce26a26c81c69a3e27616669998abe2">STATS::add</a></div><div class="ttdeci">void add(int32_t value, int32_t count)</div><div class="ttdef"><b>Definition:</b> <a href="a00428_source.html#l00100">statistc.cpp:100</a></div></div>
<div class="ttc" id="a02182_html_a0dc89fe2a365b04a61017f9d78c1a303"><div class="ttname"><a href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">GenericVector::push_back</a></div><div class="ttdeci">int push_back(T object)</div><div class="ttdef"><b>Definition:</b> <a href="a00518_source.html#l00799">genericvector.h:799</a></div></div>
<div class="ttc" id="a02402_html_a52fba22521039a79d8c1c8182f602dcc"><div class="ttname"><a href="a02402.html#a52fba22521039a79d8c1c8182f602dcc">TWERD::blobs</a></div><div class="ttdeci">GenericVector< TBLOB * > blobs</div><div class="ttdef"><b>Definition:</b> <a href="a00230_source.html#l00443">blobs.h:443</a></div></div>
<div class="ttc" id="a02546_html"><div class="ttname"><a href="a02546.html">PAGE_RES_IT</a></div><div class="ttdef"><b>Definition:</b> <a href="a00344_source.html#l00675">pageres.h:675</a></div></div>
<div class="ttc" id="a02602_html_ab90b9f9f303420fee80622acd9d268f2"><div class="ttname"><a href="a02602.html#ab90b9f9f303420fee80622acd9d268f2">BLOB_CHOICE::rating</a></div><div class="ttdeci">float rating() const</div><div class="ttdef"><b>Definition:</b> <a href="a00401_source.html#l00080">ratngs.h:80</a></div></div>
<div class="ttc" id="a02834_html"><div class="ttname"><a href="a02834.html">STRING</a></div><div class="ttdef"><b>Definition:</b> <a href="a00584_source.html#l00045">strngs.h:45</a></div></div>
<div class="ttc" id="a02634_html"><div class="ttname"><a href="a02634.html">C_BLOB</a></div><div class="ttdef"><b>Definition:</b> <a href="a00437_source.html#l00037">stepblob.h:37</a></div></div>
<div class="ttc" id="a02634_html_a50bd7e9c66492bebdba6aadcc806bf93"><div class="ttname"><a href="a02634.html#a50bd7e9c66492bebdba6aadcc806bf93">C_BLOB::bounding_box</a></div><div class="ttdeci">TBOX bounding_box() const</div><div class="ttdef"><b>Definition:</b> <a href="a00434_source.html#l00255">stepblob.cpp:255</a></div></div>
<div class="ttc" id="a02546_html_afb987bf467ef552c49b962bf6872ad34"><div class="ttname"><a href="a02546.html#afb987bf467ef552c49b962bf6872ad34">PAGE_RES_IT::DeleteCurrentWord</a></div><div class="ttdeci">void DeleteCurrentWord()</div><div class="ttdef"><b>Definition:</b> <a href="a00341_source.html#l01450">pageres.cpp:1450</a></div></div>
<div class="ttc" id="a02542_html_a053a2aeeddc26a93a41a04fa08dd688a"><div class="ttname"><a href="a02542.html#a053a2aeeddc26a93a41a04fa08dd688a">WERD_RES::uch_set</a></div><div class="ttdeci">const UNICHARSET * uch_set</div><div class="ttdef"><b>Definition:</b> <a href="a00344_source.html#l00206">pageres.h:206</a></div></div>
<div class="ttc" id="a03950_html_aa19fb595808fe4688c580334937dfa45"><div class="ttname"><a href="a03950.html#aa19fb595808fe4688c580334937dfa45">UNICHARSET::id_to_unichar</a></div><div class="ttdeci">const char * id_to_unichar(UNICHAR_ID id) const</div><div class="ttdef"><b>Definition:</b> <a href="a00620_source.html#l00290">unicharset.cpp:290</a></div></div>
<div class="ttc" id="a04866_html_a613a7dc22729f2cb084bc7093a0a4088"><div class="ttname"><a href="a04866.html#a613a7dc22729f2cb084bc7093a0a4088">tesseract::Wordrec::assume_fixed_pitch_char_segment</a></div><div class="ttdeci">bool assume_fixed_pitch_char_segment</div><div class="ttdef"><b>Definition:</b> <a href="a01622_source.html#l00230">wordrec.h:230</a></div></div>
<div class="ttc" id="a02410_html_a2505cb916ecbd87e4ba1a44654b1e078"><div class="ttname"><a href="a02410.html#a2505cb916ecbd87e4ba1a44654b1e078">tesseract::BoxWord::length</a></div><div class="ttdeci">int length() const</div><div class="ttdef"><b>Definition:</b> <a href="a00248_source.html#l00083">boxword.h:83</a></div></div>
<div class="ttc" id="a02542_html_a267e5d5e9fe67117e47223c5d336b8ba"><div class="ttname"><a href="a02542.html#a267e5d5e9fe67117e47223c5d336b8ba">WERD_RES::blamer_bundle</a></div><div class="ttdeci">BlamerBundle * blamer_bundle</div><div class="ttdef"><b>Definition:</b> <a href="a00344_source.html#l00246">pageres.h:246</a></div></div>
<div class="ttc" id="a02558_html_a3f06f8e34fc5962f342daff9623463e9"><div class="ttname"><a href="a02558.html#a3f06f8e34fc5962f342daff9623463e9">PDBLK::bounding_box</a></div><div class="ttdeci">void bounding_box(ICOORD &bottom_left, ICOORD &top_right) const</div><div class="ttdoc">get box </div><div class="ttdef"><b>Definition:</b> <a href="a00356_source.html#l00060">pdblock.h:60</a></div></div>
<div class="ttc" id="a02542_html_a9f45bb44fc6a5b4870f134137bd3d970"><div class="ttname"><a href="a02542.html#a9f45bb44fc6a5b4870f134137bd3d970">WERD_RES::ClearWordChoices</a></div><div class="ttdeci">void ClearWordChoices()</div><div class="ttdef"><b>Definition:</b> <a href="a00341_source.html#l01178">pageres.cpp:1178</a></div></div>
<div class="ttc" id="a02610_html_af74fa3bf628c9426cd6f1141a87dc2e0"><div class="ttname"><a href="a02610.html#af74fa3bf628c9426cd6f1141a87dc2e0">TBOX::right</a></div><div class="ttdeci">int16_t right() const</div><div class="ttdef"><b>Definition:</b> <a href="a00407_source.html#l00079">rect.h:79</a></div></div>
<div class="ttc" id="a02182_html_a980882b5ebc3e72fdedbdbe345196f21"><div class="ttname"><a href="a02182.html#a980882b5ebc3e72fdedbdbe345196f21">GenericVector::truncate</a></div><div class="ttdeci">void truncate(int size)</div><div class="ttdef"><b>Definition:</b> <a href="a00518_source.html#l00136">genericvector.h:136</a></div></div>
<div class="ttc" id="a00398_html_a2de5b7d5a020bb9823091dbece4ea36e"><div class="ttname"><a href="a00398.html#a2de5b7d5a020bb9823091dbece4ea36e">print_ratings_list</a></div><div class="ttdeci">void print_ratings_list(const char *msg, BLOB_CHOICE_LIST *ratings, const UNICHARSET &current_unicharset)</div><div class="ttdef"><b>Definition:</b> <a href="a00398_source.html#l00836">ratngs.cpp:836</a></div></div>
<div class="ttc" id="a02542_html_ae57ef3e90db1cb0bcdf96f4b32dee362"><div class="ttname"><a href="a02542.html#ae57ef3e90db1cb0bcdf96f4b32dee362">WERD_RES::RebuildBestState</a></div><div class="ttdeci">void RebuildBestState()</div><div class="ttdef"><b>Definition:</b> <a href="a00341_source.html#l00814">pageres.cpp:814</a></div></div>
<div class="ttc" id="a02546_html_ab29005f235cc738eebafb7d9ed6fe70b"><div class="ttname"><a href="a02546.html#ab29005f235cc738eebafb7d9ed6fe70b">PAGE_RES_IT::forward</a></div><div class="ttdeci">WERD_RES * forward()</div><div class="ttdef"><b>Definition:</b> <a href="a00344_source.html#l00731">pageres.h:731</a></div></div>
<div class="ttc" id="a02358_html_aaac7729b5dc17651a6b3ee44689302d5"><div class="ttname"><a href="a02358.html#aaac7729b5dc17651a6b3ee44689302d5">tesseract::Tesseract::CorrectClassifyWords</a></div><div class="ttdeci">void CorrectClassifyWords(PAGE_RES *page_res)</div></div>
<div class="ttc" id="a04866_html_aa5b9c5638c65d80fb426e540c700cfb4"><div class="ttname"><a href="a04866.html#aa5b9c5638c65d80fb426e540c700cfb4">tesseract::Wordrec::classify_piece</a></div><div class="ttdeci">virtual BLOB_CHOICE_LIST * classify_piece(const GenericVector< SEAM *> &seams, int16_t start, int16_t end, const char *description, TWERD *word, BlamerBundle *blamer_bundle)</div><div class="ttdef"><b>Definition:</b> <a href="a01595_source.html#l00055">pieces.cpp:55</a></div></div>
<div class="ttc" id="a02542_html_ad1d449f93bb0150bc7ef0d9b59ed27ba"><div class="ttname"><a href="a02542.html#ad1d449f93bb0150bc7ef0d9b59ed27ba">WERD_RES::chopped_word</a></div><div class="ttdeci">TWERD * chopped_word</div><div class="ttdef"><b>Definition:</b> <a href="a00344_source.html#l00215">pageres.h:215</a></div></div>
<div class="ttc" id="a01629_html_a75c8b4558543aa0d0bebea769678bb65"><div class="ttname"><a href="a01629.html#a75c8b4558543aa0d0bebea769678bb65">tesseract::UnicharAmbigsVector</a></div><div class="ttdeci">GenericVector< AmbigSpec_LIST * > UnicharAmbigsVector</div><div class="ttdef"><b>Definition:</b> <a href="a00455_source.html#l00141">ambigs.h:141</a></div></div>
<div class="ttc" id="a02622_html_a2c67b54ee80a063c0c0b976f3b22d5c6"><div class="ttname"><a href="a02622.html#a2c67b54ee80a063c0c0b976f3b22d5c6">SEAM::HasAnySplits</a></div><div class="ttdeci">bool HasAnySplits() const</div><div class="ttdef"><b>Definition:</b> <a href="a00419_source.html#l00067">seam.h:67</a></div></div>
<div class="ttc" id="a02610_html_a9fee4521e71300975cb34ebb21e3fca5"><div class="ttname"><a href="a02610.html#a9fee4521e71300975cb34ebb21e3fca5">TBOX::bottom</a></div><div class="ttdeci">int16_t bottom() const</div><div class="ttdef"><b>Definition:</b> <a href="a00407_source.html#l00065">rect.h:65</a></div></div>
<div class="ttc" id="a04866_html_aaf38d21ed09a3ebf5da70ecd3c19739f"><div class="ttname"><a href="a04866.html#aaf38d21ed09a3ebf5da70ecd3c19739f">tesseract::Wordrec::chop_one_blob</a></div><div class="ttdeci">SEAM * chop_one_blob(const GenericVector< TBOX > &boxes, const GenericVector< BLOB_CHOICE *> &blob_choices, WERD_RES *word_res, int *blob_number)</div><div class="ttdef"><b>Definition:</b> <a href="a01535_source.html#l00379">chopper.cpp:379</a></div></div>
<div class="ttc" id="a02358_html_ac465a51dfce59ff3bc7a20bdfa8850a4"><div class="ttname"><a href="a02358.html#ac465a51dfce59ff3bc7a20bdfa8850a4">tesseract::Tesseract::ReportFailedBox</a></div><div class="ttdeci">void ReportFailedBox(int boxfile_lineno, TBOX box, const char *box_ch, const char *err_msg)</div></div>
<div class="ttc" id="a02602_html_ad448095b666bfb864211714ec2c2375e"><div class="ttname"><a href="a02602.html#ad448095b666bfb864211714ec2c2375e">BLOB_CHOICE::unichar_id</a></div><div class="ttdeci">UNICHAR_ID unichar_id() const</div><div class="ttdef"><b>Definition:</b> <a href="a00401_source.html#l00077">ratngs.h:77</a></div></div>
<div class="ttc" id="a02514_html_a9e4346e037f2cc01c3c51d888531da74"><div class="ttname"><a href="a02514.html#a9e4346e037f2cc01c3c51d888531da74">BLOCK::pdblk</a></div><div class="ttdeci">PDBLK pdblk</div><div class="ttdef"><b>Definition:</b> <a href="a00320_source.html#l00192">ocrblock.h:192</a></div></div>
<div class="ttc" id="a04866_html_a3f1c04cfbc1650eae6fc981984717248"><div class="ttname"><a href="a04866.html#a3f1c04cfbc1650eae6fc981984717248">tesseract::Wordrec::chop_debug</a></div><div class="ttdeci">int chop_debug</div><div class="ttdef"><b>Definition:</b> <a href="a01622_source.html#l00208">wordrec.h:208</a></div></div>
<div class="ttc" id="a02542_html_af365b5a873da178f9ef0bb3c14e6953f"><div class="ttname"><a href="a02542.html#af365b5a873da178f9ef0bb3c14e6953f">WERD_RES::LogNewCookedChoice</a></div><div class="ttdeci">bool LogNewCookedChoice(int max_num_choices, bool debug, WERD_CHOICE *word_choice)</div><div class="ttdef"><b>Definition:</b> <a href="a00341_source.html#l00626">pageres.cpp:626</a></div></div>
<div class="ttc" id="a02358_html_a9cdc0e4ef9b85ed1b047764e9560196d"><div class="ttname"><a href="a02358.html#a9cdc0e4ef9b85ed1b047764e9560196d">tesseract::Tesseract::PreenXHeights</a></div><div class="ttdeci">void PreenXHeights(BLOCK_LIST *block_list)</div></div>
<div class="ttc" id="a02542_html_a3a92c8c9750d78631d75998f008f366a"><div class="ttname"><a href="a02542.html#a3a92c8c9750d78631d75998f008f366a">WERD_RES::box_word</a></div><div class="ttdeci">tesseract::BoxWord * box_word</div><div class="ttdef"><b>Definition:</b> <a href="a00344_source.html#l00266">pageres.h:266</a></div></div>
<div class="ttc" id="a00401_html_ac7c62d4383ee54bc9c16ef51a0ec3207a5d1ababd7ec62c799477a1ff0c33723f"><div class="ttname"><a href="a00401.html#ac7c62d4383ee54bc9c16ef51a0ec3207a5d1ababd7ec62c799477a1ff0c33723f">BCC_FAKE</a></div><div class="ttdef"><b>Definition:</b> <a href="a00401_source.html#l00046">ratngs.h:46</a></div></div>
<div class="ttc" id="a03998_html_a2fc1971dc1e42946245c98a9312326ae"><div class="ttname"><a href="a03998.html#a2fc1971dc1e42946245c98a9312326ae">tesseract::Classify::LearnWord</a></div><div class="ttdeci">void LearnWord(const char *fontname, WERD_RES *word)</div><div class="ttdef"><b>Definition:</b> <a href="a00647_source.html#l00251">adaptmatch.cpp:251</a></div></div>
<div class="ttc" id="a02358_html_ae1206c0c4b63a008cc01650004fb7b03"><div class="ttname"><a href="a02358.html#ae1206c0c4b63a008cc01650004fb7b03">tesseract::Tesseract::poly_allow_detailed_fx</a></div><div class="ttdeci">bool poly_allow_detailed_fx</div><div class="ttdef"><b>Definition:</b> <a href="a00191_source.html#l01103">tesseractclass.h:1103</a></div></div>
<div class="ttc" id="a02358_html_a5f57aa97065aaf9fe6496c5af8de7c35"><div class="ttname"><a href="a02358.html#a5f57aa97065aaf9fe6496c5af8de7c35">tesseract::Tesseract::ResegmentCharBox</a></div><div class="ttdeci">bool ResegmentCharBox(PAGE_RES *page_res, const TBOX *prev_box, const TBOX &box, const TBOX *next_box, const char *correct_text)</div></div>
<div class="ttc" id="a02538_html_ad3a856f3e9217c47b8f2f54cd3908721"><div class="ttname"><a href="a02538.html#ad3a856f3e9217c47b8f2f54cd3908721">ROW_RES::row</a></div><div class="ttdeci">ROW * row</div><div class="ttdef"><b>Definition:</b> <a href="a00344_source.html#l00143">pageres.h:143</a></div></div>
<div class="ttc" id="a00503_html_a93a603f4063a6b9403d81caa245a583b"><div class="ttname"><a href="a00503.html#a93a603f4063a6b9403d81caa245a583b">ASSERT_HOST</a></div><div class="ttdeci">#define ASSERT_HOST(x)</div><div class="ttdef"><b>Definition:</b> <a href="a00503_source.html#l00084">errcode.h:84</a></div></div>
<div class="ttc" id="a02606_html_a977bff5fc78c00ee6111d649a2b9a2b3"><div class="ttname"><a href="a02606.html#a977bff5fc78c00ee6111d649a2b9a2b3">WERD_CHOICE::set_permuter</a></div><div class="ttdeci">void set_permuter(uint8_t perm)</div><div class="ttdef"><b>Definition:</b> <a href="a00401_source.html#l00375">ratngs.h:375</a></div></div>
<div class="ttc" id="a02542_html_afc15fa7c1b5ad55d6772dea0d6865df1"><div class="ttname"><a href="a02542.html#afc15fa7c1b5ad55d6772dea0d6865df1">WERD_RES::word</a></div><div class="ttdeci">WERD * word</div><div class="ttdef"><b>Definition:</b> <a href="a00344_source.html#l00189">pageres.h:189</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_fce9a394c0d2c636e610a0a34fe30580.html">tesseract-ocr.master</a></li><li class="navelem"><a class="el" href="dir_fd2783e80b2d56815818e17a68fc4d98.html">src</a></li><li class="navelem"><a class="el" href="dir_f676e76c9a53ee7edd5046de803da784.html">ccmain</a></li><li class="navelem"><a class="el" href="a00068.html">applybox.cpp</a></li>
<li class="footer">Generated on Mon Oct 29 2018 11:03:42 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>