tesseract  5.0.0-alpha-619-ge9db
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 92 of file shapetable.h.

Constructor & Destructor Documentation

◆ ShapeRating() [1/2]

tesseract::ShapeRating::ShapeRating ( )
inline

Definition at line 93 of file shapetable.h.

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

◆ ShapeRating() [2/2]

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

Definition at line 96 of file shapetable.h.

97  : shape_id(s), rating(r), raw(1.0f), font(0.0f),
98  joined(false), broken(false) {}

Member Function Documentation

◆ FirstResultWithUnichar()

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

Definition at line 40 of file shapetable.cpp.

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

◆ SortDescendingRating()

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

Definition at line 101 of file shapetable.h.

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

Member Data Documentation

◆ broken

bool tesseract::ShapeRating::broken

Definition at line 132 of file shapetable.h.

◆ font

float tesseract::ShapeRating::font

Definition at line 128 of file shapetable.h.

◆ joined

bool tesseract::ShapeRating::joined

Definition at line 130 of file shapetable.h.

◆ rating

float tesseract::ShapeRating::rating

Definition at line 124 of file shapetable.h.

◆ raw

float tesseract::ShapeRating::raw

Definition at line 126 of file shapetable.h.

◆ shape_id

int tesseract::ShapeRating::shape_id

Definition at line 121 of file shapetable.h.


The documentation for this struct was generated from the following files:
tesseract::ShapeRating::shape_id
int shape_id
Definition: shapetable.h:121
tesseract::ShapeRating::raw
float raw
Definition: shapetable.h:126
tesseract::ShapeRating::rating
float rating
Definition: shapetable.h:124
tesseract::ShapeRating::font
float font
Definition: shapetable.h:128
tesseract::ShapeRating::broken
bool broken
Definition: shapetable.h:132
tesseract::ShapeRating::joined
bool joined
Definition: shapetable.h:130
GenericVector::size
int size() const
Definition: genericvector.h:71