tesseract
3.05.02
|
#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 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 | 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 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 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 | 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) |
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 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 NULL.
Definition at line 198 of file ratngs.cpp.
|
inline |
WERD_CHOICE::~WERD_CHOICE | ( | ) |
Definition at line 254 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 446 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 450 of file ratngs.h.
BLOB_CHOICE_LIST * WERD_CHOICE::blob_choices | ( | int | index, |
MATRIX * | ratings | ||
) | const |
Definition at line 268 of file ratngs.cpp.
|
inline |
Definition at line 320 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 304 of file ratngs.cpp.
|
inline |
|
inline |
Definition at line 503 of file ratngs.h.
void WERD_CHOICE::DisplaySegmentation | ( | TWERD * | word | ) |
Definition at line 747 of file ratngs.cpp.
|
inline |
Make more space in unichar_id_ and fragment_lengths_ arrays.
Definition at line 385 of file ratngs.h.
void WERD_CHOICE::GetNonSuperscriptSpan | ( | int * | start, |
int * | end | ||
) | const |
Definition at line 375 of file ratngs.cpp.
int WERD_CHOICE::GetTopScriptID | ( | ) | const |
Definition at line 653 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 409 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 407 of file ratngs.h.
void WERD_CHOICE::init | ( | const char * | src_string, |
const char * | src_lengths, | ||
float | src_rating, | ||
float | src_certainty, | ||
uinT8 | 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 NULL. src_lengths argument could be NULL, 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 NULL. src_lengths argument could be NULL, in which case the unichars in src_string are assumed to all be of length 1.
Definition at line 223 of file ratngs.cpp.
|
inline |
|
inline |
MATRIX_COORD WERD_CHOICE::MatrixCoord | ( | int | index | ) | const |
Definition at line 280 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 463 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 499 of file ratngs.cpp.
|
inline |
|
static |
Definition at line 174 of file ratngs.cpp.
const char * WERD_CHOICE::permuter_name | ( | ) | const |
Definition at line 261 of file ratngs.cpp.
void WERD_CHOICE::print | ( | const char * | msg | ) | const |
Print WERD_CHOICE to stdout.
Definition at line 710 of file ratngs.cpp.
void WERD_CHOICE::print_state | ( | const char * | msg | ) | const |
Definition at line 738 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 361 of file ratngs.cpp.
|
inline |
|
inline |
|
inline |
Definition at line 482 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 320 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 343 of file ratngs.cpp.
|
static |
Definition at line 615 of file ratngs.cpp.
|
inline |
void WERD_CHOICE::set_blob_choice | ( | int | index, |
int | blob_count, | ||
const BLOB_CHOICE * | blob_choice | ||
) |
Definition at line 290 of file ratngs.cpp.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 462 of file ratngs.h.
|
inline |
|
inline |
void WERD_CHOICE::SetAllScriptPositions | ( | tesseract::ScriptPos | position | ) |
Definition at line 609 of file ratngs.cpp.
void WERD_CHOICE::SetScriptPositions | ( | bool | small_caps, |
TWERD * | word | ||
) |
Definition at line 528 of file ratngs.cpp.
void WERD_CHOICE::SetScriptPositions | ( | const tesseract::ScriptPos * | positions, |
int | length | ||
) |
Definition at line 599 of file ratngs.cpp.
WERD_CHOICE WERD_CHOICE::shallow_copy | ( | int | start, |
int | end | ||
) | const |
Definition at line 392 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 427 of file ratngs.cpp.
int WERD_CHOICE::TotalOfStates | ( | ) | const |
Definition at line 697 of file ratngs.cpp.
|
inline |
|
inline |
|
inline |
Definition at line 532 of file ratngs.h.
|
inline |
Definition at line 525 of file ratngs.h.
|
inline |
|
inline |
void WERD_CHOICE::UpdateStateForSplit | ( | int | blob_position | ) |
Definition at line 685 of file ratngs.cpp.