|
| MockClassifier (ShapeTable *shape_table) |
|
| ~MockClassifier () override=default |
|
int | ClassifySample (const TrainingSample &sample, Image page_pix, int debug, UNICHAR_ID keep_this, std::vector< ShapeRating > *results) override |
|
const ShapeTable * | GetShapeTable () const override |
|
virtual | ~ShapeClassifier ()=default |
|
virtual int | UnicharClassifySample (const TrainingSample &sample, Image page_pix, int debug, UNICHAR_ID keep_this, std::vector< UnicharRating > *results) |
|
virtual int | BestShapeForUnichar (const TrainingSample &sample, Image page_pix, UNICHAR_ID unichar_id, ShapeRating *result) |
|
virtual const UNICHARSET & | GetUnicharset () const |
|
void | DebugDisplay (const TrainingSample &sample, Image page_pix, UNICHAR_ID unichar_id) |
|
virtual int | DisplayClassifyAs (const TrainingSample &sample, Image page_pix, UNICHAR_ID unichar_id, int index, std::vector< ScrollView * > &windows) |
|
virtual void | UnicharPrintResults (const char *context, const std::vector< UnicharRating > &results) const |
|
virtual void | PrintResults (const char *context, const std::vector< ShapeRating > &results) const |
|
Definition at line 63 of file mastertrainer_test.cc.
◆ MockClassifier()
MockClassifier::MockClassifier |
( |
ShapeTable * |
shape_table | ) |
|
|
inlineexplicit |
Definition at line 65 of file mastertrainer_test.cc.
66 : shape_table_(shape_table), num_done_(0), done_bad_font_(
false) {
70 false_unichar_id_ = 67;
71 false_shape_ = shape_table_->
AddShape(false_unichar_id_, 25);
unsigned AddShape(int unichar_id, int font_id)
◆ ~MockClassifier()
MockClassifier::~MockClassifier |
( |
| ) |
|
|
overridedefault |
◆ ClassifySample()
Reimplemented from tesseract::ShapeClassifier.
Definition at line 81 of file mastertrainer_test.cc.
85 if (++num_done_ > kNumNonReject) {
91 int shape_id = shape_table_->
FindShape(class_id, font_id);
93 int wrong_id1 = shape_id > 10 ? shape_id - 1 : shape_id + 1;
94 int wrong_id2 = shape_id > 10 ? shape_id - 2 : shape_id + 2;
95 if (num_done_ <= kNumTopNErrs) {
98 }
else if (num_done_ <= kNumTop2Errs) {
101 results->push_back(
ShapeRating(wrong_id2, 0.875f));
103 }
else if (num_done_ <= kNumTop1Errs) {
107 }
else if (num_done_ <= kNumTopTopErrs) {
113 }
else if (!done_bad_font_ && class_id == false_unichar_id_) {
115 results->push_back(
ShapeRating(false_shape_, 1.0f));
116 done_bad_font_ =
true;
121 return results->size();
int FindShape(int unichar_id, int font_id) const
UNICHAR_ID class_id() const
◆ GetShapeTable()
const ShapeTable* MockClassifier::GetShapeTable |
( |
| ) |
const |
|
inlineoverridevirtual |
The documentation for this class was generated from the following file: