36 unichar_id_ = INVALID_UNICHAR_ID;
42 language_model_state_ =
NULL;
50 inT16 src_fontinfo_id,
51 inT16 src_fontinfo_id2,
78 return language_model_state_;
97 unichar_id_ = newunichar_id;
106 fontinfo_id_ = newfont;
109 fontinfo_id2_ = newfont;
112 script_id_ = newscript_id;
132 tprintf(
"r%.2f c%.2f : %d %s", rating_, certainty_, unichar_id_,
133 (unicharset ==
NULL) ?
"" :
157 void *language_model_state_;
191 : unicharset_(unicharset) { this->
init(8); }
193 : unicharset_(unicharset) { this->
init(reserved); }
195 const char *src_lengths,
200 : unicharset_(&unicharset) {
201 this->
init(src_string, src_lengths, src_rating,
202 src_certainty, src_permuter);
221 assert(index < length_);
222 return unichar_ids_[index];
225 return fragment_lengths_;
228 assert(index < length_);
229 return fragment_lengths_[index];
242 return fragment_mark_;
245 return blob_choices_;
248 assert(index < length_);
252 assert(index < length_);
253 fragment_lengths_[index] = flen;
259 certainty_ = new_val;
265 fragment_mark_ = new_fragment_mark;
280 reserved_, unichar_ids_);
282 reserved_, fragment_lengths_);
286 fragment_lengths_ =
new char[1];
293 inline void init(
int reserved) {
294 reserved_ = reserved;
297 fragment_lengths_ =
new char[reserved];
300 fragment_lengths_ =
NULL;
306 fragment_mark_ =
false;
307 blob_choices_ =
NULL;
308 unichars_in_script_order_ =
false;
316 void init(
const char *src_string,
const char *src_lengths,
317 float src_rating,
float src_certainty,
325 fragment_mark_ =
false;
334 assert(reserved_ > length_);
337 rating, certainty, length_-1);
345 assert(index < length_);
349 if (certainty < certainty_) {
375 for (
int i = 0; i < length_; ++i) {
376 word_str += unicharset_->
debug_str(unichar_ids_[i]);
386 return unichars_in_script_order_ = in_script_order;
390 return unichars_in_script_order_;
397 return unichar_string_;
404 return unichar_lengths_;
407 const void print(
const char *msg)
const;
417 char *fragment_lengths_;
428 BLOB_CHOICE_LIST_CLIST *blob_choices_;
434 bool unichars_in_script_order_;
438 mutable STRING unichar_string_;
439 mutable STRING unichar_lengths_;
441 bool unichar_info_present;
444 void delete_blob_choices();
461 BLOB_CHOICE_LIST *ratings,
467 BLOB_CHOICE_LIST *ratings,
473 const BLOB_CHOICE_LIST_VECTOR &char_choices,
bool unichars_in_script_order() const
void set_fontinfo_id(inT16 newfont)
const STRING & unichar_string() const
void reverse_and_mirror_unichar_ids()
void set_script(int newscript_id)
void set_rating(float new_val)
const UNICHAR_ID * unichar_ids() const
BLOB_CHOICE_LIST_CLIST * blob_choices()
const STRING debug_string() const
bool contains_unichar_id(UNICHAR_ID unichar_id) const
void set_rating(float newrat)
bool set_unichars_in_script_order(bool in_script_order)
inT16 fontinfo_id() const
void print_ratings_list(const char *msg, BLOB_CHOICE_LIST *ratings)
ELISTIZEH(BLOB_CHOICE) CLISTIZEH(BLOB_CHOICE_LIST) enum PermuterType
void append_unichar_id(UNICHAR_ID unichar_id, char fragment_length, float rating, float certainty)
inT16 fontinfo_id2() const
void make_bad()
Set the fields in this choice to be default (bad) values.
void punct_stripped(int *start_core, int *end_core) const
void print_ratings_info(FILE *fp, BLOB_CHOICE_LIST *ratings, const UNICHARSET ¤t_unicharset)
static T * double_the_size_memcpy(int current_size, T *data)
WERD_CHOICE(const char *src_string, const char *src_lengths, float src_rating, float src_certainty, uinT8 src_permuter, const UNICHARSET &unicharset)
WERD_CHOICE & operator=(const WERD_CHOICE &source)
bool EqualIgnoringCaseAndTerminalPunct(const WERD_CHOICE &word1, const WERD_CHOICE &word2)
UNICHAR_ID unichar_id() const
STRING debug_str(UNICHAR_ID id) const
#define CLISTIZEH(CLASSNAME)
const char * fragment_lengths() const
void remove_unichar_ids(int index, int num)
void set_fragment_length(char flen, int index)
WERD_CHOICE(const WERD_CHOICE &word)
void print(const UNICHARSET *unicharset)
const char * string() const
void set_xgap_before(inT16 gap)
static const float kBadRating
void remove_unichar_id(int index)
void set_xgap_after(inT16 gap)
DLLSYM void tprintf(const char *format,...)
void remove_last_unichar_id()
WERD_CHOICE & operator+=(const WERD_CHOICE &second)
void print_char_choices_list(const char *msg, const BLOB_CHOICE_LIST_VECTOR &char_choices, const UNICHARSET ¤t_unicharset, BOOL8 detailed)
const char fragment_length(int index) const
bool fragment_mark() const
void set_certainty(float new_val)
void * language_model_state()
const STRING & unichar_lengths() const
void set_fontinfo_id2(inT16 newfont)
WERD_CHOICE(const UNICHARSET *unicharset, int reserved)
const char * permuter_name() const
void set_unichar_id(UNICHAR_ID unichar_id, int index)
void set_certainty(float newrat)
inT16 max_xheight() const
void set_unichar_id(UNICHAR_ID unichar_id, char fragment_length, float rating, float certainty, int index)
void set_blob_choices(BLOB_CHOICE_LIST_CLIST *blob_choices)
static BLOB_CHOICE * deep_copy(const BLOB_CHOICE *src)
inT16 xgap_before() const
void set_fragment_mark(bool new_fragment_mark)
void double_the_size()
Make more space in unichar_id_ and fragment_lengths_ arrays.
void set_adapted(bool adapted)
WERD_CHOICE shallow_copy(int start, int end) const
void print_word_alternates_list(WERD_CHOICE *word, GenericVector< WERD_CHOICE * > *alternates)
bool has_rtl_unichar_id() const
void string_and_lengths(STRING *word_str, STRING *word_lengths_str) const
void append_unichar_id_space_allocated(UNICHAR_ID unichar_id, char fragment_length, float rating, float certainty)
const UNICHARSET * unicharset() const
const UNICHAR_ID unichar_id(int index) const
WERD_CHOICE(const UNICHARSET *unicharset)
void set_unichar_id(UNICHAR_ID newunichar_id)
inT16 min_xheight() const
void set_permuter(uinT8 perm)
void set_language_model_state(void *language_model_state)