20 #ifndef TESSERACT_CCUTIL_AMBIGS_H_
21 #define TESSERACT_CCUTIL_AMBIGS_H_
23 #if !defined(DISABLED_LEGACY_ENGINE)
31 #define MAX_AMBIG_SIZE 10
60 if (val1 == INVALID_UNICHAR_ID)
return -1;
61 if (val2 == INVALID_UNICHAR_ID)
return 1;
62 if (val1 < val2)
return -1;
65 if (val1 == INVALID_UNICHAR_ID)
return 0;
73 for (
int i = 0; i < uid_vec.
size(); ++i)
74 if (uid_vec[i] == uid)
return i;
85 }
while (dst[i++] != INVALID_UNICHAR_ID);
94 if (*ptr == INVALID_UNICHAR_ID)
tprintf(
"[Empty]");
95 while (*ptr != INVALID_UNICHAR_ID) {
100 while (*ptr != INVALID_UNICHAR_ID)
tprintf(
"%d ", *ptr++);
116 const AmbigSpec *s1 = *static_cast<const AmbigSpec *const *>(spec1);
117 const AmbigSpec *s2 = *static_cast<const AmbigSpec *const *>(spec2);
119 if (result != 0)
return result;
140 replace_ambigs_.delete_data_pointers();
141 dang_ambigs_.delete_data_pointers();
142 one_to_one_definite_ambigs_.delete_data_pointers();
149 void InitUnicharAmbigs(
const UNICHARSET& unicharset,
150 bool use_ambigs_for_adaption);
167 void LoadUnicharAmbigs(
const UNICHARSET& encoder_set,
168 TFile *ambigs_file,
int debug_level,
169 bool use_ambigs_for_adaption,
UNICHARSET *unicharset);
174 if (one_to_one_definite_ambigs_.empty())
return nullptr;
175 return one_to_one_definite_ambigs_[unichar_id];
185 if (ambigs_for_adaption_.empty())
return nullptr;
186 return ambigs_for_adaption_[unichar_id];
194 if (reverse_ambigs_for_adaption_.empty())
return nullptr;
195 return reverse_ambigs_for_adaption_[unichar_id];
199 bool ParseAmbiguityLine(
int line_num,
int version,
int debug_level,
201 int *test_ambig_part_size,
203 int *replacement_ambig_part_size,
204 char *replacement_string,
int *
type);
206 int test_ambig_part_size,
UNICHAR_ID *test_unichar_ids,
207 int replacement_ambig_part_size,
208 const char *replacement_string,
int type,
220 #endif // !defined(DISABLED_LEGACY_ENGINE)
222 #endif // TESSERACT_CCUTIL_AMBIGS_H_