tesseract
4.0.0-1-g2a2b
|
#include <ratngs.h>
Public Member Functions | |
WERD_CHOICE (const UNICHARSET *unicharset) | |
WERD_CHOICE (const UNICHARSET *unicharset, int reserved) | |
WERD_CHOICE (const char *src_string, const char *src_lengths, float src_rating, float src_certainty, uint8_t src_permuter, const UNICHARSET &unicharset) | |
WERD_CHOICE (const char *src_string, const UNICHARSET &unicharset) | |
WERD_CHOICE (const WERD_CHOICE &word) | |
~WERD_CHOICE () | |
const UNICHARSET * | unicharset () const |
int | length () const |
float | adjust_factor () const |
void | set_adjust_factor (float factor) |
const UNICHAR_ID * | unichar_ids () const |
UNICHAR_ID | unichar_id (int index) const |
int | state (int index) const |
tesseract::ScriptPos | BlobPosition (int index) const |
float | rating () const |
float | certainty () const |
float | certainty (int index) const |
float | min_x_height () const |
float | max_x_height () const |
void | set_x_heights (float min_height, float max_height) |
uint8_t | permuter () const |
const char * | permuter_name () const |
BLOB_CHOICE_LIST * | blob_choices (int index, MATRIX *ratings) const |
MATRIX_COORD | MatrixCoord (int index) const |
void | set_unichar_id (UNICHAR_ID unichar_id, int index) |
bool | dangerous_ambig_found () const |
void | set_dangerous_ambig_found_ (bool value) |
void | set_rating (float new_val) |
void | set_certainty (float new_val) |
void | set_permuter (uint8_t perm) |
void | set_length (int len) |
void | double_the_size () |
Make more space in unichar_id_ and fragment_lengths_ arrays. More... | |
void | init (int reserved) |
void | init (const char *src_string, const char *src_lengths, float src_rating, float src_certainty, uint8_t src_permuter) |
void | make_bad () |
Set the fields in this choice to be default (bad) values. More... | |
void | append_unichar_id_space_allocated (UNICHAR_ID unichar_id, int blob_count, float rating, float certainty) |
void | append_unichar_id (UNICHAR_ID unichar_id, int blob_count, float rating, float certainty) |
void | set_unichar_id (UNICHAR_ID unichar_id, int blob_count, float rating, float certainty, int index) |
void | set_blob_choice (int index, int blob_count, const BLOB_CHOICE *blob_choice) |
bool | contains_unichar_id (UNICHAR_ID unichar_id) const |
void | remove_unichar_ids (int index, int num) |
void | remove_last_unichar_id () |
void | remove_unichar_id (int index) |
bool | has_rtl_unichar_id () const |
void | reverse_and_mirror_unichar_ids () |
void | punct_stripped (int *start_core, int *end_core) const |
void | GetNonSuperscriptSpan (int *start, int *end) const |
WERD_CHOICE | shallow_copy (int start, int end) const |
void | string_and_lengths (STRING *word_str, STRING *word_lengths_str) const |
const STRING | debug_string () const |
bool | ContainsAnyNonSpaceDelimited () const |
bool | IsAllSpaces () const |
bool | set_unichars_in_script_order (bool in_script_order) |
bool | unichars_in_script_order () const |
const STRING & | unichar_string () const |
const STRING & | unichar_lengths () const |
void | SetScriptPositions (bool small_caps, TWERD *word, int debug=0) |
void | SetScriptPositions (const tesseract::ScriptPos *positions, int length) |
void | SetAllScriptPositions (tesseract::ScriptPos position) |
int | GetTopScriptID () const |
void | UpdateStateForSplit (int blob_position) |
int | TotalOfStates () const |
void | print () const |
void | print (const char *msg) const |
void | print_state (const char *msg) const |
void | DisplaySegmentation (TWERD *word) |
WERD_CHOICE & | operator+= (const WERD_CHOICE &second) |
WERD_CHOICE & | operator= (const WERD_CHOICE &source) |
Public Member Functions inherited from ELIST_LINK | |
ELIST_LINK () | |
ELIST_LINK (const ELIST_LINK &) | |
void | operator= (const ELIST_LINK &) |
Static Public Member Functions | |
static const char * | permuter_name (uint8_t permuter) |
static tesseract::ScriptPos | ScriptPositionOf (bool print_debug, const UNICHARSET &unicharset, const TBOX &blob_box, UNICHAR_ID unichar_id) |
Static Public Attributes | |
static const float | kBadRating = 100000.0 |
|
inline |
|
inline |
|
inline |
WERD_CHOICE::WERD_CHOICE | ( | const char * | src_string, |
const UNICHARSET & | unicharset | ||
) |
Constructor to build a WERD_CHOICE from the given string. The function assumes that src_string is not nullptr.
Definition at line 218 of file ratngs.cpp.
|
inline |
WERD_CHOICE::~WERD_CHOICE | ( | ) |
Definition at line 276 of file ratngs.cpp.
|
inline |
void WERD_CHOICE::append_unichar_id | ( | UNICHAR_ID | unichar_id, |
int | blob_count, | ||
float | rating, | ||
float | certainty | ||
) |
append_unichar_id
Make sure there is enough space in the word for the new unichar id and call append_unichar_id_space_allocated().
Definition at line 468 of file ratngs.cpp.
|
inline |
This function assumes that there is enough space reserved in the WERD_CHOICE for adding another unichar. This is an efficient alternative to append_unichar_id().
Definition at line 452 of file ratngs.h.
BLOB_CHOICE_LIST * WERD_CHOICE::blob_choices | ( | int | index, |
MATRIX * | ratings | ||
) | const |
Definition at line 290 of file ratngs.cpp.
|
inline |
Definition at line 322 of file ratngs.h.
|
inline |
|
inline |
bool WERD_CHOICE::contains_unichar_id | ( | UNICHAR_ID | unichar_id | ) | const |
contains_unichar_id
Returns true if unichar_ids_ contain the given unichar_id, false otherwise.
Definition at line 326 of file ratngs.cpp.
|
inline |
Definition at line 514 of file ratngs.h.
|
inline |
|
inline |
Definition at line 505 of file ratngs.h.
void WERD_CHOICE::DisplaySegmentation | ( | TWERD * | word | ) |
Definition at line 764 of file ratngs.cpp.
|
inline |
Make more space in unichar_id_ and fragment_lengths_ arrays.
Definition at line 387 of file ratngs.h.
void WERD_CHOICE::GetNonSuperscriptSpan | ( | int * | start, |
int * | end | ||
) | const |
Definition at line 397 of file ratngs.cpp.
int WERD_CHOICE::GetTopScriptID | ( | ) | const |
Definition at line 670 of file ratngs.cpp.
bool WERD_CHOICE::has_rtl_unichar_id | ( | ) | const |
has_rtl_unichar_id
Returns true if unichar_ids contain at least one "strongly" RTL unichar.
Definition at line 431 of file ratngs.cpp.
|
inline |
Initializes WERD_CHOICE - reserves length slots in unichar_ids_ and fragment_length_ arrays. Sets other values to default (blank) values.
Definition at line 409 of file ratngs.h.
void WERD_CHOICE::init | ( | const char * | src_string, |
const char * | src_lengths, | ||
float | src_rating, | ||
float | src_certainty, | ||
uint8_t | src_permuter | ||
) |
Helper function to build a WERD_CHOICE from the given string, fragment lengths, rating, certainty and permuter. The function assumes that src_string is not nullptr. src_lengths argument could be nullptr, in which case the unichars in src_string are assumed to all be of length 1.
Helper function to build a WERD_CHOICE from the given string, fragment lengths, rating, certainty and permuter.
The function assumes that src_string is not nullptr. src_lengths argument could be nullptr, in which case the unichars in src_string are assumed to all be of length 1.
Definition at line 245 of file ratngs.cpp.
|
inline |
Definition at line 521 of file ratngs.h.
|
inline |
|
inline |
MATRIX_COORD WERD_CHOICE::MatrixCoord | ( | int | index | ) | const |
Definition at line 302 of file ratngs.cpp.
|
inline |
|
inline |
WERD_CHOICE & WERD_CHOICE::operator+= | ( | const WERD_CHOICE & | second | ) |
Cat a second word rating on the end of this current one. The ratings are added and the confidence is the min. If the permuters are NOT the same the permuter is set to COMPOUND_PERM
Definition at line 485 of file ratngs.cpp.
WERD_CHOICE & WERD_CHOICE::operator= | ( | const WERD_CHOICE & | source | ) |
Allocate enough memory to hold a copy of source and copy over all the information from source to this WERD_CHOICE.
Definition at line 521 of file ratngs.cpp.
|
inline |
|
static |
Definition at line 194 of file ratngs.cpp.
const char * WERD_CHOICE::permuter_name | ( | ) | const |
Definition at line 283 of file ratngs.cpp.
void WERD_CHOICE::print | ( | const char * | msg | ) | const |
Print WERD_CHOICE to stdout.
Definition at line 727 of file ratngs.cpp.
void WERD_CHOICE::print_state | ( | const char * | msg | ) | const |
Definition at line 755 of file ratngs.cpp.
void WERD_CHOICE::punct_stripped | ( | int * | start, |
int * | end | ||
) | const |
punct_stripped
Returns the half-open interval of unichar_id indices [start, end) which enclose the core portion of this word – the part after stripping punctuation from the left and right.
Definition at line 383 of file ratngs.cpp.
|
inline |
|
inline |
|
inline |
Definition at line 484 of file ratngs.h.
void WERD_CHOICE::remove_unichar_ids | ( | int | start, |
int | num | ||
) |
remove_unichar_ids
Removes num unichar ids starting from index start from unichar_ids_ and updates length_ and fragment_lengths_ to reflect this change. Note: this function does not modify rating_ and certainty_.
Definition at line 342 of file ratngs.cpp.
void WERD_CHOICE::reverse_and_mirror_unichar_ids | ( | ) |
reverse_and_mirror_unichar_ids
Reverses and mirrors unichars in unichar_ids.
Definition at line 365 of file ratngs.cpp.
|
static |
Definition at line 632 of file ratngs.cpp.
|
inline |
void WERD_CHOICE::set_blob_choice | ( | int | index, |
int | blob_count, | ||
const BLOB_CHOICE * | blob_choice | ||
) |
Definition at line 312 of file ratngs.cpp.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 464 of file ratngs.h.
|
inline |
|
inline |
void WERD_CHOICE::SetAllScriptPositions | ( | tesseract::ScriptPos | position | ) |
Definition at line 626 of file ratngs.cpp.
void WERD_CHOICE::SetScriptPositions | ( | bool | small_caps, |
TWERD * | word, | ||
int | debug = 0 |
||
) |
Definition at line 550 of file ratngs.cpp.
void WERD_CHOICE::SetScriptPositions | ( | const tesseract::ScriptPos * | positions, |
int | length | ||
) |
Definition at line 616 of file ratngs.cpp.
WERD_CHOICE WERD_CHOICE::shallow_copy | ( | int | start, |
int | end | ||
) | const |
Definition at line 414 of file ratngs.cpp.
|
inline |
string_and_lengths
Populates the given word_str with unichars from unichar_ids and and word_lengths_str with the corresponding unichar lengths.
Definition at line 449 of file ratngs.cpp.
int WERD_CHOICE::TotalOfStates | ( | ) | const |
Definition at line 714 of file ratngs.cpp.
|
inline |
|
inline |
|
inline |
Definition at line 548 of file ratngs.h.
|
inline |
Definition at line 541 of file ratngs.h.
|
inline |
|
inline |
void WERD_CHOICE::UpdateStateForSplit | ( | int | blob_position | ) |
Definition at line 702 of file ratngs.cpp.