tesseract v5.3.3.20231005
tesseract::REJ Class Reference

#include <rejctmap.h>

Public Member Functions

 REJ ()=default
 
 REJ (const REJ &source)
 
REJoperator= (const REJ &source)=default
 
bool flag (REJ_FLAGS rej_flag) const
 
char display_char () const
 
bool perm_rejected () const
 
bool rejected () const
 
bool accept_if_good_quality () const
 
void setrej_tess_failure ()
 
void setrej_small_xht ()
 
void setrej_edge_char ()
 
void setrej_1Il_conflict ()
 
void setrej_postNN_1Il ()
 
void setrej_rej_cblob ()
 
void setrej_mm_reject ()
 
void setrej_bad_repetition ()
 
void setrej_poor_match ()
 
void setrej_not_tess_accepted ()
 
void setrej_contains_blanks ()
 
void setrej_bad_permuter ()
 
void setrej_hyphen ()
 
void setrej_dubious ()
 
void setrej_no_alphanums ()
 
void setrej_mostly_rej ()
 
void setrej_xht_fixup ()
 
void setrej_bad_quality ()
 
void setrej_doc_rej ()
 
void setrej_block_rej ()
 
void setrej_row_rej ()
 
void setrej_unlv_rej ()
 
void setrej_hyphen_accept ()
 
void setrej_nn_accept ()
 
void setrej_mm_accept ()
 
void setrej_quality_accept ()
 
void setrej_minimal_rej_accept ()
 
bool accepted () const
 
bool recoverable () const
 
void full_print (FILE *fp) const
 

Detailed Description

Definition at line 99 of file rejctmap.h.

Constructor & Destructor Documentation

◆ REJ() [1/2]

tesseract::REJ::REJ ( )
default

◆ REJ() [2/2]

tesseract::REJ::REJ ( const REJ source)
inline

Definition at line 109 of file rejctmap.h.

110 {
111 flags = source.flags;
112 }

Member Function Documentation

◆ accept_if_good_quality()

bool tesseract::REJ::accept_if_good_quality ( ) const
inline

Definition at line 180 of file rejctmap.h.

180 { // potential rej?
181 return (rejected() && !perm_rejected() && flag(R_BAD_PERMUTER) &&
184 (!rej_between_nn_and_mm() && !rej_between_mm_and_quality_accept() &&
185 !rej_between_quality_and_minimal_rej_accept()));
186 }
@ R_POOR_MATCH
Definition: rejctmap.h:63
@ R_BAD_PERMUTER
Definition: rejctmap.h:66
@ R_CONTAINS_BLANKS
Definition: rejctmap.h:65
@ R_NOT_TESS_ACCEPTED
Definition: rejctmap.h:64
bool rejected() const
Definition: rejctmap.h:171
bool perm_rejected() const
Definition: rejctmap.h:133
bool flag(REJ_FLAGS rej_flag) const
Definition: rejctmap.h:117

◆ accepted()

bool tesseract::REJ::accepted ( ) const
inline

Definition at line 299 of file rejctmap.h.

299 { // Is char accepted?
300 return !rejected();
301 }

◆ display_char()

char tesseract::REJ::display_char ( ) const
inline

Definition at line 121 of file rejctmap.h.

121 {
122 if (perm_rejected()) {
123 return MAP_REJECT_PERM;
124 } else if (accept_if_good_quality()) {
126 } else if (rejected()) {
127 return MAP_REJECT_TEMP;
128 } else {
129 return MAP_ACCEPT;
130 }
131 }
#define MAP_ACCEPT
Definition: rejctmap.h:94
#define MAP_REJECT_POTENTIAL
Definition: rejctmap.h:97
#define MAP_REJECT_PERM
Definition: rejctmap.h:95
#define MAP_REJECT_TEMP
Definition: rejctmap.h:96
bool accept_if_good_quality() const
Definition: rejctmap.h:180

◆ flag()

bool tesseract::REJ::flag ( REJ_FLAGS  rej_flag) const
inline

Definition at line 117 of file rejctmap.h.

117 {
118 return flags[rej_flag];
119 }

◆ full_print()

void tesseract::REJ::full_print ( FILE *  fp) const

Definition at line 27 of file rejctmap.cpp.

27 {
28 fprintf(fp, "R_TESS_FAILURE: %s\n", flag(R_TESS_FAILURE) ? "T" : "F");
29 fprintf(fp, "R_SMALL_XHT: %s\n", flag(R_SMALL_XHT) ? "T" : "F");
30 fprintf(fp, "R_EDGE_CHAR: %s\n", flag(R_EDGE_CHAR) ? "T" : "F");
31 fprintf(fp, "R_1IL_CONFLICT: %s\n", flag(R_1IL_CONFLICT) ? "T" : "F");
32 fprintf(fp, "R_POSTNN_1IL: %s\n", flag(R_POSTNN_1IL) ? "T" : "F");
33 fprintf(fp, "R_REJ_CBLOB: %s\n", flag(R_REJ_CBLOB) ? "T" : "F");
34 fprintf(fp, "R_MM_REJECT: %s\n", flag(R_MM_REJECT) ? "T" : "F");
35 fprintf(fp, "R_BAD_REPETITION: %s\n", flag(R_BAD_REPETITION) ? "T" : "F");
36 fprintf(fp, "R_POOR_MATCH: %s\n", flag(R_POOR_MATCH) ? "T" : "F");
37 fprintf(fp, "R_NOT_TESS_ACCEPTED: %s\n",
38 flag(R_NOT_TESS_ACCEPTED) ? "T" : "F");
39 fprintf(fp, "R_CONTAINS_BLANKS: %s\n", flag(R_CONTAINS_BLANKS) ? "T" : "F");
40 fprintf(fp, "R_BAD_PERMUTER: %s\n", flag(R_BAD_PERMUTER) ? "T" : "F");
41 fprintf(fp, "R_HYPHEN: %s\n", flag(R_HYPHEN) ? "T" : "F");
42 fprintf(fp, "R_DUBIOUS: %s\n", flag(R_DUBIOUS) ? "T" : "F");
43 fprintf(fp, "R_NO_ALPHANUMS: %s\n", flag(R_NO_ALPHANUMS) ? "T" : "F");
44 fprintf(fp, "R_MOSTLY_REJ: %s\n", flag(R_MOSTLY_REJ) ? "T" : "F");
45 fprintf(fp, "R_XHT_FIXUP: %s\n", flag(R_XHT_FIXUP) ? "T" : "F");
46 fprintf(fp, "R_BAD_QUALITY: %s\n", flag(R_BAD_QUALITY) ? "T" : "F");
47 fprintf(fp, "R_DOC_REJ: %s\n", flag(R_DOC_REJ) ? "T" : "F");
48 fprintf(fp, "R_BLOCK_REJ: %s\n", flag(R_BLOCK_REJ) ? "T" : "F");
49 fprintf(fp, "R_ROW_REJ: %s\n", flag(R_ROW_REJ) ? "T" : "F");
50 fprintf(fp, "R_UNLV_REJ: %s\n", flag(R_UNLV_REJ) ? "T" : "F");
51 fprintf(fp, "R_HYPHEN_ACCEPT: %s\n", flag(R_HYPHEN_ACCEPT) ? "T" : "F");
52 fprintf(fp, "R_NN_ACCEPT: %s\n", flag(R_NN_ACCEPT) ? "T" : "F");
53 fprintf(fp, "R_MM_ACCEPT: %s\n", flag(R_MM_ACCEPT) ? "T" : "F");
54 fprintf(fp, "R_QUALITY_ACCEPT: %s\n", flag(R_QUALITY_ACCEPT) ? "T" : "F");
55 fprintf(fp, "R_MINIMAL_REJ_ACCEPT: %s\n",
56 flag(R_MINIMAL_REJ_ACCEPT) ? "T" : "F");
57}
@ R_MINIMAL_REJ_ACCEPT
Definition: rejctmap.h:89
@ R_ROW_REJ
Definition: rejctmap.h:81
@ R_NO_ALPHANUMS
Definition: rejctmap.h:71
@ R_TESS_FAILURE
Definition: rejctmap.h:53
@ R_QUALITY_ACCEPT
Definition: rejctmap.h:88
@ R_DOC_REJ
Definition: rejctmap.h:79
@ R_MM_ACCEPT
Definition: rejctmap.h:87
@ R_MOSTLY_REJ
Definition: rejctmap.h:72
@ R_XHT_FIXUP
Definition: rejctmap.h:73
@ R_SMALL_XHT
Definition: rejctmap.h:54
@ R_BAD_REPETITION
Definition: rejctmap.h:60
@ R_BLOCK_REJ
Definition: rejctmap.h:80
@ R_HYPHEN_ACCEPT
Definition: rejctmap.h:86
@ R_HYPHEN
Definition: rejctmap.h:69
@ R_POSTNN_1IL
Definition: rejctmap.h:57
@ R_REJ_CBLOB
Definition: rejctmap.h:58
@ R_BAD_QUALITY
Definition: rejctmap.h:76
@ R_UNLV_REJ
Definition: rejctmap.h:82
@ R_NN_ACCEPT
Definition: rejctmap.h:85
@ R_DUBIOUS
Definition: rejctmap.h:70
@ R_MM_REJECT
Definition: rejctmap.h:59
@ R_1IL_CONFLICT
Definition: rejctmap.h:56
@ R_EDGE_CHAR
Definition: rejctmap.h:55

◆ operator=()

REJ & tesseract::REJ::operator= ( const REJ source)
default

◆ perm_rejected()

bool tesseract::REJ::perm_rejected ( ) const
inline

Definition at line 133 of file rejctmap.h.

133 { // Is char perm reject?
137 }

◆ recoverable()

bool tesseract::REJ::recoverable ( ) const
inline

Definition at line 303 of file rejctmap.h.

303 {
304 return (rejected() && !perm_rejected());
305 }

◆ rejected()

bool tesseract::REJ::rejected ( ) const
inline

Definition at line 171 of file rejctmap.h.

171 { // Is char rejected?
173 return false;
174 } else {
175 return (perm_rejected() || rej_between_quality_and_minimal_rej_accept() ||
176 (!flag(R_QUALITY_ACCEPT) && rej_before_quality_accept()));
177 }
178 }

◆ setrej_1Il_conflict()

void tesseract::REJ::setrej_1Il_conflict ( )
inline

Definition at line 200 of file rejctmap.h.

200 { // Initial reject map
201 set_flag(R_1IL_CONFLICT);
202 }

◆ setrej_bad_permuter()

void tesseract::REJ::setrej_bad_permuter ( )
inline

Definition at line 234 of file rejctmap.h.

234 { // POTENTIAL reject_word
235 set_flag(R_BAD_PERMUTER);
236 }

◆ setrej_bad_quality()

void tesseract::REJ::setrej_bad_quality ( )
inline

Definition at line 258 of file rejctmap.h.

258 { // TEMP reject_word
259 set_flag(R_BAD_QUALITY);
260 }

◆ setrej_bad_repetition()

void tesseract::REJ::setrej_bad_repetition ( )
inline

Definition at line 216 of file rejctmap.h.

216 { // Odd repeated char
217 set_flag(R_BAD_REPETITION);
218 }

◆ setrej_block_rej()

void tesseract::REJ::setrej_block_rej ( )
inline

Definition at line 266 of file rejctmap.h.

266 { // TEMP reject_word
267 set_flag(R_BLOCK_REJ);
268 }

◆ setrej_contains_blanks()

void tesseract::REJ::setrej_contains_blanks ( )
inline

Definition at line 229 of file rejctmap.h.

229 {
230 // TEMP reject_word
231 set_flag(R_CONTAINS_BLANKS);
232 }

◆ setrej_doc_rej()

void tesseract::REJ::setrej_doc_rej ( )
inline

Definition at line 262 of file rejctmap.h.

262 { // TEMP reject_word
263 set_flag(R_DOC_REJ);
264 }

◆ setrej_dubious()

void tesseract::REJ::setrej_dubious ( )
inline

Definition at line 242 of file rejctmap.h.

242 { // PostNN dubious limit
243 set_flag(R_DUBIOUS);
244 }

◆ setrej_edge_char()

void tesseract::REJ::setrej_edge_char ( )
inline

Definition at line 196 of file rejctmap.h.

196 { // Close to image edge
197 set_flag(R_EDGE_CHAR);
198 }

◆ setrej_hyphen()

void tesseract::REJ::setrej_hyphen ( )
inline

Definition at line 238 of file rejctmap.h.

238 { // PostNN dubious hyphen or .
239 set_flag(R_HYPHEN);
240 }

◆ setrej_hyphen_accept()

void tesseract::REJ::setrej_hyphen_accept ( )
inline

Definition at line 278 of file rejctmap.h.

278 { // NN Flipped a char
279 set_flag(R_HYPHEN_ACCEPT);
280 }

◆ setrej_minimal_rej_accept()

void tesseract::REJ::setrej_minimal_rej_accept ( )
inline

Definition at line 294 of file rejctmap.h.

294 {
295 // Accept all except blank
296 set_flag(R_MINIMAL_REJ_ACCEPT);
297 }

◆ setrej_mm_accept()

void tesseract::REJ::setrej_mm_accept ( )
inline

Definition at line 286 of file rejctmap.h.

286 { // Matrix matcher
287 set_flag(R_MM_ACCEPT);
288 }

◆ setrej_mm_reject()

void tesseract::REJ::setrej_mm_reject ( )
inline

Definition at line 212 of file rejctmap.h.

212 { // Matrix matcher
213 set_flag(R_MM_REJECT);
214 }

◆ setrej_mostly_rej()

void tesseract::REJ::setrej_mostly_rej ( )
inline

Definition at line 250 of file rejctmap.h.

250 { // TEMP reject_word
251 set_flag(R_MOSTLY_REJ);
252 }

◆ setrej_nn_accept()

void tesseract::REJ::setrej_nn_accept ( )
inline

Definition at line 282 of file rejctmap.h.

282 { // NN Flipped a char
283 set_flag(R_NN_ACCEPT);
284 }

◆ setrej_no_alphanums()

void tesseract::REJ::setrej_no_alphanums ( )
inline

Definition at line 246 of file rejctmap.h.

246 { // TEMP reject_word
247 set_flag(R_NO_ALPHANUMS);
248 }

◆ setrej_not_tess_accepted()

void tesseract::REJ::setrej_not_tess_accepted ( )
inline

Definition at line 224 of file rejctmap.h.

224 {
225 // TEMP reject_word
226 set_flag(R_NOT_TESS_ACCEPTED);
227 }

◆ setrej_poor_match()

void tesseract::REJ::setrej_poor_match ( )
inline

Definition at line 220 of file rejctmap.h.

220 { // Failed Rays heuristic
221 set_flag(R_POOR_MATCH);
222 }

◆ setrej_postNN_1Il()

void tesseract::REJ::setrej_postNN_1Il ( )
inline

Definition at line 204 of file rejctmap.h.

204 { // 1Il after NN
205 set_flag(R_POSTNN_1IL);
206 }

◆ setrej_quality_accept()

void tesseract::REJ::setrej_quality_accept ( )
inline

Definition at line 290 of file rejctmap.h.

290 { // Quality flip a char
291 set_flag(R_QUALITY_ACCEPT);
292 }

◆ setrej_rej_cblob()

void tesseract::REJ::setrej_rej_cblob ( )
inline

Definition at line 208 of file rejctmap.h.

208 { // Insert duff blob
209 set_flag(R_REJ_CBLOB);
210 }

◆ setrej_row_rej()

void tesseract::REJ::setrej_row_rej ( )
inline

Definition at line 270 of file rejctmap.h.

270 { // TEMP reject_word
271 set_flag(R_ROW_REJ);
272 }

◆ setrej_small_xht()

void tesseract::REJ::setrej_small_xht ( )
inline

Definition at line 192 of file rejctmap.h.

192 { // Small xht char/wd
193 set_flag(R_SMALL_XHT);
194 }

◆ setrej_tess_failure()

void tesseract::REJ::setrej_tess_failure ( )
inline

Definition at line 188 of file rejctmap.h.

188 { // Tess generated blank
189 set_flag(R_TESS_FAILURE);
190 }

◆ setrej_unlv_rej()

void tesseract::REJ::setrej_unlv_rej ( )
inline

Definition at line 274 of file rejctmap.h.

274 { // TEMP reject_word
275 set_flag(R_UNLV_REJ);
276 }

◆ setrej_xht_fixup()

void tesseract::REJ::setrej_xht_fixup ( )
inline

Definition at line 254 of file rejctmap.h.

254 { // xht fixup
255 set_flag(R_XHT_FIXUP);
256 }

The documentation for this class was generated from the following files: