aboutsummaryrefslogtreecommitdiffstats
path: root/native/src/dictionary.h
diff options
context:
space:
mode:
authorKen Wakasa <kwakasa@google.com>2011-01-07 15:01:51 +0900
committerKen Wakasa <kwakasa@google.com>2011-01-07 19:51:45 +0900
commite90b333017c68e888a5e3d351f07ea29036457d0 (patch)
treedd51657376f1c571df581b7016be891d09246be5 /native/src/dictionary.h
parentf16028b92e15c0fdf3fdc364d7888cf024723b00 (diff)
downloadlatinime-e90b333017c68e888a5e3d351f07ea29036457d0.tar.gz
latinime-e90b333017c68e888a5e3d351f07ea29036457d0.tar.xz
latinime-e90b333017c68e888a5e3d351f07ea29036457d0.zip
Load main dic in native
Follow up to Id57dce51 bug: 3219819 Change-Id: I00e11ef21d0252ffa88c12dffb9c55b0f2e19a66
Diffstat (limited to 'native/src/dictionary.h')
-rw-r--r--native/src/dictionary.h22
1 files changed, 15 insertions, 7 deletions
diff --git a/native/src/dictionary.h b/native/src/dictionary.h
index da876242d..cef1cf9eb 100644
--- a/native/src/dictionary.h
+++ b/native/src/dictionary.h
@@ -25,8 +25,8 @@ namespace latinime {
class Dictionary {
public:
- Dictionary(void *dict, int typedLetterMultipler, int fullWordMultiplier, int maxWordLength,
- int maxWords, int maxAlternatives);
+ Dictionary(void *dict, int dictSize, int mmapFd, int dictBufAdjust, int typedLetterMultipler,
+ int fullWordMultiplier, int maxWordLength, int maxWords, int maxAlternatives);
int getSuggestions(int *codes, int codesSize, unsigned short *outWords, int *frequencies,
int *nextLetters, int nextLettersSize) {
return mUnigramDictionary->getSuggestions(codes, codesSize, outWords, frequencies,
@@ -42,8 +42,10 @@ public:
}
bool isValidWord(unsigned short *word, int length);
int isValidWordRec(int pos, unsigned short *word, int offset, int length);
- void setAsset(void *asset) { mAsset = asset; }
- void *getAsset() { return mAsset; }
+ void *getDict() { return (void *)mDict; }
+ int getDictSize() { return mDictSize; }
+ int getMmapFd() { return mMmapFd; }
+ int getDictBufAdjust() { return mDictBufAdjust; }
~Dictionary();
// public static utility methods
@@ -62,11 +64,17 @@ public:
private:
bool hasBigram();
- const unsigned char *DICT;
+ const unsigned char *mDict;
+
+ // Used only for the mmap version of dictionary loading, but we use these as dummy variables
+ // also for the malloc version.
+ const int mDictSize;
+ const int mMmapFd;
+ const int mDictBufAdjust;
+
const bool IS_LATEST_DICT_VERSION;
- void *mAsset;
- BigramDictionary *mBigramDictionary;
UnigramDictionary *mUnigramDictionary;
+ BigramDictionary *mBigramDictionary;
};
// ----------------------------------------------------------------------------