26 #ifndef TESSERACT_CCMAIN_TESSERACTCLASS_H_ 27 #define TESSERACT_CCMAIN_TESSERACTCLASS_H_ 29 #include "allheaders.h" 40 class BLOB_CHOICE_LIST_CLIST;
100 class EquationDetect;
102 class LSTMRecognizer;
139 WordData() : word(NULL), row(NULL), block(NULL), prev_word(NULL) {}
141 : word(page_res_it.word()), row(page_res_it.row()->row),
142 block(page_res_it.block()->block), prev_word(NULL) {}
144 : word(word_res), row(row_in), block(block_in), prev_word(NULL) {}
173 void ResetAdaptiveClassifier();
175 void ResetDocumentDictionary();
186 pixDestroy(&pix_binary_);
196 pixDestroy(&pix_grey_);
197 pix_grey_ = grey_pix;
202 pixDestroy(&pix_original_);
203 pix_original_ = original_pix;
205 for (
int i = 0; i < sub_langs_.size(); ++i)
206 sub_langs_[i]->set_pix_original(original_pix ? pixClone(original_pix)
216 Pix*
BestPix()
const {
return pix_original_; }
218 pixDestroy(&pix_thresholds_);
219 pix_thresholds_ = thresholds;
222 return source_resolution_;
225 source_resolution_ = ppi;
228 return pixGetWidth(pix_binary_);
231 return pixGetHeight(pix_binary_);
234 return scaled_color_;
237 return scaled_factor_;
240 scaled_factor_ = factor;
241 scaled_color_ = color;
251 return right_to_left_;
254 return sub_langs_.size();
257 return sub_langs_[index];
262 for (
int i = 0; i < sub_langs_.size(); ++i) {
263 if (sub_langs_[i]->tessedit_ocr_engine_mode !=
OEM_LSTM_ONLY)
return true;
270 for (
int i = 0; i < sub_langs_.size(); ++i) {
277 void SetBlackAndWhitelist();
283 void PrepareForPageseg();
290 void PrepareForTessOCR(BLOCK_LIST* block_list,
293 int SegmentPage(
const STRING* input_file, BLOCK_LIST* blocks,
295 void SetupWordScripts(BLOCK_LIST* blocks);
296 int AutoPageSeg(
PageSegMode pageseg_mode, BLOCK_LIST* blocks,
297 TO_BLOCK_LIST* to_blocks, BLOBNBOX_LIST* diacritic_blobs,
301 OSResults* osr, TO_BLOCK_LIST* to_blocks, Pix** photo_mask_pix,
302 Pix** music_mask_pix);
310 void TrainLineRecognizer(
const STRING& input_imagename,
311 const STRING& output_basename,
312 BLOCK_LIST *block_list);
318 BLOCK_LIST *block_list,
327 int start_box,
int end_box,
336 TBOX* revised_box)
const;
347 bool ProcessTargetWord(
const TBOX& word_box,
const TBOX& target_word_box,
348 const char* word_config,
int pass);
350 void SetupAllWordsPassN(
int pass_n,
351 const TBOX* target_word_box,
352 const char* word_config,
356 void SetupWordPassN(
int pass_n,
WordData* word);
358 bool RecogAllWordsPassN(
int pass_n,
ETEXT_DESC* monitor,
361 bool recog_all_words(
PAGE_RES* page_res,
363 const TBOX* target_word_box,
364 const char* word_config,
366 void rejection_passes(
PAGE_RES* page_res,
368 const TBOX* target_word_box,
369 const char* word_config);
370 void bigram_correction_pass(
PAGE_RES *page_res);
371 void blamer_pass(
PAGE_RES* page_res);
373 void script_pos_pass(
PAGE_RES* page_res);
383 bool ReassignDiacritics(
int pass,
PAGE_RES_IT* pr_it,
384 bool* make_next_word_fuzzy);
389 void AssignDiacriticsToOverlappingBlobs(
403 bool SelectGoodDiacriticOutlines(
int pass,
float certainty_threshold,
418 STRING* best_str,
float* c2);
419 void classify_word_and_language(
int pass_n,
PAGE_RES_IT* pr_it,
421 void classify_word_pass1(
const WordData& word_data,
424 void recog_pseudo_word(
PAGE_RES* page_res,
425 TBOX &selection_box);
431 const char *lengths);
433 void classify_word_pass2(
const WordData& word_data,
436 void ReportXhtFixResult(
bool accept_new_word,
float new_x_ht,
442 bool TestNewNormalization(
int original_misfits,
float baseline_shift,
448 void set_word_fonts(
WERD_RES *word);
449 void font_recognition_pass(
PAGE_RES* page_res);
450 void dictionary_correction_pass(
PAGE_RES* page_res);
454 bool SubAndSuperscriptFix(
WERD_RES *word_res);
455 void GetSubAndSuperscriptCandidates(
const WERD_RES *word,
456 int *num_rebuilt_leading,
458 float *leading_certainty,
459 int *num_rebuilt_trailing,
461 float *trailing_certainty,
462 float *avg_certainty,
463 float *unlikely_threshold);
464 WERD_RES *TrySuperscriptSplits(
int num_chopped_leading,
465 float leading_certainty,
467 int num_chopped_trailing,
468 float trailing_certainty,
473 int *retry_trailing);
474 bool BelievableSuperscript(
bool debug,
476 float certainty_threshold,
478 int *right_ok)
const;
482 void output_pass(
PAGE_RES_IT &page_res_it,
const TBOX *target_word_box);
487 void set_unlv_suspects(
WERD_RES *word);
489 BOOL8 acceptable_number_string(
const char *s,
490 const char *lengths);
499 int init_tesseract(
const char* arg0,
const char* textbase,
505 const char *language,
508 return init_tesseract(datapath, NULL, language, oem, NULL, 0, NULL, NULL,
527 int init_tesseract_internal(
const char* arg0,
const char* textbase,
529 char** configs,
int configs_size,
536 void SetupUniversalFontIds();
538 int init_tesseract_lm(
const char* arg0,
const char* textbase,
541 void recognize_page(
STRING& image_name);
542 void end_tesseract();
544 bool init_tesseract_lang_data(
const char* arg0,
const char* textbase,
546 char** configs,
int configs_size,
549 bool set_only_init_params,
552 void ParseLanguageString(
const char* lang_str,
558 #ifndef GRAPHICS_DISABLED 559 void pgeditor_main(
int width,
int height,
PAGE_RES* page_res);
560 #endif // GRAPHICS_DISABLED 561 void process_image_event(
563 BOOL8 process_cmd_win_event(
567 void debug_word(
PAGE_RES* page_res,
const TBOX &selection_box);
577 void blob_feature_display(
PAGE_RES* page_res,
const TBOX& selection_box);
582 inT16 first_alphanum_index(
const char *word,
583 const char *word_lengths);
584 inT16 first_alphanum_offset(
const char *word,
585 const char *word_lengths);
586 inT16 alpha_count(
const char *word,
587 const char *word_lengths);
589 const char *word_lengths);
591 inT16 count_alphanums(
607 void reject_edge_blobs(
WERD_RES *word);
608 void reject_mostly_rejects(
WERD_RES *word);
610 BOOL8 word_adaptable(
615 void recog_word_recursive(
WERD_RES* word);
617 void split_and_recog_word(
WERD_RES* word);
626 BOOL8 digit_or_numeric_punct(
WERD_RES *word,
int char_position);
627 inT16 eval_word_spacing(WERD_RES_LIST &word_res_list);
628 void match_current_words(WERD_RES_LIST &words,
ROW *row,
BLOCK* block);
629 inT16 fp_eval_word_spacing(WERD_RES_LIST &word_res_list);
630 void fix_noisy_space_list(WERD_RES_LIST &best_perm,
ROW *row,
BLOCK* block);
631 void fix_fuzzy_space_list(WERD_RES_LIST &best_perm,
ROW *row,
BLOCK* block);
632 void fix_sp_fp_word(WERD_RES_IT &word_res_it,
ROW *row,
BLOCK* block);
633 void fix_fuzzy_spaces(
637 void dump_words(WERD_RES_LIST &perm,
inT16 score,
640 inT16 worst_noise_blob(
WERD_RES *word_res,
float *worst_noise_score);
641 float blob_noise_score(
TBLOB *blob);
642 void break_noisiest_blob_word(WERD_RES_LIST &words);
649 void unrej_good_quality_words(
651 void doc_and_block_rejection(
653 BOOL8 good_quality_doc);
654 void quality_based_rejection(
PAGE_RES_IT &page_res_it,
655 BOOL8 good_quality_doc);
656 void convert_bad_unlv_chs(
WERD_RES *word_res);
660 inT16 *accepted_match_count);
662 inT16 count_outline_errs(
char c,
inT16 outline_count);
670 process_selected_words (
673 TBOX & selection_box,
676 void tess_add_doc_word(
679 void tess_segment_pass_n(
int pass_n,
WERD_RES *word);
680 bool tess_acceptable_word(
WERD_RES *word);
704 BLOCK_LIST *block_list);
708 void PreenXHeights(BLOCK_LIST *block_list);
713 BLOCK_LIST *block_list);
727 bool ResegmentCharBox(
PAGE_RES* page_res,
const TBOX *prev_box,
728 const TBOX& box,
const TBOX& next_box,
729 const char* correct_text);
736 bool ResegmentWordBox(BLOCK_LIST *block_list,
737 const TBOX& box,
const TBOX& next_box,
738 const char* correct_text);
741 void ReSegmentByClassification(
PAGE_RES* page_res);
744 bool ConvertStringToUnichars(
const char* utf8,
761 int choices_pos,
int choices_length,
772 void ReportFailedBox(
int boxfile_lineno,
TBOX box,
const char *box_ch,
773 const char *err_msg);
775 void CorrectClassifyWords(
PAGE_RES* page_res);
778 void ApplyBoxTraining(
const STRING& fontname,
PAGE_RES* page_res);
782 int CountMisfitTops(
WERD_RES *word_res);
787 float ComputeCompatibleXheight(
WERD_RES *word_res,
float* baseline_shift);
790 BOOL_VAR_H(tessedit_resegment_from_boxes,
false,
791 "Take segmentation and labeling from box file");
792 BOOL_VAR_H(tessedit_resegment_from_line_boxes,
false,
793 "Conversion of word/line box file to char box file");
795 "Generate training data from boxed chars");
796 BOOL_VAR_H(tessedit_make_boxes_from_boxes,
false,
797 "Generate more boxes from boxed chars");
798 BOOL_VAR_H(tessedit_train_line_recognizer,
false,
799 "Break input into lines and remap boxes if present");
800 BOOL_VAR_H(tessedit_dump_pageseg_images,
false,
801 "Dump intermediate images made during page segmentation");
803 "Page seg mode: 0=osd only, 1=auto+osd, 2=auto, 3=col, 4=block," 804 " 5=line, 6=word, 7=char" 805 " (Values from PageSegMode enum in publictypes.h)");
807 "Which OCR engine(s) to run (Tesseract, LSTM, both). Defaults" 808 " to loading and running the most accurate available.");
810 "Blacklist of chars not to recognize");
812 "Whitelist of chars to recognize");
814 "List of chars to override tessedit_char_blacklist");
816 "Perform training for ambiguities");
817 INT_VAR_H(pageseg_devanagari_split_strategy,
819 "Whether to use the top-line splitting process for Devanagari " 820 "documents while performing page-segmentation.");
823 "Whether to use the top-line splitting process for Devanagari " 824 "documents while performing ocr.");
826 "Write all parameters to the given file.");
828 "Generate and print debug information for adaption");
831 INT_VAR_H(applybox_page, 0,
"Page number to apply boxes from");
833 "Exposure value follows this pattern in the image" 834 " filename. The name of the image files are expected" 835 " to be in the form [lang].[fontname].exp[num].tif");
836 BOOL_VAR_H(applybox_learn_chars_and_char_frags_mode,
false,
837 "Learn both character fragments (as is done in the" 838 " special low exposure mode) as well as unfragmented" 841 "Each bounding box is assumed to contain ngrams. Only" 842 " learn the ngrams whose outlines overlap horizontally.");
843 BOOL_VAR_H(tessedit_display_outwords,
false,
"Draw output words");
844 BOOL_VAR_H(tessedit_dump_choices,
false,
"Dump char choices");
845 BOOL_VAR_H(tessedit_timing_debug,
false,
"Print timing stats");
847 "Try to improve fuzzy spaces");
849 "Don't bother with word plausibility");
850 BOOL_VAR_H(tessedit_fix_hyphens,
true,
"Crunch double hyphens?");
851 BOOL_VAR_H(tessedit_redo_xheight,
true,
"Check/Correct x-height");
853 "Add words to the document dictionary");
854 BOOL_VAR_H(tessedit_debug_fonts,
false,
"Output font info per char");
855 BOOL_VAR_H(tessedit_debug_block_rejection,
false,
"Block and Row stats");
856 BOOL_VAR_H(tessedit_enable_bigram_correction,
true,
857 "Enable correction based on the word bigram dictionary.");
858 BOOL_VAR_H(tessedit_enable_dict_correction,
false,
859 "Enable single word correction based on the dictionary.");
860 INT_VAR_H(tessedit_bigram_debug, 0,
"Amount of debug output for bigram " 863 "Remove and conditionally reassign small outlines when they" 864 " confuse layout analysis, determining diacritics vs noise");
865 INT_VAR_H(debug_noise_removal, 0,
"Debug reassignment of small outlines");
868 double_VAR_H(noise_cert_basechar, -8.0,
"Hingepoint for base char certainty");
871 double_VAR_H(noise_cert_disjoint, -2.5,
"Hingepoint for disjoint certainty");
874 double_VAR_H(noise_cert_punc, -2.5,
"Threshold for new punc char certainty");
877 "Scaling on certainty diff from Hingepoint");
878 INT_VAR_H(noise_maxperblob, 8,
"Max diacritics to apply to a blob");
879 INT_VAR_H(noise_maxperword, 16,
"Max diacritics to apply to a word");
881 BOOL_VAR_H(debug_acceptable_wds,
false,
"Dump word pass/fail chk");
883 STRING_VAR_H(chs_trailing_punct1,
").,;:?!",
"1st Trailing punctuation");
884 STRING_VAR_H(chs_trailing_punct2,
")'`\"",
"2nd Trailing punctuation");
885 double_VAR_H(quality_rej_pc, 0.08,
"good_quality_doc lte rejection limit");
886 double_VAR_H(quality_blob_pc, 0.0,
"good_quality_doc gte good blobs limit");
888 "good_quality_doc lte outline error limit");
889 double_VAR_H(quality_char_pc, 0.95,
"good_quality_doc gte good char limit");
890 INT_VAR_H(quality_min_initial_alphas_reqd, 2,
"alphas in a good word");
891 INT_VAR_H(tessedit_tess_adaption_mode, 0x27,
892 "Adaptation decision algorithm for tess");
894 "Do minimal rejection on pass 1 output");
895 BOOL_VAR_H(tessedit_test_adaption,
false,
"Test adaption criteria");
896 BOOL_VAR_H(tessedit_matcher_log,
false,
"Log matcher activity");
897 INT_VAR_H(tessedit_test_adaption_mode, 3,
898 "Adaptation decision algorithm for tess");
902 INT_VAR_H(multilang_debug_level, 0,
"Print multilang debug info.");
903 INT_VAR_H(paragraph_debug_level, 0,
"Print paragraph debug info.");
905 "Run paragraph detection on the post-text-recognition " 907 BOOL_VAR_H(lstm_use_matrix, 1,
"Use ratings matrix/beam searct with lstm");
909 STRING_VAR_H(outlines_2,
"ij!?%\":;",
"Non standard number of outlines");
910 BOOL_VAR_H(docqual_excuse_outline_errs,
false,
911 "Allow outline errs in unrejection?");
913 "Reduce rejection on good docs");
914 BOOL_VAR_H(tessedit_use_reject_spaces,
true,
"Reject spaces?");
916 "%rej allowed before rej whole doc");
918 "%rej allowed before rej whole block");
920 "%rej allowed before rej whole row");
922 "Number of row rejects in whole word rejects" 923 "which prevents whole row rejection");
924 BOOL_VAR_H(tessedit_preserve_blk_rej_perfect_wds,
true,
925 "Only rej partially rejected words in block rejection");
926 BOOL_VAR_H(tessedit_preserve_row_rej_perfect_wds,
true,
927 "Only rej partially rejected words in row rejection");
928 BOOL_VAR_H(tessedit_dont_blkrej_good_wds,
false,
929 "Use word segmentation quality metric");
930 BOOL_VAR_H(tessedit_dont_rowrej_good_wds,
false,
931 "Use word segmentation quality metric");
932 INT_VAR_H(tessedit_preserve_min_wd_len, 2,
933 "Only preserve wds longer than this");
935 "Apply row rejection to good docs");
937 "rej good doc wd if more than this fraction rejected");
938 BOOL_VAR_H(tessedit_reject_bad_qual_wds,
true,
939 "Reject all bad quality wds");
940 BOOL_VAR_H(tessedit_debug_doc_rejection,
false,
"Page stats");
941 BOOL_VAR_H(tessedit_debug_quality_metrics,
false,
942 "Output data to debug file");
943 BOOL_VAR_H(bland_unrej,
false,
"unrej potential with no checks");
945 "good_quality_doc gte good char limit");
947 "Mark v.bad words for tilde crunch");
949 "Add font info to hocr output");
950 BOOL_VAR_H(crunch_early_merge_tess_fails,
true,
"Before word crunch?");
951 BOOL_VAR_H(crunch_early_convert_bad_unlv_chs,
false,
"Take out ~^ early?");
955 "crunch garbage cert lt this");
956 double_VAR_H(crunch_poor_garbage_rate, 60,
"crunch garbage rating lt this");
957 double_VAR_H(crunch_pot_poor_rate, 40,
"POTENTIAL crunch rating lt this");
958 double_VAR_H(crunch_pot_poor_cert, -8.0,
"POTENTIAL crunch cert lt this");
959 BOOL_VAR_H(crunch_pot_garbage,
true,
"POTENTIAL crunch garbage");
960 double_VAR_H(crunch_del_rating, 60,
"POTENTIAL crunch rating lt this");
964 double_VAR_H(crunch_del_min_width, 3.0,
"Del if word width lt xht x this");
966 "Del if word gt xht x this above bl");
967 double_VAR_H(crunch_del_low_word, 0.5,
"Del if word gt xht x this below bl");
968 double_VAR_H(crunch_small_outlines_size, 0.6,
"Small if lt xht x this");
969 INT_VAR_H(crunch_rating_max, 10,
"For adj length in rating per ch");
970 INT_VAR_H(crunch_pot_indicators, 1,
"How many potential indicators needed");
971 BOOL_VAR_H(crunch_leave_ok_strings,
true,
"Don't touch sensible strings");
972 BOOL_VAR_H(crunch_accept_ok,
true,
"Use acceptability in okstring");
973 BOOL_VAR_H(crunch_leave_accept_strings,
false,
974 "Don't pot crunch sensible strings");
975 BOOL_VAR_H(crunch_include_numerals,
false,
"Fiddle alpha figures");
977 "Don't crunch words with long lower case strings");
979 "Don't crunch words with long lower case strings");
980 INT_VAR_H(crunch_long_repetitions, 3,
"Crunch words with long repetitions");
983 "How many non-noise blbs either side?");
984 double_VAR_H(fixsp_small_outlines_size, 0.28,
"Small if lt xht x this");
985 BOOL_VAR_H(tessedit_prefer_joined_punct,
false,
"Reward punctation joins");
986 INT_VAR_H(fixsp_done_mode, 1,
"What constitues done for spacing");
987 INT_VAR_H(debug_fix_space_level, 0,
"Contextual fixspace debug");
989 "Punct. chs expected WITHIN numbers");
991 "Max allowed deviation of blob top outside of font data");
992 INT_VAR_H(x_ht_min_change, 8,
"Min change in xht before actually trying it");
993 INT_VAR_H(superscript_debug, 0,
"Debug level for sub & superscript fixer");
994 double_VAR_H(superscript_worse_certainty, 2.0,
"How many times worse " 995 "certainty does a superscript position glyph need to be for us " 996 "to try classifying it as a char with a different baseline?");
997 double_VAR_H(superscript_bettered_certainty, 0.97,
"What reduction in " 998 "badness do we think sufficient to choose a superscript over " 999 "what we'd thought. For example, a value of 0.6 means we want " 1000 "to reduce badness of certainty by 40%");
1002 "A superscript scaled down more than this is unbelievably " 1003 "small. For example, 0.3 means we expect the font size to " 1004 "be no smaller than 30% of the text line font size.");
1006 "Maximum top of a character measured as a multiple of x-height " 1007 "above the baseline for us to reconsider whether it's a " 1010 "Minimum bottom of a character measured as a multiple of " 1011 "x-height above the baseline for us to reconsider whether it's " 1013 BOOL_VAR_H(tessedit_write_block_separators,
false,
1014 "Write block separators in output");
1016 "Write repetition char code");
1017 BOOL_VAR_H(tessedit_write_unlv,
false,
"Write .unlv output file");
1018 BOOL_VAR_H(tessedit_create_txt,
false,
"Write .txt output file");
1019 BOOL_VAR_H(tessedit_create_hocr,
false,
"Write .html hOCR output file");
1020 BOOL_VAR_H(tessedit_create_tsv,
false,
"Write .tsv output file");
1021 BOOL_VAR_H(tessedit_create_pdf,
false,
"Write .pdf output file");
1023 "Create PDF with only one invisible text layer");
1025 "Output char for unidentified blobs");
1028 "Min suspect level for rejecting spaces");
1029 INT_VAR_H(suspect_short_words, 2,
"Don't Suspect dict wds longer than this");
1030 BOOL_VAR_H(suspect_constrain_1Il,
false,
"UNLV keep 1Il chars rejected");
1031 double_VAR_H(suspect_rating_per_ch, 999.9,
"Don't touch bad rating limit");
1033 BOOL_VAR_H(tessedit_minimal_rejection,
false,
"Only reject tess failures");
1034 BOOL_VAR_H(tessedit_zero_rejection,
false,
"Don't reject ANYTHING");
1036 "Make output have exactly one word per WERD");
1037 BOOL_VAR_H(tessedit_zero_kelvin_rejection,
false,
1038 "Don't reject ANYTHING AT ALL");
1039 BOOL_VAR_H(tessedit_consistent_reps,
true,
"Force all rep chars the same");
1044 "Aspect ratio dot/hyphen test");
1046 "Aspect ratio dot/hyphen test");
1047 BOOL_VAR_H(rej_trust_doc_dawg,
false,
"Use DOC dawg in 11l conf. detector");
1049 BOOL_VAR_H(rej_1Il_trust_permuter_type,
true,
"Don't double check");
1050 BOOL_VAR_H(rej_use_tess_accepted,
true,
"Individual rejection control");
1051 BOOL_VAR_H(rej_use_tess_blanks,
true,
"Individual rejection control");
1052 BOOL_VAR_H(rej_use_good_perm,
true,
"Individual rejection control");
1054 BOOL_VAR_H(rej_alphas_in_number_perm,
false,
"Extend permuter check");
1055 double_VAR_H(rej_whole_of_mostly_reject_word_fract, 0.85,
"if >this fract");
1056 INT_VAR_H(tessedit_image_border, 2,
"Rej blbs near image edge limit");
1057 STRING_VAR_H(ok_repeated_ch_non_alphanum_wds,
"-?*\075",
1058 "Allow NN to unrej");
1060 INT_VAR_H(min_sane_x_ht_pixels, 8,
"Reject any x-ht lt or eq than this");
1061 BOOL_VAR_H(tessedit_create_boxfile,
false,
"Output text with boxes");
1063 "-1 -> All pages, else specific page to process");
1064 BOOL_VAR_H(tessedit_write_images,
false,
"Capture the image from the IPE");
1065 BOOL_VAR_H(interactive_display_mode,
false,
"Run interactively?");
1067 BOOL_VAR_H(tessedit_override_permuter,
true,
"According to dict_word");
1069 "List of languages to load with this one");
1070 BOOL_VAR_H(tessedit_use_primary_params_model,
false,
1071 "In multilingual mode use params model of the primary language");
1075 "Min acceptable orientation margin");
1076 BOOL_VAR_H(textord_tabfind_show_vlines,
false,
"Debug line finding");
1079 "Allow feature extractors to see the original outline");
1081 "Only initialize with the config file. Useful if the instance is " 1082 "not going to be used for OCR but say only for layout analysis.");
1083 BOOL_VAR_H(textord_equation_detect,
false,
"Turn on equation detector");
1084 BOOL_VAR_H(textord_tabfind_vertical_text,
true,
"Enable vertical detection");
1085 BOOL_VAR_H(textord_tabfind_force_vertical_text,
false,
1086 "Force using vertical text page mode");
1088 "Fraction of textlines deemed vertical to use vertical page " 1090 double_VAR_H(textord_tabfind_aligned_gap_fraction, 0.75,
1091 "Fraction of height used as a minimum gap for aligned blobs.");
1092 INT_VAR_H(tessedit_parallelize, 0,
"Run in parallel where possible");
1094 "Preserve multiple interword spaces");
1096 "Include page separator string in output text after each " 1099 "Page separator (default is form feed control character)");
1109 BOOL_VAR_H(textord_tabfind_vertical_horizontal_mix,
true,
1110 "find horizontal lines such as headers in vertical page mode");
1111 INT_VAR_H(tessedit_ok_mode, 5,
"Acceptance decision algorithm");
1112 BOOL_VAR_H(load_fixed_length_dawgs,
true,
"Load fixed length" 1113 " dawgs (e.g. for non-space delimited languages)");
1114 INT_VAR_H(segment_debug, 0,
"Debug the whole segmentation process");
1116 double_VAR_H(bestrate_pruning_factor, 2.0,
"Multiplying factor of" 1117 " current best rate to prune other hypotheses");
1119 "Turn on word script consistency permuter");
1121 "incorporate segmentation cost in word rating?");
1123 "Score multipler for script consistency within a word. " 1124 "Being a 'reward' factor, it should be <= 1. " 1125 "Smaller value implies bigger reward.");
1127 "Turn on fixed-length phrasebook search permuter");
1129 "Turn on character type (property) consistency permuter");
1131 "Score multipler for char type consistency within a word. ");
1133 "Score multipler for ngram permuter's best choice" 1134 " (only used in the Han script path).");
1136 "Activate character-level n-gram-based permuter");
1137 BOOL_VAR_H(permute_only_top,
false,
"Run only the top choice permuter");
1138 INT_VAR_H(language_model_fixed_length_choices_depth, 3,
1139 "Depth of blob choice lists to explore" 1140 " when fixed length dawgs are on");
1142 "use new state cost heuristics for segmentation state evaluation");
1144 "base factor for adding segmentation cost into word rating." 1145 "It's a multiplying factor, the larger the value above 1, " 1146 "the bigger the effect of segmentation cost.");
1148 "weight associated with char rating in combined cost of state");
1150 "weight associated with width evidence in combined cost of" 1153 "weight associated with seam cut in combined cost of state");
1155 "max char width-to-height ratio allowed in segmentation");
1157 "Enable new segmentation search path.");
1158 double_VAR_H(segsearch_max_fixed_pitch_char_wh_ratio, 2.0,
1159 "Maximum character width-to-height ratio for" 1160 "fixed pitch fonts");
1164 FILE *init_recog_training(
const STRING &fname);
1165 void recog_training_segmented(
const STRING &fname,
1169 void ambigs_classify_and_output(
const char *label,
1177 const char* backup_config_file_;
1188 Pix* pix_thresholds_;
1193 int source_resolution_;
1200 bool right_to_left_;
1212 int font_table_size_;
1218 int train_line_page_num_;
1223 #endif // TESSERACT_CCMAIN_TESSERACTCLASS_H_
const FCOORD & reskew() const
void flip_hyphens(WERD_RES *word)
Textord * mutable_textord()
Pix ** mutable_pix_binary()
int num_sub_langs() const
bool tilde_crunch_written
WordData(const PAGE_RES_IT &page_res_it)
Tesseract * get_sub_lang(int index) const
void flip_0O(WERD_RES *word)
void set_source_resolution(int ppi)
Assume a single uniform block of text. (Default.)
BOOL8 word_contains_non_1_digit(const char *word, const char *word_lengths)
bool last_char_was_newline
inT32 adaption_word_number
void SetScaledColor(int factor, Pix *color)
inT16 word_blob_quality(WERD_RES *word, ROW *row)
int init_tesseract(const char *datapath, const char *language, OcrEngineMode oem)
Pix * pix_original() const
BOOL8 non_0_digit(const char *str, int length)
#define double_VAR_H(name, val, comment)
WordData(BLOCK *block_in, ROW *row_in, WERD_RES *word_res)
inT16 doc_good_char_quality
Pix * scaled_color() const
#define STRING_VAR_H(name, val, comment)
int source_resolution() const
void set_pix_thresholds(Pix *thresholds)
const Textord & textord() const
PointerVector< WERD_RES > lang_words
#define INT_VAR_H(name, val, comment)
void(Tesseract::* WordRecognizer)(const WordData &word_data, WERD_RES **in_word, PointerVector< WERD_RES > *out_words)
void dont_allow_1Il(WERD_RES *word)
void set_pix_grey(Pix *grey_pix)
#define BOOL_VAR_H(name, val, comment)
bool right_to_left() const
int scaled_factor() const
bool write_results_empty_block
void set_pix_original(Pix *original_pix)