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) {}
170 Dict& getDict()
override;
176 void ResetAdaptiveClassifier();
178 void ResetDocumentDictionary();
189 pixDestroy(&pix_binary_);
199 pixDestroy(&pix_grey_);
200 pix_grey_ = grey_pix;
205 pixDestroy(&pix_original_);
206 pix_original_ = original_pix;
208 for (
int i = 0; i < sub_langs_.size(); ++i)
209 sub_langs_[i]->set_pix_original(original_pix ? pixClone(original_pix)
221 if (pixGetWidth(pix_original_) == ImageWidth())
222 return pix_original_;
223 else if (pix_grey_ != NULL)
229 pixDestroy(&pix_thresholds_);
230 pix_thresholds_ = thresholds;
233 return source_resolution_;
236 source_resolution_ = ppi;
239 return pixGetWidth(pix_binary_);
242 return pixGetHeight(pix_binary_);
245 return scaled_color_;
248 return scaled_factor_;
251 scaled_factor_ = factor;
252 scaled_color_ = color;
262 return right_to_left_;
265 return sub_langs_.size();
268 return sub_langs_[index];
273 for (
int i = 0; i < sub_langs_.size(); ++i) {
274 if (sub_langs_[i]->tessedit_ocr_engine_mode !=
OEM_LSTM_ONLY)
return true;
281 for (
int i = 0; i < sub_langs_.size(); ++i) {
288 void SetBlackAndWhitelist();
294 void PrepareForPageseg();
301 void PrepareForTessOCR(BLOCK_LIST* block_list,
304 int SegmentPage(
const STRING* input_file, BLOCK_LIST* blocks,
306 void SetupWordScripts(BLOCK_LIST* blocks);
307 int AutoPageSeg(
PageSegMode pageseg_mode, BLOCK_LIST* blocks,
308 TO_BLOCK_LIST* to_blocks, BLOBNBOX_LIST* diacritic_blobs,
312 OSResults* osr, TO_BLOCK_LIST* to_blocks, Pix** photo_mask_pix,
313 Pix** music_mask_pix);
321 void TrainLineRecognizer(
const STRING& input_imagename,
322 const STRING& output_basename,
323 BLOCK_LIST *block_list);
329 BLOCK_LIST *block_list,
338 int start_box,
int end_box,
347 TBOX* revised_box)
const;
358 bool ProcessTargetWord(
const TBOX& word_box,
const TBOX& target_word_box,
359 const char* word_config,
int pass);
361 void SetupAllWordsPassN(
int pass_n,
362 const TBOX* target_word_box,
363 const char* word_config,
367 void SetupWordPassN(
int pass_n,
WordData* word);
369 bool RecogAllWordsPassN(
int pass_n,
ETEXT_DESC* monitor,
372 bool recog_all_words(
PAGE_RES* page_res,
374 const TBOX* target_word_box,
375 const char* word_config,
377 void rejection_passes(
PAGE_RES* page_res,
379 const TBOX* target_word_box,
380 const char* word_config);
381 void bigram_correction_pass(
PAGE_RES *page_res);
382 void blamer_pass(
PAGE_RES* page_res);
384 void script_pos_pass(
PAGE_RES* page_res);
394 bool ReassignDiacritics(
int pass,
PAGE_RES_IT* pr_it,
395 bool* make_next_word_fuzzy);
400 void AssignDiacriticsToOverlappingBlobs(
414 bool SelectGoodDiacriticOutlines(
int pass,
float certainty_threshold,
429 STRING* best_str,
float* c2);
430 void classify_word_and_language(
int pass_n,
PAGE_RES_IT* pr_it,
432 void classify_word_pass1(
const WordData& word_data,
435 void recog_pseudo_word(
PAGE_RES* page_res,
436 TBOX &selection_box);
442 const char *lengths);
444 void classify_word_pass2(
const WordData& word_data,
447 void ReportXhtFixResult(
bool accept_new_word,
float new_x_ht,
453 bool TestNewNormalization(
int original_misfits,
float baseline_shift,
459 void set_word_fonts(
WERD_RES *word);
460 void font_recognition_pass(
PAGE_RES* page_res);
461 void dictionary_correction_pass(
PAGE_RES* page_res);
465 bool SubAndSuperscriptFix(
WERD_RES *word_res);
466 void GetSubAndSuperscriptCandidates(
const WERD_RES *word,
467 int *num_rebuilt_leading,
469 float *leading_certainty,
470 int *num_rebuilt_trailing,
472 float *trailing_certainty,
473 float *avg_certainty,
474 float *unlikely_threshold);
475 WERD_RES *TrySuperscriptSplits(
int num_chopped_leading,
476 float leading_certainty,
478 int num_chopped_trailing,
479 float trailing_certainty,
484 int *retry_trailing);
485 bool BelievableSuperscript(
bool debug,
487 float certainty_threshold,
489 int *right_ok)
const;
493 void output_pass(
PAGE_RES_IT &page_res_it,
const TBOX *target_word_box);
498 void set_unlv_suspects(
WERD_RES *word);
500 BOOL8 acceptable_number_string(
const char *s,
501 const char *lengths);
510 int init_tesseract(
const char* arg0,
const char* textbase,
516 const char *language,
519 return init_tesseract(datapath, NULL, language, oem, NULL, 0, NULL, NULL,
538 int init_tesseract_internal(
const char* arg0,
const char* textbase,
540 char** configs,
int configs_size,
547 void SetupUniversalFontIds();
549 int init_tesseract_lm(
const char* arg0,
const char* textbase,
552 void recognize_page(
STRING& image_name);
553 void end_tesseract();
555 bool init_tesseract_lang_data(
const char* arg0,
const char* textbase,
557 char** configs,
int configs_size,
560 bool set_only_init_params,
563 void ParseLanguageString(
const char* lang_str,
569 #ifndef GRAPHICS_DISABLED 570 void pgeditor_main(
int width,
int height,
PAGE_RES* page_res);
571 #endif // GRAPHICS_DISABLED 572 void process_image_event(
574 BOOL8 process_cmd_win_event(
578 void debug_word(
PAGE_RES* page_res,
const TBOX &selection_box);
588 void blob_feature_display(
PAGE_RES* page_res,
const TBOX& selection_box);
593 inT16 first_alphanum_index(
const char *word,
594 const char *word_lengths);
595 inT16 first_alphanum_offset(
const char *word,
596 const char *word_lengths);
597 inT16 alpha_count(
const char *word,
598 const char *word_lengths);
600 const char *word_lengths);
602 inT16 count_alphanums(
618 void reject_edge_blobs(
WERD_RES *word);
619 void reject_mostly_rejects(
WERD_RES *word);
621 BOOL8 word_adaptable(
626 void recog_word_recursive(
WERD_RES* word);
628 void split_and_recog_word(
WERD_RES* word);
637 BOOL8 digit_or_numeric_punct(
WERD_RES *word,
int char_position);
638 inT16 eval_word_spacing(WERD_RES_LIST &word_res_list);
639 void match_current_words(WERD_RES_LIST &words,
ROW *row,
BLOCK* block);
640 inT16 fp_eval_word_spacing(WERD_RES_LIST &word_res_list);
641 void fix_noisy_space_list(WERD_RES_LIST &best_perm,
ROW *row,
BLOCK* block);
642 void fix_fuzzy_space_list(WERD_RES_LIST &best_perm,
ROW *row,
BLOCK* block);
643 void fix_sp_fp_word(WERD_RES_IT &word_res_it,
ROW *row,
BLOCK* block);
644 void fix_fuzzy_spaces(
648 void dump_words(WERD_RES_LIST &perm,
inT16 score,
651 inT16 worst_noise_blob(
WERD_RES *word_res,
float *worst_noise_score);
652 float blob_noise_score(
TBLOB *blob);
653 void break_noisiest_blob_word(WERD_RES_LIST &words);
660 void unrej_good_quality_words(
662 void doc_and_block_rejection(
664 BOOL8 good_quality_doc);
665 void quality_based_rejection(
PAGE_RES_IT &page_res_it,
666 BOOL8 good_quality_doc);
667 void convert_bad_unlv_chs(
WERD_RES *word_res);
671 inT16 *accepted_match_count);
673 inT16 count_outline_errs(
char c,
inT16 outline_count);
681 process_selected_words (
684 TBOX & selection_box,
687 void tess_add_doc_word(
690 void tess_segment_pass_n(
int pass_n,
WERD_RES *word);
691 bool tess_acceptable_word(
WERD_RES *word);
715 BLOCK_LIST *block_list);
719 void PreenXHeights(BLOCK_LIST *block_list);
724 BLOCK_LIST *block_list);
738 bool ResegmentCharBox(
PAGE_RES* page_res,
const TBOX *prev_box,
739 const TBOX& box,
const TBOX& next_box,
740 const char* correct_text);
747 bool ResegmentWordBox(BLOCK_LIST *block_list,
748 const TBOX& box,
const TBOX& next_box,
749 const char* correct_text);
752 void ReSegmentByClassification(
PAGE_RES* page_res);
755 bool ConvertStringToUnichars(
const char* utf8,
772 int choices_pos,
int choices_length,
783 void ReportFailedBox(
int boxfile_lineno,
TBOX box,
const char *box_ch,
784 const char *err_msg);
786 void CorrectClassifyWords(
PAGE_RES* page_res);
789 void ApplyBoxTraining(
const STRING& fontname,
PAGE_RES* page_res);
793 int CountMisfitTops(
WERD_RES *word_res);
798 float ComputeCompatibleXheight(
WERD_RES *word_res,
float* baseline_shift);
801 BOOL_VAR_H(tessedit_resegment_from_boxes,
false,
802 "Take segmentation and labeling from box file");
803 BOOL_VAR_H(tessedit_resegment_from_line_boxes,
false,
804 "Conversion of word/line box file to char box file");
806 "Generate training data from boxed chars");
807 BOOL_VAR_H(tessedit_make_boxes_from_boxes,
false,
808 "Generate more boxes from boxed chars");
809 BOOL_VAR_H(tessedit_train_line_recognizer,
false,
810 "Break input into lines and remap boxes if present");
811 BOOL_VAR_H(tessedit_dump_pageseg_images,
false,
812 "Dump intermediate images made during page segmentation");
814 "Page seg mode: 0=osd only, 1=auto+osd, 2=auto, 3=col, 4=block," 815 " 5=line, 6=word, 7=char" 816 " (Values from PageSegMode enum in publictypes.h)");
818 "Which OCR engine(s) to run (Tesseract, LSTM, both). Defaults" 819 " to loading and running the most accurate available.");
821 "Blacklist of chars not to recognize");
823 "Whitelist of chars to recognize");
825 "List of chars to override tessedit_char_blacklist");
827 "Perform training for ambiguities");
828 INT_VAR_H(pageseg_devanagari_split_strategy,
830 "Whether to use the top-line splitting process for Devanagari " 831 "documents while performing page-segmentation.");
834 "Whether to use the top-line splitting process for Devanagari " 835 "documents while performing ocr.");
837 "Write all parameters to the given file.");
839 "Generate and print debug information for adaption");
842 INT_VAR_H(applybox_page, 0,
"Page number to apply boxes from");
844 "Exposure value follows this pattern in the image" 845 " filename. The name of the image files are expected" 846 " to be in the form [lang].[fontname].exp[num].tif");
847 BOOL_VAR_H(applybox_learn_chars_and_char_frags_mode,
false,
848 "Learn both character fragments (as is done in the" 849 " special low exposure mode) as well as unfragmented" 852 "Each bounding box is assumed to contain ngrams. Only" 853 " learn the ngrams whose outlines overlap horizontally.");
854 BOOL_VAR_H(tessedit_display_outwords,
false,
"Draw output words");
855 BOOL_VAR_H(tessedit_dump_choices,
false,
"Dump char choices");
856 BOOL_VAR_H(tessedit_timing_debug,
false,
"Print timing stats");
858 "Try to improve fuzzy spaces");
860 "Don't bother with word plausibility");
861 BOOL_VAR_H(tessedit_fix_hyphens,
true,
"Crunch double hyphens?");
862 BOOL_VAR_H(tessedit_redo_xheight,
true,
"Check/Correct x-height");
864 "Add words to the document dictionary");
865 BOOL_VAR_H(tessedit_debug_fonts,
false,
"Output font info per char");
866 BOOL_VAR_H(tessedit_debug_block_rejection,
false,
"Block and Row stats");
867 BOOL_VAR_H(tessedit_enable_bigram_correction,
true,
868 "Enable correction based on the word bigram dictionary.");
869 BOOL_VAR_H(tessedit_enable_dict_correction,
false,
870 "Enable single word correction based on the dictionary.");
871 INT_VAR_H(tessedit_bigram_debug, 0,
"Amount of debug output for bigram " 874 "Remove and conditionally reassign small outlines when they" 875 " confuse layout analysis, determining diacritics vs noise");
876 INT_VAR_H(debug_noise_removal, 0,
"Debug reassignment of small outlines");
879 double_VAR_H(noise_cert_basechar, -8.0,
"Hingepoint for base char certainty");
882 double_VAR_H(noise_cert_disjoint, -2.5,
"Hingepoint for disjoint certainty");
885 double_VAR_H(noise_cert_punc, -2.5,
"Threshold for new punc char certainty");
888 "Scaling on certainty diff from Hingepoint");
889 INT_VAR_H(noise_maxperblob, 8,
"Max diacritics to apply to a blob");
890 INT_VAR_H(noise_maxperword, 16,
"Max diacritics to apply to a word");
892 BOOL_VAR_H(debug_acceptable_wds,
false,
"Dump word pass/fail chk");
894 STRING_VAR_H(chs_trailing_punct1,
").,;:?!",
"1st Trailing punctuation");
895 STRING_VAR_H(chs_trailing_punct2,
")'`\"",
"2nd Trailing punctuation");
896 double_VAR_H(quality_rej_pc, 0.08,
"good_quality_doc lte rejection limit");
897 double_VAR_H(quality_blob_pc, 0.0,
"good_quality_doc gte good blobs limit");
899 "good_quality_doc lte outline error limit");
900 double_VAR_H(quality_char_pc, 0.95,
"good_quality_doc gte good char limit");
901 INT_VAR_H(quality_min_initial_alphas_reqd, 2,
"alphas in a good word");
902 INT_VAR_H(tessedit_tess_adaption_mode, 0x27,
903 "Adaptation decision algorithm for tess");
905 "Do minimal rejection on pass 1 output");
906 BOOL_VAR_H(tessedit_test_adaption,
false,
"Test adaption criteria");
907 BOOL_VAR_H(tessedit_matcher_log,
false,
"Log matcher activity");
908 INT_VAR_H(tessedit_test_adaption_mode, 3,
909 "Adaptation decision algorithm for tess");
913 INT_VAR_H(multilang_debug_level, 0,
"Print multilang debug info.");
914 INT_VAR_H(paragraph_debug_level, 0,
"Print paragraph debug info.");
916 "Run paragraph detection on the post-text-recognition " 918 BOOL_VAR_H(lstm_use_matrix, 1,
"Use ratings matrix/beam searct with lstm");
920 STRING_VAR_H(outlines_2,
"ij!?%\":;",
"Non standard number of outlines");
921 BOOL_VAR_H(docqual_excuse_outline_errs,
false,
922 "Allow outline errs in unrejection?");
924 "Reduce rejection on good docs");
925 BOOL_VAR_H(tessedit_use_reject_spaces,
true,
"Reject spaces?");
927 "%rej allowed before rej whole doc");
929 "%rej allowed before rej whole block");
931 "%rej allowed before rej whole row");
933 "Number of row rejects in whole word rejects" 934 "which prevents whole row rejection");
935 BOOL_VAR_H(tessedit_preserve_blk_rej_perfect_wds,
true,
936 "Only rej partially rejected words in block rejection");
937 BOOL_VAR_H(tessedit_preserve_row_rej_perfect_wds,
true,
938 "Only rej partially rejected words in row rejection");
939 BOOL_VAR_H(tessedit_dont_blkrej_good_wds,
false,
940 "Use word segmentation quality metric");
941 BOOL_VAR_H(tessedit_dont_rowrej_good_wds,
false,
942 "Use word segmentation quality metric");
943 INT_VAR_H(tessedit_preserve_min_wd_len, 2,
944 "Only preserve wds longer than this");
946 "Apply row rejection to good docs");
948 "rej good doc wd if more than this fraction rejected");
949 BOOL_VAR_H(tessedit_reject_bad_qual_wds,
true,
950 "Reject all bad quality wds");
951 BOOL_VAR_H(tessedit_debug_doc_rejection,
false,
"Page stats");
952 BOOL_VAR_H(tessedit_debug_quality_metrics,
false,
953 "Output data to debug file");
954 BOOL_VAR_H(bland_unrej,
false,
"unrej potential with no checks");
956 "good_quality_doc gte good char limit");
958 "Mark v.bad words for tilde crunch");
960 "Add font info to hocr output");
961 BOOL_VAR_H(crunch_early_merge_tess_fails,
true,
"Before word crunch?");
962 BOOL_VAR_H(crunch_early_convert_bad_unlv_chs,
false,
"Take out ~^ early?");
966 "crunch garbage cert lt this");
967 double_VAR_H(crunch_poor_garbage_rate, 60,
"crunch garbage rating lt this");
968 double_VAR_H(crunch_pot_poor_rate, 40,
"POTENTIAL crunch rating lt this");
969 double_VAR_H(crunch_pot_poor_cert, -8.0,
"POTENTIAL crunch cert lt this");
970 BOOL_VAR_H(crunch_pot_garbage,
true,
"POTENTIAL crunch garbage");
971 double_VAR_H(crunch_del_rating, 60,
"POTENTIAL crunch rating lt this");
975 double_VAR_H(crunch_del_min_width, 3.0,
"Del if word width lt xht x this");
977 "Del if word gt xht x this above bl");
978 double_VAR_H(crunch_del_low_word, 0.5,
"Del if word gt xht x this below bl");
979 double_VAR_H(crunch_small_outlines_size, 0.6,
"Small if lt xht x this");
980 INT_VAR_H(crunch_rating_max, 10,
"For adj length in rating per ch");
981 INT_VAR_H(crunch_pot_indicators, 1,
"How many potential indicators needed");
982 BOOL_VAR_H(crunch_leave_ok_strings,
true,
"Don't touch sensible strings");
983 BOOL_VAR_H(crunch_accept_ok,
true,
"Use acceptability in okstring");
984 BOOL_VAR_H(crunch_leave_accept_strings,
false,
985 "Don't pot crunch sensible strings");
986 BOOL_VAR_H(crunch_include_numerals,
false,
"Fiddle alpha figures");
988 "Don't crunch words with long lower case strings");
990 "Don't crunch words with long lower case strings");
991 INT_VAR_H(crunch_long_repetitions, 3,
"Crunch words with long repetitions");
994 "How many non-noise blbs either side?");
995 double_VAR_H(fixsp_small_outlines_size, 0.28,
"Small if lt xht x this");
996 BOOL_VAR_H(tessedit_prefer_joined_punct,
false,
"Reward punctation joins");
997 INT_VAR_H(fixsp_done_mode, 1,
"What constitues done for spacing");
998 INT_VAR_H(debug_fix_space_level, 0,
"Contextual fixspace debug");
1000 "Punct. chs expected WITHIN numbers");
1002 "Max allowed deviation of blob top outside of font data");
1003 INT_VAR_H(x_ht_min_change, 8,
"Min change in xht before actually trying it");
1004 INT_VAR_H(superscript_debug, 0,
"Debug level for sub & superscript fixer");
1005 double_VAR_H(superscript_worse_certainty, 2.0,
"How many times worse " 1006 "certainty does a superscript position glyph need to be for us " 1007 "to try classifying it as a char with a different baseline?");
1008 double_VAR_H(superscript_bettered_certainty, 0.97,
"What reduction in " 1009 "badness do we think sufficient to choose a superscript over " 1010 "what we'd thought. For example, a value of 0.6 means we want " 1011 "to reduce badness of certainty by 40%");
1013 "A superscript scaled down more than this is unbelievably " 1014 "small. For example, 0.3 means we expect the font size to " 1015 "be no smaller than 30% of the text line font size.");
1017 "Maximum top of a character measured as a multiple of x-height " 1018 "above the baseline for us to reconsider whether it's a " 1021 "Minimum bottom of a character measured as a multiple of " 1022 "x-height above the baseline for us to reconsider whether it's " 1024 BOOL_VAR_H(tessedit_write_block_separators,
false,
1025 "Write block separators in output");
1027 "Write repetition char code");
1028 BOOL_VAR_H(tessedit_write_unlv,
false,
"Write .unlv output file");
1029 BOOL_VAR_H(tessedit_create_txt,
false,
"Write .txt output file");
1030 BOOL_VAR_H(tessedit_create_hocr,
false,
"Write .html hOCR output file");
1031 BOOL_VAR_H(tessedit_create_tsv,
false,
"Write .tsv output file");
1032 BOOL_VAR_H(tessedit_create_pdf,
false,
"Write .pdf output file");
1034 "Create PDF with only one invisible text layer");
1036 "Output char for unidentified blobs");
1039 "Min suspect level for rejecting spaces");
1040 INT_VAR_H(suspect_short_words, 2,
"Don't Suspect dict wds longer than this");
1041 BOOL_VAR_H(suspect_constrain_1Il,
false,
"UNLV keep 1Il chars rejected");
1042 double_VAR_H(suspect_rating_per_ch, 999.9,
"Don't touch bad rating limit");
1044 BOOL_VAR_H(tessedit_minimal_rejection,
false,
"Only reject tess failures");
1045 BOOL_VAR_H(tessedit_zero_rejection,
false,
"Don't reject ANYTHING");
1047 "Make output have exactly one word per WERD");
1048 BOOL_VAR_H(tessedit_zero_kelvin_rejection,
false,
1049 "Don't reject ANYTHING AT ALL");
1050 BOOL_VAR_H(tessedit_consistent_reps,
true,
"Force all rep chars the same");
1055 "Aspect ratio dot/hyphen test");
1057 "Aspect ratio dot/hyphen test");
1058 BOOL_VAR_H(rej_trust_doc_dawg,
false,
"Use DOC dawg in 11l conf. detector");
1060 BOOL_VAR_H(rej_1Il_trust_permuter_type,
true,
"Don't double check");
1061 BOOL_VAR_H(rej_use_tess_accepted,
true,
"Individual rejection control");
1062 BOOL_VAR_H(rej_use_tess_blanks,
true,
"Individual rejection control");
1063 BOOL_VAR_H(rej_use_good_perm,
true,
"Individual rejection control");
1065 BOOL_VAR_H(rej_alphas_in_number_perm,
false,
"Extend permuter check");
1066 double_VAR_H(rej_whole_of_mostly_reject_word_fract, 0.85,
"if >this fract");
1067 INT_VAR_H(tessedit_image_border, 2,
"Rej blbs near image edge limit");
1068 STRING_VAR_H(ok_repeated_ch_non_alphanum_wds,
"-?*\075",
1069 "Allow NN to unrej");
1071 INT_VAR_H(min_sane_x_ht_pixels, 8,
"Reject any x-ht lt or eq than this");
1072 BOOL_VAR_H(tessedit_create_boxfile,
false,
"Output text with boxes");
1074 "-1 -> All pages, else specific page to process");
1075 BOOL_VAR_H(tessedit_write_images,
false,
"Capture the image from the IPE");
1076 BOOL_VAR_H(interactive_display_mode,
false,
"Run interactively?");
1078 BOOL_VAR_H(tessedit_override_permuter,
true,
"According to dict_word");
1080 "List of languages to load with this one");
1081 BOOL_VAR_H(tessedit_use_primary_params_model,
false,
1082 "In multilingual mode use params model of the primary language");
1086 "Min acceptable orientation margin");
1087 BOOL_VAR_H(textord_tabfind_show_vlines,
false,
"Debug line finding");
1090 "Allow feature extractors to see the original outline");
1092 "Only initialize with the config file. Useful if the instance is " 1093 "not going to be used for OCR but say only for layout analysis.");
1094 BOOL_VAR_H(textord_equation_detect,
false,
"Turn on equation detector");
1095 BOOL_VAR_H(textord_tabfind_vertical_text,
true,
"Enable vertical detection");
1096 BOOL_VAR_H(textord_tabfind_force_vertical_text,
false,
1097 "Force using vertical text page mode");
1099 "Fraction of textlines deemed vertical to use vertical page " 1101 double_VAR_H(textord_tabfind_aligned_gap_fraction, 0.75,
1102 "Fraction of height used as a minimum gap for aligned blobs.");
1103 INT_VAR_H(tessedit_parallelize, 0,
"Run in parallel where possible");
1105 "Preserve multiple interword spaces");
1107 "Page separator (default is form feed control character)");
1117 BOOL_VAR_H(textord_tabfind_vertical_horizontal_mix,
true,
1118 "find horizontal lines such as headers in vertical page mode");
1119 INT_VAR_H(tessedit_ok_mode, 5,
"Acceptance decision algorithm");
1120 BOOL_VAR_H(load_fixed_length_dawgs,
true,
"Load fixed length" 1121 " dawgs (e.g. for non-space delimited languages)");
1122 INT_VAR_H(segment_debug, 0,
"Debug the whole segmentation process");
1124 double_VAR_H(bestrate_pruning_factor, 2.0,
"Multiplying factor of" 1125 " current best rate to prune other hypotheses");
1127 "Turn on word script consistency permuter");
1129 "incorporate segmentation cost in word rating?");
1131 "Score multipler for script consistency within a word. " 1132 "Being a 'reward' factor, it should be <= 1. " 1133 "Smaller value implies bigger reward.");
1135 "Turn on fixed-length phrasebook search permuter");
1137 "Turn on character type (property) consistency permuter");
1139 "Score multipler for char type consistency within a word. ");
1141 "Score multipler for ngram permuter's best choice" 1142 " (only used in the Han script path).");
1144 "Activate character-level n-gram-based permuter");
1145 BOOL_VAR_H(permute_only_top,
false,
"Run only the top choice permuter");
1146 INT_VAR_H(language_model_fixed_length_choices_depth, 3,
1147 "Depth of blob choice lists to explore" 1148 " when fixed length dawgs are on");
1150 "use new state cost heuristics for segmentation state evaluation");
1152 "base factor for adding segmentation cost into word rating." 1153 "It's a multiplying factor, the larger the value above 1, " 1154 "the bigger the effect of segmentation cost.");
1156 "weight associated with char rating in combined cost of state");
1158 "weight associated with width evidence in combined cost of" 1161 "weight associated with seam cut in combined cost of state");
1163 "max char width-to-height ratio allowed in segmentation");
1165 "Enable new segmentation search path.");
1166 double_VAR_H(segsearch_max_fixed_pitch_char_wh_ratio, 2.0,
1167 "Maximum character width-to-height ratio for" 1168 "fixed pitch fonts");
1172 FILE *init_recog_training(
const STRING &fname);
1173 void recog_training_segmented(
const STRING &fname,
1177 void ambigs_classify_and_output(
const char *label,
1185 const char* backup_config_file_;
1196 Pix* pix_thresholds_;
1201 int source_resolution_;
1208 bool right_to_left_;
1220 int font_table_size_;
1226 int train_line_page_num_;
1231 #endif // TESSERACT_CCMAIN_TESSERACTCLASS_H_
void flip_0O(WERD_RES *word)
bool tilde_crunch_written
const Textord & textord() const
void SetScaledColor(int factor, Pix *color)
Assume a single uniform block of text. (Default.)
void set_pix_original(Pix *original_pix)
Tesseract * get_sub_lang(int index) const
bool write_results_empty_block
PointerVector< WERD_RES > lang_words
inT16 doc_good_char_quality
void dont_allow_1Il(WERD_RES *word)
inT16 word_blob_quality(WERD_RES *word, ROW *row)
Pix * pix_original() const
void flip_hyphens(WERD_RES *word)
Pix * scaled_color() const
int num_sub_langs() const
int init_tesseract(const char *datapath, const char *language, OcrEngineMode oem)
#define INT_VAR_H(name, val, comment)
const FCOORD & reskew() const
void set_pix_thresholds(Pix *thresholds)
int scaled_factor() const
BOOL8 non_0_digit(const char *str, int length)
WordData(BLOCK *block_in, ROW *row_in, WERD_RES *word_res)
int source_resolution() const
#define double_VAR_H(name, val, comment)
Textord * mutable_textord()
#define BOOL_VAR_H(name, val, comment)
void set_source_resolution(int ppi)
void set_pix_grey(Pix *grey_pix)
bool last_char_was_newline
#define STRING_VAR_H(name, val, comment)
bool right_to_left() const
BOOL8 word_contains_non_1_digit(const char *word, const char *word_lengths)
WordData(const PAGE_RES_IT &page_res_it)
inT32 adaption_word_number
Pix ** mutable_pix_binary()
void(Tesseract::* WordRecognizer)(const WordData &word_data, WERD_RES **in_word, PointerVector< WERD_RES > *out_words)