REJ Class Reference

#include <rejctmap.h>

List of all members.


Detailed Description

ALL processing of the reject map is done here.

This module may look unneccessarily verbose, but here's the philosophy...

ALL processing of the reject map is done in this module. There are lots of separate calls to set reject/accept flags. These have DELIBERATELY been kept distinct so that this module can decide what to do.

IT IS FUNDAMENTAL THAT ANYONE HACKING THIS CODE UNDERSTANDS THE SIGNIFICANCE OF THIS IMPLIED TEMPORAL ORDERING OF THE FLAGS!!!!

See REJ_FLAGS

Definition at line 124 of file rejctmap.h.

Public Member Functions

Private Member Functions

Private Attributes


Constructor & Destructor Documentation

REJ::REJ (  )  [inline]

Definition at line 144 of file rejctmap.h.

00144           {  //constructor
00145     }

REJ::REJ ( const REJ source  )  [inline]

Definition at line 147 of file rejctmap.h.

References flags1, and flags2.

00148                            {
00149       flags1 = source.flags1;
00150       flags2 = source.flags2;
00151     }


Member Function Documentation

BOOL8 REJ::accept_if_good_quality (  ) 

potential rej?

Definition at line 116 of file rejctmap.cpp.

References flag(), perm_rejected(), R_BAD_PERMUTER, R_CONTAINS_BLANKS, R_NOT_TESS_ACCEPTED, R_POOR_MATCH, rej_between_mm_and_quality_accept(), rej_between_nn_and_mm(), rej_between_quality_and_minimal_rej_accept(), and rejected().

Referenced by display_char().

00116                                   {
00117   return (rejected () &&
00118     !perm_rejected () &&
00119     flag (R_BAD_PERMUTER) &&
00120     !flag (R_POOR_MATCH) &&
00121     !flag (R_NOT_TESS_ACCEPTED) &&
00122     !flag (R_CONTAINS_BLANKS) &&
00123     (rejmap_allow_more_good_qual ||
00124     (!rej_between_nn_and_mm () &&
00125     !rej_between_mm_and_quality_accept () &&
00126     !rej_between_quality_and_minimal_rej_accept ())));
00127 }

BOOL8 REJ::accepted (  )  [inline]

Definition at line 182 of file rejctmap.h.

References rejected().

00182                      {  //Is char accepted?
00183       return !rejected ();
00184     }

char REJ::display_char (  )  [inline]

Definition at line 167 of file rejctmap.h.

References accept_if_good_quality(), MAP_ACCEPT, MAP_REJECT_PERM, MAP_REJECT_POTENTIAL, MAP_REJECT_TEMP, perm_rejected(), and rejected().

00167                         { 
00168       if (perm_rejected ())
00169         return MAP_REJECT_PERM;
00170       else if (accept_if_good_quality ())
00171         return MAP_REJECT_POTENTIAL;
00172       else if (rejected ())
00173         return MAP_REJECT_TEMP;
00174       else
00175         return MAP_ACCEPT;
00176     }

BOOL8 REJ::flag ( REJ_FLAGS  rej_flag  )  [inline]

Definition at line 160 of file rejctmap.h.

References BITS16::bit(), flags1, and flags2.

Referenced by accept_if_good_quality(), full_print(), perm_rejected(), rej_before_mm_accept(), rej_before_nn_accept(), rej_before_quality_accept(), rej_between_mm_and_quality_accept(), rej_between_nn_and_mm(), rej_between_quality_and_minimal_rej_accept(), and rejected().

00160                                    { 
00161       if (rej_flag < 16)
00162         return flags1.bit (rej_flag);
00163       else
00164         return flags2.bit (rej_flag - 16);
00165     }

void REJ::full_print ( FILE *  fp  ) 

Dump out everything about rejection to logfile

Definition at line 350 of file rejctmap.cpp.

References flag(), R_1IL_CONFLICT, R_BAD_PERMUTER, R_BAD_QUALITY, R_BAD_REPETITION, R_BLOCK_REJ, R_CONTAINS_BLANKS, R_DOC_REJ, R_DUBIOUS, R_EDGE_CHAR, R_HYPHEN, R_HYPHEN_ACCEPT, R_MINIMAL_REJ_ACCEPT, R_MM_ACCEPT, R_MM_REJECT, R_MOSTLY_REJ, R_NN_ACCEPT, R_NO_ALPHANUMS, R_NOT_TESS_ACCEPTED, R_POOR_MATCH, R_POSTNN_1IL, R_QUALITY_ACCEPT, R_REJ_CBLOB, R_ROW_REJ, R_SMALL_XHT, R_TESS_FAILURE, R_UNLV_REJ, and R_XHT_FIXUP.

00350                              { 
00351   #ifndef SECURE_NAMES
00352 
00353   fprintf (fp, "R_TESS_FAILURE: %s\n", flag (R_TESS_FAILURE) ? "T" : "F");
00354   fprintf (fp, "R_SMALL_XHT: %s\n", flag (R_SMALL_XHT) ? "T" : "F");
00355   fprintf (fp, "R_EDGE_CHAR: %s\n", flag (R_EDGE_CHAR) ? "T" : "F");
00356   fprintf (fp, "R_1IL_CONFLICT: %s\n", flag (R_1IL_CONFLICT) ? "T" : "F");
00357   fprintf (fp, "R_POSTNN_1IL: %s\n", flag (R_POSTNN_1IL) ? "T" : "F");
00358   fprintf (fp, "R_REJ_CBLOB: %s\n", flag (R_REJ_CBLOB) ? "T" : "F");
00359   fprintf (fp, "R_MM_REJECT: %s\n", flag (R_MM_REJECT) ? "T" : "F");
00360   fprintf (fp, "R_BAD_REPETITION: %s\n", flag (R_BAD_REPETITION) ? "T" : "F");
00361   fprintf (fp, "R_POOR_MATCH: %s\n", flag (R_POOR_MATCH) ? "T" : "F");
00362   fprintf (fp, "R_NOT_TESS_ACCEPTED: %s\n",
00363     flag (R_NOT_TESS_ACCEPTED) ? "T" : "F");
00364   fprintf (fp, "R_CONTAINS_BLANKS: %s\n",
00365     flag (R_CONTAINS_BLANKS) ? "T" : "F");
00366   fprintf (fp, "R_BAD_PERMUTER: %s\n", flag (R_BAD_PERMUTER) ? "T" : "F");
00367   fprintf (fp, "R_HYPHEN: %s\n", flag (R_HYPHEN) ? "T" : "F");
00368   fprintf (fp, "R_DUBIOUS: %s\n", flag (R_DUBIOUS) ? "T" : "F");
00369   fprintf (fp, "R_NO_ALPHANUMS: %s\n", flag (R_NO_ALPHANUMS) ? "T" : "F");
00370   fprintf (fp, "R_MOSTLY_REJ: %s\n", flag (R_MOSTLY_REJ) ? "T" : "F");
00371   fprintf (fp, "R_XHT_FIXUP: %s\n", flag (R_XHT_FIXUP) ? "T" : "F");
00372   fprintf (fp, "R_BAD_QUALITY: %s\n", flag (R_BAD_QUALITY) ? "T" : "F");
00373   fprintf (fp, "R_DOC_REJ: %s\n", flag (R_DOC_REJ) ? "T" : "F");
00374   fprintf (fp, "R_BLOCK_REJ: %s\n", flag (R_BLOCK_REJ) ? "T" : "F");
00375   fprintf (fp, "R_ROW_REJ: %s\n", flag (R_ROW_REJ) ? "T" : "F");
00376   fprintf (fp, "R_UNLV_REJ: %s\n", flag (R_UNLV_REJ) ? "T" : "F");
00377   fprintf (fp, "R_HYPHEN_ACCEPT: %s\n", flag (R_HYPHEN_ACCEPT) ? "T" : "F");
00378   fprintf (fp, "R_NN_ACCEPT: %s\n", flag (R_NN_ACCEPT) ? "T" : "F");
00379   fprintf (fp, "R_MM_ACCEPT: %s\n", flag (R_MM_ACCEPT) ? "T" : "F");
00380   fprintf (fp, "R_QUALITY_ACCEPT: %s\n", flag (R_QUALITY_ACCEPT) ? "T" : "F");
00381   fprintf (fp, "R_MINIMAL_REJ_ACCEPT: %s\n",
00382     flag (R_MINIMAL_REJ_ACCEPT) ? "T" : "F");
00383   #endif
00384 }

REJ& REJ::operator= ( const REJ source  )  [inline]

Definition at line 153 of file rejctmap.h.

References flags1, and flags2.

00154                         {        //from this
00155       flags1 = source.flags1;
00156       flags2 = source.flags2;
00157       return *this;
00158     }

BOOL8 REJ::perm_rejected (  ) 

Is char perm reject?

Definition at line 39 of file rejctmap.cpp.

References flag(), R_1IL_CONFLICT, R_BAD_REPETITION, R_EDGE_CHAR, R_MM_REJECT, R_POSTNN_1IL, R_REJ_CBLOB, R_SMALL_XHT, and R_TESS_FAILURE.

Referenced by accept_if_good_quality(), display_char(), recoverable(), and rejected().

00039                          {
00040   return (flag (R_TESS_FAILURE) ||
00041     flag (R_SMALL_XHT) ||
00042     flag (R_EDGE_CHAR) ||
00043     flag (R_1IL_CONFLICT) ||
00044     flag (R_POSTNN_1IL) ||
00045     flag (R_REJ_CBLOB) ||
00046     flag (R_BAD_REPETITION) || flag (R_MM_REJECT));
00047 }

BOOL8 REJ::recoverable (  )  [inline]

Definition at line 189 of file rejctmap.h.

References perm_rejected(), and rejected().

00189                         { 
00190       return (rejected () && !perm_rejected ());
00191     }

BOOL8 REJ::rej_before_mm_accept (  )  [private]

Definition at line 85 of file rejctmap.cpp.

References flag(), R_HYPHEN_ACCEPT, R_NN_ACCEPT, rej_before_nn_accept(), and rej_between_nn_and_mm().

Referenced by rej_before_quality_accept().

00085                                 { 
00086   return rej_between_nn_and_mm () ||
00087     (rej_before_nn_accept () &&
00088     !flag (R_NN_ACCEPT) && !flag (R_HYPHEN_ACCEPT));
00089 }

BOOL8 REJ::rej_before_nn_accept (  )  [private]

Definition at line 52 of file rejctmap.cpp.

References flag(), R_BAD_PERMUTER, R_CONTAINS_BLANKS, R_NOT_TESS_ACCEPTED, and R_POOR_MATCH.

Referenced by rej_before_mm_accept().

00052                                 { 
00053   return flag (R_POOR_MATCH) ||
00054     flag (R_NOT_TESS_ACCEPTED) ||
00055     flag (R_CONTAINS_BLANKS) || flag (R_BAD_PERMUTER);
00056 }

BOOL8 REJ::rej_before_quality_accept (  )  [private]

Definition at line 94 of file rejctmap.cpp.

References flag(), R_MM_ACCEPT, rej_before_mm_accept(), and rej_between_mm_and_quality_accept().

Referenced by rejected().

00094                                      { 
00095   return rej_between_mm_and_quality_accept () ||
00096     (!flag (R_MM_ACCEPT) && rej_before_mm_accept ());
00097 }

BOOL8 REJ::rej_between_mm_and_quality_accept (  )  [private]

Definition at line 70 of file rejctmap.cpp.

References flag(), and R_BAD_QUALITY.

Referenced by accept_if_good_quality(), and rej_before_quality_accept().

00070                                              { 
00071   return flag (R_BAD_QUALITY);
00072 }

BOOL8 REJ::rej_between_nn_and_mm (  )  [private]

Definition at line 61 of file rejctmap.cpp.

References flag(), R_DUBIOUS, R_HYPHEN, R_MOSTLY_REJ, R_NO_ALPHANUMS, and R_XHT_FIXUP.

Referenced by accept_if_good_quality(), and rej_before_mm_accept().

00061                                  { 
00062   return flag (R_HYPHEN) ||
00063     flag (R_DUBIOUS) ||
00064     flag (R_NO_ALPHANUMS) || flag (R_MOSTLY_REJ) || flag (R_XHT_FIXUP);
00065 }

BOOL8 REJ::rej_between_quality_and_minimal_rej_accept (  )  [private]

Definition at line 77 of file rejctmap.cpp.

References flag(), R_BLOCK_REJ, R_DOC_REJ, R_ROW_REJ, and R_UNLV_REJ.

Referenced by accept_if_good_quality(), and rejected().

00077                                                       { 
00078   return flag (R_DOC_REJ) ||
00079     flag (R_BLOCK_REJ) || flag (R_ROW_REJ) || flag (R_UNLV_REJ);
00080 }

BOOL8 REJ::rejected (  ) 

Is char rejected?

Definition at line 103 of file rejctmap.cpp.

References FALSE, flag(), perm_rejected(), R_MINIMAL_REJ_ACCEPT, R_QUALITY_ACCEPT, rej_before_quality_accept(), and rej_between_quality_and_minimal_rej_accept().

Referenced by accept_if_good_quality(), accepted(), display_char(), and recoverable().

00103                     {
00104   if (flag (R_MINIMAL_REJ_ACCEPT))
00105     return FALSE;
00106   else
00107     return (perm_rejected () ||
00108       rej_between_quality_and_minimal_rej_accept () ||
00109       (!flag (R_QUALITY_ACCEPT) && rej_before_quality_accept ()));
00110 }

void REJ::set_flag ( REJ_FLAGS  rej_flag  )  [inline, private]

Definition at line 129 of file rejctmap.h.

References flags1, flags2, and BITS16::turn_on_bit().

Referenced by setrej_1Il_conflict(), setrej_bad_permuter(), setrej_bad_quality(), setrej_bad_repetition(), setrej_block_rej(), setrej_contains_blanks(), setrej_doc_rej(), setrej_dubious(), setrej_edge_char(), setrej_hyphen(), setrej_hyphen_accept(), setrej_minimal_rej_accept(), setrej_mm_accept(), setrej_mm_reject(), setrej_mostly_rej(), setrej_nn_accept(), setrej_no_alphanums(), setrej_not_tess_accepted(), setrej_poor_match(), setrej_postNN_1Il(), setrej_quality_accept(), setrej_rej_cblob(), setrej_row_rej(), setrej_small_xht(), setrej_tess_failure(), setrej_unlv_rej(), and setrej_xht_fixup().

00129                                     { 
00130     if (rej_flag < 16)
00131       flags1.turn_on_bit (rej_flag);
00132     else
00133       flags2.turn_on_bit (rej_flag - 16);
00134   }

void REJ::setrej_1Il_conflict (  ) 

Initial reject map

Definition at line 157 of file rejctmap.cpp.

References R_1IL_CONFLICT, and set_flag().

00157                               {
00158   if (rej_use_1Il_rej)
00159     set_flag(R_1IL_CONFLICT); 
00160 }

void REJ::setrej_bad_permuter (  ) 

POTENTIAL reject_word

Definition at line 222 of file rejctmap.cpp.

References R_BAD_PERMUTER, and set_flag().

00222                               {
00223   set_flag(R_BAD_PERMUTER); 
00224 }

void REJ::setrej_bad_quality (  ) 

TEMP reject_word

Definition at line 270 of file rejctmap.cpp.

References R_BAD_QUALITY, and set_flag().

00270                              {
00271   set_flag(R_BAD_QUALITY); 
00272 }

void REJ::setrej_bad_repetition (  ) 

Odd repeated char

Definition at line 190 of file rejctmap.cpp.

References R_BAD_REPETITION, and set_flag().

00190                                 {
00191   set_flag(R_BAD_REPETITION); 
00192 }

void REJ::setrej_block_rej (  ) 

TEMP reject_word

Definition at line 286 of file rejctmap.cpp.

References R_BLOCK_REJ, and set_flag().

00286                            {
00287   set_flag(R_BLOCK_REJ); 
00288 }

void REJ::setrej_contains_blanks (  ) 

TEMP reject_word

Definition at line 214 of file rejctmap.cpp.

References R_CONTAINS_BLANKS, and set_flag().

00214                                  { 
00215   set_flag(R_CONTAINS_BLANKS); 
00216 }

void REJ::setrej_doc_rej (  ) 

TEMP reject_word

Definition at line 278 of file rejctmap.cpp.

References R_DOC_REJ, and set_flag().

00278                          {
00279   set_flag(R_DOC_REJ); 
00280 }

void REJ::setrej_dubious (  ) 

PostNN dubious limit

Definition at line 238 of file rejctmap.cpp.

References R_DUBIOUS, and set_flag().

00238                          {
00239   set_flag(R_DUBIOUS); 
00240 }

void REJ::setrej_edge_char (  ) 

Close to image edge

Definition at line 149 of file rejctmap.cpp.

References R_EDGE_CHAR, and set_flag().

00149                            {
00150   set_flag(R_EDGE_CHAR); 
00151 }

void REJ::setrej_hyphen (  ) 

PostNN dubious hyphen or .

Definition at line 230 of file rejctmap.cpp.

References R_HYPHEN, and set_flag().

00230                         {
00231   set_flag(R_HYPHEN); 
00232 }

void REJ::setrej_hyphen_accept (  ) 

NN Flipped a char

Definition at line 310 of file rejctmap.cpp.

References R_HYPHEN_ACCEPT, and set_flag().

00310                                {
00311   set_flag(R_HYPHEN_ACCEPT); 
00312 }

void REJ::setrej_minimal_rej_accept (  ) 

Accept all except blank

Definition at line 342 of file rejctmap.cpp.

References R_MINIMAL_REJ_ACCEPT, and set_flag().

00342                                     { 
00343   set_flag(R_MINIMAL_REJ_ACCEPT); 
00344 }

void REJ::setrej_mm_accept (  ) 

Matrix matcher

Definition at line 326 of file rejctmap.cpp.

References R_MM_ACCEPT, and set_flag().

00326                            {
00327   set_flag(R_MM_ACCEPT); 
00328 }

void REJ::setrej_mm_reject (  ) 

Matrix matcher

Definition at line 182 of file rejctmap.cpp.

References R_MM_REJECT, and set_flag().

00182                            {
00183   set_flag(R_MM_REJECT); 
00184 }

void REJ::setrej_mostly_rej (  ) 

TEMP reject_word

Definition at line 254 of file rejctmap.cpp.

References R_MOSTLY_REJ, and set_flag().

00254                             {
00255   set_flag(R_MOSTLY_REJ); 
00256 }

void REJ::setrej_nn_accept (  ) 

NN Flipped a char

Definition at line 318 of file rejctmap.cpp.

References R_NN_ACCEPT, and set_flag().

00318                            {
00319   set_flag(R_NN_ACCEPT); 
00320 }

void REJ::setrej_no_alphanums (  ) 

TEMP reject_word

Definition at line 246 of file rejctmap.cpp.

References R_NO_ALPHANUMS, and set_flag().

00246                               {
00247   set_flag(R_NO_ALPHANUMS); 
00248 }

void REJ::setrej_not_tess_accepted (  ) 

TEMP reject_word

Definition at line 206 of file rejctmap.cpp.

References R_NOT_TESS_ACCEPTED, and set_flag().

00206                                    { 
00207   set_flag(R_NOT_TESS_ACCEPTED); 
00208 }

void REJ::setrej_poor_match (  ) 

Failed Rays heuristic

Definition at line 198 of file rejctmap.cpp.

References R_POOR_MATCH, and set_flag().

00198                             {
00199   set_flag(R_POOR_MATCH); 
00200 }

void REJ::setrej_postNN_1Il (  ) 

1Il after NN

Definition at line 166 of file rejctmap.cpp.

References R_POSTNN_1IL, and set_flag().

00166                             {
00167   set_flag(R_POSTNN_1IL); 
00168 }

void REJ::setrej_quality_accept (  ) 

Quality flip a char

Definition at line 334 of file rejctmap.cpp.

References R_QUALITY_ACCEPT, and set_flag().

00334                                 {
00335   set_flag(R_QUALITY_ACCEPT); 
00336 }

void REJ::setrej_rej_cblob (  ) 

Insert duff blob

Definition at line 174 of file rejctmap.cpp.

References R_REJ_CBLOB, and set_flag().

00174                            {
00175   set_flag(R_REJ_CBLOB); 
00176 }

void REJ::setrej_row_rej (  ) 

TEMP reject_word

Definition at line 294 of file rejctmap.cpp.

References R_ROW_REJ, and set_flag().

00294                          {
00295   set_flag(R_ROW_REJ); 
00296 }

void REJ::setrej_small_xht (  ) 

Small xht char/wd

Definition at line 141 of file rejctmap.cpp.

References R_SMALL_XHT, and set_flag().

00141                            {
00142   set_flag(R_SMALL_XHT); 
00143 }

void REJ::setrej_tess_failure (  ) 

Tess generated blank

Definition at line 133 of file rejctmap.cpp.

References R_TESS_FAILURE, and set_flag().

00133                               {
00134   set_flag(R_TESS_FAILURE); 
00135 }

void REJ::setrej_unlv_rej (  ) 

TEMP reject_word

Definition at line 302 of file rejctmap.cpp.

References R_UNLV_REJ, and set_flag().

00302                           {
00303   set_flag(R_UNLV_REJ); 
00304 }

void REJ::setrej_xht_fixup (  ) 

xht fixup

Definition at line 262 of file rejctmap.cpp.

References R_XHT_FIXUP, and set_flag().

00262                            {
00263   set_flag(R_XHT_FIXUP); 
00264 }


Member Data Documentation

BITS16 REJ::flags1 [private]

Definition at line 126 of file rejctmap.h.

Referenced by flag(), operator=(), REJ(), and set_flag().

BITS16 REJ::flags2 [private]

Definition at line 127 of file rejctmap.h.

Referenced by flag(), operator=(), REJ(), and set_flag().


The documentation for this class was generated from the following files:
Generated on Wed Feb 28 19:49:33 2007 for Tesseract by  doxygen 1.5.1