23 #ifndef TESSERACT_CLASSIFY_SHAPETABLE_H_
24 #define TESSERACT_CLASSIFY_SHAPETABLE_H_
50 tprintf(
"Unichar-id=%d, rating=%g, adapted=%d, config=%d, misses=%d,"
197 return destination_index_;
200 destination_index_ = index;
203 return unichars_.size();
208 return unichars_[index];
212 unichars_[index].unichar_id = unichar_id;
248 bool unichars_sorted_;
251 int destination_index_;
279 return shape_table_.size();
302 int AddShape(
int unichar_id,
int font_id);
310 void AddToShape(
int shape_id,
int unichar_id,
int font_id);
317 int FindShape(
int unichar_id,
int font_id)
const;
320 int* unichar_id,
int* font_id)
const;
324 return *shape_table_[shape_id];
327 return shape_table_[shape_id];
352 void SwapShapes(
int shape_id1,
int shape_id2);
376 bool CommonFont(
int shape_id1,
int shape_id2)
const;
392 int AddUnicharToResults(
int unichar_id,
float rating,
402 mutable int num_fonts_;
407 #endif // TESSERACT_CLASSIFY_SHAPETABLE_H_
static int FirstResultWithUnichar(const GenericVector< UnicharRating > &results, UNICHAR_ID unichar_id)
int BuildFromShape(const Shape &shape, const ShapeTable &master_shapes)
bool ContainsMultipleFontProperties(const FontInfoTable &font_table) const
static int SortByUnicharId(const void *v1, const void *v2)
int NumMasterShapes() const
bool EqualUnichars(int shape_id1, int shape_id2) const
static int SortDescendingRating(const void *t1, const void *t2)
void AddShapeToShape(int shape_id, const Shape &other)
bool Serialize(FILE *fp) const
bool IsSubsetOf(const Shape &other) const
STRING SummaryStr() const
bool DeSerialize(bool swap, FILE *fp)
ShapeRating(int s, float r)
void set_unicharset(const UNICHARSET &unicharset)
void AddToShape(int unichar_id, int font_id)
void set_destination_index(int index)
bool ContainsUnichar(int unichar_id) const
void DeleteShape(int shape_id)
void SwapShapes(int shape_id1, int shape_id2)
void ForceFontMerges(int start, int end)
bool ContainsUnicharAndFont(int unichar_id, int font_id) const
void ReMapClassIds(const GenericVector< int > &unicharset_map)
int MaxNumUnichars() const
int MasterDestinationIndex(int shape_id) const
void MergeShapes(int shape_id1, int shape_id2)
int MasterFontCount(int shape_id) const
void AddShape(const Shape &other)
bool operator<(const ShapeQueueEntry &other) const
bool IsEqualUnichars(Shape *other)
GenericVector< ScoredFont > fonts
Shape * MutableShape(int shape_id)
bool CommonUnichars(int shape_id1, int shape_id2) const
bool Serialize(FILE *fp) const
bool CommonFont(int shape_id1, int shape_id2) const
static int SortDescendingRating(const void *t1, const void *t2)
bool ContainsFont(int font_id) const
UnicharAndFonts(int uni_id, int font_id)
bool DeSerialize(bool swap, FILE *fp)
ShapeQueueEntry(const ShapeRating &rating, int level0)
bool MergeEqualUnichars(int merge_id1, int merge_id2, int shape_id) const
bool AlreadyMerged(int shape_id1, int shape_id2) const
GenericVector< inT32 > font_ids
bool operator==(const Shape &other) const
bool Serialize(FILE *fp) const
STRING DebugStr(int shape_id) const
void AddShapeToResults(const ShapeRating &shape_rating, GenericVector< int > *unichar_map, GenericVector< UnicharRating > *results) const
int MergedUnicharCount(int shape_id1, int shape_id2) const
int MasterUnicharCount(int shape_id) const
bool SubsetUnichar(int shape_id1, int shape_id2) const
int FindShape(int unichar_id, int font_id) const
bool AnyMultipleUnichars() const
const UNICHARSET & unicharset() const
void SetUnicharId(int index, int unichar_id)
void GetFirstUnicharAndFont(int shape_id, int *unichar_id, int *font_id) const
int AddShape(int unichar_id, int font_id)
void AppendMasterShapes(const ShapeTable &other, GenericVector< int > *shape_map)
GenericHeap< ShapeQueueEntry > ShapeQueue
UnicharRating(int u, float r)
const Shape & GetShape(int shape_id) const
static int FirstResultWithUnichar(const GenericVector< ShapeRating > &results, const ShapeTable &shape_table, UNICHAR_ID unichar_id)
const UnicharAndFonts & operator[](int index) const
void AddToShape(int shape_id, int unichar_id, int font_id)
bool ContainsFontProperties(const FontInfoTable &font_table, uinT32 properties) const
bool DeSerialize(bool swap, FILE *fp)
int destination_index() const
bool MergeSubsetUnichar(int merge_id1, int merge_id2, int shape_id) const