40 void WordListLangModel::Cleanup() {
49 bool WordListLangModel::Init() {
56 WordListLangModel::kMaxDawgEdges,
76 if (Init() ==
false) {
87 if (tess_lm_edge ==
NULL) {
90 edge_ref = tess_lm_edge->
EndEdge();
101 if (edge_array ==
NULL) {
107 edge_array + (*edge_cnt));
124 vector<WERD_CHOICE *> *word_variants) {
125 int str_len = str32.length();
127 if (word_so_far->
length() > 0) {
128 word_variants->push_back(
new WERD_CHOICE(*word_so_far));
132 for (
int len = 1; len <= str_len; len++) {
134 string_32 str_pref32 = str32.substr(0, len);
135 int class_id = char_set.
ClassID(reinterpret_cast<const char_32 *>(
136 str_pref32.c_str()));
140 string_32 new_prefix_str32 = prefix_str32 + str_pref32;
143 WordVariants(char_set, new_prefix_str32, word_so_far, new_str32,
156 vector<WERD_CHOICE *> *word_variants) {
157 for (
int i = 0; i < word_variants->size(); i++) {
158 delete (*word_variants)[i];
160 word_variants->clear();
163 WordVariants(char_set, prefix_str32, &word_so_far, str32, word_variants);
168 if (!init_ && !Init()) {
174 if (str32.length() < 1) {
182 if (char_32_ptr ==
NULL) {
186 vector<WERD_CHOICE *> word_variants;
188 char_32_ptr, &word_variants);
190 if (word_variants.size() > 0) {
192 int shortest_word = 0;
193 for (
int word = 1; word < word_variants.size(); word++) {
194 if (word_variants[shortest_word]->length() >
195 word_variants[word]->length()) {
196 shortest_word = word;
202 for (
int i = 0; i < word_variants.size(); i++) {
delete word_variants[i]; }