aboutsummaryrefslogtreecommitdiffstats
path: root/native/src/dictionary.h
diff options
context:
space:
mode:
Diffstat (limited to 'native/src/dictionary.h')
-rw-r--r--native/src/dictionary.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/native/src/dictionary.h b/native/src/dictionary.h
index 3dc577a56..73e03d8fd 100644
--- a/native/src/dictionary.h
+++ b/native/src/dictionary.h
@@ -17,7 +17,9 @@
#ifndef LATINIME_DICTIONARY_H
#define LATINIME_DICTIONARY_H
+#include "basechars.h"
#include "bigram_dictionary.h"
+#include "char_utils.h"
#include "defines.h"
#include "proximity_info.h"
#include "unigram_dictionary.h"
@@ -61,7 +63,7 @@ public:
static int setDictionaryValues(const unsigned char *dict, const bool isLatestDictVersion,
const int pos, unsigned short *c, int *childrenPosition,
bool *terminal, int *freq);
-
+ static inline unsigned short toBaseLowerCase(unsigned short c);
// TODO: delete this
int getBigramPosition(unsigned short *word, int length);
@@ -156,6 +158,19 @@ inline int Dictionary::setDictionaryValues(const unsigned char *dict,
return position;
}
+
+inline unsigned short Dictionary::toBaseLowerCase(unsigned short c) {
+ if (c < sizeof(BASE_CHARS) / sizeof(BASE_CHARS[0])) {
+ c = BASE_CHARS[c];
+ }
+ if (c >='A' && c <= 'Z') {
+ c |= 32;
+ } else if (c > 127) {
+ c = latin_tolower(c);
+ }
+ return c;
+}
+
} // namespace latinime
#endif // LATINIME_DICTIONARY_H