26 #ifndef TESSERACT_CCMAIN_TESSERACTCLASS_H__ 27 #define TESSERACT_CCMAIN_TESSERACTCLASS_H__ 29 #include "allheaders.h" 39 class BLOB_CHOICE_LIST_CLIST;
100 #ifndef ANDROID_BUILD 101 class CubeLineObject;
103 class CubeRecoContext;
105 class EquationDetect;
107 #ifndef ANDROID_BUILD 108 class TesseractCubeCombiner;
147 : word(page_res_it.word()), row(page_res_it.row()->row),
148 block(page_res_it.block()->block), prev_word(
NULL) {}
150 : word(word_res), row(row_in), block(block_in), prev_word(
NULL) {}
179 void ResetAdaptiveClassifier();
181 void ResetDocumentDictionary();
202 pixDestroy(&pix_grey_);
203 pix_grey_ = grey_pix;
213 return pix_grey_ !=
NULL ? pix_grey_ : pix_binary_;
216 pixDestroy(&pix_thresholds_);
217 pix_thresholds_ = thresholds;
220 return source_resolution_;
223 source_resolution_ = ppi;
226 return pixGetWidth(pix_binary_);
229 return pixGetHeight(pix_binary_);
232 return scaled_color_;
235 return scaled_factor_;
238 scaled_factor_ = factor;
239 scaled_color_ = color;
249 return right_to_left_;
252 return sub_langs_.size();
255 return sub_langs_[index];
260 for (
int i = 0; i < sub_langs_.size(); ++i) {
261 if (sub_langs_[i]->tessedit_ocr_engine_mode !=
OEM_CUBE_ONLY)
267 void SetBlackAndWhitelist();
273 void PrepareForPageseg();
280 void PrepareForTessOCR(BLOCK_LIST* block_list,
283 int SegmentPage(
const STRING* input_file, BLOCK_LIST* blocks,
285 void SetupWordScripts(BLOCK_LIST* blocks);
286 int AutoPageSeg(
PageSegMode pageseg_mode, BLOCK_LIST* blocks,
287 TO_BLOCK_LIST* to_blocks, BLOBNBOX_LIST* diacritic_blobs,
291 OSResults* osr, TO_BLOCK_LIST* to_blocks, Pix** photo_mask_pix,
292 Pix** music_mask_pix);
297 bool ProcessTargetWord(
const TBOX& word_box,
const TBOX& target_word_box,
298 const char* word_config,
int pass);
300 void SetupAllWordsPassN(
int pass_n,
301 const TBOX* target_word_box,
302 const char* word_config,
306 void SetupWordPassN(
int pass_n,
WordData* word);
308 bool RecogAllWordsPassN(
int pass_n,
ETEXT_DESC* monitor,
311 bool recog_all_words(
PAGE_RES* page_res,
313 const TBOX* target_word_box,
314 const char* word_config,
316 void rejection_passes(
PAGE_RES* page_res,
318 const TBOX* target_word_box,
319 const char* word_config);
320 void bigram_correction_pass(
PAGE_RES *page_res);
321 void blamer_pass(
PAGE_RES* page_res);
323 void script_pos_pass(
PAGE_RES* page_res);
327 int RetryWithLanguage(
const WordData& word_data,
334 bool ReassignDiacritics(
int pass,
PAGE_RES_IT* pr_it,
335 bool* make_next_word_fuzzy);
340 void AssignDiacriticsToOverlappingBlobs(
354 bool SelectGoodDiacriticOutlines(
int pass,
float certainty_threshold,
369 STRING* best_str,
float* c2);
370 void classify_word_and_language(
int pass_n,
PAGE_RES_IT* pr_it,
372 void classify_word_pass1(
const WordData& word_data,
375 void recog_pseudo_word(
PAGE_RES* page_res,
376 TBOX &selection_box);
382 const char *lengths);
384 void classify_word_pass2(
const WordData& word_data,
387 void ReportXhtFixResult(
bool accept_new_word,
float new_x_ht,
393 bool TestNewNormalization(
int original_misfits,
float baseline_shift,
399 void set_word_fonts(
WERD_RES *word);
400 void font_recognition_pass(
PAGE_RES* page_res);
401 void dictionary_correction_pass(
PAGE_RES* page_res);
405 bool SubAndSuperscriptFix(
WERD_RES *word_res);
406 void GetSubAndSuperscriptCandidates(
const WERD_RES *word,
407 int *num_rebuilt_leading,
409 float *leading_certainty,
410 int *num_rebuilt_trailing,
412 float *trailing_certainty,
413 float *avg_certainty,
414 float *unlikely_threshold);
415 WERD_RES *TrySuperscriptSplits(
int num_chopped_leading,
416 float leading_certainty,
418 int num_chopped_trailing,
419 float trailing_certainty,
424 int *retry_trailing);
425 bool BelievableSuperscript(
bool debug,
427 float certainty_threshold,
429 int *right_ok)
const;
432 #ifndef ANDROID_BUILD 433 bool init_cube_objects(
bool load_combiner,
437 void run_cube_combiner(
PAGE_RES *page_res);
451 void fill_werd_res(
const BoxWord& cube_box_word,
452 const char* cube_best_str,
454 bool extract_cube_state(
CubeObject* cube_obj,
int* num_chars,
455 Boxa** char_boxes,
CharSamp*** char_samples);
456 bool create_cube_box_word(Boxa *char_boxes,
int num_chars,
461 void output_pass(
PAGE_RES_IT &page_res_it,
const TBOX *target_word_box);
466 void set_unlv_suspects(
WERD_RES *word);
468 BOOL8 acceptable_number_string(
const char *s,
469 const char *lengths);
478 int init_tesseract(
const char *arg0,
479 const char *textbase,
480 const char *language,
486 bool set_only_init_params);
488 const char *language,
490 return init_tesseract(datapath,
NULL, language, oem,
509 int init_tesseract_internal(
const char *arg0,
510 const char *textbase,
511 const char *language,
517 bool set_only_init_params);
521 void SetupUniversalFontIds();
523 int init_tesseract_lm(
const char *arg0,
524 const char *textbase,
525 const char *language);
527 void recognize_page(
STRING& image_name);
528 void end_tesseract();
530 bool init_tesseract_lang_data(
const char *arg0,
531 const char *textbase,
532 const char *language,
538 bool set_only_init_params);
540 void ParseLanguageString(
const char* lang_str,
546 #ifndef GRAPHICS_DISABLED 547 void pgeditor_main(
int width,
int height,
PAGE_RES* page_res);
548 #endif // GRAPHICS_DISABLED 549 void process_image_event(
551 BOOL8 process_cmd_win_event(
555 void debug_word(
PAGE_RES* page_res,
const TBOX &selection_box);
565 void blob_feature_display(
PAGE_RES* page_res,
const TBOX& selection_box);
570 inT16 first_alphanum_index(
const char *word,
571 const char *word_lengths);
572 inT16 first_alphanum_offset(
const char *word,
573 const char *word_lengths);
574 inT16 alpha_count(
const char *word,
575 const char *word_lengths);
577 const char *word_lengths);
579 inT16 count_alphanums(
595 void reject_edge_blobs(
WERD_RES *word);
596 void reject_mostly_rejects(
WERD_RES *word);
598 BOOL8 word_adaptable(
603 void recog_word_recursive(
WERD_RES* word);
605 void split_and_recog_word(
WERD_RES* word);
614 BOOL8 digit_or_numeric_punct(
WERD_RES *word,
int char_position);
615 inT16 eval_word_spacing(WERD_RES_LIST &word_res_list);
616 void match_current_words(WERD_RES_LIST &words,
ROW *row,
BLOCK* block);
617 inT16 fp_eval_word_spacing(WERD_RES_LIST &word_res_list);
618 void fix_noisy_space_list(WERD_RES_LIST &best_perm,
ROW *row,
BLOCK* block);
619 void fix_fuzzy_space_list(WERD_RES_LIST &best_perm,
ROW *row,
BLOCK* block);
620 void fix_sp_fp_word(WERD_RES_IT &word_res_it,
ROW *row,
BLOCK* block);
621 void fix_fuzzy_spaces(
625 void dump_words(WERD_RES_LIST &perm,
inT16 score,
628 inT16 worst_noise_blob(
WERD_RES *word_res,
float *worst_noise_score);
629 float blob_noise_score(
TBLOB *blob);
630 void break_noisiest_blob_word(WERD_RES_LIST &words);
637 void unrej_good_quality_words(
639 void doc_and_block_rejection(
641 BOOL8 good_quality_doc);
642 void quality_based_rejection(
PAGE_RES_IT &page_res_it,
643 BOOL8 good_quality_doc);
644 void convert_bad_unlv_chs(
WERD_RES *word_res);
648 inT16 *accepted_match_count);
650 inT16 count_outline_errs(
char c,
inT16 outline_count);
658 process_selected_words (
661 TBOX & selection_box,
664 void tess_add_doc_word(
667 void tess_segment_pass_n(
int pass_n,
WERD_RES *word);
668 bool tess_acceptable_word(
WERD_RES *word);
692 BLOCK_LIST *block_list);
696 void PreenXHeights(BLOCK_LIST *block_list);
701 BLOCK_LIST *block_list);
715 bool ResegmentCharBox(
PAGE_RES* page_res,
const TBOX *prev_box,
716 const TBOX& box,
const TBOX& next_box,
717 const char* correct_text);
724 bool ResegmentWordBox(BLOCK_LIST *block_list,
725 const TBOX& box,
const TBOX& next_box,
726 const char* correct_text);
729 void ReSegmentByClassification(
PAGE_RES* page_res);
732 bool ConvertStringToUnichars(
const char* utf8,
749 int choices_pos,
int choices_length,
760 void ReportFailedBox(
int boxfile_lineno,
TBOX box,
const char *box_ch,
761 const char *err_msg);
763 void CorrectClassifyWords(
PAGE_RES* page_res);
766 void ApplyBoxTraining(
const STRING& fontname,
PAGE_RES* page_res);
770 int CountMisfitTops(
WERD_RES *word_res);
775 float ComputeCompatibleXheight(
WERD_RES *word_res,
float* baseline_shift);
778 BOOL_VAR_H(tessedit_resegment_from_boxes,
false,
779 "Take segmentation and labeling from box file");
780 BOOL_VAR_H(tessedit_resegment_from_line_boxes,
false,
781 "Conversion of word/line box file to char box file");
783 "Generate training data from boxed chars");
784 BOOL_VAR_H(tessedit_make_boxes_from_boxes,
false,
785 "Generate more boxes from boxed chars");
786 BOOL_VAR_H(tessedit_dump_pageseg_images,
false,
787 "Dump intermediate images made during page segmentation");
789 "Page seg mode: 0=osd only, 1=auto+osd, 2=auto, 3=col, 4=block," 790 " 5=line, 6=word, 7=char" 791 " (Values from PageSegMode enum in publictypes.h)");
793 "Which OCR engine(s) to run (Tesseract, Cube, both). Defaults" 794 " to loading and running only Tesseract (no Cube, no combiner)." 795 " (Values from OcrEngineMode enum in tesseractclass.h)");
797 "Blacklist of chars not to recognize");
799 "Whitelist of chars to recognize");
801 "List of chars to override tessedit_char_blacklist");
803 "Perform training for ambiguities");
804 INT_VAR_H(pageseg_devanagari_split_strategy,
806 "Whether to use the top-line splitting process for Devanagari " 807 "documents while performing page-segmentation.");
810 "Whether to use the top-line splitting process for Devanagari " 811 "documents while performing ocr.");
813 "Write all parameters to the given file.");
815 "Generate and print debug information for adaption");
818 INT_VAR_H(applybox_page, 0,
"Page number to apply boxes from");
820 "Exposure value follows this pattern in the image" 821 " filename. The name of the image files are expected" 822 " to be in the form [lang].[fontname].exp[num].tif");
823 BOOL_VAR_H(applybox_learn_chars_and_char_frags_mode,
false,
824 "Learn both character fragments (as is done in the" 825 " special low exposure mode) as well as unfragmented" 828 "Each bounding box is assumed to contain ngrams. Only" 829 " learn the ngrams whose outlines overlap horizontally.");
830 BOOL_VAR_H(tessedit_display_outwords,
false,
"Draw output words");
831 BOOL_VAR_H(tessedit_dump_choices,
false,
"Dump char choices");
832 BOOL_VAR_H(tessedit_timing_debug,
false,
"Print timing stats");
834 "Try to improve fuzzy spaces");
836 "Dont bother with word plausibility");
837 BOOL_VAR_H(tessedit_fix_hyphens,
true,
"Crunch double hyphens?");
838 BOOL_VAR_H(tessedit_redo_xheight,
true,
"Check/Correct x-height");
840 "Add words to the document dictionary");
841 BOOL_VAR_H(tessedit_debug_fonts,
false,
"Output font info per char");
842 BOOL_VAR_H(tessedit_debug_block_rejection,
false,
"Block and Row stats");
843 BOOL_VAR_H(tessedit_enable_bigram_correction,
true,
844 "Enable correction based on the word bigram dictionary.");
845 BOOL_VAR_H(tessedit_enable_dict_correction,
false,
846 "Enable single word correction based on the dictionary.");
847 INT_VAR_H(tessedit_bigram_debug, 0,
"Amount of debug output for bigram " 850 "Remove and conditionally reassign small outlines when they" 851 " confuse layout analysis, determining diacritics vs noise");
852 INT_VAR_H(debug_noise_removal, 0,
"Debug reassignment of small outlines");
855 double_VAR_H(noise_cert_basechar, -8.0,
"Hingepoint for base char certainty");
858 double_VAR_H(noise_cert_disjoint, -2.5,
"Hingepoint for disjoint certainty");
861 double_VAR_H(noise_cert_punc, -2.5,
"Threshold for new punc char certainty");
864 "Scaling on certainty diff from Hingepoint");
865 INT_VAR_H(noise_maxperblob, 8,
"Max diacritics to apply to a blob");
866 INT_VAR_H(noise_maxperword, 16,
"Max diacritics to apply to a word");
868 BOOL_VAR_H(debug_acceptable_wds,
false,
"Dump word pass/fail chk");
870 STRING_VAR_H(chs_trailing_punct1,
").,;:?!",
"1st Trailing punctuation");
871 STRING_VAR_H(chs_trailing_punct2,
")'`\"",
"2nd Trailing punctuation");
872 double_VAR_H(quality_rej_pc, 0.08,
"good_quality_doc lte rejection limit");
873 double_VAR_H(quality_blob_pc, 0.0,
"good_quality_doc gte good blobs limit");
875 "good_quality_doc lte outline error limit");
876 double_VAR_H(quality_char_pc, 0.95,
"good_quality_doc gte good char limit");
877 INT_VAR_H(quality_min_initial_alphas_reqd, 2,
"alphas in a good word");
878 INT_VAR_H(tessedit_tess_adaption_mode, 0x27,
879 "Adaptation decision algorithm for tess");
881 "Do minimal rejection on pass 1 output");
882 BOOL_VAR_H(tessedit_test_adaption,
false,
"Test adaption criteria");
883 BOOL_VAR_H(tessedit_matcher_log,
false,
"Log matcher activity");
884 INT_VAR_H(tessedit_test_adaption_mode, 3,
885 "Adaptation decision algorithm for tess");
889 INT_VAR_H(paragraph_debug_level, 0,
"Print paragraph debug info.");
891 "Run paragraph detection on the post-text-recognition " 893 INT_VAR_H(cube_debug_level, 1,
"Print cube debug info.");
895 STRING_VAR_H(outlines_2,
"ij!?%\":;",
"Non standard number of outlines");
896 BOOL_VAR_H(docqual_excuse_outline_errs,
false,
897 "Allow outline errs in unrejection?");
899 "Reduce rejection on good docs");
900 BOOL_VAR_H(tessedit_use_reject_spaces,
true,
"Reject spaces?");
902 "%rej allowed before rej whole doc");
904 "%rej allowed before rej whole block");
906 "%rej allowed before rej whole row");
908 "Number of row rejects in whole word rejects" 909 "which prevents whole row rejection");
910 BOOL_VAR_H(tessedit_preserve_blk_rej_perfect_wds,
true,
911 "Only rej partially rejected words in block rejection");
912 BOOL_VAR_H(tessedit_preserve_row_rej_perfect_wds,
true,
913 "Only rej partially rejected words in row rejection");
914 BOOL_VAR_H(tessedit_dont_blkrej_good_wds,
false,
915 "Use word segmentation quality metric");
916 BOOL_VAR_H(tessedit_dont_rowrej_good_wds,
false,
917 "Use word segmentation quality metric");
918 INT_VAR_H(tessedit_preserve_min_wd_len, 2,
919 "Only preserve wds longer than this");
921 "Apply row rejection to good docs");
923 "rej good doc wd if more than this fraction rejected");
924 BOOL_VAR_H(tessedit_reject_bad_qual_wds,
true,
925 "Reject all bad quality wds");
926 BOOL_VAR_H(tessedit_debug_doc_rejection,
false,
"Page stats");
927 BOOL_VAR_H(tessedit_debug_quality_metrics,
false,
928 "Output data to debug file");
929 BOOL_VAR_H(bland_unrej,
false,
"unrej potential with no chekcs");
931 "good_quality_doc gte good char limit");
933 "Mark v.bad words for tilde crunch");
935 "Add font info to hocr output");
936 BOOL_VAR_H(crunch_early_merge_tess_fails,
true,
"Before word crunch?");
937 BOOL_VAR_H(crunch_early_convert_bad_unlv_chs,
false,
"Take out ~^ early?");
941 "crunch garbage cert lt this");
942 double_VAR_H(crunch_poor_garbage_rate, 60,
"crunch garbage rating lt this");
943 double_VAR_H(crunch_pot_poor_rate, 40,
"POTENTIAL crunch rating lt this");
944 double_VAR_H(crunch_pot_poor_cert, -8.0,
"POTENTIAL crunch cert lt this");
945 BOOL_VAR_H(crunch_pot_garbage,
true,
"POTENTIAL crunch garbage");
946 double_VAR_H(crunch_del_rating, 60,
"POTENTIAL crunch rating lt this");
950 double_VAR_H(crunch_del_min_width, 3.0,
"Del if word width lt xht x this");
952 "Del if word gt xht x this above bl");
953 double_VAR_H(crunch_del_low_word, 0.5,
"Del if word gt xht x this below bl");
954 double_VAR_H(crunch_small_outlines_size, 0.6,
"Small if lt xht x this");
955 INT_VAR_H(crunch_rating_max, 10,
"For adj length in rating per ch");
956 INT_VAR_H(crunch_pot_indicators, 1,
"How many potential indicators needed");
957 BOOL_VAR_H(crunch_leave_ok_strings,
true,
"Dont touch sensible strings");
958 BOOL_VAR_H(crunch_accept_ok,
true,
"Use acceptability in okstring");
959 BOOL_VAR_H(crunch_leave_accept_strings,
false,
960 "Dont pot crunch sensible strings");
961 BOOL_VAR_H(crunch_include_numerals,
false,
"Fiddle alpha figures");
963 "Dont crunch words with long lower case strings");
965 "Dont crunch words with long lower case strings");
966 INT_VAR_H(crunch_long_repetitions, 3,
"Crunch words with long repetitions");
969 "How many non-noise blbs either side?");
970 double_VAR_H(fixsp_small_outlines_size, 0.28,
"Small if lt xht x this");
971 BOOL_VAR_H(tessedit_prefer_joined_punct,
false,
"Reward punctation joins");
972 INT_VAR_H(fixsp_done_mode, 1,
"What constitues done for spacing");
973 INT_VAR_H(debug_fix_space_level, 0,
"Contextual fixspace debug");
975 "Punct. chs expected WITHIN numbers");
977 "Max allowed deviation of blob top outside of font data");
978 INT_VAR_H(x_ht_min_change, 8,
"Min change in xht before actually trying it");
979 INT_VAR_H(superscript_debug, 0,
"Debug level for sub & superscript fixer");
980 double_VAR_H(superscript_worse_certainty, 2.0,
"How many times worse " 981 "certainty does a superscript position glyph need to be for us " 982 "to try classifying it as a char with a different baseline?");
983 double_VAR_H(superscript_bettered_certainty, 0.97,
"What reduction in " 984 "badness do we think sufficient to choose a superscript over " 985 "what we'd thought. For example, a value of 0.6 means we want " 986 "to reduce badness of certainty by 40%");
988 "A superscript scaled down more than this is unbelievably " 989 "small. For example, 0.3 means we expect the font size to " 990 "be no smaller than 30% of the text line font size.");
992 "Maximum top of a character measured as a multiple of x-height " 993 "above the baseline for us to reconsider whether it's a " 996 "Minimum bottom of a character measured as a multiple of " 997 "x-height above the baseline for us to reconsider whether it's " 999 BOOL_VAR_H(tessedit_write_block_separators,
false,
1000 "Write block separators in output");
1002 "Write repetition char code");
1003 BOOL_VAR_H(tessedit_write_unlv,
false,
"Write .unlv output file");
1005 BOOL_VAR_H(tessedit_create_hocr,
false,
"Write .html hOCR output file");
1006 BOOL_VAR_H(tessedit_create_pdf,
false,
"Write .pdf output file");
1008 "Output char for unidentified blobs");
1011 "Min suspect level for rejecting spaces");
1013 "Dont Suspect dict wds longer than this");
1014 BOOL_VAR_H(suspect_constrain_1Il,
false,
"UNLV keep 1Il chars rejected");
1017 BOOL_VAR_H(tessedit_minimal_rejection,
false,
"Only reject tess failures");
1018 BOOL_VAR_H(tessedit_zero_rejection,
false,
"Dont reject ANYTHING");
1020 "Make output have exactly one word per WERD");
1021 BOOL_VAR_H(tessedit_zero_kelvin_rejection,
false,
1022 "Dont reject ANYTHING AT ALL");
1023 BOOL_VAR_H(tessedit_consistent_reps,
true,
"Force all rep chars the same");
1028 "Aspect ratio dot/hyphen test");
1030 "Aspect ratio dot/hyphen test");
1031 BOOL_VAR_H(rej_trust_doc_dawg,
false,
"Use DOC dawg in 11l conf. detector");
1033 BOOL_VAR_H(rej_1Il_trust_permuter_type,
true,
"Dont double check");
1034 BOOL_VAR_H(rej_use_tess_accepted,
true,
"Individual rejection control");
1035 BOOL_VAR_H(rej_use_tess_blanks,
true,
"Individual rejection control");
1036 BOOL_VAR_H(rej_use_good_perm,
true,
"Individual rejection control");
1038 BOOL_VAR_H(rej_alphas_in_number_perm,
false,
"Extend permuter check");
1039 double_VAR_H(rej_whole_of_mostly_reject_word_fract, 0.85,
"if >this fract");
1040 INT_VAR_H(tessedit_image_border, 2,
"Rej blbs near image edge limit");
1041 STRING_VAR_H(ok_repeated_ch_non_alphanum_wds,
"-?*\075",
1042 "Allow NN to unrej");
1044 INT_VAR_H(min_sane_x_ht_pixels, 8,
"Reject any x-ht lt or eq than this");
1045 BOOL_VAR_H(tessedit_create_boxfile,
false,
"Output text with boxes");
1047 "-1 -> All pages, else specifc page to process");
1048 BOOL_VAR_H(tessedit_write_images,
false,
"Capture the image from the IPE");
1049 BOOL_VAR_H(interactive_display_mode,
false,
"Run interactively?");
1051 BOOL_VAR_H(tessedit_override_permuter,
true,
"According to dict_word");
1052 INT_VAR_H(tessdata_manager_debug_level, 0,
1053 "Debug level for TessdataManager functions.");
1055 "List of languages to load with this one");
1056 BOOL_VAR_H(tessedit_use_primary_params_model,
false,
1057 "In multilingual mode use params model of the primary language");
1061 "Min acceptable orientation margin");
1062 BOOL_VAR_H(textord_tabfind_show_vlines,
false,
"Debug line finding");
1065 "Allow feature extractors to see the original outline");
1067 "Only initialize with the config file. Useful if the instance is " 1068 "not going to be used for OCR but say only for layout analysis.");
1069 BOOL_VAR_H(textord_equation_detect,
false,
"Turn on equation detector");
1070 BOOL_VAR_H(textord_tabfind_vertical_text,
true,
"Enable vertical detection");
1071 BOOL_VAR_H(textord_tabfind_force_vertical_text,
false,
1072 "Force using vertical text page mode");
1074 "Fraction of textlines deemed vertical to use vertical page " 1076 double_VAR_H(textord_tabfind_aligned_gap_fraction, 0.75,
1077 "Fraction of height used as a minimum gap for aligned blobs.");
1078 INT_VAR_H(tessedit_parallelize, 0,
"Run in parallel where possible");
1080 "Preserve multiple interword spaces");
1082 "Include page separator string in output text after each " 1085 "Page separator (default is form feed control character)");
1095 BOOL_VAR_H(textord_tabfind_vertical_horizontal_mix,
true,
1096 "find horizontal lines such as headers in vertical page mode");
1097 INT_VAR_H(tessedit_ok_mode, 5,
"Acceptance decision algorithm");
1098 BOOL_VAR_H(load_fixed_length_dawgs,
true,
"Load fixed length" 1099 " dawgs (e.g. for non-space delimited languages)");
1100 INT_VAR_H(segment_debug, 0,
"Debug the whole segmentation process");
1102 double_VAR_H(bestrate_pruning_factor, 2.0,
"Multiplying factor of" 1103 " current best rate to prune other hypotheses");
1105 "Turn on word script consistency permuter");
1107 "incorporate segmentation cost in word rating?");
1109 "Score multipler for script consistency within a word. " 1110 "Being a 'reward' factor, it should be <= 1. " 1111 "Smaller value implies bigger reward.");
1113 "Turn on fixed-length phrasebook search permuter");
1115 "Turn on character type (property) consistency permuter");
1117 "Score multipler for char type consistency within a word. ");
1119 "Score multipler for ngram permuter's best choice" 1120 " (only used in the Han script path).");
1122 "Activate character-level n-gram-based permuter");
1123 BOOL_VAR_H(permute_only_top,
false,
"Run only the top choice permuter");
1124 INT_VAR_H(language_model_fixed_length_choices_depth, 3,
1125 "Depth of blob choice lists to explore" 1126 " when fixed length dawgs are on");
1128 "use new state cost heuristics for segmentation state evaluation");
1130 "base factor for adding segmentation cost into word rating." 1131 "It's a multiplying factor, the larger the value above 1, " 1132 "the bigger the effect of segmentation cost.");
1134 "weight associated with char rating in combined cost of state");
1136 "weight associated with width evidence in combined cost of" 1139 "weight associated with seam cut in combined cost of state");
1141 "max char width-to-height ratio allowed in segmentation");
1143 "Enable new segmentation search path.");
1144 double_VAR_H(segsearch_max_fixed_pitch_char_wh_ratio, 2.0,
1145 "Maximum character width-to-height ratio for" 1146 "fixed pitch fonts");
1150 FILE *init_recog_training(
const STRING &fname);
1151 void recog_training_segmented(
const STRING &fname,
1155 void ambigs_classify_and_output(
const char *label,
1159 #ifndef ANDROID_BUILD 1167 const char* backup_config_file_;
1178 Pix* pix_thresholds_;
1181 int source_resolution_;
1188 bool right_to_left_;
1200 int font_table_size_;
1201 #ifndef ANDROID_BUILD 1213 #endif // TESSERACT_CCMAIN_TESSERACTCLASS_H__
BOOL8 non_0_digit(const char *str, int length)
void dont_allow_1Il(WERD_RES *word)
void(Tesseract::* WordRecognizer)(const WordData &word_data, WERD_RES **in_word, PointerVector< WERD_RES > *out_words)
inT16 word_blob_quality(WERD_RES *word, ROW *row)
Tesseract * get_sub_lang(int index) const
Textord * mutable_textord()
void set_pix_grey(Pix *grey_pix)
PointerVector< WERD_RES > lang_words
inT16 doc_good_char_quality
WordData(const PAGE_RES_IT &page_res_it)
CubeRecoContext * GetCubeRecoContext()
Assume a single uniform block of text. (Default.)
inT32 adaption_word_number
int scaled_factor() const
#define STRING_VAR_H(name, val, comment)
int num_sub_langs() const
void flip_hyphens(WERD_RES *word)
void set_pix_thresholds(Pix *thresholds)
int init_tesseract(const char *datapath, const char *language, OcrEngineMode oem)
bool write_results_empty_block
const Textord & textord() const
Pix ** mutable_pix_binary()
int source_resolution() const
WordData(BLOCK *block_in, ROW *row_in, WERD_RES *word_res)
const FCOORD & reskew() const
#define double_VAR_H(name, val, comment)
void SetScaledColor(int factor, Pix *color)
bool tilde_crunch_written
Pix * scaled_color() const
void set_source_resolution(int ppi)
BOOL8 word_contains_non_1_digit(const char *word, const char *word_lengths)
bool right_to_left() const
#define BOOL_VAR_H(name, val, comment)
bool last_char_was_newline
#define INT_VAR_H(name, val, comment)
void flip_0O(WERD_RES *word)