tesseract
5.0.0-alpha-619-ge9db
|
Go to the documentation of this file.
22 #ifndef TESSERACT_CLASSIFY_SHAPETABLE_H_
23 #define TESSERACT_CLASSIFY_SHAPETABLE_H_
49 tprintf(
"Unichar-id=%d, rating=%g, adapted=%d, config=%d, misses=%d,"
56 const auto* a = static_cast<const UnicharRating*>(t1);
57 const auto* b = static_cast<const UnicharRating*>(t2);
58 if (a->rating > b->rating) {
60 }
else if (a->rating < b->rating) {
63 return a->unichar_id - b->unichar_id;
102 const auto* a = static_cast<const ShapeRating*>(t1);
103 const auto* b = static_cast<const ShapeRating*>(t2);
104 if (a->rating > b->rating) {
106 }
else if (a->rating < b->rating) {
109 return a->shape_id - b->shape_id;
194 return destination_index_;
197 destination_index_ = index;
200 return unichars_.size();
205 return unichars_[index];
209 unichars_[index].unichar_id = unichar_id;
225 uint32_t properties)
const;
245 bool unichars_sorted_ =
false;
248 int destination_index_ = 0;
275 return shape_table_.size();
298 int AddShape(
int unichar_id,
int font_id);
306 void AddToShape(
int shape_id,
int unichar_id,
int font_id);
313 int FindShape(
int unichar_id,
int font_id)
const;
316 int* unichar_id,
int* font_id)
const;
320 return *shape_table_[shape_id];
323 return shape_table_[shape_id];
348 void SwapShapes(
int shape_id1,
int shape_id2);
372 bool CommonFont(
int shape_id1,
int shape_id2)
const;
388 int AddUnicharToResults(
int unichar_id,
float rating,
398 mutable int num_fonts_;
403 #endif // TESSERACT_CLASSIFY_SHAPETABLE_H_
bool ContainsUnichar(int unichar_id) const
static int FirstResultWithUnichar(const GenericVector< ShapeRating > &results, const ShapeTable &shape_table, UNICHAR_ID unichar_id)
bool Serialize(FILE *fp) const
bool operator==(const Shape &other) const
void SwapShapes(int shape_id1, int shape_id2)
bool ContainsFont(int font_id) const
bool CommonFont(int shape_id1, int shape_id2) const
ShapeQueueEntry(const ShapeRating &rating, int level0)
bool ContainsMultipleFontProperties(const FontInfoTable &font_table) const
int NumMasterShapes() const
GenericVector< ScoredFont > fonts
void AppendMasterShapes(const ShapeTable &other, GenericVector< int > *shape_map)
UnicharAndFonts(int uni_id, int font_id)
void ForceFontMerges(int start, int end)
static int SortByUnicharId(const void *v1, const void *v2)
ShapeRating(int s, float r)
void AddShape(const Shape &other)
void AddToShape(int shape_id, int unichar_id, int font_id)
bool ContainsUnicharAndFont(int unichar_id, int font_id) const
bool DeSerialize(TFile *fp)
bool AlreadyMerged(int shape_id1, int shape_id2) const
bool DeSerialize(TFile *fp)
bool EqualUnichars(int shape_id1, int shape_id2) const
bool SubsetUnichar(int shape_id1, int shape_id2) const
bool MergeEqualUnichars(int merge_id1, int merge_id2, int shape_id) const
Shape * MutableShape(int shape_id)
void set_unicharset(const UNICHARSET &unicharset)
void GetFirstUnicharAndFont(int shape_id, int *unichar_id, int *font_id) const
const UNICHARSET & unicharset() const
bool MergeSubsetUnichar(int merge_id1, int merge_id2, int shape_id) const
bool Serialize(FILE *fp) const
bool CommonUnichars(int shape_id1, int shape_id2) const
void SetUnicharId(int index, int unichar_id)
STRING DebugStr(int shape_id) const
const Shape & GetShape(int shape_id) const
void ReMapClassIds(const GenericVector< int > &unicharset_map)
void AddShapeToShape(int shape_id, const Shape &other)
int MasterDestinationIndex(int shape_id) const
bool operator<(const ShapeQueueEntry &other) const
bool IsSubsetOf(const Shape &other) const
int MergedUnicharCount(int shape_id1, int shape_id2) const
const UnicharAndFonts & operator[](int index) const
bool IsEqualUnichars(Shape *other)
bool DeSerialize(TFile *fp)
int MasterUnicharCount(int shape_id) const
int destination_index() const
static int SortDescendingRating(const void *t1, const void *t2)
int MasterFontCount(int shape_id) const
void AddToShape(int unichar_id, int font_id)
void AddShapeToResults(const ShapeRating &shape_rating, GenericVector< int > *unichar_map, GenericVector< UnicharRating > *results) const
int FindShape(int unichar_id, int font_id) const
bool AnyMultipleUnichars() const
DLLSYM void tprintf(const char *format,...)
STRING SummaryStr() const
int AddShape(int unichar_id, int font_id)
bool Serialize(FILE *fp) const
static int FirstResultWithUnichar(const GenericVector< UnicharRating > &results, UNICHAR_ID unichar_id)
static int SortDescendingRating(const void *t1, const void *t2)
void DeleteShape(int shape_id)
bool ContainsFontProperties(const FontInfoTable &font_table, uint32_t properties) const
void set_destination_index(int index)
int MaxNumUnichars() const
void MergeShapes(int shape_id1, int shape_id2)
int BuildFromShape(const Shape &shape, const ShapeTable &master_shapes)
GenericVector< int32_t > font_ids
UnicharRating(int u, float r)