tesseract  4.0.0-1-g2a2b
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 41 of file shapetable.h.

Constructor & Destructor Documentation

◆ UnicharRating() [1/2]

tesseract::UnicharRating::UnicharRating ( )
inline

Definition at line 42 of file shapetable.h.

◆ UnicharRating() [2/2]

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

Definition at line 45 of file shapetable.h.

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 }
int size() const
Definition: genericvector.h:71

◆ Print()

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

Definition at line 49 of file shapetable.h.

49  {
50  tprintf("Unichar-id=%d, rating=%g, adapted=%d, config=%d, misses=%d,"
51  " %d fonts\n", unichar_id, rating, adapted, config, feature_misses,
52  fonts.size());
53  }
DLLSYM void tprintf(const char *format,...)
Definition: tprintf.cpp:37
GenericVector< ScoredFont > fonts
Definition: shapetable.h:88

◆ SortDescendingRating()

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

Definition at line 56 of file shapetable.h.

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

Member Data Documentation

◆ adapted

bool tesseract::UnicharRating::adapted

Definition at line 80 of file shapetable.h.

◆ config

uint8_t tesseract::UnicharRating::config

Definition at line 82 of file shapetable.h.

◆ feature_misses

uint16_t tesseract::UnicharRating::feature_misses

Definition at line 84 of file shapetable.h.

◆ fonts

GenericVector<ScoredFont> tesseract::UnicharRating::fonts

Definition at line 88 of file shapetable.h.

◆ rating

float tesseract::UnicharRating::rating

Definition at line 78 of file shapetable.h.

◆ unichar_id

UNICHAR_ID tesseract::UnicharRating::unichar_id

Definition at line 75 of file shapetable.h.


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