tesseract  4.1.1
REJMAP Class Reference

#include <rejctmap.h>

Public Member Functions

 REJMAP ()
 
 REJMAP (const REJMAP &rejmap)
 
REJMAPoperator= (const REJMAP &source)
 
void initialise (int16_t length)
 
REJoperator[] (int16_t index) const
 
int32_t length () const
 
int16_t accept_count ()
 
int16_t reject_count ()
 
void remove_pos (int16_t pos)
 
void print (FILE *fp)
 
void full_print (FILE *fp)
 
bool recoverable_rejects ()
 
bool quality_recoverable_rejects ()
 
void rej_word_small_xht ()
 
void rej_word_tess_failure ()
 
void rej_word_not_tess_accepted ()
 
void rej_word_contains_blanks ()
 
void rej_word_bad_permuter ()
 
void rej_word_xht_fixup ()
 
void rej_word_no_alphanums ()
 
void rej_word_mostly_rej ()
 
void rej_word_bad_quality ()
 
void rej_word_doc_rej ()
 
void rej_word_block_rej ()
 
void rej_word_row_rej ()
 

Detailed Description

Definition at line 201 of file rejctmap.h.

Constructor & Destructor Documentation

◆ REJMAP() [1/2]

REJMAP::REJMAP ( )
inline

Definition at line 207 of file rejctmap.h.

207 : len(0) {}

◆ REJMAP() [2/2]

REJMAP::REJMAP ( const REJMAP rejmap)
inline

Definition at line 209 of file rejctmap.h.

209 { *this = rejmap; }

Member Function Documentation

◆ accept_count()

int16_t REJMAP::accept_count ( )

Definition at line 279 of file rejctmap.cpp.

279  { //How many accepted?
280  int i;
281  int16_t count = 0;
282 
283  for (i = 0; i < len; i++) {
284  if (ptr[i].accepted ())
285  count++;
286  }
287  return count;
288 }
int count(LIST var_list)
Definition: oldlist.cpp:95

◆ full_print()

void REJMAP::full_print ( FILE *  fp)

Definition at line 333 of file rejctmap.cpp.

333  {
334  int i;
335 
336  for (i = 0; i < len; i++) {
337  ptr[i].full_print (fp);
338  fprintf (fp, "\n");
339  }
340 }

◆ initialise()

void REJMAP::initialise ( int16_t  length)

Definition at line 273 of file rejctmap.cpp.

273  {
274  ptr.reset(new REJ[length]);
275  len = length;
276 }
Definition: rejctmap.h:97
int32_t length() const
Definition: rejctmap.h:223

◆ length()

int32_t REJMAP::length ( ) const
inline

Definition at line 223 of file rejctmap.h.

223  { //map length
224  return len;
225  }

◆ operator=()

REJMAP & REJMAP::operator= ( const REJMAP source)

Definition at line 265 of file rejctmap.cpp.

265  {
266  initialise(source.len);
267  for (int i = 0; i < len; i++) {
268  ptr[i] = source.ptr[i];
269  }
270  return *this;
271 }
void initialise(int16_t length)
Definition: rejctmap.cpp:273

◆ operator[]()

REJ& REJMAP::operator[] ( int16_t  index) const
inline

Definition at line 216 of file rejctmap.h.

218  {
219  ASSERT_HOST(index < len);
220  return ptr[index]; // no bounds checks
221  }
#define ASSERT_HOST(x)
Definition: errcode.h:88

◆ print()

void REJMAP::print ( FILE *  fp)

Definition at line 321 of file rejctmap.cpp.

321  {
322  int i;
323  char buff[512];
324 
325  for (i = 0; i < len; i++) {
326  buff[i] = ptr[i].display_char ();
327  }
328  buff[i] = '\0';
329  fprintf (fp, "\"%s\"", buff);
330 }

◆ quality_recoverable_rejects()

bool REJMAP::quality_recoverable_rejects ( )

Definition at line 300 of file rejctmap.cpp.

300  { //Any potential rejs?
301  for (int i = 0; i < len; i++) {
302  if (ptr[i].accept_if_good_quality ())
303  return true;
304  }
305  return false;
306 }

◆ recoverable_rejects()

bool REJMAP::recoverable_rejects ( )

Definition at line 291 of file rejctmap.cpp.

291  { //Any non perm rejs?
292  for (int i = 0; i < len; i++) {
293  if (ptr[i].recoverable ())
294  return true;
295  }
296  return false;
297 }

◆ rej_word_bad_permuter()

void REJMAP::rej_word_bad_permuter ( )

Definition at line 379 of file rejctmap.cpp.

379  { //Reject whole word
380  int i;
381 
382  for (i = 0; i < len; i++) {
383  if (ptr[i].accepted()) ptr[i].setrej_bad_permuter ();
384  }
385 }

◆ rej_word_bad_quality()

void REJMAP::rej_word_bad_quality ( )

Definition at line 415 of file rejctmap.cpp.

415  { //Reject whole word
416  int i;
417 
418  for (i = 0; i < len; i++) {
419  if (ptr[i].accepted()) ptr[i].setrej_bad_quality();
420  }
421 }

◆ rej_word_block_rej()

void REJMAP::rej_word_block_rej ( )

Definition at line 433 of file rejctmap.cpp.

433  { //Reject whole word
434  int i;
435 
436  for (i = 0; i < len; i++) {
437  if (ptr[i].accepted()) ptr[i].setrej_block_rej();
438  }
439 }

◆ rej_word_contains_blanks()

void REJMAP::rej_word_contains_blanks ( )

Definition at line 370 of file rejctmap.cpp.

370  { //Reject whole word
371  int i;
372 
373  for (i = 0; i < len; i++) {
374  if (ptr[i].accepted()) ptr[i].setrej_contains_blanks();
375  }
376 }

◆ rej_word_doc_rej()

void REJMAP::rej_word_doc_rej ( )

Definition at line 424 of file rejctmap.cpp.

424  { //Reject whole word
425  int i;
426 
427  for (i = 0; i < len; i++) {
428  if (ptr[i].accepted()) ptr[i].setrej_doc_rej();
429  }
430 }

◆ rej_word_mostly_rej()

void REJMAP::rej_word_mostly_rej ( )

Definition at line 406 of file rejctmap.cpp.

406  { //Reject whole word
407  int i;
408 
409  for (i = 0; i < len; i++) {
410  if (ptr[i].accepted()) ptr[i].setrej_mostly_rej();
411  }
412 }

◆ rej_word_no_alphanums()

void REJMAP::rej_word_no_alphanums ( )

Definition at line 397 of file rejctmap.cpp.

397  { //Reject whole word
398  int i;
399 
400  for (i = 0; i < len; i++) {
401  if (ptr[i].accepted()) ptr[i].setrej_no_alphanums();
402  }
403 }

◆ rej_word_not_tess_accepted()

void REJMAP::rej_word_not_tess_accepted ( )

Definition at line 361 of file rejctmap.cpp.

361  { //Reject whole word
362  int i;
363 
364  for (i = 0; i < len; i++) {
365  if (ptr[i].accepted()) ptr[i].setrej_not_tess_accepted();
366  }
367 }

◆ rej_word_row_rej()

void REJMAP::rej_word_row_rej ( )

Definition at line 442 of file rejctmap.cpp.

442  { //Reject whole word
443  int i;
444 
445  for (i = 0; i < len; i++) {
446  if (ptr[i].accepted()) ptr[i].setrej_row_rej();
447  }
448 }

◆ rej_word_small_xht()

void REJMAP::rej_word_small_xht ( )

Definition at line 343 of file rejctmap.cpp.

343  { //Reject whole word
344  int i;
345 
346  for (i = 0; i < len; i++) {
347  ptr[i].setrej_small_xht ();
348  }
349 }

◆ rej_word_tess_failure()

void REJMAP::rej_word_tess_failure ( )

Definition at line 352 of file rejctmap.cpp.

352  { //Reject whole word
353  int i;
354 
355  for (i = 0; i < len; i++) {
356  ptr[i].setrej_tess_failure ();
357  }
358 }

◆ rej_word_xht_fixup()

void REJMAP::rej_word_xht_fixup ( )

Definition at line 388 of file rejctmap.cpp.

388  { //Reject whole word
389  int i;
390 
391  for (i = 0; i < len; i++) {
392  if (ptr[i].accepted()) ptr[i].setrej_xht_fixup();
393  }
394 }

◆ reject_count()

int16_t REJMAP::reject_count ( )
inline

Definition at line 229 of file rejctmap.h.

229  { //How many rejects?
230  return len - accept_count ();
231  }
int16_t accept_count()
Definition: rejctmap.cpp:279

◆ remove_pos()

void REJMAP::remove_pos ( int16_t  pos)

Definition at line 309 of file rejctmap.cpp.

311  {
312  ASSERT_HOST (pos >= 0);
313  ASSERT_HOST (pos < len);
314  ASSERT_HOST (len > 0);
315 
316  len--;
317  for (; pos < len; pos++) ptr[pos] = ptr[pos + 1];
318 }
#define ASSERT_HOST(x)
Definition: errcode.h:88

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