1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
<html xmlns="http://www.w3.org/1999/xhtml">
4
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
5
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
6
<title>tesseract: /usr/local/google/home/jbreiden/tesseract-ocr-read-only/ccmain/paragraphs_internal.h Source File</title>
8
<link href="tabs.css" rel="stylesheet" type="text/css"/>
9
<link href="doxygen.css" rel="stylesheet" type="text/css" />
10
<link href="navtree.css" rel="stylesheet" type="text/css"/>
11
<script type="text/javascript" src="jquery.js"></script>
12
<script type="text/javascript" src="resize.js"></script>
13
<script type="text/javascript" src="navtree.js"></script>
14
<script type="text/javascript">
15
$(document).ready(initResizable);
17
<link href="search/search.css" rel="stylesheet" type="text/css"/>
18
<script type="text/javascript" src="search/search.js"></script>
19
<script type="text/javascript">
20
$(document).ready(function() { searchBox.OnSelectItem(0); });
25
<div id="top"><!-- do not remove this div! -->
29
<table cellspacing="0" cellpadding="0">
31
<tr style="height: 56px;">
34
<td style="padding-left: 0.5em;">
35
<div id="projectname">tesseract
36
 <span id="projectnumber">3.03</span>
48
<!-- Generated by Doxygen 1.7.6.1 -->
49
<script type="text/javascript">
50
var searchBox = new SearchBox("searchBox", "search",false,'Search');
52
<div id="navrow1" class="tabs">
54
<li><a href="index.html"><span>Main Page</span></a></li>
55
<li><a href="pages.html"><span>Related Pages</span></a></li>
56
<li><a href="modules.html"><span>Modules</span></a></li>
57
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
58
<li><a href="annotated.html"><span>Classes</span></a></li>
59
<li class="current"><a href="files.html"><span>Files</span></a></li>
61
<div id="MSearchBox" class="MSearchBoxInactive">
63
<img id="MSearchSelect" src="search/mag_sel.png"
64
onmouseover="return searchBox.OnSearchSelectShow()"
65
onmouseout="return searchBox.OnSearchSelectHide()"
67
<input type="text" id="MSearchField" value="Search" accesskey="S"
68
onfocus="searchBox.OnSearchFieldFocus(true)"
69
onblur="searchBox.OnSearchFieldFocus(false)"
70
onkeyup="searchBox.OnSearchFieldChange(event)"/>
71
</span><span class="right">
72
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
78
<div id="navrow2" class="tabs2">
80
<li><a href="files.html"><span>File List</span></a></li>
81
<li><a href="globals.html"><span>File Members</span></a></li>
85
<div id="side-nav" class="ui-resizable side-nav-resizable">
87
<div id="nav-tree-contents">
90
<div id="splitbar" style="-moz-user-select:none;"
91
class="ui-resizable-handle">
94
<script type="text/javascript">
95
initNavTree('a00698.html','');
97
<div id="doc-content">
99
<div class="headertitle">
100
<div class="title">/usr/local/google/home/jbreiden/tesseract-ocr-read-only/ccmain/paragraphs_internal.h</div> </div>
102
<div class="contents">
103
<a href="a00698.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/**********************************************************************</span>
104
<a name="l00002"></a>00002 <span class="comment"> * File: paragraphs.h</span>
105
<a name="l00003"></a>00003 <span class="comment"> * Description: Paragraph Detection internal data structures.</span>
106
<a name="l00004"></a>00004 <span class="comment"> * Author: David Eger</span>
107
<a name="l00005"></a>00005 <span class="comment"> * Created: 11 March 2011</span>
108
<a name="l00006"></a>00006 <span class="comment"> *</span>
109
<a name="l00007"></a>00007 <span class="comment"> * (C) Copyright 2011, Google Inc.</span>
110
<a name="l00008"></a>00008 <span class="comment"> ** Licensed under the Apache License, Version 2.0 (the "License");</span>
111
<a name="l00009"></a>00009 <span class="comment"> ** you may not use this file except in compliance with the License.</span>
112
<a name="l00010"></a>00010 <span class="comment"> ** You may obtain a copy of the License at</span>
113
<a name="l00011"></a>00011 <span class="comment"> ** http://www.apache.org/licenses/LICENSE-2.0</span>
114
<a name="l00012"></a>00012 <span class="comment"> ** Unless required by applicable law or agreed to in writing, software</span>
115
<a name="l00013"></a>00013 <span class="comment"> ** distributed under the License is distributed on an "AS IS" BASIS,</span>
116
<a name="l00014"></a>00014 <span class="comment"> ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
117
<a name="l00015"></a>00015 <span class="comment"> ** See the License for the specific language governing permissions and</span>
118
<a name="l00016"></a>00016 <span class="comment"> ** limitations under the License.</span>
119
<a name="l00017"></a>00017 <span class="comment"> *</span>
120
<a name="l00018"></a>00018 <span class="comment"> **********************************************************************/</span>
121
<a name="l00019"></a>00019
122
<a name="l00020"></a>00020 <span class="preprocessor">#ifndef TESSERACT_CCMAIN_PARAGRAPHS_INTERNAL_H_</span>
123
<a name="l00021"></a>00021 <span class="preprocessor"></span><span class="preprocessor">#define TESSERACT_CCMAIN_PARAGRAPHS_INTERNAL_H_</span>
124
<a name="l00022"></a>00022 <span class="preprocessor"></span>
125
<a name="l00023"></a>00023 <span class="preprocessor">#include "<a class="code" href="a00697.html">paragraphs.h</a>"</span>
126
<a name="l00024"></a>00024 <span class="preprocessor">#ifdef _MSC_VER</span>
127
<a name="l00025"></a>00025 <span class="preprocessor"></span><span class="preprocessor">#include <string></span>
128
<a name="l00026"></a>00026 <span class="preprocessor">#else</span>
129
<a name="l00027"></a>00027 <span class="preprocessor"></span><span class="preprocessor">#include "strings.h"</span>
130
<a name="l00028"></a>00028 <span class="preprocessor">#endif</span>
131
<a name="l00029"></a>00029 <span class="preprocessor"></span>
132
<a name="l00030"></a>00030 <span class="comment">// NO CODE OUTSIDE OF paragraphs.cpp AND TESTS SHOULD NEED TO ACCESS</span>
133
<a name="l00031"></a>00031 <span class="comment">// DATA STRUCTURES OR FUNCTIONS IN THIS FILE.</span>
134
<a name="l00032"></a>00032
135
<a name="l00033"></a>00033 <span class="keyword">class </span><a class="code" href="a00649.html">WERD_CHOICE</a>;
136
<a name="l00034"></a>00034
137
<a name="l00035"></a>00035 <span class="keyword">namespace </span><a class="code" href="a01266.html#afed58feacb84df2de88bdd613cfdba6d">tesseract</a> {
138
<a name="l00036"></a>00036
139
<a name="l00037"></a>00037 <span class="comment">// Return whether the given word is likely to be a list item start word.</span>
140
<a name="l00038"></a>00038 <span class="keywordtype">bool</span> <a class="code" href="a01265.html#a4b153a6c7f9116c12cffe35964cf6ba3">AsciiLikelyListItem</a>(<span class="keyword">const</span> <a class="code" href="a00557.html">STRING</a> &word);
141
<a name="l00039"></a>00039
142
<a name="l00040"></a>00040 <span class="comment">// Return the first Unicode Codepoint from werd[pos].</span>
143
<a name="l00041"></a>00041 <span class="keywordtype">int</span> <a class="code" href="a01265.html#abe22d992db19f44c79906b66dc846eaa">UnicodeFor</a>(<span class="keyword">const</span> <a class="code" href="a00642.html">UNICHARSET</a> *u, <span class="keyword">const</span> <a class="code" href="a00649.html">WERD_CHOICE</a> *werd, <span class="keywordtype">int</span> pos);
144
<a name="l00042"></a>00042
145
<a name="l00043"></a>00043 <span class="comment">// Set right word attributes given either a unicharset and werd or a utf8</span>
146
<a name="l00044"></a>00044 <span class="comment">// string.</span>
147
<a name="l00045"></a>00045 <span class="keywordtype">void</span> <a class="code" href="a01265.html#aa0bc43fa3c52639420ed7eeb1093aa24">RightWordAttributes</a>(<span class="keyword">const</span> <a class="code" href="a00642.html">UNICHARSET</a> *unicharset, <span class="keyword">const</span> <a class="code" href="a00649.html">WERD_CHOICE</a> *werd,
148
<a name="l00046"></a>00046 <span class="keyword">const</span> <a class="code" href="a00557.html">STRING</a> &utf8,
149
<a name="l00047"></a>00047 <span class="keywordtype">bool</span> *is_list, <span class="keywordtype">bool</span> *starts_idea, <span class="keywordtype">bool</span> *ends_idea);
150
<a name="l00048"></a>00048
151
<a name="l00049"></a>00049 <span class="comment">// Set left word attributes given either a unicharset and werd or a utf8 string.</span>
152
<a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="a01265.html#a04498cd763cc4a381f1b7c2d0e17f020">LeftWordAttributes</a>(<span class="keyword">const</span> <a class="code" href="a00642.html">UNICHARSET</a> *unicharset, <span class="keyword">const</span> <a class="code" href="a00649.html">WERD_CHOICE</a> *werd,
153
<a name="l00051"></a>00051 <span class="keyword">const</span> <a class="code" href="a00557.html">STRING</a> &utf8,
154
<a name="l00052"></a>00052 <span class="keywordtype">bool</span> *is_list, <span class="keywordtype">bool</span> *starts_idea, <span class="keywordtype">bool</span> *ends_idea);
155
<a name="l00053"></a>00053
156
<a name="l00054"></a><a class="code" href="a01265.html#af86c486b511cb293ee45a39233f99bd4">00054</a> <span class="keyword">enum</span> <a class="code" href="a01265.html#af86c486b511cb293ee45a39233f99bd4">LineType</a> {
157
<a name="l00055"></a><a class="code" href="a01265.html#af86c486b511cb293ee45a39233f99bd4a350c14d666e61e3ad1310244edde8537">00055</a> <a class="code" href="a01265.html#af86c486b511cb293ee45a39233f99bd4a350c14d666e61e3ad1310244edde8537">LT_START</a> = <span class="charliteral">'S'</span>, <span class="comment">// First line of a paragraph.</span>
158
<a name="l00056"></a><a class="code" href="a01265.html#af86c486b511cb293ee45a39233f99bd4a92f4e011332f48d7de7ddef587dff012">00056</a> <a class="code" href="a01265.html#af86c486b511cb293ee45a39233f99bd4a92f4e011332f48d7de7ddef587dff012">LT_BODY</a> = <span class="charliteral">'C'</span>, <span class="comment">// Continuation line of a paragraph.</span>
159
<a name="l00057"></a><a class="code" href="a01265.html#af86c486b511cb293ee45a39233f99bd4a5dc9805a3ad0a4c99b98ff282e36d204">00057</a> <a class="code" href="a01265.html#af86c486b511cb293ee45a39233f99bd4a5dc9805a3ad0a4c99b98ff282e36d204">LT_UNKNOWN</a> = <span class="charliteral">'U'</span>, <span class="comment">// No clues.</span>
160
<a name="l00058"></a><a class="code" href="a01265.html#af86c486b511cb293ee45a39233f99bd4a923acc0db591045108d7903821a8a594">00058</a> <a class="code" href="a01265.html#af86c486b511cb293ee45a39233f99bd4a923acc0db591045108d7903821a8a594">LT_MULTIPLE</a> = <span class="charliteral">'M'</span>, <span class="comment">// Matches for both LT_START and LT_BODY.</span>
161
<a name="l00059"></a>00059 };
162
<a name="l00060"></a>00060
163
<a name="l00061"></a>00061 <span class="comment">// The first paragraph in a page of body text is often un-indented.</span>
164
<a name="l00062"></a>00062 <span class="comment">// This is a typographic convention which is common to indicate either that:</span>
165
<a name="l00063"></a>00063 <span class="comment">// (1) The paragraph is the continuation of a previous paragraph, or</span>
166
<a name="l00064"></a>00064 <span class="comment">// (2) The paragraph is the first paragraph in a chapter.</span>
167
<a name="l00065"></a>00065 <span class="comment">//</span>
168
<a name="l00066"></a>00066 <span class="comment">// I refer to such paragraphs as "crown"s, and the output of the paragraph</span>
169
<a name="l00067"></a>00067 <span class="comment">// detection algorithm attempts to give them the same paragraph model as</span>
170
<a name="l00068"></a>00068 <span class="comment">// the rest of the body text.</span>
171
<a name="l00069"></a>00069 <span class="comment">//</span>
172
<a name="l00070"></a>00070 <span class="comment">// Nonetheless, while building hypotheses, it is useful to mark the lines</span>
173
<a name="l00071"></a>00071 <span class="comment">// of crown paragraphs temporarily as crowns, either aligned left or right.</span>
174
<a name="l00072"></a>00072 <span class="keyword">extern</span> <span class="keyword">const</span> <a class="code" href="a00487.html">ParagraphModel</a> *<a class="code" href="a01265.html#a98233252a018dc9eb158c8223e2db208">kCrownLeft</a>;
175
<a name="l00073"></a>00073 <span class="keyword">extern</span> <span class="keyword">const</span> <a class="code" href="a00487.html">ParagraphModel</a> *<a class="code" href="a01265.html#a9fec475017947c91c5cdb29b160f4453">kCrownRight</a>;
176
<a name="l00074"></a>00074
177
<a name="l00075"></a><a class="code" href="a01265.html#a2f0e8f8921e73010316eaf366ec45852">00075</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="a01265.html#a2f0e8f8921e73010316eaf366ec45852">StrongModel</a>(<span class="keyword">const</span> <a class="code" href="a00487.html">ParagraphModel</a> *model) {
178
<a name="l00076"></a>00076 <span class="keywordflow">return</span> model != NULL && model != <a class="code" href="a01265.html#a98233252a018dc9eb158c8223e2db208">kCrownLeft</a> && model != <a class="code" href="a01265.html#a9fec475017947c91c5cdb29b160f4453">kCrownRight</a>;
179
<a name="l00077"></a>00077 }
180
<a name="l00078"></a>00078
181
<a name="l00079"></a><a class="code" href="a00452.html">00079</a> <span class="keyword">struct </span><a class="code" href="a00452.html">LineHypothesis</a> {
182
<a name="l00080"></a><a class="code" href="a00452.html#adfa78be50626c43e8fa64500f4cb08ed">00080</a> <a class="code" href="a00452.html#adfa78be50626c43e8fa64500f4cb08ed">LineHypothesis</a>() : <a class="code" href="a00452.html#a9dbc369f700ac22eb77973c389cbcefa">ty</a>(<a class="code" href="a01265.html#af86c486b511cb293ee45a39233f99bd4a5dc9805a3ad0a4c99b98ff282e36d204">LT_UNKNOWN</a>), <a class="code" href="a00452.html#a40094dd9208b225aa9467ebc0ea53a4f">model</a>(NULL) {}
183
<a name="l00081"></a><a class="code" href="a00452.html#a406ded33b01a5773adc552c46339f5da">00081</a> <a class="code" href="a00452.html#adfa78be50626c43e8fa64500f4cb08ed">LineHypothesis</a>(<a class="code" href="a01265.html#af86c486b511cb293ee45a39233f99bd4">LineType</a> line_type, <span class="keyword">const</span> <a class="code" href="a00487.html">ParagraphModel</a> *m)
184
<a name="l00082"></a>00082 : <a class="code" href="a00452.html#a9dbc369f700ac22eb77973c389cbcefa">ty</a>(line_type), <a class="code" href="a00452.html#a40094dd9208b225aa9467ebc0ea53a4f">model</a>(m) {}
185
<a name="l00083"></a><a class="code" href="a00452.html#ab380e9064f80d80460c7f288372226a8">00083</a> <a class="code" href="a00452.html#adfa78be50626c43e8fa64500f4cb08ed">LineHypothesis</a>(<span class="keyword">const</span> <a class="code" href="a00452.html">LineHypothesis</a> &other)
186
<a name="l00084"></a>00084 : <a class="code" href="a00452.html#a9dbc369f700ac22eb77973c389cbcefa">ty</a>(other.<a class="code" href="a00452.html#a9dbc369f700ac22eb77973c389cbcefa">ty</a>), <a class="code" href="a00452.html#a40094dd9208b225aa9467ebc0ea53a4f">model</a>(other.<a class="code" href="a00452.html#a40094dd9208b225aa9467ebc0ea53a4f">model</a>) {}
187
<a name="l00085"></a>00085
188
<a name="l00086"></a><a class="code" href="a00452.html#adfbe05985d7d2773f0c3ee8b72b52eae">00086</a> <span class="keywordtype">bool</span> <a class="code" href="a00452.html#adfbe05985d7d2773f0c3ee8b72b52eae">operator==</a>(<span class="keyword">const</span> <a class="code" href="a00452.html">LineHypothesis</a> &other)<span class="keyword"> const </span>{
189
<a name="l00087"></a>00087 <span class="keywordflow">return</span> <a class="code" href="a00452.html#a9dbc369f700ac22eb77973c389cbcefa">ty</a> == other.<a class="code" href="a00452.html#a9dbc369f700ac22eb77973c389cbcefa">ty</a> && <a class="code" href="a00452.html#a40094dd9208b225aa9467ebc0ea53a4f">model</a> == other.<a class="code" href="a00452.html#a40094dd9208b225aa9467ebc0ea53a4f">model</a>;
190
<a name="l00088"></a>00088 }
191
<a name="l00089"></a>00089
192
<a name="l00090"></a><a class="code" href="a00452.html#a9dbc369f700ac22eb77973c389cbcefa">00090</a> <a class="code" href="a01265.html#af86c486b511cb293ee45a39233f99bd4">LineType</a> <a class="code" href="a00452.html#a9dbc369f700ac22eb77973c389cbcefa">ty</a>;
193
<a name="l00091"></a><a class="code" href="a00452.html#a40094dd9208b225aa9467ebc0ea53a4f">00091</a> <span class="keyword">const</span> <a class="code" href="a00487.html">ParagraphModel</a> *<a class="code" href="a00452.html#a40094dd9208b225aa9467ebc0ea53a4f">model</a>;
194
<a name="l00092"></a>00092 };
195
<a name="l00093"></a>00093
196
<a name="l00094"></a><a class="code" href="a01265.html#a5616e4c6a53be12ea0d684b1f0fb8485">00094</a> <span class="keyword">class </span><a class="code" href="a00489.html">ParagraphTheory</a>; <span class="comment">// Forward Declaration</span>
197
<a name="l00095"></a>00095
198
<a name="l00096"></a>00096 <span class="keyword">typedef</span> <a class="code" href="a00404.html">GenericVectorEqEq<const ParagraphModel *></a> <a class="code" href="a01265.html#a5616e4c6a53be12ea0d684b1f0fb8485">SetOfModels</a>;
199
<a name="l00097"></a>00097
200
<a name="l00098"></a>00098 <span class="comment">// Row Scratch Registers are data generated by the paragraph detection</span>
201
<a name="l00099"></a>00099 <span class="comment">// algorithm based on a RowInfo input.</span>
202
<a name="l00100"></a><a class="code" href="a00524.html">00100</a> <span class="keyword">class </span><a class="code" href="a00524.html">RowScratchRegisters</a> {
203
<a name="l00101"></a>00101 <span class="keyword">public</span>:
204
<a name="l00102"></a>00102 <span class="comment">// We presume row will outlive us.</span>
205
<a name="l00103"></a>00103 <span class="keywordtype">void</span> <a class="code" href="a00524.html#af7939bb6dda65342551cf0f958ffe285">Init</a>(<span class="keyword">const</span> <a class="code" href="a00523.html">RowInfo</a> &row);
206
<a name="l00104"></a>00104
207
<a name="l00105"></a>00105 <a class="code" href="a01265.html#af86c486b511cb293ee45a39233f99bd4">LineType</a> <a class="code" href="a00524.html#a799dffc5a36821b0751fec9de5bfe8c7">GetLineType</a>() <span class="keyword">const</span>;
208
<a name="l00106"></a>00106
209
<a name="l00107"></a>00107 <a class="code" href="a01265.html#af86c486b511cb293ee45a39233f99bd4">LineType</a> <a class="code" href="a00524.html#a799dffc5a36821b0751fec9de5bfe8c7">GetLineType</a>(<span class="keyword">const</span> <a class="code" href="a00487.html">ParagraphModel</a> *model) <span class="keyword">const</span>;
210
<a name="l00108"></a>00108
211
<a name="l00109"></a>00109 <span class="comment">// Mark this as a start line type, sans model. This is useful for the</span>
212
<a name="l00110"></a>00110 <span class="comment">// initial marking of probable body lines or paragraph start lines.</span>
213
<a name="l00111"></a>00111 <span class="keywordtype">void</span> <a class="code" href="a00524.html#a5ac1cfb79119ecac5dcc7f292714b58e">SetStartLine</a>();
214
<a name="l00112"></a>00112
215
<a name="l00113"></a>00113 <span class="comment">// Mark this as a body line type, sans model. This is useful for the</span>
216
<a name="l00114"></a>00114 <span class="comment">// initial marking of probably body lines or paragraph start lines.</span>
217
<a name="l00115"></a>00115 <span class="keywordtype">void</span> <a class="code" href="a00524.html#a4444df7bef80fb2baa7f94dcc848eab3">SetBodyLine</a>();
218
<a name="l00116"></a>00116
219
<a name="l00117"></a>00117 <span class="comment">// Record that this row fits as a paragraph start line in the given model,</span>
220
<a name="l00118"></a>00118 <span class="keywordtype">void</span> <a class="code" href="a00524.html#ac661ad034b57b7f5a2886c9976933b1b">AddStartLine</a>(<span class="keyword">const</span> <a class="code" href="a00487.html">ParagraphModel</a> *model);
221
<a name="l00119"></a>00119 <span class="comment">// Record that this row fits as a paragraph body line in the given model,</span>
222
<a name="l00120"></a>00120 <span class="keywordtype">void</span> <a class="code" href="a00524.html#a6bd11d00c7e46e5546f5a3a9e8e80bb9">AddBodyLine</a>(<span class="keyword">const</span> <a class="code" href="a00487.html">ParagraphModel</a> *model);
223
<a name="l00121"></a>00121
224
<a name="l00122"></a>00122 <span class="comment">// Clear all hypotheses about this line.</span>
225
<a name="l00123"></a><a class="code" href="a00524.html#a4b5abb3df8a610b52476ae463c4a900f">00123</a> <span class="keywordtype">void</span> <a class="code" href="a00524.html#a4b5abb3df8a610b52476ae463c4a900f">SetUnknown</a>() { hypotheses_.<a class="code" href="a00403.html#a980882b5ebc3e72fdedbdbe345196f21">truncate</a>(0); }
226
<a name="l00124"></a>00124
227
<a name="l00125"></a>00125 <span class="comment">// Append all hypotheses of strong models that match this row as a start.</span>
228
<a name="l00126"></a>00126 <span class="keywordtype">void</span> <a class="code" href="a00524.html#ae97c077ce2f7231d098ad4c36ed397bc">StartHypotheses</a>(<a class="code" href="a00404.html">SetOfModels</a> *models) <span class="keyword">const</span>;
229
<a name="l00127"></a>00127
230
<a name="l00128"></a>00128 <span class="comment">// Append all hypotheses of strong models matching this row.</span>
231
<a name="l00129"></a>00129 <span class="keywordtype">void</span> <a class="code" href="a00524.html#a286be9e6a0dbff4773e63908e47128bd">StrongHypotheses</a>(<a class="code" href="a00404.html">SetOfModels</a> *models) <span class="keyword">const</span>;
232
<a name="l00130"></a>00130
233
<a name="l00131"></a>00131 <span class="comment">// Append all hypotheses for this row.</span>
234
<a name="l00132"></a>00132 <span class="keywordtype">void</span> <a class="code" href="a00524.html#a2734f261fcc7d1c69ce511dd0a57f818">NonNullHypotheses</a>(<a class="code" href="a00404.html">SetOfModels</a> *models) <span class="keyword">const</span>;
235
<a name="l00133"></a>00133
236
<a name="l00134"></a>00134 <span class="comment">// Discard any hypotheses whose model is not in the given list.</span>
237
<a name="l00135"></a>00135 <span class="keywordtype">void</span> <a class="code" href="a00524.html#ab4b4ba0ceb0dc647802c7dfb45021797">DiscardNonMatchingHypotheses</a>(<span class="keyword">const</span> <a class="code" href="a00404.html">SetOfModels</a> &models);
238
<a name="l00136"></a>00136
239
<a name="l00137"></a>00137 <span class="comment">// If we have only one hypothesis and that is that this line is a paragraph</span>
240
<a name="l00138"></a>00138 <span class="comment">// start line of a certain model, return that model. Else return NULL.</span>
241
<a name="l00139"></a>00139 <span class="keyword">const</span> <a class="code" href="a00487.html">ParagraphModel</a> *<a class="code" href="a00524.html#a6ff04cb924366a9448613f454b3543fe">UniqueStartHypothesis</a>() <span class="keyword">const</span>;
242
<a name="l00140"></a>00140
243
<a name="l00141"></a>00141 <span class="comment">// If we have only one hypothesis and that is that this line is a paragraph</span>
244
<a name="l00142"></a>00142 <span class="comment">// body line of a certain model, return that model. Else return NULL.</span>
245
<a name="l00143"></a>00143 <span class="keyword">const</span> <a class="code" href="a00487.html">ParagraphModel</a> *<a class="code" href="a00524.html#abca09d3b4538c40ba7da907dd41fff79">UniqueBodyHypothesis</a>() <span class="keyword">const</span>;
246
<a name="l00144"></a>00144
247
<a name="l00145"></a>00145 <span class="comment">// Return the indentation for the side opposite of the aligned side.</span>
248
<a name="l00146"></a><a class="code" href="a00524.html#a56b066d9f536e64951140317d060b637">00146</a> <span class="keywordtype">int</span> <a class="code" href="a00524.html#a56b066d9f536e64951140317d060b637">OffsideIndent</a>(<a class="code" href="a01265.html#a550970d1662b3ac5830c6a28dba676b1">tesseract::ParagraphJustification</a> just)<span class="keyword"> const </span>{
249
<a name="l00147"></a>00147 <span class="keywordflow">switch</span> (just) {
250
<a name="l00148"></a>00148 <span class="keywordflow">case</span> <a class="code" href="a01265.html#a550970d1662b3ac5830c6a28dba676b1a93a23b19fec3ebdb587df6e0aa9e9fce">tesseract::JUSTIFICATION_RIGHT</a>: <span class="keywordflow">return</span> <a class="code" href="a00524.html#a880a72675fbddb983dfd23b8c0dc6177">lindent_</a>;
251
<a name="l00149"></a>00149 <span class="keywordflow">case</span> <a class="code" href="a01265.html#a550970d1662b3ac5830c6a28dba676b1a0141f695e0959de2dc43e0eb94023ff6">tesseract::JUSTIFICATION_LEFT</a>: <span class="keywordflow">return</span> <a class="code" href="a00524.html#a03b35da914e3dffa0454959f2a642432">rindent_</a>;
252
<a name="l00150"></a>00150 <span class="keywordflow">default</span>: <span class="keywordflow">return</span> <a class="code" href="a00524.html#a880a72675fbddb983dfd23b8c0dc6177">lindent_</a> > <a class="code" href="a00524.html#a03b35da914e3dffa0454959f2a642432">rindent_</a> ? <a class="code" href="a00524.html#a880a72675fbddb983dfd23b8c0dc6177">lindent_</a> : <a class="code" href="a00524.html#a03b35da914e3dffa0454959f2a642432">rindent_</a>;
253
<a name="l00151"></a>00151 }
254
<a name="l00152"></a>00152 }
255
<a name="l00153"></a>00153
256
<a name="l00154"></a>00154 <span class="comment">// Return the indentation for the side the text is aligned to.</span>
257
<a name="l00155"></a><a class="code" href="a00524.html#a1b995f3649381c72ba904b0b628d7fd7">00155</a> <span class="keywordtype">int</span> <a class="code" href="a00524.html#a1b995f3649381c72ba904b0b628d7fd7">AlignsideIndent</a>(<a class="code" href="a01265.html#a550970d1662b3ac5830c6a28dba676b1">tesseract::ParagraphJustification</a> just)<span class="keyword"> const </span>{
258
<a name="l00156"></a>00156 <span class="keywordflow">switch</span> (just) {
259
<a name="l00157"></a>00157 <span class="keywordflow">case</span> <a class="code" href="a01265.html#a550970d1662b3ac5830c6a28dba676b1a93a23b19fec3ebdb587df6e0aa9e9fce">tesseract::JUSTIFICATION_RIGHT</a>: <span class="keywordflow">return</span> <a class="code" href="a00524.html#a03b35da914e3dffa0454959f2a642432">rindent_</a>;
260
<a name="l00158"></a>00158 <span class="keywordflow">case</span> <a class="code" href="a01265.html#a550970d1662b3ac5830c6a28dba676b1a0141f695e0959de2dc43e0eb94023ff6">tesseract::JUSTIFICATION_LEFT</a>: <span class="keywordflow">return</span> <a class="code" href="a00524.html#a880a72675fbddb983dfd23b8c0dc6177">lindent_</a>;
261
<a name="l00159"></a>00159 <span class="keywordflow">default</span>: <span class="keywordflow">return</span> <a class="code" href="a00524.html#a880a72675fbddb983dfd23b8c0dc6177">lindent_</a> > <a class="code" href="a00524.html#a03b35da914e3dffa0454959f2a642432">rindent_</a> ? <a class="code" href="a00524.html#a880a72675fbddb983dfd23b8c0dc6177">lindent_</a> : <a class="code" href="a00524.html#a03b35da914e3dffa0454959f2a642432">rindent_</a>;
262
<a name="l00160"></a>00160 }
263
<a name="l00161"></a>00161 }
264
<a name="l00162"></a>00162
265
<a name="l00163"></a>00163 <span class="comment">// Append header fields to a vector of row headings.</span>
266
<a name="l00164"></a>00164 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="a00524.html#a0d7b1cca6b735498a9286b1842e55f92">AppendDebugHeaderFields</a>(<a class="code" href="a00403.html">GenericVector<STRING></a> *header);
267
<a name="l00165"></a>00165
268
<a name="l00166"></a>00166 <span class="comment">// Append data for this row to a vector of debug strings.</span>
269
<a name="l00167"></a>00167 <span class="keywordtype">void</span> <a class="code" href="a00524.html#a57cc3690c4f6306a3af08421f8b7f006">AppendDebugInfo</a>(<span class="keyword">const</span> <a class="code" href="a00489.html">ParagraphTheory</a> &theory,
270
<a name="l00168"></a>00168 <a class="code" href="a00403.html">GenericVector<STRING></a> *dbg) <span class="keyword">const</span>;
271
<a name="l00169"></a>00169
272
<a name="l00170"></a><a class="code" href="a00524.html#a7a86a2a63937c6b9976d275bd42360fb">00170</a> <span class="keyword">const</span> <a class="code" href="a00523.html">RowInfo</a> *<a class="code" href="a00524.html#a7a86a2a63937c6b9976d275bd42360fb">ri_</a>;
273
<a name="l00171"></a>00171
274
<a name="l00172"></a>00172 <span class="comment">// These four constants form a horizontal box model for the white space</span>
275
<a name="l00173"></a>00173 <span class="comment">// on the edges of each line. At each point in the algorithm, the following</span>
276
<a name="l00174"></a>00174 <span class="comment">// shall hold:</span>
277
<a name="l00175"></a>00175 <span class="comment">// ri_->pix_ldistance = lmargin_ + lindent_</span>
278
<a name="l00176"></a>00176 <span class="comment">// ri_->pix_rdistance = rindent_ + rmargin_</span>
279
<a name="l00177"></a><a class="code" href="a00524.html#a5980c9d63c4c7fde05f13eade2356838">00177</a> <span class="keywordtype">int</span> <a class="code" href="a00524.html#a5980c9d63c4c7fde05f13eade2356838">lmargin_</a>;
280
<a name="l00178"></a><a class="code" href="a00524.html#a880a72675fbddb983dfd23b8c0dc6177">00178</a> <span class="keywordtype">int</span> <a class="code" href="a00524.html#a880a72675fbddb983dfd23b8c0dc6177">lindent_</a>;
281
<a name="l00179"></a><a class="code" href="a00524.html#a03b35da914e3dffa0454959f2a642432">00179</a> <span class="keywordtype">int</span> <a class="code" href="a00524.html#a03b35da914e3dffa0454959f2a642432">rindent_</a>;
282
<a name="l00180"></a><a class="code" href="a00524.html#a36b06387969774ec5a66e496ade5561b">00180</a> <span class="keywordtype">int</span> <a class="code" href="a00524.html#a36b06387969774ec5a66e496ade5561b">rmargin_</a>;
283
<a name="l00181"></a>00181
284
<a name="l00182"></a>00182 <span class="keyword">private</span>:
285
<a name="l00183"></a>00183 <span class="comment">// Hypotheses of either LT_START or LT_BODY</span>
286
<a name="l00184"></a>00184 <a class="code" href="a00404.html">GenericVectorEqEq<LineHypothesis></a> hypotheses_;
287
<a name="l00185"></a>00185 };
288
<a name="l00186"></a>00186
289
<a name="l00187"></a>00187 <span class="comment">// A collection of convenience functions for wrapping the set of</span>
290
<a name="l00188"></a>00188 <span class="comment">// Paragraph Models we believe correctly model the paragraphs in the image.</span>
291
<a name="l00189"></a><a class="code" href="a00489.html">00189</a> <span class="keyword">class </span><a class="code" href="a00489.html">ParagraphTheory</a> {
292
<a name="l00190"></a>00190 <span class="keyword">public</span>:
293
<a name="l00191"></a>00191 <span class="comment">// We presume models will outlive us, and that models will take ownership</span>
294
<a name="l00192"></a>00192 <span class="comment">// of any ParagraphModel *'s we add.</span>
295
<a name="l00193"></a><a class="code" href="a00489.html#a29153455785e1ee8d290a3f9217bc9c9">00193</a> <span class="keyword">explicit</span> <a class="code" href="a00489.html#a29153455785e1ee8d290a3f9217bc9c9">ParagraphTheory</a>(<a class="code" href="a00403.html">GenericVector<ParagraphModel *></a> *<a class="code" href="a00489.html#a15ae7e55f888813fe2b72f74ea11c23a">models</a>)
296
<a name="l00194"></a>00194 : models_(models) {}
297
<a name="l00195"></a><a class="code" href="a00489.html#a15ae7e55f888813fe2b72f74ea11c23a">00195</a> <a class="code" href="a00403.html">GenericVector<ParagraphModel *></a> &<a class="code" href="a00489.html#a15ae7e55f888813fe2b72f74ea11c23a">models</a>() { <span class="keywordflow">return</span> *models_; }
298
<a name="l00196"></a><a class="code" href="a00489.html#aa44ab1d539807b2d4e78aaad876eaa66">00196</a> <span class="keyword">const</span> <a class="code" href="a00403.html">GenericVector<ParagraphModel *></a> &<a class="code" href="a00489.html#aa44ab1d539807b2d4e78aaad876eaa66">models</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> *models_; }
299
<a name="l00197"></a>00197
300
<a name="l00198"></a>00198 <span class="comment">// Return an existing model if one that is Comparable() can be found.</span>
301
<a name="l00199"></a>00199 <span class="comment">// Else, allocate a new copy of model to save and return a pointer to it.</span>
302
<a name="l00200"></a>00200 <span class="keyword">const</span> <a class="code" href="a00487.html">ParagraphModel</a> *<a class="code" href="a00489.html#ae701beca9a73ff95107e82b6fa3aa1ff">AddModel</a>(<span class="keyword">const</span> <a class="code" href="a00487.html">ParagraphModel</a> &model);
303
<a name="l00201"></a>00201
304
<a name="l00202"></a>00202 <span class="comment">// Discard any models we've made that are not in the list of used models.</span>
305
<a name="l00203"></a>00203 <span class="keywordtype">void</span> <a class="code" href="a00489.html#ac945b8be877a405dd556cf830e8d1c7e">DiscardUnusedModels</a>(<span class="keyword">const</span> <a class="code" href="a00404.html">SetOfModels</a> &used_models);
306
<a name="l00204"></a>00204
307
<a name="l00205"></a>00205 <span class="comment">// Return the set of all non-centered models.</span>
308
<a name="l00206"></a>00206 <span class="keywordtype">void</span> <a class="code" href="a00489.html#a33e212251fa9eb84dd8270c7f238ff61">NonCenteredModels</a>(<a class="code" href="a00404.html">SetOfModels</a> *<a class="code" href="a00489.html#a15ae7e55f888813fe2b72f74ea11c23a">models</a>);
309
<a name="l00207"></a>00207
310
<a name="l00208"></a>00208 <span class="comment">// If any of the non-centered paragraph models we know about fit</span>
311
<a name="l00209"></a>00209 <span class="comment">// rows[start, end), return it. Else NULL.</span>
312
<a name="l00210"></a>00210 <span class="keyword">const</span> <a class="code" href="a00487.html">ParagraphModel</a> *<a class="code" href="a00489.html#a6686340f77a669565d345995ac171a0d">Fits</a>(<span class="keyword">const</span> <a class="code" href="a00403.html">GenericVector<RowScratchRegisters></a> *rows,
313
<a name="l00211"></a>00211 <span class="keywordtype">int</span> start, <span class="keywordtype">int</span> end) <span class="keyword">const</span>;
314
<a name="l00212"></a>00212
315
<a name="l00213"></a>00213 <span class="keywordtype">int</span> <a class="code" href="a00489.html#a6824d3c12724d31d2eef0b514cbba192">IndexOf</a>(<span class="keyword">const</span> <a class="code" href="a00487.html">ParagraphModel</a> *model) <span class="keyword">const</span>;
316
<a name="l00214"></a>00214
317
<a name="l00215"></a>00215 <span class="keyword">private</span>:
318
<a name="l00216"></a>00216 <a class="code" href="a00403.html">GenericVector<ParagraphModel *></a> *models_;
319
<a name="l00217"></a>00217 <a class="code" href="a00404.html">GenericVectorEqEq<ParagraphModel *></a> models_we_added_;
320
<a name="l00218"></a>00218 };
321
<a name="l00219"></a>00219
322
<a name="l00220"></a>00220 <span class="keywordtype">bool</span> <a class="code" href="a01265.html#a8f44dde2641dd1047debf38c4429dc2b">ValidFirstLine</a>(<span class="keyword">const</span> <a class="code" href="a00403.html">GenericVector<RowScratchRegisters></a> *rows,
323
<a name="l00221"></a>00221 <span class="keywordtype">int</span> row, <span class="keyword">const</span> <a class="code" href="a00487.html">ParagraphModel</a> *model);
324
<a name="l00222"></a>00222 <span class="keywordtype">bool</span> <a class="code" href="a01265.html#a7933d5b144ff81c13320bfb6f32e0264">ValidBodyLine</a>(<span class="keyword">const</span> <a class="code" href="a00403.html">GenericVector<RowScratchRegisters></a> *rows,
325
<a name="l00223"></a>00223 <span class="keywordtype">int</span> row, <span class="keyword">const</span> <a class="code" href="a00487.html">ParagraphModel</a> *model);
326
<a name="l00224"></a>00224 <span class="keywordtype">bool</span> <a class="code" href="a01265.html#a2327e0fae9f7527a805d6cb2ac9bfc16">CrownCompatible</a>(<span class="keyword">const</span> <a class="code" href="a00403.html">GenericVector<RowScratchRegisters></a> *rows,
327
<a name="l00225"></a>00225 <span class="keywordtype">int</span> a, <span class="keywordtype">int</span> b, <span class="keyword">const</span> <a class="code" href="a00487.html">ParagraphModel</a> *model);
328
<a name="l00226"></a>00226
329
<a name="l00227"></a>00227 <span class="comment">// A class for smearing Paragraph Model hypotheses to surrounding rows.</span>
330
<a name="l00228"></a>00228 <span class="comment">// The idea here is that StrongEvidenceClassify first marks only exceedingly</span>
331
<a name="l00229"></a>00229 <span class="comment">// obvious start and body rows and constructs models of them. Thereafter,</span>
332
<a name="l00230"></a>00230 <span class="comment">// we may have left over unmarked lines (mostly end-of-paragraph lines) which</span>
333
<a name="l00231"></a>00231 <span class="comment">// were too short to have much confidence about, but which fit the models we've</span>
334
<a name="l00232"></a>00232 <span class="comment">// constructed perfectly and which we ought to mark. This class is used to</span>
335
<a name="l00233"></a>00233 <span class="comment">// "smear" our models over the text.</span>
336
<a name="l00234"></a><a class="code" href="a00488.html">00234</a> <span class="keyword">class </span><a class="code" href="a00488.html">ParagraphModelSmearer</a> {
337
<a name="l00235"></a>00235 <span class="keyword">public</span>:
338
<a name="l00236"></a>00236 <a class="code" href="a00488.html#a42b97ade9478b6198e94bae46b8de969">ParagraphModelSmearer</a>(<a class="code" href="a00403.html">GenericVector<RowScratchRegisters></a> *rows,
339
<a name="l00237"></a>00237 <span class="keywordtype">int</span> row_start, <span class="keywordtype">int</span> row_end,
340
<a name="l00238"></a>00238 <a class="code" href="a00489.html">ParagraphTheory</a> *theory);
341
<a name="l00239"></a>00239
342
<a name="l00240"></a>00240 <span class="comment">// Smear forward paragraph models from existing row markings to subsequent</span>
343
<a name="l00241"></a>00241 <span class="comment">// text lines if they fit, and mark any thereafter still unmodeled rows</span>
344
<a name="l00242"></a>00242 <span class="comment">// with any model in the theory that fits them.</span>
345
<a name="l00243"></a>00243 <span class="keywordtype">void</span> <a class="code" href="a00488.html#ad5865041cc00c68c5cb2235e35c31b31">Smear</a>();
346
<a name="l00244"></a>00244
347
<a name="l00245"></a>00245 <span class="keyword">private</span>:
348
<a name="l00246"></a>00246 <span class="comment">// Record in open_models_ for rows [start_row, end_row) the list of models</span>
349
<a name="l00247"></a>00247 <span class="comment">// currently open at each row.</span>
350
<a name="l00248"></a>00248 <span class="comment">// A model is still open in a row if some previous row has said model as a</span>
351
<a name="l00249"></a>00249 <span class="comment">// start hypothesis, and all rows since (including this row) would fit as</span>
352
<a name="l00250"></a>00250 <span class="comment">// either a body or start line in that model.</span>
353
<a name="l00251"></a>00251 <span class="keywordtype">void</span> CalculateOpenModels(<span class="keywordtype">int</span> row_start, <span class="keywordtype">int</span> row_end);
354
<a name="l00252"></a>00252
355
<a name="l00253"></a>00253 <a class="code" href="a00404.html">SetOfModels</a> &OpenModels(<span class="keywordtype">int</span> row) {
356
<a name="l00254"></a>00254 <span class="keywordflow">return</span> open_models_[row - row_start_ + 1];
357
<a name="l00255"></a>00255 }
358
<a name="l00256"></a>00256
359
<a name="l00257"></a>00257 <a class="code" href="a00489.html">ParagraphTheory</a> *theory_;
360
<a name="l00258"></a>00258 <a class="code" href="a00403.html">GenericVector<RowScratchRegisters></a> *rows_;
361
<a name="l00259"></a>00259 <span class="keywordtype">int</span> row_start_;
362
<a name="l00260"></a>00260 <span class="keywordtype">int</span> row_end_;
363
<a name="l00261"></a>00261
364
<a name="l00262"></a>00262 <span class="comment">// open_models_ corresponds to rows[start_row_ - 1, end_row_]</span>
365
<a name="l00263"></a>00263 <span class="comment">//</span>
366
<a name="l00264"></a>00264 <span class="comment">// open_models_: Contains models which there was an active (open) paragraph</span>
367
<a name="l00265"></a>00265 <span class="comment">// as of the previous line and for which the left and right</span>
368
<a name="l00266"></a>00266 <span class="comment">// indents admit the possibility that this text line continues</span>
369
<a name="l00267"></a>00267 <span class="comment">// to fit the same model.</span>
370
<a name="l00268"></a>00268 <span class="comment">// TODO(eger): Think about whether we can get rid of "Open" models and just</span>
371
<a name="l00269"></a>00269 <span class="comment">// use the current hypotheses on RowScratchRegisters.</span>
372
<a name="l00270"></a>00270 <a class="code" href="a00403.html">GenericVector<SetOfModels></a> open_models_;
373
<a name="l00271"></a>00271 };
374
<a name="l00272"></a>00272
375
<a name="l00273"></a>00273 <span class="comment">// Clear all hypotheses about lines [start, end) and reset the margins to the</span>
376
<a name="l00274"></a>00274 <span class="comment">// percentile (0..100) value of the left and right row edges for this run of</span>
377
<a name="l00275"></a>00275 <span class="comment">// rows.</span>
378
<a name="l00276"></a>00276 <span class="keywordtype">void</span> <a class="code" href="a01265.html#a8f083a56b3a7be7431cea88c86f49216">RecomputeMarginsAndClearHypotheses</a>(
379
<a name="l00277"></a>00277 <a class="code" href="a00403.html">GenericVector<RowScratchRegisters></a> *rows, <span class="keywordtype">int</span> start, <span class="keywordtype">int</span> end,
380
<a name="l00278"></a>00278 <span class="keywordtype">int</span> percentile);
381
<a name="l00279"></a>00279
382
<a name="l00280"></a>00280 <span class="comment">// Return the median inter-word space in rows[row_start, row_end).</span>
383
<a name="l00281"></a>00281 <span class="keywordtype">int</span> <a class="code" href="a01265.html#adf0128a0f8d13a8183820ce034d56122">InterwordSpace</a>(<span class="keyword">const</span> <a class="code" href="a00403.html">GenericVector<RowScratchRegisters></a> &rows,
384
<a name="l00282"></a>00282 <span class="keywordtype">int</span> row_start, <span class="keywordtype">int</span> row_end);
385
<a name="l00283"></a>00283
386
<a name="l00284"></a>00284 <span class="comment">// Return whether the first word on the after line can fit in the space at</span>
387
<a name="l00285"></a>00285 <span class="comment">// the end of the before line (knowing which way the text is aligned and read).</span>
388
<a name="l00286"></a>00286 <span class="keywordtype">bool</span> <a class="code" href="a01265.html#a5d73136a6cc816e7f51fcfbfe99d52c1">FirstWordWouldHaveFit</a>(<span class="keyword">const</span> <a class="code" href="a00524.html">RowScratchRegisters</a> &before,
389
<a name="l00287"></a>00287 <span class="keyword">const</span> <a class="code" href="a00524.html">RowScratchRegisters</a> &after,
390
<a name="l00288"></a>00288 <a class="code" href="a01265.html#a550970d1662b3ac5830c6a28dba676b1">tesseract::ParagraphJustification</a> justification);
391
<a name="l00289"></a>00289
392
<a name="l00290"></a>00290 <span class="comment">// Return whether the first word on the after line can fit in the space at</span>
393
<a name="l00291"></a>00291 <span class="comment">// the end of the before line (not knowing the text alignment).</span>
394
<a name="l00292"></a>00292 <span class="keywordtype">bool</span> <a class="code" href="a01265.html#a5d73136a6cc816e7f51fcfbfe99d52c1">FirstWordWouldHaveFit</a>(<span class="keyword">const</span> <a class="code" href="a00524.html">RowScratchRegisters</a> &before,
395
<a name="l00293"></a>00293 <span class="keyword">const</span> <a class="code" href="a00524.html">RowScratchRegisters</a> &after);
396
<a name="l00294"></a>00294
397
<a name="l00295"></a>00295 <span class="comment">// Do rows[start, end) form a single instance of the given paragraph model?</span>
398
<a name="l00296"></a>00296 <span class="keywordtype">bool</span> <a class="code" href="a01265.html#ac1812316831faad241ffadb840e9a21e">RowsFitModel</a>(<span class="keyword">const</span> <a class="code" href="a00403.html">GenericVector<RowScratchRegisters></a> *rows,
399
<a name="l00297"></a>00297 <span class="keywordtype">int</span> start, <span class="keywordtype">int</span> end, <span class="keyword">const</span> <a class="code" href="a00487.html">ParagraphModel</a> *model);
400
<a name="l00298"></a>00298
401
<a name="l00299"></a>00299 <span class="comment">// Do the text and geometry of two rows support a paragraph break between them?</span>
402
<a name="l00300"></a>00300 <span class="keywordtype">bool</span> <a class="code" href="a01265.html#ac154ce339833f35931ef5b2e57d47a2a">LikelyParagraphStart</a>(<span class="keyword">const</span> <a class="code" href="a00524.html">RowScratchRegisters</a> &before,
403
<a name="l00301"></a>00301 <span class="keyword">const</span> <a class="code" href="a00524.html">RowScratchRegisters</a> &after,
404
<a name="l00302"></a>00302 <a class="code" href="a01265.html#a550970d1662b3ac5830c6a28dba676b1">tesseract::ParagraphJustification</a> j);
405
<a name="l00303"></a>00303
406
<a name="l00304"></a>00304 <span class="comment">// Given a set of row_owners pointing to PARAs or NULL (no paragraph known),</span>
407
<a name="l00305"></a>00305 <span class="comment">// normalize each row_owner to point to an actual PARA, and output the</span>
408
<a name="l00306"></a>00306 <span class="comment">// paragraphs in order onto paragraphs.</span>
409
<a name="l00307"></a>00307 <span class="keywordtype">void</span> <a class="code" href="a01265.html#a9cafdf34c1f6a37446d3e656da69afdc">CanonicalizeDetectionResults</a>(
410
<a name="l00308"></a>00308 <a class="code" href="a00403.html">GenericVector<PARA *></a> *row_owners,
411
<a name="l00309"></a>00309 PARA_LIST *paragraphs);
412
<a name="l00310"></a>00310
413
<a name="l00311"></a>00311 } <span class="comment">// namespace</span>
414
<a name="l00312"></a>00312 <span class="preprocessor">#endif // TESSERACT_CCMAIN_PARAGRAPHS_INTERNAL_H_</span>
415
</pre></div></div><!-- contents -->
417
<!-- window showing the filter options -->
418
<div id="MSearchSelectWindow"
419
onmouseover="return searchBox.OnSearchSelectShow()"
420
onmouseout="return searchBox.OnSearchSelectHide()"
421
onkeydown="return searchBox.OnSearchSelectKey(event)">
422
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark"> </span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark"> </span>Defines</a></div>
424
<!-- iframe showing the search results (closed by default) -->
425
<div id="MSearchResultsWindow">
426
<iframe src="javascript:void(0)" frameborder="0"
427
name="MSearchResults" id="MSearchResults">
431
<div id="nav-path" class="navpath">
433
<li class="navelem"><a class="el" href="a00698.html">paragraphs_internal.h</a> </li>
435
<li class="footer">Generated on Mon Feb 3 2014 10:59:07 for tesseract by
436
<a href="http://www.doxygen.org/index.html">
437
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.6.1 </li>