21 #ifndef TESSERACT_CCUTIL_AMBIGS_H_
22 #define TESSERACT_CCUTIL_AMBIGS_H_
30 #define MAX_AMBIG_SIZE 10
36 static const int kUnigramAmbigsBufferSize = 1000;
37 static const char kAmbigNgramSeparator[] = {
' ',
'\0' };
38 static const char kAmbigDelimiters[] =
"\t ";
39 static const char kIllegalMsg[] =
40 "Illegal ambiguity specification on line %d\n";
41 static const char kIllegalUnicharMsg[] =
42 "Illegal unichar %s in ambiguity specification\n";
66 while (*ptr1 != INVALID_UNICHAR_ID && *ptr2 != INVALID_UNICHAR_ID) {
67 if (*ptr1 != *ptr2)
return *ptr1 < *ptr2 ? -1 : 1;
71 if (*ptr1 == INVALID_UNICHAR_ID && *ptr2 == INVALID_UNICHAR_ID)
return 0;
72 return *ptr1 == INVALID_UNICHAR_ID ? -1 : 1;
79 for (
int i = 0; i < uid_vec.
size(); ++i)
80 if (uid_vec[i] == uid)
return i;
91 }
while (dst[i++] != INVALID_UNICHAR_ID);
100 if (*ptr == INVALID_UNICHAR_ID)
tprintf(
"[Empty]");
101 while (*ptr != INVALID_UNICHAR_ID) {
106 while (*ptr != INVALID_UNICHAR_ID)
tprintf(
"%d ", *ptr++);
123 *
reinterpret_cast<const AmbigSpec *
const *
>(spec1);
125 *
reinterpret_cast<const AmbigSpec *
const *
>(spec2);
164 bool use_ambigs_for_adaption,
UNICHARSET *unicharset);
169 if (one_to_one_definite_ambigs_.
empty())
return NULL;
170 return one_to_one_definite_ambigs_[unichar_id];
180 if (ambigs_for_adaption_.
empty())
return NULL;
181 return ambigs_for_adaption_[unichar_id];
189 if (reverse_ambigs_for_adaption_.
empty())
return NULL;
190 return reverse_ambigs_for_adaption_[unichar_id];
195 bool ParseAmbiguityLine(
int line_num,
int version,
int debug_level,
197 int *TestAmbigPartSize,
UNICHAR_ID *TestUnicharIds,
198 int *ReplacementAmbigPartSize,
199 char *ReplacementString,
int *type);
201 int TestAmbigPartSize,
UNICHAR_ID *TestUnicharIds,
202 int ReplacementAmbigPartSize,
203 const char *ReplacementString,
int type,
214 #endif // TESSERACT_CCUTIL_AMBIGS_H_