Tesseract  3.02
REJMAP Class Reference

#include <rejctmap.h>

List of all members.

Public Member Functions

 REJMAP ()
 REJMAP (const REJMAP &rejmap)
REJMAPoperator= (const REJMAP &source)
 ~REJMAP ()
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 206 of file rejctmap.h.


Constructor & Destructor Documentation

REJMAP::REJMAP ( ) [inline]

Definition at line 212 of file rejctmap.h.

             {  //constructor
      ptr = NULL;
      len = 0;
    }
REJMAP::REJMAP ( const REJMAP rejmap)

Definition at line 281 of file rejctmap.cpp.

                                     {
  REJ *to;
  REJ *from = source.ptr;
  int i;

  len = source.length ();

  if (len > 0) {
    ptr = (REJ *) alloc_struct (len * sizeof (REJ), "REJ");
    to = ptr;
    for (i = 0; i < len; i++) {
      *to = *from;
      to++;
      from++;
    }
  }
  else
    ptr = NULL;
}
REJMAP::~REJMAP ( ) [inline]

Definition at line 223 of file rejctmap.h.

               {                 //destructor
      if (ptr != NULL)
        free_struct (ptr, len * sizeof (REJ), "REJ");
    }

Member Function Documentation

inT16 REJMAP::accept_count ( )

Definition at line 337 of file rejctmap.cpp.

                           {  //How many accepted?
  int i;
  inT16 count = 0;

  for (i = 0; i < len; i++) {
    if (ptr[i].accepted ())
      count++;
  }
  return count;
}
void REJMAP::full_print ( FILE *  fp)

Definition at line 412 of file rejctmap.cpp.

                                {
  int i;

  for (i = 0; i < len; i++) {
    ptr[i].full_print (fp);
    fprintf (fp, "\n");
  }
}
void REJMAP::initialise ( inT16  length)

Definition at line 324 of file rejctmap.cpp.

                                      {
  if (ptr != NULL)
    free_struct (ptr, len * sizeof (REJ), "REJ");
  len = length;
  if (len > 0)
    ptr = (REJ *) memset (alloc_struct (len * sizeof (REJ), "REJ"),
      0, len * sizeof (REJ));
  else
    ptr = NULL;
}
inT32 REJMAP::length ( ) const [inline]

Definition at line 238 of file rejctmap.h.

                         {  //map length
      return len;
    }
REJMAP & REJMAP::operator= ( const REJMAP source)

Definition at line 303 of file rejctmap.cpp.

  {
  REJ *
    to;
  REJ *
    from = source.ptr;
  int
    i;

  initialise (source.len);
  to = ptr;
  for (i = 0; i < len; i++) {
    *to = *from;
    to++;
    from++;
  }
  return *this;
}
REJ& REJMAP::operator[] ( inT16  index) const [inline]

Definition at line 231 of file rejctmap.h.

    {
      ASSERT_HOST (index < len);
      return ptr[index];         //no bounds checks
    }
void REJMAP::print ( FILE *  fp)

Definition at line 400 of file rejctmap.cpp.

                           {
  int i;
  char buff[512];

  for (i = 0; i < len; i++) {
    buff[i] = ptr[i].display_char ();
  }
  buff[i] = '\0';
  fprintf (fp, "\"%s\"", buff);
}
BOOL8 REJMAP::quality_recoverable_rejects ( )

Definition at line 360 of file rejctmap.cpp.

                                          {  //Any potential rejs?
  int i;

  for (i = 0; i < len; i++) {
    if (ptr[i].accept_if_good_quality ())
      return TRUE;
  }
  return FALSE;
}
BOOL8 REJMAP::recoverable_rejects ( )

Definition at line 349 of file rejctmap.cpp.

                                  {  //Any non perm rejs?
  int i;

  for (i = 0; i < len; i++) {
    if (ptr[i].recoverable ())
      return TRUE;
  }
  return FALSE;
}
void REJMAP::rej_word_bad_permuter ( )

Definition at line 458 of file rejctmap.cpp.

                                   {  //Reject whole word
  int i;

  for (i = 0; i < len; i++) {
    if (ptr[i].accepted()) ptr[i].setrej_bad_permuter ();
  }
}
void REJMAP::rej_word_bad_quality ( )

Definition at line 494 of file rejctmap.cpp.

                                  {  //Reject whole word
  int i;

  for (i = 0; i < len; i++) {
    if (ptr[i].accepted()) ptr[i].setrej_bad_quality();
  }
}
void REJMAP::rej_word_block_rej ( )

Definition at line 512 of file rejctmap.cpp.

                                {  //Reject whole word
  int i;

  for (i = 0; i < len; i++) {
    if (ptr[i].accepted()) ptr[i].setrej_block_rej();
  }
}
void REJMAP::rej_word_contains_blanks ( )

Definition at line 449 of file rejctmap.cpp.

                                      {  //Reject whole word
  int i;

  for (i = 0; i < len; i++) {
    if (ptr[i].accepted()) ptr[i].setrej_contains_blanks();
  }
}
void REJMAP::rej_word_doc_rej ( )

Definition at line 503 of file rejctmap.cpp.

                              {  //Reject whole word
  int i;

  for (i = 0; i < len; i++) {
    if (ptr[i].accepted()) ptr[i].setrej_doc_rej();
  }
}
void REJMAP::rej_word_mostly_rej ( )

Definition at line 485 of file rejctmap.cpp.

                                 {  //Reject whole word
  int i;

  for (i = 0; i < len; i++) {
    if (ptr[i].accepted()) ptr[i].setrej_mostly_rej();
  }
}
void REJMAP::rej_word_no_alphanums ( )

Definition at line 476 of file rejctmap.cpp.

                                   {  //Reject whole word
  int i;

  for (i = 0; i < len; i++) {
    if (ptr[i].accepted()) ptr[i].setrej_no_alphanums();
  }
}
void REJMAP::rej_word_not_tess_accepted ( )

Definition at line 440 of file rejctmap.cpp.

                                        {  //Reject whole word
  int i;

  for (i = 0; i < len; i++) {
    if (ptr[i].accepted()) ptr[i].setrej_not_tess_accepted();
  }
}
void REJMAP::rej_word_row_rej ( )

Definition at line 521 of file rejctmap.cpp.

                              {  //Reject whole word
  int i;

  for (i = 0; i < len; i++) {
    if (ptr[i].accepted()) ptr[i].setrej_row_rej();
  }
}
void REJMAP::rej_word_small_xht ( )

Definition at line 422 of file rejctmap.cpp.

                                {  //Reject whole word
  int i;

  for (i = 0; i < len; i++) {
    ptr[i].setrej_small_xht ();
  }
}
void REJMAP::rej_word_tess_failure ( )

Definition at line 431 of file rejctmap.cpp.

                                   {  //Reject whole word
  int i;

  for (i = 0; i < len; i++) {
    ptr[i].setrej_tess_failure ();
  }
}
void REJMAP::rej_word_xht_fixup ( )

Definition at line 467 of file rejctmap.cpp.

                                {  //Reject whole word
  int i;

  for (i = 0; i < len; i++) {
    if (ptr[i].accepted()) ptr[i].setrej_xht_fixup();
  }
}
inT16 REJMAP::reject_count ( ) [inline]

Definition at line 244 of file rejctmap.h.

                         {  //How many rejects?
      return len - accept_count ();
    }
void REJMAP::remove_pos ( inT16  pos)

Definition at line 371 of file rejctmap.cpp.

                         {
  REJ *new_ptr;                  //new, smaller map
  int i;

  ASSERT_HOST (pos >= 0);
  ASSERT_HOST (pos < len);
  ASSERT_HOST (len > 0);

  len--;
  if (len > 0)
    new_ptr = (REJ *) memset (alloc_struct (len * sizeof (REJ), "REJ"),
      0, len * sizeof (REJ));
  else
    new_ptr = NULL;

  for (i = 0; i < pos; i++)
    new_ptr[i] = ptr[i];         //copy pre pos

  for (; pos < len; pos++)
    new_ptr[pos] = ptr[pos + 1]; //copy post pos

                                 //delete old map
  free_struct (ptr, (len + 1) * sizeof (REJ), "REJ");
  ptr = new_ptr;
}

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