tesseract  4.00.00dev
tesseract::ShapeRating Struct Reference

#include <shapetable.h>

Public Member Functions

 ShapeRating ()
 
 ShapeRating (int s, float r)
 

Static Public Member Functions

static int SortDescendingRating (const void *t1, const void *t2)
 
static int FirstResultWithUnichar (const GenericVector< ShapeRating > &results, const ShapeTable &shape_table, UNICHAR_ID unichar_id)
 

Public Attributes

int shape_id
 
float rating
 
float raw
 
float font
 
bool joined
 
bool broken
 

Detailed Description

Definition at line 93 of file shapetable.h.

Constructor & Destructor Documentation

◆ ShapeRating() [1/2]

tesseract::ShapeRating::ShapeRating ( )
inline

Definition at line 94 of file shapetable.h.

95  : shape_id(0), rating(0.0f), raw(0.0f), font(0.0f),
96  joined(false), broken(false) {}

◆ ShapeRating() [2/2]

tesseract::ShapeRating::ShapeRating ( int  s,
float  r 
)
inline

Definition at line 97 of file shapetable.h.

Member Function Documentation

◆ FirstResultWithUnichar()

int tesseract::ShapeRating::FirstResultWithUnichar ( const GenericVector< ShapeRating > &  results,
const ShapeTable shape_table,
UNICHAR_ID  unichar_id 
)
static

Definition at line 38 of file shapetable.cpp.

41  {
42  for (int r = 0; r < results.size(); ++r) {
43  int shape_id = results[r].shape_id;
44  const Shape& shape = shape_table.GetShape(shape_id);
45  if (shape.ContainsUnichar(unichar_id)) {
46  return r;
47  }
48  }
49  return -1;
50 }
int size() const
Definition: genericvector.h:72

◆ SortDescendingRating()

static int tesseract::ShapeRating::SortDescendingRating ( const void *  t1,
const void *  t2 
)
inlinestatic

Definition at line 102 of file shapetable.h.

102  {
103  const ShapeRating* a = static_cast<const ShapeRating *>(t1);
104  const ShapeRating* b = static_cast<const ShapeRating *>(t2);
105  if (a->rating > b->rating) {
106  return -1;
107  } else if (a->rating < b->rating) {
108  return 1;
109  } else {
110  return a->shape_id - b->shape_id;
111  }
112  }

Member Data Documentation

◆ broken

bool tesseract::ShapeRating::broken

Definition at line 133 of file shapetable.h.

◆ font

float tesseract::ShapeRating::font

Definition at line 129 of file shapetable.h.

◆ joined

bool tesseract::ShapeRating::joined

Definition at line 131 of file shapetable.h.

◆ rating

float tesseract::ShapeRating::rating

Definition at line 125 of file shapetable.h.

◆ raw

float tesseract::ShapeRating::raw

Definition at line 127 of file shapetable.h.

◆ shape_id

int tesseract::ShapeRating::shape_id

Definition at line 122 of file shapetable.h.


The documentation for this struct was generated from the following files: