00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef DOCQUAL_H
00021 #define DOCQUAL_H
00022
00023 #include "control.h"
00024 #include "notdll.h"
00025
00026 enum GARBAGE_LEVEL
00027 {
00028 G_NEVER_CRUNCH,
00029 G_OK,
00030 G_DODGY,
00031 G_TERRIBLE
00032 };
00033
00034 extern STRING_VAR_H (outlines_odd, "%| ", "Non standard number of outlines");
00035 extern STRING_VAR_H (outlines_2, "ij!?%\":;",
00036 "Non standard number of outlines");
00037 extern BOOL_VAR_H (docqual_excuse_outline_errs, FALSE,
00038 "Allow outline errs in unrejection?");
00039 extern BOOL_VAR_H (tessedit_good_quality_unrej, TRUE,
00040 "Reduce rejection on good docs");
00041 extern BOOL_VAR_H (tessedit_use_reject_spaces, TRUE, "Reject spaces?");
00042 extern double_VAR_H (tessedit_reject_doc_percent, 65.00,
00043 "%rej allowed before rej whole doc");
00044 extern double_VAR_H (tessedit_reject_block_percent, 45.00,
00045 "%rej allowed before rej whole block");
00046 extern double_VAR_H (tessedit_reject_row_percent, 40.00,
00047 "%rej allowed before rej whole row");
00048 extern double_VAR_H (tessedit_whole_wd_rej_row_percent, 70.00,
00049 "%of row rejects in whole word rejects which prevents whole row rejection");
00050 extern BOOL_VAR_H (tessedit_preserve_blk_rej_perfect_wds, TRUE,
00051 "Only rej partially rejected words in block rejection");
00052 extern BOOL_VAR_H (tessedit_preserve_row_rej_perfect_wds, TRUE,
00053 "Only rej partially rejected words in row rejection");
00054 extern BOOL_VAR_H (tessedit_dont_blkrej_good_wds, FALSE,
00055 "Use word segmentation quality metric");
00056 extern BOOL_VAR_H (tessedit_dont_rowrej_good_wds, FALSE,
00057 "Use word segmentation quality metric");
00058 extern INT_VAR_H (tessedit_preserve_min_wd_len, 2,
00059 "Only preserve wds longer than this");
00060 extern BOOL_VAR_H (tessedit_row_rej_good_docs, TRUE,
00061 "Apply row rejection to good docs");
00062 extern double_VAR_H (tessedit_good_doc_still_rowrej_wd, 1.1,
00063 "rej good doc wd if more than this fraction rejected");
00064 extern BOOL_VAR_H (tessedit_reject_bad_qual_wds, TRUE,
00065 "Reject all bad quality wds");
00066 extern BOOL_VAR_H (tessedit_debug_doc_rejection, FALSE, "Page stats");
00067 extern BOOL_VAR_H (tessedit_debug_quality_metrics, FALSE,
00068 "Output data to debug file");
00069 extern BOOL_VAR_H (bland_unrej, FALSE, "unrej potential with no chekcs");
00070 extern double_VAR_H (quality_rowrej_pc, 1.1,
00071 "good_quality_doc gte good char limit");
00072 extern BOOL_VAR_H (unlv_tilde_crunching, TRUE,
00073 "Mark v.bad words for tilde crunch");
00074 extern BOOL_VAR_H (crunch_early_merge_tess_fails, TRUE,
00075 "Before word crunch?");
00076 extern BOOL_VAR_H (crunch_early_convert_bad_unlv_chs, FALSE,
00077 "Take out ~^ early?");
00078 extern double_VAR_H (crunch_terrible_rating, 80.0, "crunch rating lt this");
00079 extern BOOL_VAR_H (crunch_terrible_garbage, TRUE, "As it says");
00080 extern double_VAR_H (crunch_poor_garbage_cert, -9.0,
00081 "crunch garbage cert lt this");
00082 extern double_VAR_H (crunch_poor_garbage_rate, 60,
00083 "crunch garbage rating lt this");
00084 extern double_VAR_H (crunch_pot_poor_rate, 40,
00085 "POTENTIAL crunch rating lt this");
00086 extern double_VAR_H (crunch_pot_poor_cert, -8.0,
00087 "POTENTIAL crunch cert lt this");
00088 extern BOOL_VAR_H (crunch_pot_garbage, TRUE, "POTENTIAL crunch garbage");
00089 extern double_VAR_H (crunch_del_rating, 60,
00090 "POTENTIAL crunch rating lt this");
00091 extern double_VAR_H (crunch_del_cert, -10.0, "POTENTIAL crunch cert lt this");
00092 extern double_VAR_H (crunch_del_min_ht, 0.7, "Del if word ht lt xht x this");
00093 extern double_VAR_H (crunch_del_max_ht, 3.0, "Del if word ht gt xht x this");
00094 extern double_VAR_H (crunch_del_min_width, 3.0,
00095 "Del if word width lt xht x this");
00096 extern double_VAR_H (crunch_del_high_word, 1.5,
00097 "Del if word gt xht x this above bl");
00098 extern double_VAR_H (crunch_del_low_word, 0.5,
00099 "Del if word gt xht x this below bl");
00100 extern double_VAR_H (crunch_small_outlines_size, 0.6,
00101 "Small if lt xht x this");
00102 extern INT_VAR_H (crunch_rating_max, 10, "For adj length in rating per ch");
00103 extern INT_VAR_H (crunch_pot_indicators, 1,
00104 "How many potential indicators needed");
00105 extern BOOL_VAR_H (crunch_leave_ok_strings, TRUE,
00106 "Dont touch sensible strings");
00107 extern BOOL_VAR_H (crunch_accept_ok, TRUE, "Use acceptability in okstring");
00108 extern BOOL_VAR_H (crunch_leave_accept_strings, FALSE,
00109 "Dont pot crunch sensible strings");
00110 extern BOOL_VAR_H (crunch_include_numerals, FALSE, "Fiddle alpha figures");
00111 extern INT_VAR_H (crunch_leave_lc_strings, 4,
00112 "Dont crunch words with long lower case strings");
00113 extern INT_VAR_H (crunch_leave_uc_strings, 4,
00114 "Dont crunch words with long lower case strings");
00115 extern INT_VAR_H (crunch_long_repetitions, 3,
00116 "Crunch words with long repetitions");
00117 extern INT_VAR_H (crunch_debug, 0, "As it says");
00119 inT16 word_blob_quality(
00120 WERD_RES *word,
00121 ROW *row);
00122 BOOL8 crude_match_blobs(PBLOB *blob1, PBLOB *blob2);
00124 inT16 word_outline_errs(
00125 WERD_RES *word);
00127 void word_char_quality(
00128 WERD_RES *word,
00129 ROW *row,
00130 inT16 *match_count,
00131 inT16 *accepted_match_count);
00132 void unrej_good_chs(WERD_RES *word, ROW *row);
00133 void print_boxes(WERD *word);
00134 inT16 count_outline_errs(char c, inT16 outline_count);
00135 void reject_whole_page(PAGE_RES_IT &page_res_it);
00136 BOOL8 terrible_word_crunch(WERD_RES *word, GARBAGE_LEVEL garbage_level);
00137
00138 CRUNCH_MODE word_deletable(WERD_RES *word, inT16 &delete_mode);
00139 inT16 failure_count(WERD_RES *word);
00140 BOOL8 noise_outlines(WERD *word);
00141 #endif