tesseract  4.0.0-1-g2a2b
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 281 of file rejctmap.cpp.

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

◆ full_print()

void REJMAP::full_print ( FILE *  fp)

Definition at line 335 of file rejctmap.cpp.

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

◆ initialise()

void REJMAP::initialise ( int16_t  length)

Definition at line 275 of file rejctmap.cpp.

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

◆ 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 267 of file rejctmap.cpp.

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

◆ 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:84

◆ print()

void REJMAP::print ( FILE *  fp)

Definition at line 323 of file rejctmap.cpp.

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

◆ quality_recoverable_rejects()

bool REJMAP::quality_recoverable_rejects ( )

Definition at line 302 of file rejctmap.cpp.

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

◆ recoverable_rejects()

bool REJMAP::recoverable_rejects ( )

Definition at line 293 of file rejctmap.cpp.

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

◆ rej_word_bad_permuter()

void REJMAP::rej_word_bad_permuter ( )

Definition at line 381 of file rejctmap.cpp.

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

◆ rej_word_bad_quality()

void REJMAP::rej_word_bad_quality ( )

Definition at line 417 of file rejctmap.cpp.

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

◆ rej_word_block_rej()

void REJMAP::rej_word_block_rej ( )

Definition at line 435 of file rejctmap.cpp.

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

◆ rej_word_contains_blanks()

void REJMAP::rej_word_contains_blanks ( )

Definition at line 372 of file rejctmap.cpp.

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

◆ rej_word_doc_rej()

void REJMAP::rej_word_doc_rej ( )

Definition at line 426 of file rejctmap.cpp.

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

◆ rej_word_mostly_rej()

void REJMAP::rej_word_mostly_rej ( )

Definition at line 408 of file rejctmap.cpp.

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

◆ rej_word_no_alphanums()

void REJMAP::rej_word_no_alphanums ( )

Definition at line 399 of file rejctmap.cpp.

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

◆ rej_word_not_tess_accepted()

void REJMAP::rej_word_not_tess_accepted ( )

Definition at line 363 of file rejctmap.cpp.

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

◆ rej_word_row_rej()

void REJMAP::rej_word_row_rej ( )

Definition at line 444 of file rejctmap.cpp.

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

◆ rej_word_small_xht()

void REJMAP::rej_word_small_xht ( )

Definition at line 345 of file rejctmap.cpp.

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

◆ rej_word_tess_failure()

void REJMAP::rej_word_tess_failure ( )

Definition at line 354 of file rejctmap.cpp.

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

◆ rej_word_xht_fixup()

void REJMAP::rej_word_xht_fixup ( )

Definition at line 390 of file rejctmap.cpp.

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

◆ 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:281

◆ remove_pos()

void REJMAP::remove_pos ( int16_t  pos)

Definition at line 311 of file rejctmap.cpp.

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

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