-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy patha00062_source.html
618 lines (616 loc) · 102 KB
/
a00062_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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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.16"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>tesseract: /tesseract/src/api/hocrrenderer.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">5.0.0-alpha-619-ge9db</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.16 -->
<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('a00062_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">hocrrenderer.cpp</div> </div>
</div><!--header-->
<div class="contents">
<a href="a00062.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: hocrrenderer.cpp</span></div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> * Description: Simple API for calling tesseract.</span></div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"> * Author: Ray Smith (original code from baseapi.cpp)</span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> * Author: Stefan Weil (moved to separate file and cleaned code)</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 2006, Google Inc.</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 <locale></span> <span class="comment">// for std::locale::classic</span></div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="preprocessor">#include <memory></span> <span class="comment">// for std::unique_ptr</span></div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="preprocessor">#include <sstream></span> <span class="comment">// for std::stringstream</span></div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="preprocessor">#include <<a class="code" href="a00005.html">tesseract/baseapi.h</a>></span> <span class="comment">// for TessBaseAPI</span></div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="preprocessor">#ifdef _WIN32</span></div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="preprocessor"># include "<a class="code" href="a00530.html">host.h</a>"</span> <span class="comment">// windows.h for MultiByteToWideChar, ...</span></div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="preprocessor">#include <<a class="code" href="a00035.html">tesseract/renderer.h</a>></span></div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="preprocessor">#include "<a class="code" href="a00224.html">tesseractclass.h</a>"</span> <span class="comment">// for Tesseract</span></div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  </div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span> <span class="keyword">namespace </span><a class="code" href="a01818.html">tesseract</a> {</div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  </div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span> <span class="keyword">static</span> <a class="code" href="a01818.html#a76ce0248fd3ba576ca053e9bb82e492f">tesseract::Orientation</a> GetBlockTextOrientation(<span class="keyword">const</span> PageIterator* it) {</div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  <a class="code" href="a01818.html#a76ce0248fd3ba576ca053e9bb82e492f">tesseract::Orientation</a> orientation;</div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  <a class="code" href="a01818.html#acac5bfbc6e9f8ca26f42ea3bad95d84e">tesseract::WritingDirection</a> writing_direction;</div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  <a class="code" href="a01818.html#a28b14f9ab9d686fb45e130abc15c1781">tesseract::TextlineOrder</a> textline_order;</div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  <span class="keywordtype">float</span> deskew_angle;</div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  it->Orientation(&orientation, &writing_direction, &textline_order,</div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  &deskew_angle);</div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  <span class="keywordflow">return</span> orientation;</div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span> }</div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  </div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span> <span class="keyword">static</span> <span class="keywordtype">void</span> AddBaselineCoordsTohOCR(<span class="keyword">const</span> PageIterator* it,</div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  <a class="code" href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7">PageIteratorLevel</a> level,</div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  std::stringstream& hocr_str) {</div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  <a class="code" href="a01818.html#a76ce0248fd3ba576ca053e9bb82e492f">tesseract::Orientation</a> orientation = GetBlockTextOrientation(it);</div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  <span class="keywordflow">if</span> (orientation != <a class="code" href="a01818.html#a76ce0248fd3ba576ca053e9bb82e492fa6e5beda212ea9e59ce8aad91ac47f248">ORIENTATION_PAGE_UP</a>) {</div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  hocr_str << <span class="stringliteral">"; textangle "</span> << 360 - orientation * 90;</div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  }</div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  </div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  <span class="keywordtype">int</span> left, top, right, bottom;</div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  it->BoundingBox(level, &left, &top, &right, &bottom);</div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  </div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  <span class="comment">// Try to get the baseline coordinates at this level.</span></div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  <span class="keywordtype">int</span> x1, y1, x2, y2;</div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  <span class="keywordflow">if</span> (!it->Baseline(level, &x1, &y1, &x2, &y2)) <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  <span class="comment">// Following the description of this field of the hOCR spec, we convert the</span></div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  <span class="comment">// baseline coordinates so that "the bottom left of the bounding box is the</span></div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  <span class="comment">// origin".</span></div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  x1 -= left;</div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  x2 -= left;</div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  y1 -= bottom;</div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  y2 -= bottom;</div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  </div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  <span class="comment">// Now fit a line through the points so we can extract coefficients for the</span></div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  <span class="comment">// equation: y = p1 x + p0</span></div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  <span class="keywordflow">if</span> (x1 == x2) {</div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  <span class="comment">// Problem computing the polynomial coefficients.</span></div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  }</div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  <span class="keywordtype">double</span> p1 = (y2 - y1) / static_cast<double>(x2 - x1);</div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  <span class="keywordtype">double</span> p0 = y1 - p1 * x1;</div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  </div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  hocr_str << <span class="stringliteral">"; baseline "</span> << round(p1 * 1000.0) / 1000.0 << <span class="stringliteral">" "</span></div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  << round(p0 * 1000.0) / 1000.0;</div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</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> <span class="keyword">static</span> <span class="keywordtype">void</span> AddBoxTohOCR(<span class="keyword">const</span> ResultIterator* it, <a class="code" href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7">PageIteratorLevel</a> level,</div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  std::stringstream& hocr_str) {</div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  <span class="keywordtype">int</span> left, top, right, bottom;</div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  it->BoundingBox(level, &left, &top, &right, &bottom);</div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  <span class="comment">// This is the only place we use double quotes instead of single quotes,</span></div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  <span class="comment">// but it may too late to change for consistency</span></div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  hocr_str << <span class="stringliteral">" title=\"bbox "</span> << left << <span class="stringliteral">" "</span> << top << <span class="stringliteral">" "</span> << right << <span class="stringliteral">" "</span></div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  << bottom;</div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  <span class="comment">// Add baseline coordinates & heights for textlines only.</span></div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  <span class="keywordflow">if</span> (level == <a class="code" href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7a5e87a35f16de644593c353159ede11d1">RIL_TEXTLINE</a>) {</div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  AddBaselineCoordsTohOCR(it, level, hocr_str);</div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>  <span class="comment">// add custom height measures</span></div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  <span class="keywordtype">float</span> row_height, descenders, ascenders; <span class="comment">// row attributes</span></div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  it->RowAttributes(&row_height, &descenders, &ascenders);</div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  <span class="comment">// TODO(rays): Do we want to limit these to a single decimal place?</span></div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  hocr_str << <span class="stringliteral">"; x_size "</span> << row_height << <span class="stringliteral">"; x_descenders "</span> << -descenders</div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  << <span class="stringliteral">"; x_ascenders "</span> << ascenders;</div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  }</div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  hocr_str << <span class="stringliteral">"\">"</span>;</div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span> }</div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  </div>
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span> <span class="keywordtype">char</span>* <a class="code" href="a02438.html#a7fffd7934197b7c9ac91db5aac09bf78">TessBaseAPI::GetHOCRText</a>(<span class="keywordtype">int</span> page_number) {</div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  <span class="keywordflow">return</span> <a class="code" href="a02438.html#a7fffd7934197b7c9ac91db5aac09bf78">GetHOCRText</a>(<span class="keyword">nullptr</span>, page_number);</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="l00132"></a><span class="lineno"> 132</span> <span class="keywordtype">char</span>* <a class="code" href="a02438.html#a7fffd7934197b7c9ac91db5aac09bf78">TessBaseAPI::GetHOCRText</a>(<a class="code" href="a02466.html">ETEXT_DESC</a>* monitor, <span class="keywordtype">int</span> page_number) {</div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  <span class="keywordflow">if</span> (<a class="code" href="a02438.html#a247f50792f581df05afe336a2aeda402">tesseract_</a> == <span class="keyword">nullptr</span> || (<a class="code" href="a02438.html#a12dda612630eba40e15f9d0b9955a04c">page_res_</a> == <span class="keyword">nullptr</span> && <a class="code" href="a02438.html#a0e4065c20b142d69a2324ee0c74ae0b0">Recognize</a>(monitor) < 0))</div>
<div class="line"><a name="l00134"></a><span class="lineno"><a class="line" href="a02438.html#a655f906bbf64dcd6f33ce633ecce997d"> 134</a></span>  <span class="keywordflow">return</span> <span class="keyword">nullptr</span>;</div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  </div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  <span class="keywordtype">int</span> lcnt = 1, bcnt = 1, pcnt = 1, wcnt = 1, scnt = 1, tcnt = 1, ccnt = 1;</div>
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span>  <span class="keywordtype">int</span> page_id = page_number + 1; <span class="comment">// hOCR uses 1-based page numbers.</span></div>
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  <span class="keywordtype">bool</span> para_is_ltr = <span class="keyword">true</span>; <span class="comment">// Default direction is LTR</span></div>
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  <span class="keyword">const</span> <span class="keywordtype">char</span>* paragraph_lang = <span class="keyword">nullptr</span>;</div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  <span class="keywordtype">bool</span> font_info = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>  <span class="keywordtype">bool</span> hocr_boxes = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  <a class="code" href="a02438.html#adc8316d75713a2abf5373f85f6f58a93">GetBoolVariable</a>(<span class="stringliteral">"hocr_font_info"</span>, &font_info);</div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  <a class="code" href="a02438.html#adc8316d75713a2abf5373f85f6f58a93">GetBoolVariable</a>(<span class="stringliteral">"hocr_char_boxes"</span>, &hocr_boxes);</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> (<a class="code" href="a02438.html#a4690919aa9d4eabda36bdefdaadf7ac9">input_file_</a> == <span class="keyword">nullptr</span>) <a class="code" href="a02438.html#a896312e68d246b58e704a8f5576e6917">SetInputName</a>(<span class="keyword">nullptr</span>);</div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>  </div>
<div class="line"><a name="l00147"></a><span class="lineno"><a class="line" href="a02438.html#a7fffd7934197b7c9ac91db5aac09bf78"> 147</a></span> <span class="preprocessor">#ifdef _WIN32</span></div>
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span>  <span class="comment">// convert input name from ANSI encoding to utf-8</span></div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>  <span class="keywordtype">int</span> str16_len =</div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>  MultiByteToWideChar(CP_ACP, 0, <a class="code" href="a02438.html#a4690919aa9d4eabda36bdefdaadf7ac9">input_file_</a>-><a class="code" href="a02542.html#a552838a146145cb7993f42aefb740ea4">c_str</a>(), -1, <span class="keyword">nullptr</span>, 0);</div>
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>  <span class="keywordtype">wchar_t</span>* uni16_str = <span class="keyword">new</span> WCHAR[str16_len];</div>
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>  str16_len = MultiByteToWideChar(CP_ACP, 0, <a class="code" href="a02438.html#a4690919aa9d4eabda36bdefdaadf7ac9">input_file_</a>-><a class="code" href="a02542.html#a552838a146145cb7993f42aefb740ea4">c_str</a>(), -1,</div>
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>  uni16_str, str16_len);</div>
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>  <span class="keywordtype">int</span> utf8_len = WideCharToMultiByte(CP_UTF8, 0, uni16_str, str16_len, <span class="keyword">nullptr</span>,</div>
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>  0, <span class="keyword">nullptr</span>, <span class="keyword">nullptr</span>);</div>
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>  <span class="keywordtype">char</span>* utf8_str = <span class="keyword">new</span> <span class="keywordtype">char</span>[utf8_len];</div>
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span>  WideCharToMultiByte(CP_UTF8, 0, uni16_str, str16_len, utf8_str, utf8_len,</div>
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>  <span class="keyword">nullptr</span>, <span class="keyword">nullptr</span>);</div>
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>  *<a class="code" href="a02438.html#a4690919aa9d4eabda36bdefdaadf7ac9">input_file_</a> = utf8_str;</div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>  <span class="keyword">delete</span>[] uni16_str;</div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>  <span class="keyword">delete</span>[] utf8_str;</div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span> <span class="preprocessor">#endif</span></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>  std::stringstream hocr_str;</div>
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span>  <span class="comment">// Use "C" locale (needed for double values x_size and x_descenders).</span></div>
<div class="line"><a name="l00166"></a><span class="lineno"> 166</span>  hocr_str.imbue(std::locale::classic());</div>
<div class="line"><a name="l00167"></a><span class="lineno"> 167</span>  <span class="comment">// Use 8 digits for double values.</span></div>
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>  hocr_str.precision(8);</div>
<div class="line"><a name="l00169"></a><span class="lineno"> 169</span>  hocr_str << <span class="stringliteral">" <div class='ocr_page'"</span>;</div>
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span>  hocr_str << <span class="stringliteral">" id='"</span></div>
<div class="line"><a name="l00171"></a><span class="lineno"> 171</span>  << <span class="stringliteral">"page_"</span> << page_id << <span class="stringliteral">"'"</span>;</div>
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span>  hocr_str << <span class="stringliteral">" title='image \""</span>;</div>
<div class="line"><a name="l00173"></a><span class="lineno"> 173</span>  <span class="keywordflow">if</span> (<a class="code" href="a02438.html#a4690919aa9d4eabda36bdefdaadf7ac9">input_file_</a>) {</div>
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span>  hocr_str << <a class="code" href="a01818.html#a91558c5771a593a5c2e3e62e9ad8e822">HOcrEscape</a>(<a class="code" href="a02438.html#a4690919aa9d4eabda36bdefdaadf7ac9">input_file_</a>-><a class="code" href="a02542.html#a552838a146145cb7993f42aefb740ea4">c_str</a>()).c_str();</div>
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span>  } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span>  hocr_str << <span class="stringliteral">"unknown"</span>;</div>
<div class="line"><a name="l00177"></a><span class="lineno"> 177</span>  }</div>
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span>  hocr_str << <span class="stringliteral">"\"; bbox "</span> << <a class="code" href="a02438.html#ab3c90d43a3628dc7abeb93e9ca01bc97">rect_left_</a> << <span class="stringliteral">" "</span> << <a class="code" href="a02438.html#ac71648cd860510ca65b94d87d7d9bb1f">rect_top_</a> << <span class="stringliteral">" "</span></div>
<div class="line"><a name="l00179"></a><span class="lineno"> 179</span>  << <a class="code" href="a02438.html#a31dbaec91a5dd8ee7d399786a4bd5ef8">rect_width_</a> << <span class="stringliteral">" "</span> << <a class="code" href="a02438.html#a978edc537da096ec07d4bb8e4ae5332d">rect_height_</a> << <span class="stringliteral">"; ppageno "</span> << page_number</div>
<div class="line"><a name="l00180"></a><span class="lineno"> 180</span>  << <span class="stringliteral">"'>\n"</span>;</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>  std::unique_ptr<ResultIterator> res_it(<a class="code" href="a02438.html#a52eee8b9a4f147c26e4b64c16b46bc04">GetIterator</a>());</div>
<div class="line"><a name="l00183"></a><span class="lineno"> 183</span>  <span class="keywordflow">while</span> (!res_it->Empty(<a class="code" href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7a2dcea8d4208c16055353029d26f9bf49">RIL_BLOCK</a>)) {</div>
<div class="line"><a name="l00184"></a><span class="lineno"> 184</span>  <span class="keywordflow">if</span> (res_it->Empty(<a class="code" href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7afd466aec253e5daa6f0c112b0f0e0610">RIL_WORD</a>)) {</div>
<div class="line"><a name="l00185"></a><span class="lineno"> 185</span>  res_it->Next(<a class="code" href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7afd466aec253e5daa6f0c112b0f0e0610">RIL_WORD</a>);</div>
<div class="line"><a name="l00186"></a><span class="lineno"> 186</span>  <span class="keywordflow">continue</span>;</div>
<div class="line"><a name="l00187"></a><span class="lineno"> 187</span>  }</div>
<div class="line"><a name="l00188"></a><span class="lineno"> 188</span>  </div>
<div class="line"><a name="l00189"></a><span class="lineno"> 189</span>  <span class="comment">// Open any new block/paragraph/textline.</span></div>
<div class="line"><a name="l00190"></a><span class="lineno"> 190</span>  <span class="keywordflow">if</span> (res_it->IsAtBeginningOf(<a class="code" href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7a2dcea8d4208c16055353029d26f9bf49">RIL_BLOCK</a>)) {</div>
<div class="line"><a name="l00191"></a><span class="lineno"> 191</span>  para_is_ltr = <span class="keyword">true</span>; <span class="comment">// reset to default direction</span></div>
<div class="line"><a name="l00192"></a><span class="lineno"> 192</span>  hocr_str << <span class="stringliteral">" <div class='ocr_carea'"</span></div>
<div class="line"><a name="l00193"></a><span class="lineno"> 193</span>  << <span class="stringliteral">" id='"</span></div>
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>  << <span class="stringliteral">"block_"</span> << page_id << <span class="stringliteral">"_"</span> << bcnt << <span class="stringliteral">"'"</span>;</div>
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>  AddBoxTohOCR(res_it.get(), <a class="code" href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7a2dcea8d4208c16055353029d26f9bf49">RIL_BLOCK</a>, hocr_str);</div>
<div class="line"><a name="l00196"></a><span class="lineno"> 196</span>  }</div>
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>  <span class="keywordflow">if</span> (res_it->IsAtBeginningOf(<a class="code" href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7a3e63980691bf64801c704f59bd795bd9">RIL_PARA</a>)) {</div>
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>  hocr_str << <span class="stringliteral">"\n <p class='ocr_par'"</span>;</div>
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>  para_is_ltr = res_it->ParagraphIsLtr();</div>
<div class="line"><a name="l00200"></a><span class="lineno"> 200</span>  <span class="keywordflow">if</span> (!para_is_ltr) {</div>
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>  hocr_str << <span class="stringliteral">" dir='rtl'"</span>;</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>  hocr_str << <span class="stringliteral">" id='"</span></div>
<div class="line"><a name="l00204"></a><span class="lineno"> 204</span>  << <span class="stringliteral">"par_"</span> << page_id << <span class="stringliteral">"_"</span> << pcnt << <span class="stringliteral">"'"</span>;</div>
<div class="line"><a name="l00205"></a><span class="lineno"> 205</span>  paragraph_lang = res_it->WordRecognitionLanguage();</div>
<div class="line"><a name="l00206"></a><span class="lineno"> 206</span>  <span class="keywordflow">if</span> (paragraph_lang) {</div>
<div class="line"><a name="l00207"></a><span class="lineno"> 207</span>  hocr_str << <span class="stringliteral">" lang='"</span> << paragraph_lang << <span class="stringliteral">"'"</span>;</div>
<div class="line"><a name="l00208"></a><span class="lineno"> 208</span>  }</div>
<div class="line"><a name="l00209"></a><span class="lineno"> 209</span>  AddBoxTohOCR(res_it.get(), <a class="code" href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7a3e63980691bf64801c704f59bd795bd9">RIL_PARA</a>, hocr_str);</div>
<div class="line"><a name="l00210"></a><span class="lineno"> 210</span>  }</div>
<div class="line"><a name="l00211"></a><span class="lineno"> 211</span>  <span class="keywordflow">if</span> (res_it->IsAtBeginningOf(<a class="code" href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7a5e87a35f16de644593c353159ede11d1">RIL_TEXTLINE</a>)) {</div>
<div class="line"><a name="l00212"></a><span class="lineno"> 212</span>  hocr_str << <span class="stringliteral">"\n <span class='"</span>;</div>
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span>  <span class="keywordflow">switch</span> (res_it->BlockType()) {</div>
<div class="line"><a name="l00214"></a><span class="lineno"> 214</span>  <span class="keywordflow">case</span> <a class="code" href="a00008.html#a02cfd8369d5ad8c70a8b90c0f40d677fa47f25d4065407dd98db92554ca54468b">PT_HEADING_TEXT</a>:</div>
<div class="line"><a name="l00215"></a><span class="lineno"> 215</span>  hocr_str << <span class="stringliteral">"ocr_header"</span>;</div>
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span>  <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00217"></a><span class="lineno"> 217</span>  <span class="keywordflow">case</span> <a class="code" href="a00008.html#a02cfd8369d5ad8c70a8b90c0f40d677fa0e758c0b8cd519397b9c94ce6c12858c">PT_PULLOUT_TEXT</a>:</div>
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span>  hocr_str << <span class="stringliteral">"ocr_textfloat"</span>;</div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>  <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00220"></a><span class="lineno"> 220</span>  <span class="keywordflow">case</span> <a class="code" href="a00008.html#a02cfd8369d5ad8c70a8b90c0f40d677faf25906cdd91c91c56489f5878b89b99b">PT_CAPTION_TEXT</a>:</div>
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>  hocr_str << <span class="stringliteral">"ocr_caption"</span>;</div>
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>  <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>  <span class="keywordflow">default</span>:</div>
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>  hocr_str << <span class="stringliteral">"ocr_line"</span>;</div>
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>  }</div>
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>  hocr_str << <span class="stringliteral">"' id='"</span></div>
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>  << <span class="stringliteral">"line_"</span> << page_id << <span class="stringliteral">"_"</span> << lcnt << <span class="stringliteral">"'"</span>;</div>
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span>  AddBoxTohOCR(res_it.get(), <a class="code" href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7a5e87a35f16de644593c353159ede11d1">RIL_TEXTLINE</a>, hocr_str);</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>  <span class="comment">// Now, process the word...</span></div>
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>  int32_t lstm_choice_mode = <a class="code" href="a02438.html#a247f50792f581df05afe336a2aeda402">tesseract_</a>-><a class="code" href="a02658.html#ab7a5193af82a227f15b4811003960da2">lstm_choice_mode</a>;</div>
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>  std::vector<std::vector<std::vector<std::pair<const char*, float>>>>* rawTimestepMap =</div>
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span>  <span class="keyword">nullptr</span>;</div>
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>  std::vector<std::vector<std::pair<const char*, float>>>* CTCMap =</div>
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span>  <span class="keyword">nullptr</span>;</div>
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span>  <span class="keywordflow">if</span> (lstm_choice_mode) {</div>
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>  </div>
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>  CTCMap = res_it->GetBestLSTMSymbolChoices();</div>
<div class="line"><a name="l00240"></a><span class="lineno"> 240</span>  rawTimestepMap = res_it->GetRawLSTMTimesteps();</div>
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>  }</div>
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span>  hocr_str << <span class="stringliteral">"\n <span class='ocrx_word'"</span></div>
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>  << <span class="stringliteral">" id='"</span></div>
<div class="line"><a name="l00244"></a><span class="lineno"> 244</span>  << <span class="stringliteral">"word_"</span> << page_id << <span class="stringliteral">"_"</span> << wcnt << <span class="stringliteral">"'"</span>;</div>
<div class="line"><a name="l00245"></a><span class="lineno"> 245</span>  <span class="keywordtype">int</span> left, top, right, bottom;</div>
<div class="line"><a name="l00246"></a><span class="lineno"> 246</span>  <span class="keywordtype">bool</span> bold, italic, underlined, monospace, serif, smallcaps;</div>
<div class="line"><a name="l00247"></a><span class="lineno"> 247</span>  <span class="keywordtype">int</span> pointsize, font_id;</div>
<div class="line"><a name="l00248"></a><span class="lineno"> 248</span>  <span class="keyword">const</span> <span class="keywordtype">char</span>* font_name;</div>
<div class="line"><a name="l00249"></a><span class="lineno"> 249</span>  res_it->BoundingBox(<a class="code" href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7afd466aec253e5daa6f0c112b0f0e0610">RIL_WORD</a>, &left, &top, &right, &bottom);</div>
<div class="line"><a name="l00250"></a><span class="lineno"> 250</span>  font_name =</div>
<div class="line"><a name="l00251"></a><span class="lineno"> 251</span>  res_it->WordFontAttributes(&bold, &italic, &underlined, &monospace,</div>
<div class="line"><a name="l00252"></a><span class="lineno"> 252</span>  &serif, &smallcaps, &pointsize, &font_id);</div>
<div class="line"><a name="l00253"></a><span class="lineno"> 253</span>  hocr_str << <span class="stringliteral">" title='bbox "</span> << left << <span class="stringliteral">" "</span> << top << <span class="stringliteral">" "</span> << right << <span class="stringliteral">" "</span></div>
<div class="line"><a name="l00254"></a><span class="lineno"> 254</span>  << bottom << <span class="stringliteral">"; x_wconf "</span></div>
<div class="line"><a name="l00255"></a><span class="lineno"> 255</span>  << static_cast<int>(res_it->Confidence(<a class="code" href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7afd466aec253e5daa6f0c112b0f0e0610">RIL_WORD</a>));</div>
<div class="line"><a name="l00256"></a><span class="lineno"> 256</span>  <span class="keywordflow">if</span> (font_info) {</div>
<div class="line"><a name="l00257"></a><span class="lineno"> 257</span>  <span class="keywordflow">if</span> (font_name) {</div>
<div class="line"><a name="l00258"></a><span class="lineno"> 258</span>  hocr_str << <span class="stringliteral">"; x_font "</span> << <a class="code" href="a01818.html#a91558c5771a593a5c2e3e62e9ad8e822">HOcrEscape</a>(font_name).<a class="code" href="a02542.html#a552838a146145cb7993f42aefb740ea4">c_str</a>();</div>
<div class="line"><a name="l00259"></a><span class="lineno"> 259</span>  }</div>
<div class="line"><a name="l00260"></a><span class="lineno"> 260</span>  hocr_str << <span class="stringliteral">"; x_fsize "</span> << pointsize;</div>
<div class="line"><a name="l00261"></a><span class="lineno"> 261</span>  }</div>
<div class="line"><a name="l00262"></a><span class="lineno"> 262</span>  hocr_str << <span class="stringliteral">"'"</span>;</div>
<div class="line"><a name="l00263"></a><span class="lineno"> 263</span>  <span class="keyword">const</span> <span class="keywordtype">char</span>* lang = res_it->WordRecognitionLanguage();</div>
<div class="line"><a name="l00264"></a><span class="lineno"> 264</span>  <span class="keywordflow">if</span> (lang && (!paragraph_lang || strcmp(lang, paragraph_lang))) {</div>
<div class="line"><a name="l00265"></a><span class="lineno"> 265</span>  hocr_str << <span class="stringliteral">" lang='"</span> << lang << <span class="stringliteral">"'"</span>;</div>
<div class="line"><a name="l00266"></a><span class="lineno"> 266</span>  }</div>
<div class="line"><a name="l00267"></a><span class="lineno"> 267</span>  <span class="keywordflow">switch</span> (res_it->WordDirection()) {</div>
<div class="line"><a name="l00268"></a><span class="lineno"> 268</span>  <span class="comment">// Only emit direction if different from current paragraph direction</span></div>
<div class="line"><a name="l00269"></a><span class="lineno"> 269</span>  <span class="keywordflow">case</span> <a class="code" href="a00050.html#abc3119a959ecd5cffc1d9b9d57479dbaa5978cd698552a6106db1bf6528617317">DIR_LEFT_TO_RIGHT</a>:</div>
<div class="line"><a name="l00270"></a><span class="lineno"> 270</span>  <span class="keywordflow">if</span> (!para_is_ltr) hocr_str << <span class="stringliteral">" dir='ltr'"</span>;</div>
<div class="line"><a name="l00271"></a><span class="lineno"> 271</span>  <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00272"></a><span class="lineno"> 272</span>  <span class="keywordflow">case</span> <a class="code" href="a00050.html#abc3119a959ecd5cffc1d9b9d57479dbaa3c6da23f98ab8ac48598c21583d9297e">DIR_RIGHT_TO_LEFT</a>:</div>
<div class="line"><a name="l00273"></a><span class="lineno"> 273</span>  <span class="keywordflow">if</span> (para_is_ltr) hocr_str << <span class="stringliteral">" dir='rtl'"</span>;</div>
<div class="line"><a name="l00274"></a><span class="lineno"> 274</span>  <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00275"></a><span class="lineno"> 275</span>  <span class="keywordflow">case</span> <a class="code" href="a00050.html#abc3119a959ecd5cffc1d9b9d57479dbaa252615b6d7ebef9293183f6e94488cc1">DIR_MIX</a>:</div>
<div class="line"><a name="l00276"></a><span class="lineno"> 276</span>  <span class="keywordflow">case</span> <a class="code" href="a00050.html#abc3119a959ecd5cffc1d9b9d57479dbaaacc5ec7fd402a8806e78fba831045aae">DIR_NEUTRAL</a>:</div>
<div class="line"><a name="l00277"></a><span class="lineno"> 277</span>  <span class="keywordflow">default</span>: <span class="comment">// Do nothing.</span></div>
<div class="line"><a name="l00278"></a><span class="lineno"> 278</span>  <span class="keywordflow">break</span>;</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>  hocr_str << <span class="stringliteral">">"</span>;</div>
<div class="line"><a name="l00281"></a><span class="lineno"> 281</span>  <span class="keywordtype">bool</span> last_word_in_line = res_it->IsAtFinalElement(<a class="code" href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7a5e87a35f16de644593c353159ede11d1">RIL_TEXTLINE</a>, <a class="code" href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7afd466aec253e5daa6f0c112b0f0e0610">RIL_WORD</a>);</div>
<div class="line"><a name="l00282"></a><span class="lineno"> 282</span>  <span class="keywordtype">bool</span> last_word_in_para = res_it->IsAtFinalElement(<a class="code" href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7a3e63980691bf64801c704f59bd795bd9">RIL_PARA</a>, <a class="code" href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7afd466aec253e5daa6f0c112b0f0e0610">RIL_WORD</a>);</div>
<div class="line"><a name="l00283"></a><span class="lineno"> 283</span>  <span class="keywordtype">bool</span> last_word_in_block = res_it->IsAtFinalElement(<a class="code" href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7a2dcea8d4208c16055353029d26f9bf49">RIL_BLOCK</a>, <a class="code" href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7afd466aec253e5daa6f0c112b0f0e0610">RIL_WORD</a>);</div>
<div class="line"><a name="l00284"></a><span class="lineno"> 284</span>  <span class="keywordflow">if</span> (bold) hocr_str << <span class="stringliteral">"<strong>"</span>;</div>
<div class="line"><a name="l00285"></a><span class="lineno"> 285</span>  <span class="keywordflow">if</span> (italic) hocr_str << <span class="stringliteral">"<em>"</span>;</div>
<div class="line"><a name="l00286"></a><span class="lineno"> 286</span>  <span class="keywordflow">do</span> {</div>
<div class="line"><a name="l00287"></a><span class="lineno"> 287</span>  <span class="keyword">const</span> std::unique_ptr<const char[]> grapheme(</div>
<div class="line"><a name="l00288"></a><span class="lineno"> 288</span>  res_it->GetUTF8Text(<a class="code" href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7adbd62c7f34a9ebdd6e3b813a34cd812d">RIL_SYMBOL</a>));</div>
<div class="line"><a name="l00289"></a><span class="lineno"> 289</span>  <span class="keywordflow">if</span> (grapheme && grapheme[0] != 0) {</div>
<div class="line"><a name="l00290"></a><span class="lineno"> 290</span>  <span class="keywordflow">if</span> (hocr_boxes) {</div>
<div class="line"><a name="l00291"></a><span class="lineno"> 291</span>  res_it->BoundingBox(<a class="code" href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7adbd62c7f34a9ebdd6e3b813a34cd812d">RIL_SYMBOL</a>, &left, &top, &right, &bottom);</div>
<div class="line"><a name="l00292"></a><span class="lineno"> 292</span>  hocr_str << <span class="stringliteral">"\n <span class='ocrx_cinfo' title='x_bboxes "</span></div>
<div class="line"><a name="l00293"></a><span class="lineno"> 293</span>  << left << <span class="stringliteral">" "</span> << top << <span class="stringliteral">" "</span> << right << <span class="stringliteral">" "</span> << bottom</div>
<div class="line"><a name="l00294"></a><span class="lineno"> 294</span>  << <span class="stringliteral">"; x_conf "</span> << res_it->Confidence(<a class="code" href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7adbd62c7f34a9ebdd6e3b813a34cd812d">RIL_SYMBOL</a>) << <span class="stringliteral">"'>"</span>;</div>
<div class="line"><a name="l00295"></a><span class="lineno"> 295</span>  }</div>
<div class="line"><a name="l00296"></a><span class="lineno"> 296</span>  hocr_str << <a class="code" href="a01818.html#a91558c5771a593a5c2e3e62e9ad8e822">HOcrEscape</a>(grapheme.get()).c_str();</div>
<div class="line"><a name="l00297"></a><span class="lineno"> 297</span>  <span class="keywordflow">if</span> (hocr_boxes) {</div>
<div class="line"><a name="l00298"></a><span class="lineno"> 298</span>  hocr_str << <span class="stringliteral">"</span>"</span>;</div>
<div class="line"><a name="l00299"></a><span class="lineno"> 299</span>  <a class="code" href="a02458.html">tesseract::ChoiceIterator</a> ci(*res_it);</div>
<div class="line"><a name="l00300"></a><span class="lineno"> 300</span>  <span class="keywordflow">if</span> (lstm_choice_mode == 1 && ci.Timesteps() != <span class="keyword">nullptr</span>) {</div>
<div class="line"><a name="l00301"></a><span class="lineno"> 301</span>  std::vector<std::vector<std::pair<const char*, float>>>* symbol =</div>
<div class="line"><a name="l00302"></a><span class="lineno"> 302</span>  ci.Timesteps();</div>
<div class="line"><a name="l00303"></a><span class="lineno"> 303</span>  hocr_str << <span class="stringliteral">"\n <span class='ocr_symbol'"</span></div>
<div class="line"><a name="l00304"></a><span class="lineno"> 304</span>  << <span class="stringliteral">" id='"</span></div>
<div class="line"><a name="l00305"></a><span class="lineno"> 305</span>  << <span class="stringliteral">"symbol_"</span> << page_id << <span class="stringliteral">"_"</span> << wcnt << <span class="stringliteral">"_"</span> << scnt</div>
<div class="line"><a name="l00306"></a><span class="lineno"> 306</span>  << <span class="stringliteral">"'>"</span>;</div>
<div class="line"><a name="l00307"></a><span class="lineno"> 307</span>  <span class="keywordflow">for</span> (<span class="keyword">auto</span> timestep : *symbol) {</div>
<div class="line"><a name="l00308"></a><span class="lineno"> 308</span>  hocr_str << <span class="stringliteral">"\n <span class='ocrx_cinfo'"</span></div>
<div class="line"><a name="l00309"></a><span class="lineno"> 309</span>  << <span class="stringliteral">" id='"</span></div>
<div class="line"><a name="l00310"></a><span class="lineno"> 310</span>  << <span class="stringliteral">"timestep"</span> << page_id << <span class="stringliteral">"_"</span> << wcnt << <span class="stringliteral">"_"</span> << tcnt</div>
<div class="line"><a name="l00311"></a><span class="lineno"> 311</span>  << <span class="stringliteral">"'>"</span>;</div>
<div class="line"><a name="l00312"></a><span class="lineno"> 312</span>  <span class="keywordflow">for</span> (<span class="keyword">auto</span> conf : timestep) {</div>
<div class="line"><a name="l00313"></a><span class="lineno"> 313</span>  hocr_str << <span class="stringliteral">"\n <span class='ocrx_cinfo'"</span></div>
<div class="line"><a name="l00314"></a><span class="lineno"> 314</span>  << <span class="stringliteral">" id='"</span></div>
<div class="line"><a name="l00315"></a><span class="lineno"> 315</span>  << <span class="stringliteral">"choice_"</span> << page_id << <span class="stringliteral">"_"</span> << wcnt << <span class="stringliteral">"_"</span> << ccnt</div>
<div class="line"><a name="l00316"></a><span class="lineno"> 316</span>  << <span class="stringliteral">"'"</span></div>
<div class="line"><a name="l00317"></a><span class="lineno"> 317</span>  << <span class="stringliteral">" title='x_confs "</span> << <a class="code" href="a01827.html#a09a009a90bfc702287cb52f5b818acda">int</a>(conf.second * 100)</div>
<div class="line"><a name="l00318"></a><span class="lineno"> 318</span>  << <span class="stringliteral">"'>"</span> << <a class="code" href="a01818.html#a91558c5771a593a5c2e3e62e9ad8e822">HOcrEscape</a>(conf.first).<a class="code" href="a02542.html#a552838a146145cb7993f42aefb740ea4">c_str</a>()</div>
<div class="line"><a name="l00319"></a><span class="lineno"> 319</span>  << <span class="stringliteral">"</span>"</span>;</div>
<div class="line"><a name="l00320"></a><span class="lineno"> 320</span>  ++ccnt;</div>
<div class="line"><a name="l00321"></a><span class="lineno"> 321</span>  }</div>
<div class="line"><a name="l00322"></a><span class="lineno"> 322</span>  hocr_str << <span class="stringliteral">"</span>"</span>;</div>
<div class="line"><a name="l00323"></a><span class="lineno"> 323</span>  ++tcnt;</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>  hocr_str << <span class="stringliteral">"\n </span>"</span>;</div>
<div class="line"><a name="l00326"></a><span class="lineno"> 326</span>  ++scnt;</div>
<div class="line"><a name="l00327"></a><span class="lineno"> 327</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (lstm_choice_mode == 2) {</div>
<div class="line"><a name="l00328"></a><span class="lineno"> 328</span>  <a class="code" href="a02458.html">tesseract::ChoiceIterator</a> ci(*res_it);</div>
<div class="line"><a name="l00329"></a><span class="lineno"> 329</span>  hocr_str << <span class="stringliteral">"\n <span class='ocrx_cinfo'"</span></div>
<div class="line"><a name="l00330"></a><span class="lineno"> 330</span>  << <span class="stringliteral">" id='"</span></div>
<div class="line"><a name="l00331"></a><span class="lineno"> 331</span>  << <span class="stringliteral">"lstm_choices_"</span> << page_id << <span class="stringliteral">"_"</span> << wcnt << <span class="stringliteral">"_"</span> << tcnt</div>
<div class="line"><a name="l00332"></a><span class="lineno"> 332</span>  << <span class="stringliteral">"'>"</span>;</div>
<div class="line"><a name="l00333"></a><span class="lineno"> 333</span>  <span class="keywordflow">do</span> {</div>
<div class="line"><a name="l00334"></a><span class="lineno"> 334</span>  <span class="keyword">const</span> <span class="keywordtype">char</span>* choice = ci.GetUTF8Text();</div>
<div class="line"><a name="l00335"></a><span class="lineno"> 335</span>  <span class="keywordtype">float</span> choiceconf = ci.Confidence();</div>
<div class="line"><a name="l00336"></a><span class="lineno"> 336</span>  <span class="keywordflow">if</span> (choice != <span class="keyword">nullptr</span>) {</div>
<div class="line"><a name="l00337"></a><span class="lineno"> 337</span>  hocr_str << <span class="stringliteral">"\n <span class='ocrx_cinfo'"</span></div>
<div class="line"><a name="l00338"></a><span class="lineno"> 338</span>  << <span class="stringliteral">" id='"</span></div>
<div class="line"><a name="l00339"></a><span class="lineno"> 339</span>  << <span class="stringliteral">"choice_"</span> << page_id << <span class="stringliteral">"_"</span> << wcnt << <span class="stringliteral">"_"</span> << ccnt</div>
<div class="line"><a name="l00340"></a><span class="lineno"> 340</span>  << <span class="stringliteral">"'"</span></div>
<div class="line"><a name="l00341"></a><span class="lineno"> 341</span>  << <span class="stringliteral">" title='x_confs "</span> << choiceconf << <span class="stringliteral">"'>"</span></div>
<div class="line"><a name="l00342"></a><span class="lineno"> 342</span>  << <a class="code" href="a01818.html#a91558c5771a593a5c2e3e62e9ad8e822">HOcrEscape</a>(choice).<a class="code" href="a02542.html#a552838a146145cb7993f42aefb740ea4">c_str</a>() << <span class="stringliteral">"</span>"</span>;</div>
<div class="line"><a name="l00343"></a><span class="lineno"> 343</span>  ccnt++;</div>
<div class="line"><a name="l00344"></a><span class="lineno"> 344</span>  }</div>
<div class="line"><a name="l00345"></a><span class="lineno"> 345</span>  } <span class="keywordflow">while</span> (ci.Next());</div>
<div class="line"><a name="l00346"></a><span class="lineno"> 346</span>  hocr_str << <span class="stringliteral">"\n </span>"</span>;</div>
<div class="line"><a name="l00347"></a><span class="lineno"> 347</span>  tcnt++;</div>
<div class="line"><a name="l00348"></a><span class="lineno"> 348</span>  }</div>
<div class="line"><a name="l00349"></a><span class="lineno"> 349</span>  }</div>
<div class="line"><a name="l00350"></a><span class="lineno"> 350</span>  }</div>
<div class="line"><a name="l00351"></a><span class="lineno"> 351</span>  res_it->Next(<a class="code" href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7adbd62c7f34a9ebdd6e3b813a34cd812d">RIL_SYMBOL</a>);</div>
<div class="line"><a name="l00352"></a><span class="lineno"> 352</span>  } <span class="keywordflow">while</span> (!res_it->Empty(<a class="code" href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7a2dcea8d4208c16055353029d26f9bf49">RIL_BLOCK</a>) && !res_it->IsAtBeginningOf(<a class="code" href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7afd466aec253e5daa6f0c112b0f0e0610">RIL_WORD</a>));</div>
<div class="line"><a name="l00353"></a><span class="lineno"> 353</span>  <span class="keywordflow">if</span> (italic) hocr_str << <span class="stringliteral">"</em>"</span>;</div>
<div class="line"><a name="l00354"></a><span class="lineno"> 354</span>  <span class="keywordflow">if</span> (bold) hocr_str << <span class="stringliteral">"</strong>"</span>;</div>
<div class="line"><a name="l00355"></a><span class="lineno"> 355</span>  <span class="comment">// If the lstm choice mode is required it is added here</span></div>
<div class="line"><a name="l00356"></a><span class="lineno"> 356</span>  <span class="keywordflow">if</span> (lstm_choice_mode == 1 && !hocr_boxes && rawTimestepMap != <span class="keyword">nullptr</span>) {</div>
<div class="line"><a name="l00357"></a><span class="lineno"> 357</span>  <span class="keywordflow">for</span> (<span class="keyword">auto</span> symbol : *rawTimestepMap) {</div>
<div class="line"><a name="l00358"></a><span class="lineno"> 358</span>  hocr_str << <span class="stringliteral">"\n <span class='ocr_symbol'"</span></div>
<div class="line"><a name="l00359"></a><span class="lineno"> 359</span>  << <span class="stringliteral">" id='"</span></div>
<div class="line"><a name="l00360"></a><span class="lineno"> 360</span>  << <span class="stringliteral">"symbol_"</span> << page_id << <span class="stringliteral">"_"</span> << wcnt << <span class="stringliteral">"_"</span> << scnt << <span class="stringliteral">"'>"</span>;</div>
<div class="line"><a name="l00361"></a><span class="lineno"> 361</span>  <span class="keywordflow">for</span> (<span class="keyword">auto</span> timestep : symbol) {</div>
<div class="line"><a name="l00362"></a><span class="lineno"> 362</span>  hocr_str << <span class="stringliteral">"\n <span class='ocrx_cinfo'"</span></div>
<div class="line"><a name="l00363"></a><span class="lineno"> 363</span>  << <span class="stringliteral">" id='"</span></div>
<div class="line"><a name="l00364"></a><span class="lineno"> 364</span>  << <span class="stringliteral">"timestep"</span> << page_id << <span class="stringliteral">"_"</span> << wcnt << <span class="stringliteral">"_"</span> << tcnt</div>
<div class="line"><a name="l00365"></a><span class="lineno"> 365</span>  << <span class="stringliteral">"'>"</span>;</div>
<div class="line"><a name="l00366"></a><span class="lineno"> 366</span>  <span class="keywordflow">for</span> (<span class="keyword">auto</span> conf : timestep) {</div>
<div class="line"><a name="l00367"></a><span class="lineno"> 367</span>  hocr_str << <span class="stringliteral">"\n <span class='ocrx_cinfo'"</span></div>
<div class="line"><a name="l00368"></a><span class="lineno"> 368</span>  << <span class="stringliteral">" id='"</span></div>
<div class="line"><a name="l00369"></a><span class="lineno"> 369</span>  << <span class="stringliteral">"choice_"</span> << page_id << <span class="stringliteral">"_"</span> << wcnt << <span class="stringliteral">"_"</span> << ccnt</div>
<div class="line"><a name="l00370"></a><span class="lineno"> 370</span>  << <span class="stringliteral">"'"</span></div>
<div class="line"><a name="l00371"></a><span class="lineno"> 371</span>  << <span class="stringliteral">" title='x_confs "</span> << <a class="code" href="a01827.html#a09a009a90bfc702287cb52f5b818acda">int</a>(conf.second * 100) << <span class="stringliteral">"'>"</span></div>
<div class="line"><a name="l00372"></a><span class="lineno"> 372</span>  << <a class="code" href="a01818.html#a91558c5771a593a5c2e3e62e9ad8e822">HOcrEscape</a>(conf.first).<a class="code" href="a02542.html#a552838a146145cb7993f42aefb740ea4">c_str</a>() << <span class="stringliteral">"</span>"</span>;</div>
<div class="line"><a name="l00373"></a><span class="lineno"> 373</span>  ++ccnt;</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>  hocr_str << <span class="stringliteral">"</span>"</span>;</div>
<div class="line"><a name="l00376"></a><span class="lineno"> 376</span>  ++tcnt;</div>
<div class="line"><a name="l00377"></a><span class="lineno"> 377</span>  }</div>
<div class="line"><a name="l00378"></a><span class="lineno"> 378</span>  hocr_str << <span class="stringliteral">"</span>"</span>;</div>
<div class="line"><a name="l00379"></a><span class="lineno"> 379</span>  ++scnt;</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">else</span> <span class="keywordflow">if</span> (lstm_choice_mode == 2 && !hocr_boxes && CTCMap != <span class="keyword">nullptr</span>) {</div>
<div class="line"><a name="l00382"></a><span class="lineno"> 382</span>  <span class="keywordflow">for</span> (<span class="keyword">auto</span> timestep : *CTCMap) {</div>
<div class="line"><a name="l00383"></a><span class="lineno"> 383</span>  <span class="keywordflow">if</span> (timestep.size() > 0) {</div>
<div class="line"><a name="l00384"></a><span class="lineno"> 384</span>  hocr_str << <span class="stringliteral">"\n <span class='ocrx_cinfo'"</span></div>
<div class="line"><a name="l00385"></a><span class="lineno"> 385</span>  << <span class="stringliteral">" id='"</span></div>
<div class="line"><a name="l00386"></a><span class="lineno"> 386</span>  << <span class="stringliteral">"lstm_choices_"</span> << page_id << <span class="stringliteral">"_"</span> << wcnt << <span class="stringliteral">"_"</span> << tcnt</div>
<div class="line"><a name="l00387"></a><span class="lineno"> 387</span>  << <span class="stringliteral">"'>"</span>;</div>
<div class="line"><a name="l00388"></a><span class="lineno"> 388</span>  <span class="keywordflow">for</span> (<span class="keyword">auto</span>& j : timestep) {</div>
<div class="line"><a name="l00389"></a><span class="lineno"> 389</span>  <span class="keywordtype">float</span> conf = 100 - <a class="code" href="a02438.html#a247f50792f581df05afe336a2aeda402">tesseract_</a>-><a class="code" href="a02658.html#acb12aa285f51260d7ce445c75ca01306">lstm_rating_coefficient</a> * j.second;</div>
<div class="line"><a name="l00390"></a><span class="lineno"> 390</span>  <span class="keywordflow">if</span> (conf < 0.0f)</div>
<div class="line"><a name="l00391"></a><span class="lineno"> 391</span>  conf = 0.0f;</div>
<div class="line"><a name="l00392"></a><span class="lineno"> 392</span>  <span class="keywordflow">if</span> (conf > 100.0f)</div>
<div class="line"><a name="l00393"></a><span class="lineno"> 393</span>  conf = 100.0f;</div>
<div class="line"><a name="l00394"></a><span class="lineno"> 394</span>  hocr_str << <span class="stringliteral">"\n <span class='ocrx_cinfo'"</span></div>
<div class="line"><a name="l00395"></a><span class="lineno"> 395</span>  << <span class="stringliteral">" id='"</span></div>
<div class="line"><a name="l00396"></a><span class="lineno"> 396</span>  << <span class="stringliteral">"choice_"</span> << page_id << <span class="stringliteral">"_"</span> << wcnt << <span class="stringliteral">"_"</span> << ccnt</div>
<div class="line"><a name="l00397"></a><span class="lineno"> 397</span>  << <span class="stringliteral">"'"</span></div>
<div class="line"><a name="l00398"></a><span class="lineno"> 398</span>  << <span class="stringliteral">" title='x_confs "</span> << conf << <span class="stringliteral">"'>"</span></div>
<div class="line"><a name="l00399"></a><span class="lineno"> 399</span>  << <a class="code" href="a01818.html#a91558c5771a593a5c2e3e62e9ad8e822">HOcrEscape</a>(j.first).<a class="code" href="a02542.html#a552838a146145cb7993f42aefb740ea4">c_str</a>() << <span class="stringliteral">"</span>"</span>;</div>
<div class="line"><a name="l00400"></a><span class="lineno"> 400</span>  ccnt++;</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>  hocr_str << <span class="stringliteral">"</span>"</span>;</div>
<div class="line"><a name="l00403"></a><span class="lineno"> 403</span>  tcnt++;</div>
<div class="line"><a name="l00404"></a><span class="lineno"> 404</span>  }</div>
<div class="line"><a name="l00405"></a><span class="lineno"> 405</span>  }</div>
<div class="line"><a name="l00406"></a><span class="lineno"> 406</span>  } </div>
<div class="line"><a name="l00407"></a><span class="lineno"> 407</span>  <span class="comment">// Close ocrx_word.</span></div>
<div class="line"><a name="l00408"></a><span class="lineno"> 408</span>  <span class="keywordflow">if</span> (hocr_boxes || lstm_choice_mode > 0) {</div>
<div class="line"><a name="l00409"></a><span class="lineno"> 409</span>  hocr_str << <span class="stringliteral">"\n "</span>;</div>
<div class="line"><a name="l00410"></a><span class="lineno"> 410</span>  }</div>
<div class="line"><a name="l00411"></a><span class="lineno"> 411</span>  hocr_str << <span class="stringliteral">"</span>"</span>;</div>
<div class="line"><a name="l00412"></a><span class="lineno"> 412</span>  tcnt = 1;</div>
<div class="line"><a name="l00413"></a><span class="lineno"> 413</span>  ccnt = 1;</div>
<div class="line"><a name="l00414"></a><span class="lineno"> 414</span>  wcnt++;</div>
<div class="line"><a name="l00415"></a><span class="lineno"> 415</span>  <span class="comment">// Close any ending block/paragraph/textline.</span></div>
<div class="line"><a name="l00416"></a><span class="lineno"> 416</span>  <span class="keywordflow">if</span> (last_word_in_line) {</div>
<div class="line"><a name="l00417"></a><span class="lineno"> 417</span>  hocr_str << <span class="stringliteral">"\n </span>"</span>;</div>
<div class="line"><a name="l00418"></a><span class="lineno"> 418</span>  lcnt++;</div>
<div class="line"><a name="l00419"></a><span class="lineno"> 419</span>  }</div>
<div class="line"><a name="l00420"></a><span class="lineno"> 420</span>  <span class="keywordflow">if</span> (last_word_in_para) {</div>
<div class="line"><a name="l00421"></a><span class="lineno"> 421</span>  hocr_str << <span class="stringliteral">"\n </p>\n"</span>;</div>
<div class="line"><a name="l00422"></a><span class="lineno"> 422</span>  pcnt++;</div>
<div class="line"><a name="l00423"></a><span class="lineno"> 423</span>  para_is_ltr = <span class="keyword">true</span>; <span class="comment">// back to default direction</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>  <span class="keywordflow">if</span> (last_word_in_block) {</div>
<div class="line"><a name="l00426"></a><span class="lineno"> 426</span>  hocr_str << <span class="stringliteral">" </div>\n"</span>;</div>
<div class="line"><a name="l00427"></a><span class="lineno"> 427</span>  bcnt++;</div>
<div class="line"><a name="l00428"></a><span class="lineno"> 428</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>  hocr_str << <span class="stringliteral">" </div>\n"</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>  <span class="keyword">const</span> <a class="code" href="a01622.html#aca454f84dd198a937af6499dd758aa3d">std::string</a>& text = hocr_str.str();</div>
<div class="line"><a name="l00433"></a><span class="lineno"> 433</span>  <span class="keywordtype">char</span>* result = <span class="keyword">new</span> <span class="keywordtype">char</span>[text.length() + 1];</div>
<div class="line"><a name="l00434"></a><span class="lineno"> 434</span>  strcpy(result, text.c_str());</div>
<div class="line"><a name="l00435"></a><span class="lineno"> 435</span>  <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l00436"></a><span class="lineno"> 436</span> }</div>
<div class="line"><a name="l00437"></a><span class="lineno"> 437</span>  </div>
<div class="line"><a name="l00438"></a><span class="lineno"> 438</span> <span class="comment">/**********************************************************************</span></div>
<div class="line"><a name="l00439"></a><span class="lineno"> 439</span> <span class="comment"> * HOcr Text Renderer interface implementation</span></div>
<div class="line"><a name="l00440"></a><span class="lineno"> 440</span> <span class="comment"> **********************************************************************/</span></div>
<div class="line"><a name="l00441"></a><span class="lineno"> 441</span> <a class="code" href="a02498.html#a3c6a1ec7ca443265eb0f9f899a3222b6">TessHOcrRenderer::TessHOcrRenderer</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* outputbase)</div>
<div class="line"><a name="l00442"></a><span class="lineno"> 442</span>  : <a class="code" href="a00008.html#a79b401fe19433464a13b416108deb755">TessResultRenderer</a>(outputbase, <span class="stringliteral">"hocr"</span>) {</div>
<div class="line"><a name="l00443"></a><span class="lineno"> 443</span>  font_info_ = <span class="keyword">false</span>;</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>  </div>
<div class="line"><a name="l00446"></a><span class="lineno"> 446</span> <a class="code" href="a02498.html#a3c6a1ec7ca443265eb0f9f899a3222b6">TessHOcrRenderer::TessHOcrRenderer</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* outputbase, <span class="keywordtype">bool</span> font_info)</div>
<div class="line"><a name="l00447"></a><span class="lineno"> 447</span>  : <a class="code" href="a00008.html#a79b401fe19433464a13b416108deb755">TessResultRenderer</a>(outputbase, <span class="stringliteral">"hocr"</span>) {</div>
<div class="line"><a name="l00448"></a><span class="lineno"> 448</span>  font_info_ = font_info;</div>
<div class="line"><a name="l00449"></a><span class="lineno"> 449</span> }</div>
<div class="line"><a name="l00450"></a><span class="lineno"> 450</span>  </div>
<div class="line"><a name="l00451"></a><span class="lineno"> 451</span> <span class="keywordtype">bool</span> <a class="code" href="a02498.html#a797bd5fae583dd07ee325f58a6768f96">TessHOcrRenderer::BeginDocumentHandler</a>() {</div>
<div class="line"><a name="l00452"></a><span class="lineno"> 452</span>  <a class="code" href="a02490.html#a9d903a379bfc1467618b8ee616ba64b6">AppendString</a>(</div>
<div class="line"><a name="l00453"></a><span class="lineno"> 453</span>  <span class="stringliteral">"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"</span></div>
<div class="line"><a name="l00454"></a><span class="lineno"> 454</span>  <span class="stringliteral">"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n"</span></div>
<div class="line"><a name="l00455"></a><span class="lineno"><a class="line" href="a02498.html#a91faa97e7113b7ebdd2b0c6ab01f17da"> 455</a></span>  <span class="stringliteral">" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"</span></div>
<div class="line"><a name="l00456"></a><span class="lineno"> 456</span>  <span class="stringliteral">"<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" "</span></div>
<div class="line"><a name="l00457"></a><span class="lineno"> 457</span>  <span class="stringliteral">"lang=\"en\">\n <head>\n <title>"</span>);</div>
<div class="line"><a name="l00458"></a><span class="lineno"> 458</span>  <a class="code" href="a02490.html#a9d903a379bfc1467618b8ee616ba64b6">AppendString</a>(<a class="code" href="a02490.html#a8f231200d397cd24e2d9642f4306a9f0">title</a>());</div>
<div class="line"><a name="l00459"></a><span class="lineno"> 459</span>  <a class="code" href="a02490.html#a9d903a379bfc1467618b8ee616ba64b6">AppendString</a>(</div>
<div class="line"><a name="l00460"></a><span class="lineno"><a class="line" href="a02498.html#a3c6a1ec7ca443265eb0f9f899a3222b6"> 460</a></span>  <span class="stringliteral">"</title>\n"</span></div>
<div class="line"><a name="l00461"></a><span class="lineno"> 461</span>  <span class="stringliteral">" <meta http-equiv=\"Content-Type\" content=\"text/html;"</span></div>
<div class="line"><a name="l00462"></a><span class="lineno"> 462</span>  <span class="stringliteral">"charset=utf-8\"/>\n"</span></div>
<div class="line"><a name="l00463"></a><span class="lineno"> 463</span>  <span class="stringliteral">" <meta name='ocr-system' content='tesseract "</span> PACKAGE_VERSION</div>
<div class="line"><a name="l00464"></a><span class="lineno"> 464</span>  <span class="stringliteral">"' />\n"</span></div>
<div class="line"><a name="l00465"></a><span class="lineno"><a class="line" href="a02498.html#a797bd5fae583dd07ee325f58a6768f96"> 465</a></span>  <span class="stringliteral">" <meta name='ocr-capabilities' content='ocr_page ocr_carea ocr_par"</span></div>
<div class="line"><a name="l00466"></a><span class="lineno"> 466</span>  <span class="stringliteral">" ocr_line ocrx_word ocrp_wconf"</span>);</div>
<div class="line"><a name="l00467"></a><span class="lineno"> 467</span>  <span class="keywordflow">if</span> (font_info_) <a class="code" href="a02490.html#a9d903a379bfc1467618b8ee616ba64b6">AppendString</a>(<span class="stringliteral">" ocrp_lang ocrp_dir ocrp_font ocrp_fsize"</span>);</div>
<div class="line"><a name="l00468"></a><span class="lineno"> 468</span>  <a class="code" href="a02490.html#a9d903a379bfc1467618b8ee616ba64b6">AppendString</a>(</div>
<div class="line"><a name="l00469"></a><span class="lineno"> 469</span>  <span class="stringliteral">"'/>\n"</span></div>
<div class="line"><a name="l00470"></a><span class="lineno"> 470</span>  <span class="stringliteral">" </head>\n"</span></div>
<div class="line"><a name="l00471"></a><span class="lineno"> 471</span>  <span class="stringliteral">" <body>\n"</span>);</div>
<div class="line"><a name="l00472"></a><span class="lineno"> 472</span>  </div>
<div class="line"><a name="l00473"></a><span class="lineno"> 473</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00474"></a><span class="lineno"> 474</span> }</div>
<div class="line"><a name="l00475"></a><span class="lineno"> 475</span>  </div>
<div class="line"><a name="l00476"></a><span class="lineno"> 476</span> <span class="keywordtype">bool</span> <a class="code" href="a02498.html#a7f1e8198d020e38fec709b3fb64b758e">TessHOcrRenderer::EndDocumentHandler</a>() {</div>
<div class="line"><a name="l00477"></a><span class="lineno"> 477</span>  <a class="code" href="a02490.html#a9d903a379bfc1467618b8ee616ba64b6">AppendString</a>(<span class="stringliteral">" </body>\n</html>\n"</span>);</div>
<div class="line"><a name="l00478"></a><span class="lineno"> 478</span>  </div>
<div class="line"><a name="l00479"></a><span class="lineno"> 479</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00480"></a><span class="lineno"> 480</span> }</div>
<div class="line"><a name="l00481"></a><span class="lineno"> 481</span>  </div>
<div class="line"><a name="l00482"></a><span class="lineno"> 482</span> <span class="keywordtype">bool</span> <a class="code" href="a02498.html#a16005230e3dc7a0eef131819114eb5d5">TessHOcrRenderer::AddImageHandler</a>(<a class="code" href="a00008.html#a47436d31525552f08492b8dcdfc12755">TessBaseAPI</a>* api) {</div>
<div class="line"><a name="l00483"></a><span class="lineno"> 483</span>  <span class="keyword">const</span> std::unique_ptr<const char[]> hocr(api->GetHOCRText(<a class="code" href="a02490.html#a2682a4f6c8bc6671baa0ca7336178b08">imagenum</a>()));</div>
<div class="line"><a name="l00484"></a><span class="lineno"> 484</span>  <span class="keywordflow">if</span> (hocr == <span class="keyword">nullptr</span>) <span class="keywordflow">return</span> <span class="keyword">false</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>  <a class="code" href="a02490.html#a9d903a379bfc1467618b8ee616ba64b6">AppendString</a>(hocr.get());</div>
<div class="line"><a name="l00487"></a><span class="lineno"> 487</span>  </div>
<div class="line"><a name="l00488"></a><span class="lineno"> 488</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00489"></a><span class="lineno"> 489</span> }</div>
<div class="line"><a name="l00490"></a><span class="lineno"><a class="line" href="a02498.html#a7f1e8198d020e38fec709b3fb64b758e"> 490</a></span>  </div>
<div class="line"><a name="l00491"></a><span class="lineno"> 491</span> } <span class="comment">// namespace tesseract</span></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<div class="ttc" id="aa01622_html_aca454f84dd198a937af6499dd758aa3d"><div class="ttname"><a href="a01622.html#aca454f84dd198a937af6499dd758aa3d">string</a></div><div class="ttdeci">std::string string</div><div class="ttdef"><b>Definition:</b> <a href="a01622_source.html#l00021">equationdetect_test.cc:21</a></div></div>
<div class="ttc" id="aa01818_html_aa26c22b65cc9765a0e747120f4287fd7afd466aec253e5daa6f0c112b0f0e0610"><div class="ttname"><a href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7afd466aec253e5daa6f0c112b0f0e0610">tesseract::RIL_WORD</a></div><div class="ttdef"><b>Definition:</b> <a href="a00032_source.html#l00220">publictypes.h:220</a></div></div>
<div class="ttc" id="aa02438_html_a12dda612630eba40e15f9d0b9955a04c"><div class="ttname"><a href="a02438.html#a12dda612630eba40e15f9d0b9955a04c">tesseract::TessBaseAPI::page_res_</a></div><div class="ttdeci">PAGE_RES * page_res_</div><div class="ttdoc">The page-level data.</div><div class="ttdef"><b>Definition:</b> <a href="a00005_source.html#l00893">baseapi.h:893</a></div></div>
<div class="ttc" id="aa00530_html"><div class="ttname"><a href="a00530.html">host.h</a></div></div>
<div class="ttc" id="aa02658_html_ab7a5193af82a227f15b4811003960da2"><div class="ttname"><a href="a02658.html#ab7a5193af82a227f15b4811003960da2">tesseract::Tesseract::lstm_choice_mode</a></div><div class="ttdeci">int lstm_choice_mode</div><div class="ttdef"><b>Definition:</b> <a href="a00224_source.html#l01086">tesseractclass.h:1086</a></div></div>
<div class="ttc" id="aa00224_html"><div class="ttname"><a href="a00224.html">tesseractclass.h</a></div></div>
<div class="ttc" id="aa02658_html_acb12aa285f51260d7ce445c75ca01306"><div class="ttname"><a href="a02658.html#acb12aa285f51260d7ce445c75ca01306">tesseract::Tesseract::lstm_rating_coefficient</a></div><div class="ttdeci">double lstm_rating_coefficient</div><div class="ttdef"><b>Definition:</b> <a href="a00224_source.html#l01095">tesseractclass.h:1095</a></div></div>
<div class="ttc" id="aa01818_html_aa26c22b65cc9765a0e747120f4287fd7a2dcea8d4208c16055353029d26f9bf49"><div class="ttname"><a href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7a2dcea8d4208c16055353029d26f9bf49">tesseract::RIL_BLOCK</a></div><div class="ttdef"><b>Definition:</b> <a href="a00032_source.html#l00217">publictypes.h:217</a></div></div>
<div class="ttc" id="aa02458_html"><div class="ttname"><a href="a02458.html">tesseract::ChoiceIterator</a></div><div class="ttdef"><b>Definition:</b> <a href="a00017_source.html#l00186">ltrresultiterator.h:186</a></div></div>
<div class="ttc" id="aa02438_html_ac71648cd860510ca65b94d87d7d9bb1f"><div class="ttname"><a href="a02438.html#ac71648cd860510ca65b94d87d7d9bb1f">tesseract::TessBaseAPI::rect_top_</a></div><div class="ttdeci">int rect_top_</div><div class="ttdef"><b>Definition:</b> <a href="a00005_source.html#l00908">baseapi.h:908</a></div></div>
<div class="ttc" id="aa01818_html_acac5bfbc6e9f8ca26f42ea3bad95d84e"><div class="ttname"><a href="a01818.html#acac5bfbc6e9f8ca26f42ea3bad95d84e">tesseract::WritingDirection</a></div><div class="ttdeci">WritingDirection</div><div class="ttdef"><b>Definition:</b> <a href="a00032_source.html#l00131">publictypes.h:131</a></div></div>
<div class="ttc" id="aa00008_html_a02cfd8369d5ad8c70a8b90c0f40d677faf25906cdd91c91c56489f5878b89b99b"><div class="ttname"><a href="a00008.html#a02cfd8369d5ad8c70a8b90c0f40d677faf25906cdd91c91c56489f5878b89b99b">PT_CAPTION_TEXT</a></div><div class="ttdef"><b>Definition:</b> <a href="a00008_source.html#l00116">capi.h:116</a></div></div>
<div class="ttc" id="aa02438_html_a978edc537da096ec07d4bb8e4ae5332d"><div class="ttname"><a href="a02438.html#a978edc537da096ec07d4bb8e4ae5332d">tesseract::TessBaseAPI::rect_height_</a></div><div class="ttdeci">int rect_height_</div><div class="ttdef"><b>Definition:</b> <a href="a00005_source.html#l00910">baseapi.h:910</a></div></div>
<div class="ttc" id="aa02466_html"><div class="ttname"><a href="a02466.html">ETEXT_DESC</a></div><div class="ttdef"><b>Definition:</b> <a href="a00020_source.html#l00095">ocrclass.h:95</a></div></div>
<div class="ttc" id="aa02490_html_a9d903a379bfc1467618b8ee616ba64b6"><div class="ttname"><a href="a02490.html#a9d903a379bfc1467618b8ee616ba64b6">tesseract::TessResultRenderer::AppendString</a></div><div class="ttdeci">void AppendString(const char *s)</div><div class="ttdef"><b>Definition:</b> <a href="a00071_source.html#l00101">renderer.cpp:101</a></div></div>
<div class="ttc" id="aa00050_html_abc3119a959ecd5cffc1d9b9d57479dbaa5978cd698552a6106db1bf6528617317"><div class="ttname"><a href="a00050.html#abc3119a959ecd5cffc1d9b9d57479dbaa5978cd698552a6106db1bf6528617317">DIR_LEFT_TO_RIGHT</a></div><div class="ttdef"><b>Definition:</b> <a href="a00050_source.html#l00045">unichar.h:45</a></div></div>
<div class="ttc" id="aa01818_html_aa26c22b65cc9765a0e747120f4287fd7adbd62c7f34a9ebdd6e3b813a34cd812d"><div class="ttname"><a href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7adbd62c7f34a9ebdd6e3b813a34cd812d">tesseract::RIL_SYMBOL</a></div><div class="ttdef"><b>Definition:</b> <a href="a00032_source.html#l00221">publictypes.h:221</a></div></div>
<div class="ttc" id="aa02498_html_a3c6a1ec7ca443265eb0f9f899a3222b6"><div class="ttname"><a href="a02498.html#a3c6a1ec7ca443265eb0f9f899a3222b6">tesseract::TessHOcrRenderer::TessHOcrRenderer</a></div><div class="ttdeci">TessHOcrRenderer(const char *outputbase, bool font_info)</div><div class="ttdef"><b>Definition:</b> <a href="a00062_source.html#l00460">hocrrenderer.cpp:460</a></div></div>
<div class="ttc" id="aa02438_html_a31dbaec91a5dd8ee7d399786a4bd5ef8"><div class="ttname"><a href="a02438.html#a31dbaec91a5dd8ee7d399786a4bd5ef8">tesseract::TessBaseAPI::rect_width_</a></div><div class="ttdeci">int rect_width_</div><div class="ttdef"><b>Definition:</b> <a href="a00005_source.html#l00909">baseapi.h:909</a></div></div>
<div class="ttc" id="aa01818_html_a28b14f9ab9d686fb45e130abc15c1781"><div class="ttname"><a href="a01818.html#a28b14f9ab9d686fb45e130abc15c1781">tesseract::TextlineOrder</a></div><div class="ttdeci">TextlineOrder</div><div class="ttdef"><b>Definition:</b> <a href="a00032_source.html#l00148">publictypes.h:148</a></div></div>
<div class="ttc" id="aa00005_html"><div class="ttname"><a href="a00005.html">baseapi.h</a></div></div>
<div class="ttc" id="aa02498_html_a16005230e3dc7a0eef131819114eb5d5"><div class="ttname"><a href="a02498.html#a16005230e3dc7a0eef131819114eb5d5">tesseract::TessHOcrRenderer::AddImageHandler</a></div><div class="ttdeci">bool AddImageHandler(TessBaseAPI *api) override</div><div class="ttdef"><b>Definition:</b> <a href="a00062_source.html#l00496">hocrrenderer.cpp:496</a></div></div>
<div class="ttc" id="aa02542_html_a552838a146145cb7993f42aefb740ea4"><div class="ttname"><a href="a02542.html#a552838a146145cb7993f42aefb740ea4">STRING::c_str</a></div><div class="ttdeci">const char * c_str() const</div><div class="ttdef"><b>Definition:</b> <a href="a00572_source.html#l00192">strngs.cpp:192</a></div></div>
<div class="ttc" id="aa02498_html_a7f1e8198d020e38fec709b3fb64b758e"><div class="ttname"><a href="a02498.html#a7f1e8198d020e38fec709b3fb64b758e">tesseract::TessHOcrRenderer::EndDocumentHandler</a></div><div class="ttdeci">bool EndDocumentHandler() override</div><div class="ttdef"><b>Definition:</b> <a href="a00062_source.html#l00490">hocrrenderer.cpp:490</a></div></div>
<div class="ttc" id="aa01827_html_a09a009a90bfc702287cb52f5b818acda"><div class="ttname"><a href="a01827.html#a09a009a90bfc702287cb52f5b818acda">tesstrain_utils.int</a></div><div class="ttdeci">int</div><div class="ttdef"><b>Definition:</b> <a href="a01397_source.html#l00154">tesstrain_utils.py:154</a></div></div>
<div class="ttc" id="aa00008_html_a02cfd8369d5ad8c70a8b90c0f40d677fa47f25d4065407dd98db92554ca54468b"><div class="ttname"><a href="a00008.html#a02cfd8369d5ad8c70a8b90c0f40d677fa47f25d4065407dd98db92554ca54468b">PT_HEADING_TEXT</a></div><div class="ttdef"><b>Definition:</b> <a href="a00008_source.html#l00110">capi.h:110</a></div></div>
<div class="ttc" id="aa02498_html_a797bd5fae583dd07ee325f58a6768f96"><div class="ttname"><a href="a02498.html#a797bd5fae583dd07ee325f58a6768f96">tesseract::TessHOcrRenderer::BeginDocumentHandler</a></div><div class="ttdeci">bool BeginDocumentHandler() override</div><div class="ttdef"><b>Definition:</b> <a href="a00062_source.html#l00465">hocrrenderer.cpp:465</a></div></div>
<div class="ttc" id="aa02438_html_a247f50792f581df05afe336a2aeda402"><div class="ttname"><a href="a02438.html#a247f50792f581df05afe336a2aeda402">tesseract::TessBaseAPI::tesseract_</a></div><div class="ttdeci">Tesseract * tesseract_</div><div class="ttdoc">The underlying data object.</div><div class="ttdef"><b>Definition:</b> <a href="a00005_source.html#l00886">baseapi.h:886</a></div></div>
<div class="ttc" id="aa02438_html_a52eee8b9a4f147c26e4b64c16b46bc04"><div class="ttname"><a href="a02438.html#a52eee8b9a4f147c26e4b64c16b46bc04">tesseract::TessBaseAPI::GetIterator</a></div><div class="ttdeci">ResultIterator * GetIterator()</div><div class="ttdef"><b>Definition:</b> <a href="a00056_source.html#l01321">baseapi.cpp:1321</a></div></div>
<div class="ttc" id="aa02438_html_a4690919aa9d4eabda36bdefdaadf7ac9"><div class="ttname"><a href="a02438.html#a4690919aa9d4eabda36bdefdaadf7ac9">tesseract::TessBaseAPI::input_file_</a></div><div class="ttdeci">STRING * input_file_</div><div class="ttdoc">Name used by training code.</div><div class="ttdef"><b>Definition:</b> <a href="a00005_source.html#l00894">baseapi.h:894</a></div></div>
<div class="ttc" id="aa01818_html_aa26c22b65cc9765a0e747120f4287fd7"><div class="ttname"><a href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7">tesseract::PageIteratorLevel</a></div><div class="ttdeci">PageIteratorLevel</div><div class="ttdef"><b>Definition:</b> <a href="a00032_source.html#l00216">publictypes.h:216</a></div></div>
<div class="ttc" id="aa01818_html"><div class="ttname"><a href="a01818.html">tesseract</a></div><div class="ttdef"><b>Definition:</b> <a href="a00005_source.html#l00065">baseapi.h:65</a></div></div>
<div class="ttc" id="aa02438_html_a896312e68d246b58e704a8f5576e6917"><div class="ttname"><a href="a02438.html#a896312e68d246b58e704a8f5576e6917">tesseract::TessBaseAPI::SetInputName</a></div><div class="ttdeci">void SetInputName(const char *name)</div><div class="ttdef"><b>Definition:</b> <a href="a00056_source.html#l00262">baseapi.cpp:262</a></div></div>
<div class="ttc" id="aa01818_html_aa26c22b65cc9765a0e747120f4287fd7a5e87a35f16de644593c353159ede11d1"><div class="ttname"><a href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7a5e87a35f16de644593c353159ede11d1">tesseract::RIL_TEXTLINE</a></div><div class="ttdef"><b>Definition:</b> <a href="a00032_source.html#l00219">publictypes.h:219</a></div></div>
<div class="ttc" id="aa00050_html_abc3119a959ecd5cffc1d9b9d57479dbaaacc5ec7fd402a8806e78fba831045aae"><div class="ttname"><a href="a00050.html#abc3119a959ecd5cffc1d9b9d57479dbaaacc5ec7fd402a8806e78fba831045aae">DIR_NEUTRAL</a></div><div class="ttdef"><b>Definition:</b> <a href="a00050_source.html#l00044">unichar.h:44</a></div></div>
<div class="ttc" id="aa02438_html_ab3c90d43a3628dc7abeb93e9ca01bc97"><div class="ttname"><a href="a02438.html#ab3c90d43a3628dc7abeb93e9ca01bc97">tesseract::TessBaseAPI::rect_left_</a></div><div class="ttdeci">int rect_left_</div><div class="ttdef"><b>Definition:</b> <a href="a00005_source.html#l00907">baseapi.h:907</a></div></div>
<div class="ttc" id="aa02438_html_adc8316d75713a2abf5373f85f6f58a93"><div class="ttname"><a href="a02438.html#adc8316d75713a2abf5373f85f6f58a93">tesseract::TessBaseAPI::GetBoolVariable</a></div><div class="ttdeci">bool GetBoolVariable(const char *name, bool *value) const</div><div class="ttdef"><b>Definition:</b> <a href="a00056_source.html#l00297">baseapi.cpp:297</a></div></div>
<div class="ttc" id="aa01818_html_a76ce0248fd3ba576ca053e9bb82e492fa6e5beda212ea9e59ce8aad91ac47f248"><div class="ttname"><a href="a01818.html#a76ce0248fd3ba576ca053e9bb82e492fa6e5beda212ea9e59ce8aad91ac47f248">tesseract::ORIENTATION_PAGE_UP</a></div><div class="ttdef"><b>Definition:</b> <a href="a00032_source.html#l00117">publictypes.h:117</a></div></div>
<div class="ttc" id="aa02490_html_a8f231200d397cd24e2d9642f4306a9f0"><div class="ttname"><a href="a02490.html#a8f231200d397cd24e2d9642f4306a9f0">tesseract::TessResultRenderer::title</a></div><div class="ttdeci">const char * title() const</div><div class="ttdef"><b>Definition:</b> <a href="a00035_source.html#l00089">renderer.h:89</a></div></div>
<div class="ttc" id="aa00035_html"><div class="ttname"><a href="a00035.html">renderer.h</a></div></div>
<div class="ttc" id="aa00050_html_abc3119a959ecd5cffc1d9b9d57479dbaa3c6da23f98ab8ac48598c21583d9297e"><div class="ttname"><a href="a00050.html#abc3119a959ecd5cffc1d9b9d57479dbaa3c6da23f98ab8ac48598c21583d9297e">DIR_RIGHT_TO_LEFT</a></div><div class="ttdef"><b>Definition:</b> <a href="a00050_source.html#l00046">unichar.h:46</a></div></div>
<div class="ttc" id="aa00050_html_abc3119a959ecd5cffc1d9b9d57479dbaa252615b6d7ebef9293183f6e94488cc1"><div class="ttname"><a href="a00050.html#abc3119a959ecd5cffc1d9b9d57479dbaa252615b6d7ebef9293183f6e94488cc1">DIR_MIX</a></div><div class="ttdef"><b>Definition:</b> <a href="a00050_source.html#l00047">unichar.h:47</a></div></div>
<div class="ttc" id="aa00008_html_a02cfd8369d5ad8c70a8b90c0f40d677fa0e758c0b8cd519397b9c94ce6c12858c"><div class="ttname"><a href="a00008.html#a02cfd8369d5ad8c70a8b90c0f40d677fa0e758c0b8cd519397b9c94ce6c12858c">PT_PULLOUT_TEXT</a></div><div class="ttdef"><b>Definition:</b> <a href="a00008_source.html#l00111">capi.h:111</a></div></div>
<div class="ttc" id="aa02490_html_a2682a4f6c8bc6671baa0ca7336178b08"><div class="ttname"><a href="a02490.html#a2682a4f6c8bc6671baa0ca7336178b08">tesseract::TessResultRenderer::imagenum</a></div><div class="ttdeci">int imagenum() const</div><div class="ttdef"><b>Definition:</b> <a href="a00035_source.html#l00107">renderer.h:107</a></div></div>
<div class="ttc" id="aa00008_html_a47436d31525552f08492b8dcdfc12755"><div class="ttname"><a href="a00008.html#a47436d31525552f08492b8dcdfc12755">TessBaseAPI</a></div><div class="ttdeci">struct TessBaseAPI TessBaseAPI</div><div class="ttdef"><b>Definition:</b> <a href="a00008_source.html#l00072">capi.h:72</a></div></div>
<div class="ttc" id="aa01818_html_a76ce0248fd3ba576ca053e9bb82e492f"><div class="ttname"><a href="a01818.html#a76ce0248fd3ba576ca053e9bb82e492f">tesseract::Orientation</a></div><div class="ttdeci">Orientation</div><div class="ttdef"><b>Definition:</b> <a href="a00032_source.html#l00116">publictypes.h:116</a></div></div>
<div class="ttc" id="aa00008_html_a79b401fe19433464a13b416108deb755"><div class="ttname"><a href="a00008.html#a79b401fe19433464a13b416108deb755">TessResultRenderer</a></div><div class="ttdeci">struct TessResultRenderer TessResultRenderer</div><div class="ttdef"><b>Definition:</b> <a href="a00008_source.html#l00071">capi.h:71</a></div></div>
<div class="ttc" id="aa01818_html_aa26c22b65cc9765a0e747120f4287fd7a3e63980691bf64801c704f59bd795bd9"><div class="ttname"><a href="a01818.html#aa26c22b65cc9765a0e747120f4287fd7a3e63980691bf64801c704f59bd795bd9">tesseract::RIL_PARA</a></div><div class="ttdef"><b>Definition:</b> <a href="a00032_source.html#l00218">publictypes.h:218</a></div></div>
<div class="ttc" id="aa02438_html_a0e4065c20b142d69a2324ee0c74ae0b0"><div class="ttname"><a href="a02438.html#a0e4065c20b142d69a2324ee0c74ae0b0">tesseract::TessBaseAPI::Recognize</a></div><div class="ttdeci">int Recognize(ETEXT_DESC *monitor)</div><div class="ttdef"><b>Definition:</b> <a href="a00056_source.html#l00827">baseapi.cpp:827</a></div></div>
<div class="ttc" id="aa01818_html_a91558c5771a593a5c2e3e62e9ad8e822"><div class="ttname"><a href="a01818.html#a91558c5771a593a5c2e3e62e9ad8e822">tesseract::HOcrEscape</a></div><div class="ttdeci">STRING HOcrEscape(const char *text)</div><div class="ttdef"><b>Definition:</b> <a href="a00056_source.html#l02307">baseapi.cpp:2307</a></div></div>
<div class="ttc" id="aa02438_html_a7fffd7934197b7c9ac91db5aac09bf78"><div class="ttname"><a href="a02438.html#a7fffd7934197b7c9ac91db5aac09bf78">tesseract::TessBaseAPI::GetHOCRText</a></div><div class="ttdeci">char * GetHOCRText(ETEXT_DESC *monitor, int page_number)</div><div class="ttdef"><b>Definition:</b> <a href="a00062_source.html#l00147">hocrrenderer.cpp:147</a></div></div>
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_da61e3e9a357748887e3ca8d7c5a0c16.html">api</a></li><li class="navelem"><a class="el" href="a00062.html">hocrrenderer.cpp</a></li>
<li class="footer">Generated on Thu Jan 30 2020 14:22:19 for tesseract by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.16 </li>
</ul>
</div>
</body>
</html>