21 #ifndef TESSERACT_CCSTRUCT_BLAMER_H_ 22 #define TESSERACT_CCSTRUCT_BLAMER_H_ 28 #ifndef DISABLED_LEGACY_ENGINE 30 #endif // ndef DISABLED_LEGACY_ENGINE 47 static const int16_t kBlamerBoxTolerance = 5;
116 for (
int i = 0; i < truth_text_.
length(); ++i)
117 truth_str += truth_text_[i];
121 return incorrect_result_reason_;
128 return debug_.
length() > 0 || misadaption_debug_.
length() > 0;
134 return misadaption_debug_;
137 if (rating < best_correctly_segmented_rating_)
138 best_correctly_segmented_rating_ = rating;
141 return correct_segmentation_cols_.
length();
146 return correct_segmentation_cols_[index] == coord.
col &&
147 correct_segmentation_rows_[index] == coord.
row;
150 best_choice_is_dict_and_top_choice_ = value;
153 return lattice_data_;
156 return lattice_size_;
159 lattice_size_ = size;
160 delete [] lattice_data_;
161 lattice_data_ =
new char[lattice_size_];
162 memcpy(lattice_data_, data, lattice_size_);
164 #ifndef DISABLED_LEGACY_ENGINE 166 return params_training_bundle_;
172 #endif // ndef DISABLED_LEGACY_ENGINE 177 const char* truth_str,
const TBOX& word_box);
181 const char* char_str,
const TBOX& char_box);
191 norm_box_tolerance_ = 0;
194 segsearch_is_looking_for_blame_ =
false;
196 correct_segmentation_cols_.
clear();
197 correct_segmentation_rows_.
clear();
198 best_choice_is_dict_and_top_choice_ =
false;
199 delete[] lattice_data_;
200 lattice_data_ =
nullptr;
204 truth_has_char_boxes_ = other.truth_has_char_boxes_;
205 truth_word_ = other.truth_word_;
206 truth_text_ = other.truth_text_;
207 incorrect_result_reason_ =
211 norm_truth_word_ = other.norm_truth_word_;
212 norm_box_tolerance_ = other.norm_box_tolerance_;
213 incorrect_result_reason_ = other.incorrect_result_reason_;
214 segsearch_is_looking_for_blame_ = other.segsearch_is_looking_for_blame_;
215 best_correctly_segmented_rating_ = other.best_correctly_segmented_rating_;
216 correct_segmentation_cols_ = other.correct_segmentation_cols_;
217 correct_segmentation_rows_ = other.correct_segmentation_rows_;
218 best_choice_is_dict_and_top_choice_ =
219 other.best_choice_is_dict_and_top_choice_;
220 if (other.lattice_data_ !=
nullptr) {
221 lattice_data_ =
new char[other.lattice_size_];
222 memcpy(lattice_data_, other.lattice_data_, other.lattice_size_);
223 lattice_size_ = other.lattice_size_;
225 lattice_data_ =
nullptr;
250 const TBOX& blob_box,
251 const BLOB_CHOICE_LIST& choices,
300 incorrect_result_reason_ = irr;
302 debug_ +=
" to blame: ";
309 bool truth_has_char_boxes_;
317 int norm_box_tolerance_;
325 STRING misadaption_debug_;
329 bool segsearch_is_looking_for_blame_;
332 float best_correctly_segmented_rating_;
339 bool best_choice_is_dict_and_top_choice_;
344 #ifndef DISABLED_LEGACY_ENGINE 346 #endif // ndef DISABLED_LEGACY_ENGINE 350 #endif // TESSERACT_CCSTRUCT_BLAMER_H_
DLLSYM void tprintf(const char *format,...)
static const char * IncorrectReasonName(IncorrectResultReason irr)
const char * lattice_data() const
bool GuidedSegsearchStillGoing() const
static void LastChanceBlame(bool debug, WERD_RES *word)
const char * IncorrectReason() const
void FinishSegSearch(const WERD_CHOICE *best_choice, bool debug, STRING *debug_str)
const char * string() const
bool GuidedSegsearchNeeded(const WERD_CHOICE *best_choice) const
void UpdateBestRating(float rating)
void InitForSegSearch(const WERD_CHOICE *best_choice, MATRIX *ratings, UNICHAR_ID wildcard_id, bool debug, STRING *debug_str, TessResultCallback2< bool, int, int > *pp_cb)
void AddHypothesis(const tesseract::ParamsTrainingHypothesis &hypo)
void set_best_choice_is_dict_and_top_choice(bool value)
void SetWordTruth(const UNICHARSET &unicharset, const char *truth_str, const TBOX &word_box)
bool ChoiceIsCorrect(const WERD_CHOICE *word_choice) const
void JoinBlames(const BlamerBundle &bundle1, const BlamerBundle &bundle2, bool debug)
bool HasDebugInfo() const
void BlameClassifier(const UNICHARSET &unicharset, const TBOX &blob_box, const BLOB_CHOICE_LIST &choices, bool debug)
void CopyResults(const BlamerBundle &other)
void FillDebugString(const STRING &msg, const WERD_CHOICE *choice, STRING *debug)
int correct_segmentation_length() const
void SplitBundle(int word1_right, int word2_left, bool debug, BlamerBundle *bundle1, BlamerBundle *bundle2) const
static const float kBadRating
BlamerBundle(const BlamerBundle &other)
const tesseract::ParamsTrainingBundle & params_training_bundle() const
ParamsTrainingHypothesis & AddHypothesis(const ParamsTrainingHypothesis &other)
void CopyTruth(const BlamerBundle &other)
void SetupCorrectSegmentation(const TWERD *word, bool debug)
void set_lattice_data(const char *data, int size)
void SetChopperBlame(const WERD_RES *word, bool debug)
void SetMisAdaptionDebug(const WERD_CHOICE *best_choice, bool debug)
bool MatrixPositionCorrect(int index, const MATRIX_COORD &coord)
void SetupNormTruthWord(const DENORM &denorm)
STRING TruthString() const
void BlameClassifierOrLangModel(const WERD_RES *word, const UNICHARSET &unicharset, bool valid_permuter, bool debug)
IncorrectResultReason incorrect_result_reason() const
const STRING & misadaption_debug() const
void SetSymbolTruth(const UNICHARSET &unicharset, const char *char_str, const TBOX &char_box)
const STRING & debug() const