36 : cube_cntxt_(tesseract->GetCubeRecoContext()),
37 shape_table_(*tesseract->shape_table()) {
48 if (page_pix ==
NULL)
return 0;
53 cube_cntxt_, page_pix, char_box.
left(),
54 pixGetHeight(page_pix) - char_box.
top(),
57 if (alt_list !=
NULL) {
60 for (
int i = 0; i < alt_list->AltCount(); ++i) {
62 int alt_id = alt_list->Alt(i);
70 return results->
size();
79 : cube_cntxt_(tesseract->GetCubeRecoContext()),
80 shape_table_(*tesseract->shape_table()),
94 if (page_pix ==
NULL)
return num_results;
99 cube_cntxt_, page_pix, char_box.
left(),
100 pixGetHeight(page_pix) - char_box.
top(),
104 if (alt_list !=
NULL) {
105 for (
int r = 0; r < num_results; ++r) {
107 double best_prob = 0.0;
108 for (
int i = 0; i < alt_list->AltCount(); ++i) {
109 int alt_id = alt_list->Alt(i);
111 if (unichar_id == (*results)[r].unichar_id &&
112 alt_list->AltProb(i) > best_prob) {
113 best_prob = alt_list->AltProb(i);
116 (*results)[r].rating = best_prob;
123 return results->
size();
128 return &shape_table_;
virtual int UnicharClassifySample(const TrainingSample &sample, Pix *page_pix, int debug, UNICHAR_ID keep_this, GenericVector< UnicharRating > *results)
virtual ~CubeTessClassifier()
virtual int UnicharClassifySample(const TrainingSample &sample, Pix *page_pix, int debug, UNICHAR_ID keep_this, GenericVector< UnicharRating > *results)
virtual ~CubeClassifier()
virtual int UnicharClassifySample(const TrainingSample &sample, Pix *page_pix, int debug, UNICHAR_ID keep_this, GenericVector< UnicharRating > *results)
virtual const ShapeTable * GetShapeTable() const
static int SortDescendingRating(const void *t1, const void *t2)
int UnicharID(const char_32 *str) const
CharAltList * RecognizeChar()
CubeClassifier(Tesseract *tesseract)
CubeTessClassifier(Tesseract *tesseract)
virtual const ShapeTable * GetShapeTable() const
CharSet * CharacterSet() const
const TBOX & bounding_box() const
const char_32 * ClassString(int class_id) const