tesseract  5.0.0-alpha-619-ge9db
tesseract::UnicharRating Struct Reference

#include <shapetable.h>

Public Member Functions

 UnicharRating ()
 
 UnicharRating (int u, float r)
 
void Print () const
 

Static Public Member Functions

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

Public Attributes

UNICHAR_ID unichar_id
 
float rating
 
bool adapted
 
uint8_t config
 
uint16_t feature_misses
 
GenericVector< ScoredFontfonts
 

Detailed Description

Definition at line 40 of file shapetable.h.

Constructor & Destructor Documentation

◆ UnicharRating() [1/2]

tesseract::UnicharRating::UnicharRating ( )
inline

Definition at line 41 of file shapetable.h.

42  : unichar_id(0), rating(0.0f), adapted(false), config(0),
43  feature_misses(0) {}

◆ UnicharRating() [2/2]

tesseract::UnicharRating::UnicharRating ( int  u,
float  r 
)
inline

Definition at line 44 of file shapetable.h.

45  : unichar_id(u), rating(r), adapted(false), config(0), feature_misses(0) {}

Member Function Documentation

◆ FirstResultWithUnichar()

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

Definition at line 58 of file shapetable.cpp.

60  {
61  for (int r = 0; r < results.size(); ++r) {
62  if (results[r].unichar_id == unichar_id)
63  return r;
64  }
65  return -1;
66 }

◆ Print()

void tesseract::UnicharRating::Print ( ) const
inline

Definition at line 48 of file shapetable.h.

48  {
49  tprintf("Unichar-id=%d, rating=%g, adapted=%d, config=%d, misses=%d,"
50  " %d fonts\n", unichar_id, rating, adapted, config, feature_misses,
51  fonts.size());
52  }

◆ SortDescendingRating()

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

Definition at line 55 of file shapetable.h.

55  {
56  const auto* a = static_cast<const UnicharRating*>(t1);
57  const auto* b = static_cast<const UnicharRating*>(t2);
58  if (a->rating > b->rating) {
59  return -1;
60  } else if (a->rating < b->rating) {
61  return 1;
62  } else {
63  return a->unichar_id - b->unichar_id;
64  }
65  }

Member Data Documentation

◆ adapted

bool tesseract::UnicharRating::adapted

Definition at line 79 of file shapetable.h.

◆ config

uint8_t tesseract::UnicharRating::config

Definition at line 81 of file shapetable.h.

◆ feature_misses

uint16_t tesseract::UnicharRating::feature_misses

Definition at line 83 of file shapetable.h.

◆ fonts

GenericVector<ScoredFont> tesseract::UnicharRating::fonts

Definition at line 87 of file shapetable.h.

◆ rating

float tesseract::UnicharRating::rating

Definition at line 77 of file shapetable.h.

◆ unichar_id

UNICHAR_ID tesseract::UnicharRating::unichar_id

Definition at line 74 of file shapetable.h.


The documentation for this struct was generated from the following files:
tesseract::UnicharRating::unichar_id
UNICHAR_ID unichar_id
Definition: shapetable.h:74
tesseract::UnicharRating::fonts
GenericVector< ScoredFont > fonts
Definition: shapetable.h:87
tesseract::UnicharRating::config
uint8_t config
Definition: shapetable.h:81
tesseract::UnicharRating::rating
float rating
Definition: shapetable.h:77
tprintf
DLLSYM void tprintf(const char *format,...)
Definition: tprintf.cpp:34
tesseract::UnicharRating::adapted
bool adapted
Definition: shapetable.h:79
GenericVector::size
int size() const
Definition: genericvector.h:71
tesseract::UnicharRating::feature_misses
uint16_t feature_misses
Definition: shapetable.h:83