tesseract  3.03
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 205 of file rejctmap.h.


Constructor & Destructor Documentation

REJMAP::REJMAP ( ) [inline]

Definition at line 211 of file rejctmap.h.

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

Definition at line 279 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 222 of file rejctmap.h.

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

Member Function Documentation

Definition at line 335 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 410 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 322 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 237 of file rejctmap.h.

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

Definition at line 301 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 230 of file rejctmap.h.

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

Definition at line 398 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);
}

Definition at line 358 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;
}

Definition at line 347 of file rejctmap.cpp.

                                  {  //Any non perm rejs?
  int i;

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

Definition at line 456 of file rejctmap.cpp.

                                   {  //Reject whole word
  int i;

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

Definition at line 492 of file rejctmap.cpp.

                                  {  //Reject whole word
  int i;

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

Definition at line 510 of file rejctmap.cpp.

                                {  //Reject whole word
  int i;

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

Definition at line 447 of file rejctmap.cpp.

                                      {  //Reject whole word
  int i;

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

Definition at line 501 of file rejctmap.cpp.

                              {  //Reject whole word
  int i;

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

Definition at line 483 of file rejctmap.cpp.

                                 {  //Reject whole word
  int i;

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

Definition at line 474 of file rejctmap.cpp.

                                   {  //Reject whole word
  int i;

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

Definition at line 438 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();
  }
}

Definition at line 519 of file rejctmap.cpp.

                              {  //Reject whole word
  int i;

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

Definition at line 420 of file rejctmap.cpp.

                                {  //Reject whole word
  int i;

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

Definition at line 429 of file rejctmap.cpp.

                                   {  //Reject whole word
  int i;

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

Definition at line 465 of file rejctmap.cpp.

                                {  //Reject whole word
  int i;

  for (i = 0; i < len; i++) {
    if (ptr[i].accepted()) ptr[i].setrej_xht_fixup();
  }
}

Definition at line 243 of file rejctmap.h.

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

Definition at line 369 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:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines