tesseract  4.00.00dev
REJMAP Class Reference

#include <rejctmap.h>

Public Member Functions

 REJMAP ()
 
 REJMAP (const REJMAP &rejmap)
 
REJMAPoperator= (const REJMAP &source)
 
void initialise (inT16 length)
 
REJoperator[] (inT16 index) const
 
inT32 length () const
 
inT16 accept_count ()
 
inT16 reject_count ()
 
void remove_pos (inT16 pos)
 
void print (FILE *fp)
 
void full_print (FILE *fp)
 
BOOL8 recoverable_rejects ()
 
BOOL8 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 204 of file rejctmap.h.

Constructor & Destructor Documentation

◆ REJMAP() [1/2]

REJMAP::REJMAP ( )
inline

Definition at line 210 of file rejctmap.h.

210 : len(0) {}

◆ REJMAP() [2/2]

REJMAP::REJMAP ( const REJMAP rejmap)
inline

Definition at line 212 of file rejctmap.h.

212 { *this = rejmap; }

Member Function Documentation

◆ accept_count()

inT16 REJMAP::accept_count ( )

Definition at line 281 of file rejctmap.cpp.

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

◆ full_print()

void REJMAP::full_print ( FILE *  fp)

Definition at line 339 of file rejctmap.cpp.

339  {
340  int i;
341 
342  for (i = 0; i < len; i++) {
343  ptr[i].full_print (fp);
344  fprintf (fp, "\n");
345  }
346 }

◆ initialise()

void REJMAP::initialise ( inT16  length)

Definition at line 275 of file rejctmap.cpp.

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

◆ length()

inT32 REJMAP::length ( ) const
inline

Definition at line 226 of file rejctmap.h.

226  { //map length
227  return len;
228  }

◆ 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 length)
Definition: rejctmap.cpp:275

◆ operator[]()

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

Definition at line 219 of file rejctmap.h.

221  {
222  ASSERT_HOST(index < len);
223  return ptr[index]; // no bounds checks
224  }
#define ASSERT_HOST(x)
Definition: errcode.h:84

◆ print()

void REJMAP::print ( FILE *  fp)

Definition at line 327 of file rejctmap.cpp.

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

◆ quality_recoverable_rejects()

BOOL8 REJMAP::quality_recoverable_rejects ( )

Definition at line 304 of file rejctmap.cpp.

304  { //Any potential rejs?
305  int i;
306 
307  for (i = 0; i < len; i++) {
308  if (ptr[i].accept_if_good_quality ())
309  return TRUE;
310  }
311  return FALSE;
312 }
#define TRUE
Definition: capi.h:45
#define FALSE
Definition: capi.h:46

◆ recoverable_rejects()

BOOL8 REJMAP::recoverable_rejects ( )

Definition at line 293 of file rejctmap.cpp.

293  { //Any non perm rejs?
294  int i;
295 
296  for (i = 0; i < len; i++) {
297  if (ptr[i].recoverable ())
298  return TRUE;
299  }
300  return FALSE;
301 }
#define TRUE
Definition: capi.h:45
#define FALSE
Definition: capi.h:46

◆ rej_word_bad_permuter()

void REJMAP::rej_word_bad_permuter ( )

Definition at line 385 of file rejctmap.cpp.

385  { //Reject whole word
386  int i;
387 
388  for (i = 0; i < len; i++) {
389  if (ptr[i].accepted()) ptr[i].setrej_bad_permuter ();
390  }
391 }

◆ rej_word_bad_quality()

void REJMAP::rej_word_bad_quality ( )

Definition at line 421 of file rejctmap.cpp.

421  { //Reject whole word
422  int i;
423 
424  for (i = 0; i < len; i++) {
425  if (ptr[i].accepted()) ptr[i].setrej_bad_quality();
426  }
427 }

◆ rej_word_block_rej()

void REJMAP::rej_word_block_rej ( )

Definition at line 439 of file rejctmap.cpp.

439  { //Reject whole word
440  int i;
441 
442  for (i = 0; i < len; i++) {
443  if (ptr[i].accepted()) ptr[i].setrej_block_rej();
444  }
445 }

◆ rej_word_contains_blanks()

void REJMAP::rej_word_contains_blanks ( )

Definition at line 376 of file rejctmap.cpp.

376  { //Reject whole word
377  int i;
378 
379  for (i = 0; i < len; i++) {
380  if (ptr[i].accepted()) ptr[i].setrej_contains_blanks();
381  }
382 }

◆ rej_word_doc_rej()

void REJMAP::rej_word_doc_rej ( )

Definition at line 430 of file rejctmap.cpp.

430  { //Reject whole word
431  int i;
432 
433  for (i = 0; i < len; i++) {
434  if (ptr[i].accepted()) ptr[i].setrej_doc_rej();
435  }
436 }

◆ rej_word_mostly_rej()

void REJMAP::rej_word_mostly_rej ( )

Definition at line 412 of file rejctmap.cpp.

412  { //Reject whole word
413  int i;
414 
415  for (i = 0; i < len; i++) {
416  if (ptr[i].accepted()) ptr[i].setrej_mostly_rej();
417  }
418 }

◆ rej_word_no_alphanums()

void REJMAP::rej_word_no_alphanums ( )

Definition at line 403 of file rejctmap.cpp.

403  { //Reject whole word
404  int i;
405 
406  for (i = 0; i < len; i++) {
407  if (ptr[i].accepted()) ptr[i].setrej_no_alphanums();
408  }
409 }

◆ rej_word_not_tess_accepted()

void REJMAP::rej_word_not_tess_accepted ( )

Definition at line 367 of file rejctmap.cpp.

367  { //Reject whole word
368  int i;
369 
370  for (i = 0; i < len; i++) {
371  if (ptr[i].accepted()) ptr[i].setrej_not_tess_accepted();
372  }
373 }

◆ rej_word_row_rej()

void REJMAP::rej_word_row_rej ( )

Definition at line 448 of file rejctmap.cpp.

448  { //Reject whole word
449  int i;
450 
451  for (i = 0; i < len; i++) {
452  if (ptr[i].accepted()) ptr[i].setrej_row_rej();
453  }
454 }

◆ rej_word_small_xht()

void REJMAP::rej_word_small_xht ( )

Definition at line 349 of file rejctmap.cpp.

349  { //Reject whole word
350  int i;
351 
352  for (i = 0; i < len; i++) {
353  ptr[i].setrej_small_xht ();
354  }
355 }

◆ rej_word_tess_failure()

void REJMAP::rej_word_tess_failure ( )

Definition at line 358 of file rejctmap.cpp.

358  { //Reject whole word
359  int i;
360 
361  for (i = 0; i < len; i++) {
362  ptr[i].setrej_tess_failure ();
363  }
364 }

◆ rej_word_xht_fixup()

void REJMAP::rej_word_xht_fixup ( )

Definition at line 394 of file rejctmap.cpp.

394  { //Reject whole word
395  int i;
396 
397  for (i = 0; i < len; i++) {
398  if (ptr[i].accepted()) ptr[i].setrej_xht_fixup();
399  }
400 }

◆ reject_count()

inT16 REJMAP::reject_count ( )
inline

Definition at line 232 of file rejctmap.h.

232  { //How many rejects?
233  return len - accept_count ();
234  }
inT16 accept_count()
Definition: rejctmap.cpp:281

◆ remove_pos()

void REJMAP::remove_pos ( inT16  pos)

Definition at line 315 of file rejctmap.cpp.

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

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