aboutsummaryrefslogtreecommitdiffstats
path: root/native/src/dictionary.h
diff options
context:
space:
mode:
authorsatok <satok@google.com>2011-07-14 15:43:42 +0900
committersatok <satok@google.com>2011-07-14 15:47:32 +0900
commitd24df43eaf1f7a7a9a9fcf31a45f0c2b2e11b698 (patch)
tree75d21d2ad20d3e5ec69cae7e9680920df471011e /native/src/dictionary.h
parentf7f2e82e8bbd14c00298d09be987e3c666195f50 (diff)
downloadlatinime-d24df43eaf1f7a7a9a9fcf31a45f0c2b2e11b698.tar.gz
latinime-d24df43eaf1f7a7a9a9fcf31a45f0c2b2e11b698.tar.xz
latinime-d24df43eaf1f7a7a9a9fcf31a45f0c2b2e11b698.zip
(Step2)Move functions related to proximity to proximity_info.cpp
Change-Id: Iae0eb2a5cd758bda820fa42b4bc3eb3d2665bf96
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