Tesseract 3.01
|
#include <ratngs.h>
Public Member Functions | |
WERD_CHOICE () | |
WERD_CHOICE (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 () | |
int | length () const |
const UNICHAR_ID * | unichar_ids () const |
const UNICHAR_ID | unichar_id (int index) const |
const char * | fragment_lengths () const |
const char | fragment_length (int index) const |
float | rating () const |
float | certainty () const |
uinT8 | permuter () const |
bool | fragment_mark () const |
BLOB_CHOICE_LIST_CLIST * | blob_choices () |
void | set_unichar_id (UNICHAR_ID unichar_id, int index) |
void | set_fragment_length (char flen, int index) |
void | set_rating (float new_val) |
void | set_certainty (float new_val) |
void | set_permuter (uinT8 perm) |
void | set_fragment_mark (bool new_fragment_mark) |
void | set_length (int len) |
void | set_blob_choices (BLOB_CHOICE_LIST_CLIST *blob_choices) |
void | double_the_size () |
Make more space in unichar_id_ and fragment_lengths_ arrays. | |
void | init (int reserved) |
void | init (const char *src_string, const char *src_lengths, float src_rating, float src_certainty, uinT8 src_permuter, const UNICHARSET ¤t_unicharset) |
void | make_bad () |
Set the fields in this choice to be default (bad) values. | |
void | append_unichar_id_space_allocated (UNICHAR_ID unichar_id, char fragment_length, float rating, float certainty) |
void | append_unichar_id (UNICHAR_ID unichar_id, char fragment_length, float rating, float certainty) |
void | set_unichar_id (UNICHAR_ID unichar_id, char fragment_length, float rating, float certainty, int index) |
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) |
void | string_and_lengths (const UNICHARSET ¤t_unicharset, STRING *word_str, STRING *word_lengths_str) const |
const STRING | debug_string (const UNICHARSET ¤t_unicharset) const |
void | populate_unichars (const UNICHARSET ¤t_unicharset) |
void | depopulate_unichars () |
const STRING & | unichar_string () const |
const STRING & | unichar_lengths () const |
const void | print () const |
const void | print (const char *msg) const |
WERD_CHOICE & | operator+= (const WERD_CHOICE &second) |
WERD_CHOICE & | operator= (const WERD_CHOICE &source) |
Static Public Attributes | |
static const float | kBadRating |
WERD_CHOICE::WERD_CHOICE | ( | ) | [inline] |
WERD_CHOICE::WERD_CHOICE | ( | int | reserved | ) | [inline] |
WERD_CHOICE::WERD_CHOICE | ( | const char * | src_string, |
const char * | src_lengths, | ||
float | src_rating, | ||
float | src_certainty, | ||
uinT8 | src_permuter, | ||
const UNICHARSET & | unicharset | ||
) | [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.
WERD_CHOICE::WERD_CHOICE | ( | const WERD_CHOICE & | word | ) | [inline] |
WERD_CHOICE::~WERD_CHOICE | ( | ) |
void WERD_CHOICE::append_unichar_id | ( | UNICHAR_ID | unichar_id, |
char | fragment_length, | ||
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().
void WERD_CHOICE::append_unichar_id_space_allocated | ( | UNICHAR_ID | unichar_id, |
char | fragment_length, | ||
float | rating, | ||
float | certainty | ||
) | [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().
BLOB_CHOICE_LIST_CLIST* WERD_CHOICE::blob_choices | ( | ) | [inline] |
float WERD_CHOICE::certainty | ( | ) | const [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.
const STRING WERD_CHOICE::debug_string | ( | const UNICHARSET & | current_unicharset | ) | const [inline] |
void WERD_CHOICE::depopulate_unichars | ( | ) | [inline] |
Undoes populate_unichars, so that unichar_string_ and unichar_lengths_ are empty.
void WERD_CHOICE::double_the_size | ( | ) | [inline] |
Make more space in unichar_id_ and fragment_lengths_ arrays.
const char WERD_CHOICE::fragment_length | ( | int | index | ) | const [inline] |
const char* WERD_CHOICE::fragment_lengths | ( | ) | const [inline] |
bool WERD_CHOICE::fragment_mark | ( | ) | const [inline] |
void WERD_CHOICE::init | ( | int | reserved | ) | [inline] |
Initializes WERD_CHOICE - reserves length slots in unichar_ids_ and fragment_length_ arrays. Sets other values to default (blank) values.
void WERD_CHOICE::init | ( | const char * | src_string, |
const char * | src_lengths, | ||
float | src_rating, | ||
float | src_certainty, | ||
uinT8 | src_permuter, | ||
const UNICHARSET & | unicharset | ||
) |
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.
int WERD_CHOICE::length | ( | ) | const [inline] |
void WERD_CHOICE::make_bad | ( | ) | [inline] |
Set the fields in this choice to be default (bad) values.
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
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.
uinT8 WERD_CHOICE::permuter | ( | ) | const [inline] |
void WERD_CHOICE::populate_unichars | ( | const UNICHARSET & | current_unicharset | ) | [inline] |
Since this function walks over the whole word to convert unichar ids to unichars, it is best to call it once, e.g. after all changes to unichar_ids_ in WERD_CHOICE are finished.
const void WERD_CHOICE::print | ( | const char * | msg | ) | const |
Print WERD_CHOICE to stdout.
const void WERD_CHOICE::print | ( | ) | const [inline] |
float WERD_CHOICE::rating | ( | ) | const [inline] |
void WERD_CHOICE::remove_last_unichar_id | ( | ) | [inline] |
void WERD_CHOICE::remove_unichar_id | ( | int | index | ) | [inline] |
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_.
void WERD_CHOICE::set_blob_choices | ( | BLOB_CHOICE_LIST_CLIST * | blob_choices | ) |
Delete current blob_choices. Set the blob_choices to the given new list.
void WERD_CHOICE::set_certainty | ( | float | new_val | ) | [inline] |
void WERD_CHOICE::set_fragment_length | ( | char | flen, |
int | index | ||
) | [inline] |
void WERD_CHOICE::set_fragment_mark | ( | bool | new_fragment_mark | ) | [inline] |
void WERD_CHOICE::set_length | ( | int | len | ) | [inline] |
void WERD_CHOICE::set_permuter | ( | uinT8 | perm | ) | [inline] |
void WERD_CHOICE::set_rating | ( | float | new_val | ) | [inline] |
void WERD_CHOICE::set_unichar_id | ( | UNICHAR_ID | unichar_id, |
char | fragment_length, | ||
float | rating, | ||
float | certainty, | ||
int | index | ||
) | [inline] |
void WERD_CHOICE::set_unichar_id | ( | UNICHAR_ID | unichar_id, |
int | index | ||
) | [inline] |
void WERD_CHOICE::string_and_lengths | ( | const UNICHARSET & | current_unicharset, |
STRING * | word_str, | ||
STRING * | word_lengths_str | ||
) | const |
string_and_lengths
Populates the given word_str with unichars from unichar_ids and and word_lengths_str with the corresponding unichar lengths. Uses current_unicharset to make unichar id -> unichar conversions.
const UNICHAR_ID WERD_CHOICE::unichar_id | ( | int | index | ) | const [inline] |
const UNICHAR_ID* WERD_CHOICE::unichar_ids | ( | ) | const [inline] |
const STRING& WERD_CHOICE::unichar_lengths | ( | ) | const [inline] |
This function should only be called if populate_unichars() was called and WERD_CHOICE did not change since then.
const STRING& WERD_CHOICE::unichar_string | ( | ) | const [inline] |
This function should only be called if populate_unichars() was called and WERD_CHOICE did not change since then.
const float WERD_CHOICE::kBadRating [static] |