21 #ifndef TESSERACT_CCSTRUCT_BLAMER_H_ 22 #define TESSERACT_CCSTRUCT_BLAMER_H_ 45 static const int16_t kBlamerBoxTolerance = 5;
114 for (
int i = 0; i < truth_text_.
length(); ++i)
115 truth_str += truth_text_[i];
119 return incorrect_result_reason_;
126 return debug_.
length() > 0 || misadaption_debug_.
length() > 0;
132 return misadaption_debug_;
135 if (rating < best_correctly_segmented_rating_)
136 best_correctly_segmented_rating_ = rating;
139 return correct_segmentation_cols_.
length();
144 return correct_segmentation_cols_[index] == coord.
col &&
145 correct_segmentation_rows_[index] == coord.
row;
148 best_choice_is_dict_and_top_choice_ = value;
151 return lattice_data_;
154 return lattice_size_;
157 lattice_size_ = size;
158 delete [] lattice_data_;
159 lattice_data_ =
new char[lattice_size_];
160 memcpy(lattice_data_, data, lattice_size_);
163 return params_training_bundle_;
173 const char* truth_str,
const TBOX& word_box);
177 const char* char_str,
const TBOX& char_box);
187 norm_box_tolerance_ = 0;
190 segsearch_is_looking_for_blame_ =
false;
192 correct_segmentation_cols_.
clear();
193 correct_segmentation_rows_.
clear();
194 best_choice_is_dict_and_top_choice_ =
false;
195 delete[] lattice_data_;
196 lattice_data_ =
nullptr;
200 truth_has_char_boxes_ = other.truth_has_char_boxes_;
201 truth_word_ = other.truth_word_;
202 truth_text_ = other.truth_text_;
203 incorrect_result_reason_ =
207 norm_truth_word_ = other.norm_truth_word_;
208 norm_box_tolerance_ = other.norm_box_tolerance_;
209 incorrect_result_reason_ = other.incorrect_result_reason_;
210 segsearch_is_looking_for_blame_ = other.segsearch_is_looking_for_blame_;
211 best_correctly_segmented_rating_ = other.best_correctly_segmented_rating_;
212 correct_segmentation_cols_ = other.correct_segmentation_cols_;
213 correct_segmentation_rows_ = other.correct_segmentation_rows_;
214 best_choice_is_dict_and_top_choice_ =
215 other.best_choice_is_dict_and_top_choice_;
216 if (other.lattice_data_ !=
nullptr) {
217 lattice_data_ =
new char[other.lattice_size_];
218 memcpy(lattice_data_, other.lattice_data_, other.lattice_size_);
219 lattice_size_ = other.lattice_size_;
221 lattice_data_ =
nullptr;
246 const TBOX& blob_box,
247 const BLOB_CHOICE_LIST& choices,
296 incorrect_result_reason_ = irr;
298 debug_ +=
" to blame: ";
305 bool truth_has_char_boxes_;
313 int norm_box_tolerance_;
321 STRING misadaption_debug_;
325 bool segsearch_is_looking_for_blame_;
328 float best_correctly_segmented_rating_;
335 bool best_choice_is_dict_and_top_choice_;
344 #endif // TESSERACT_CCSTRUCT_BLAMER_H_ bool GuidedSegsearchStillGoing() const
const STRING & debug() const
static const float kBadRating
void set_best_choice_is_dict_and_top_choice(bool value)
void SplitBundle(int word1_right, int word2_left, bool debug, BlamerBundle *bundle1, BlamerBundle *bundle2) const
void CopyResults(const BlamerBundle &other)
void BlameClassifier(const UNICHARSET &unicharset, const TBOX &blob_box, const BLOB_CHOICE_LIST &choices, bool debug)
const char * lattice_data() const
const char * string() const
void SetChopperBlame(const WERD_RES *word, bool debug)
void set_lattice_data(const char *data, int size)
void CopyTruth(const BlamerBundle &other)
static const char * IncorrectReasonName(IncorrectResultReason irr)
void SetMisAdaptionDebug(const WERD_CHOICE *best_choice, bool debug)
const tesseract::ParamsTrainingBundle & params_training_bundle() const
BlamerBundle(const BlamerBundle &other)
bool ChoiceIsCorrect(const WERD_CHOICE *word_choice) const
void InitForSegSearch(const WERD_CHOICE *best_choice, MATRIX *ratings, UNICHAR_ID wildcard_id, bool debug, STRING *debug_str, TessResultCallback2< bool, int, int > *pp_cb)
bool GuidedSegsearchNeeded(const WERD_CHOICE *best_choice) const
void BlameClassifierOrLangModel(const WERD_RES *word, const UNICHARSET &unicharset, bool valid_permuter, bool debug)
void SetSymbolTruth(const UNICHARSET &unicharset, const char *char_str, const TBOX &char_box)
void JoinBlames(const BlamerBundle &bundle1, const BlamerBundle &bundle2, bool debug)
IncorrectResultReason incorrect_result_reason() const
void UpdateBestRating(float rating)
STRING TruthString() const
void SetWordTruth(const UNICHARSET &unicharset, const char *truth_str, const TBOX &word_box)
DLLSYM void tprintf(const char *format,...)
ParamsTrainingHypothesis & AddHypothesis(const ParamsTrainingHypothesis &other)
void FillDebugString(const STRING &msg, const WERD_CHOICE *choice, STRING *debug)
const STRING & misadaption_debug() const
void SetupCorrectSegmentation(const TWERD *word, bool debug)
static void LastChanceBlame(bool debug, WERD_RES *word)
const char * IncorrectReason() const
void FinishSegSearch(const WERD_CHOICE *best_choice, bool debug, STRING *debug_str)
bool MatrixPositionCorrect(int index, const MATRIX_COORD &coord)
int correct_segmentation_length() const
void SetupNormTruthWord(const DENORM &denorm)
bool HasDebugInfo() const
void AddHypothesis(const tesseract::ParamsTrainingHypothesis &hypo)