93 if (++num_done_ > kNumNonReject)
return 0;
95 int class_id =
sample.class_id();
96 int font_id =
sample.font_id();
97 int shape_id = shape_table_->
FindShape(class_id, font_id);
99 int wrong_id1 = shape_id > 10 ? shape_id - 1 : shape_id + 1;
100 int wrong_id2 = shape_id > 10 ? shape_id - 2 : shape_id + 2;
101 if (num_done_ <= kNumTopNErrs) {
103 results->
push_back(ShapeRating(wrong_id1, 1.0f));
104 }
else if (num_done_ <= kNumTop2Errs) {
106 results->
push_back(ShapeRating(wrong_id1, 1.0f));
107 results->
push_back(ShapeRating(wrong_id2, 0.875f));
108 results->
push_back(ShapeRating(shape_id, 0.75f));
109 }
else if (num_done_ <= kNumTop1Errs) {
111 results->
push_back(ShapeRating(wrong_id1, 1.0f));
112 results->
push_back(ShapeRating(shape_id, 0.8f));
113 }
else if (num_done_ <= kNumTopTopErrs) {
117 results->
push_back(ShapeRating(wrong_id1, 1.0f));
118 results->
push_back(ShapeRating(shape_id, 0.99f));
119 }
else if (!done_bad_font_ && class_id == false_unichar_id_) {
121 results->
push_back(ShapeRating(false_shape_, 1.0f));
122 done_bad_font_ =
true;
125 results->
push_back(ShapeRating(shape_id, 1.0f));
127 return results->
size();