55 int hash_val = Hash(str);
56 if (hash_bin_size_[hash_val] == 0)
58 for (
int bin = 0; bin < hash_bin_size_[hash_val]; bin++) {
59 if (class_strings_[hash_bins_[hash_val][bin]]->compare(str) == 0)
60 return hash_bins_[hash_val][bin];
66 int hash_val = Hash(ch);
67 if (hash_bin_size_[hash_val] == 0)
69 for (
int bin = 0; bin < hash_bin_size_[hash_val]; bin++) {
70 if ((*class_strings_[hash_bins_[hash_val][bin]])[0] == ch &&
71 class_strings_[hash_bins_[hash_val][bin]]->length() == 1) {
72 return hash_bins_[hash_val][bin];
82 if (class_id == INVALID_UNICHAR_ID)
83 return INVALID_UNICHAR_ID;
86 unichar_id = unicharset_map_[class_id];
88 unichar_id = class_id;
94 if (class_id == INVALID_UNICHAR_ID)
95 return INVALID_UNICHAR_ID;
98 unichar_id = unicharset_map_[class_id];
100 unichar_id = class_id;
105 if (class_id < 0 || class_id >= class_cnt_) {
108 return reinterpret_cast<const char_32 *
>(class_strings_[class_id]->c_str());
127 static const int kHashBins = 3001;
128 static const int kMaxHashSize = 16;
132 static inline int Hash(
const char_32 *str) {
133 unsigned long hash = 5381;
136 hash = ((hash << 5) + hash) + c;
137 return (hash%kHashBins);
140 static inline int Hash(
char_32 ch) {
150 bool LoadSupportedCharList(FILE *fp,
UNICHARSET *tess_unicharset);
155 int hash_bin_size_[kHashBins];
157 int hash_bins_[kHashBins][kMaxHashSize];
161 int *unicharset_map_;
static CharSet * Create(TessdataManager *tessdata_manager, UNICHARSET *tess_unicharset)
int UnicharID(const char_32 *str) const
basic_string< char_32 > string_32
UNICHARSET * InternalUnicharset()
int ClassID(const char_32 *str) const
int UnicharID(char_32 ch) const
int ClassID(char_32 ch) const
const char_32 * ClassString(int class_id) const