21 #ifndef TESSERACT_CCSTRUCT_BLAMER_H_ 22 #define TESSERACT_CCSTRUCT_BLAMER_H_ 33 static const inT16 kBlamerBoxTolerance = 5;
102 for (
int i = 0; i < truth_text_.
length(); ++i)
103 truth_str += truth_text_[i];
107 return incorrect_result_reason_;
114 return debug_.
length() > 0 || misadaption_debug_.
length() > 0;
120 return misadaption_debug_;
123 if (rating < best_correctly_segmented_rating_)
124 best_correctly_segmented_rating_ = rating;
127 return correct_segmentation_cols_.
length();
132 return correct_segmentation_cols_[index] == coord.
col &&
133 correct_segmentation_rows_[index] == coord.
row;
136 best_choice_is_dict_and_top_choice_ = value;
139 return lattice_data_;
142 return lattice_size_;
145 lattice_size_ = size;
146 delete [] lattice_data_;
147 lattice_data_ =
new char[lattice_size_];
148 memcpy(lattice_data_, data, lattice_size_);
151 return params_training_bundle_;
161 const char* truth_str,
const TBOX& word_box);
165 const char* char_str,
const TBOX& char_box);
175 norm_box_tolerance_ = 0;
178 segsearch_is_looking_for_blame_ =
false;
180 correct_segmentation_cols_.
clear();
181 correct_segmentation_rows_.
clear();
182 best_choice_is_dict_and_top_choice_ =
false;
183 delete[] lattice_data_;
184 lattice_data_ = NULL;
188 truth_has_char_boxes_ = other.truth_has_char_boxes_;
189 truth_word_ = other.truth_word_;
190 truth_text_ = other.truth_text_;
191 incorrect_result_reason_ =
195 norm_truth_word_ = other.norm_truth_word_;
196 norm_box_tolerance_ = other.norm_box_tolerance_;
197 incorrect_result_reason_ = other.incorrect_result_reason_;
198 segsearch_is_looking_for_blame_ = other.segsearch_is_looking_for_blame_;
199 best_correctly_segmented_rating_ = other.best_correctly_segmented_rating_;
200 correct_segmentation_cols_ = other.correct_segmentation_cols_;
201 correct_segmentation_rows_ = other.correct_segmentation_rows_;
202 best_choice_is_dict_and_top_choice_ =
203 other.best_choice_is_dict_and_top_choice_;
204 if (other.lattice_data_ != NULL) {
205 lattice_data_ =
new char[other.lattice_size_];
206 memcpy(lattice_data_, other.lattice_data_, other.lattice_size_);
207 lattice_size_ = other.lattice_size_;
209 lattice_data_ = NULL;
234 const TBOX& blob_box,
235 const BLOB_CHOICE_LIST& choices,
282 incorrect_result_reason_ = irr;
284 debug_ +=
" to blame: ";
291 bool truth_has_char_boxes_;
299 int norm_box_tolerance_;
307 STRING misadaption_debug_;
311 bool segsearch_is_looking_for_blame_;
314 float best_correctly_segmented_rating_;
321 bool best_choice_is_dict_and_top_choice_;
330 #endif // TESSERACT_CCSTRUCT_BLAMER_H_
const STRING & misadaption_debug() const
void SetWordTruth(const UNICHARSET &unicharset, const char *truth_str, const TBOX &word_box)
void SetupCorrectSegmentation(const TWERD *word, bool debug)
void SetupNormTruthWord(const DENORM &denorm)
STRING TruthString() const
void FinishSegSearch(const WERD_CHOICE *best_choice, bool debug, STRING *debug_str)
bool HasDebugInfo() const
void UpdateBestRating(float rating)
const char * lattice_data() const
const STRING & debug() const
void BlameClassifierOrLangModel(const WERD_RES *word, const UNICHARSET &unicharset, bool valid_permuter, bool debug)
bool GuidedSegsearchStillGoing() const
void SplitBundle(int word1_right, int word2_left, bool debug, BlamerBundle *bundle1, BlamerBundle *bundle2) const
BlamerBundle(const BlamerBundle &other)
bool ChoiceIsCorrect(const WERD_CHOICE *word_choice) const
IncorrectResultReason incorrect_result_reason() const
const char * string() const
static const char * IncorrectReasonName(IncorrectResultReason irr)
void JoinBlames(const BlamerBundle &bundle1, const BlamerBundle &bundle2, bool debug)
void set_lattice_data(const char *data, int size)
void FillDebugString(const STRING &msg, const WERD_CHOICE *choice, STRING *debug)
void set_best_choice_is_dict_and_top_choice(bool value)
void SetSymbolTruth(const UNICHARSET &unicharset, const char *char_str, const TBOX &char_box)
void SetMisAdaptionDebug(const WERD_CHOICE *best_choice, bool debug)
void CopyResults(const BlamerBundle &other)
const char * IncorrectReason() const
bool MatrixPositionCorrect(int index, const MATRIX_COORD &coord)
void BlameClassifier(const UNICHARSET &unicharset, const TBOX &blob_box, const BLOB_CHOICE_LIST &choices, bool debug)
void CopyTruth(const BlamerBundle &other)
static const float kBadRating
static void LastChanceBlame(bool debug, WERD_RES *word)
void AddHypothesis(const tesseract::ParamsTrainingHypothesis &hypo)
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 SetChopperBlame(const WERD_RES *word, bool debug)
bool GuidedSegsearchNeeded(const WERD_CHOICE *best_choice) const
int correct_segmentation_length() const
ParamsTrainingHypothesis & AddHypothesis(const ParamsTrainingHypothesis &other)
const tesseract::ParamsTrainingBundle & params_training_bundle() const