Loading native/jni/src/bigram_dictionary.cpp +1 −4 Original line number Diff line number Diff line Loading @@ -26,11 +26,8 @@ namespace latinime { BigramDictionary::BigramDictionary(const unsigned char *dict, int maxWordLength, const bool isLatestDictVersion, const bool hasBigram, Dictionary *parentDictionary) : DICT(dict), MAX_WORD_LENGTH(maxWordLength), IS_LATEST_DICT_VERSION(isLatestDictVersion), HAS_BIGRAM(hasBigram), mParentDictionary(parentDictionary) { : DICT(dict), MAX_WORD_LENGTH(maxWordLength), mParentDictionary(parentDictionary) { if (DEBUG_DICT) { AKLOGI("BigramDictionary - constructor"); AKLOGI("Has Bigram : %d", hasBigram); Loading native/jni/src/bigram_dictionary.h +1 −4 Original line number Diff line number Diff line Loading @@ -22,8 +22,7 @@ namespace latinime { class Dictionary; class BigramDictionary { public: BigramDictionary(const unsigned char *dict, int maxWordLength, const bool isLatestDictVersion, const bool hasBigram, Dictionary *parentDictionary); BigramDictionary(const unsigned char *dict, int maxWordLength, Dictionary *parentDictionary); int getBigrams(unsigned short *word, int length, int *codes, int codesSize, unsigned short *outWords, int *frequencies, int maxWordLength, int maxBigrams); ~BigramDictionary(); Loading @@ -40,8 +39,6 @@ class BigramDictionary { const int MAX_WORD_LENGTH; // TODO: Re-implement proximity correction for bigram correction static const int MAX_ALTERNATIVES = 1; const bool IS_LATEST_DICT_VERSION; const bool HAS_BIGRAM; Dictionary *mParentDictionary; int *mBigramFreq; Loading native/jni/src/binary_format.h +1 −1 Original line number Diff line number Diff line Loading @@ -81,7 +81,7 @@ inline int BinaryFormat::detectFormat(const uint8_t* const dict) { // Format 2 header is as follows: // Magic number (4 bytes) 0x9B 0xC1 0x3A 0xFE // Version number (2 bytes) 0x00 0x02 // Options (2 bytes) must be 0x00 0x00 // Options (2 bytes) // Header size (4 bytes) : integer, big endian return (dict[4] << 8) + dict[5]; default: Loading native/jni/src/dictionary.cpp +3 −6 Original line number Diff line number Diff line Loading @@ -29,9 +29,7 @@ Dictionary::Dictionary(void *dict, int dictSize, int mmapFd, int dictBufAdjust, int typedLetterMultiplier, int fullWordMultiplier, int maxWordLength, int maxWords) : mDict((unsigned char*) dict), mDictSize(dictSize), mMmapFd(mmapFd), mDictBufAdjust(dictBufAdjust), // Checks whether it has the latest dictionary or the old dictionary IS_LATEST_DICT_VERSION((((unsigned char*) dict)[0] & 0xFF) >= DICTIONARY_VERSION_MIN) { mMmapFd(mmapFd), mDictBufAdjust(dictBufAdjust) { if (DEBUG_DICT) { if (MAX_WORD_LENGTH_INTERNAL < maxWordLength) { AKLOGI("Max word length (%d) is greater than %d", Loading @@ -44,9 +42,8 @@ Dictionary::Dictionary(void *dict, int dictSize, int mmapFd, int dictBufAdjust, maxWords, SUB_QUEUE_MAX_WORDS, maxWordLength); const unsigned int headerSize = BinaryFormat::getHeaderSize(mDict); mUnigramDictionary = new UnigramDictionary(mDict + headerSize, typedLetterMultiplier, fullWordMultiplier, maxWordLength, maxWords, IS_LATEST_DICT_VERSION); mBigramDictionary = new BigramDictionary(mDict + headerSize, maxWordLength, IS_LATEST_DICT_VERSION, true /* hasBigram */, this); fullWordMultiplier, maxWordLength, maxWords); mBigramDictionary = new BigramDictionary(mDict + headerSize, maxWordLength, this); } Dictionary::~Dictionary() { Loading native/jni/src/dictionary.h +0 −2 Original line number Diff line number Diff line Loading @@ -39,7 +39,6 @@ class Dictionary { codesSize, flags, outWords, frequencies); } // TODO: Call mBigramDictionary instead of mUnigramDictionary int getBigrams(unsigned short *word, int length, int *codes, int codesSize, unsigned short *outWords, int *frequencies, int maxWordLength, int maxBigrams) { return mBigramDictionary->getBigrams(word, length, codes, codesSize, outWords, frequencies, Loading Loading @@ -68,7 +67,6 @@ class Dictionary { const int mMmapFd; const int mDictBufAdjust; const bool IS_LATEST_DICT_VERSION; UnigramDictionary *mUnigramDictionary; BigramDictionary *mBigramDictionary; WordsPriorityQueuePool *mWordsPriorityQueuePool; Loading Loading
native/jni/src/bigram_dictionary.cpp +1 −4 Original line number Diff line number Diff line Loading @@ -26,11 +26,8 @@ namespace latinime { BigramDictionary::BigramDictionary(const unsigned char *dict, int maxWordLength, const bool isLatestDictVersion, const bool hasBigram, Dictionary *parentDictionary) : DICT(dict), MAX_WORD_LENGTH(maxWordLength), IS_LATEST_DICT_VERSION(isLatestDictVersion), HAS_BIGRAM(hasBigram), mParentDictionary(parentDictionary) { : DICT(dict), MAX_WORD_LENGTH(maxWordLength), mParentDictionary(parentDictionary) { if (DEBUG_DICT) { AKLOGI("BigramDictionary - constructor"); AKLOGI("Has Bigram : %d", hasBigram); Loading
native/jni/src/bigram_dictionary.h +1 −4 Original line number Diff line number Diff line Loading @@ -22,8 +22,7 @@ namespace latinime { class Dictionary; class BigramDictionary { public: BigramDictionary(const unsigned char *dict, int maxWordLength, const bool isLatestDictVersion, const bool hasBigram, Dictionary *parentDictionary); BigramDictionary(const unsigned char *dict, int maxWordLength, Dictionary *parentDictionary); int getBigrams(unsigned short *word, int length, int *codes, int codesSize, unsigned short *outWords, int *frequencies, int maxWordLength, int maxBigrams); ~BigramDictionary(); Loading @@ -40,8 +39,6 @@ class BigramDictionary { const int MAX_WORD_LENGTH; // TODO: Re-implement proximity correction for bigram correction static const int MAX_ALTERNATIVES = 1; const bool IS_LATEST_DICT_VERSION; const bool HAS_BIGRAM; Dictionary *mParentDictionary; int *mBigramFreq; Loading
native/jni/src/binary_format.h +1 −1 Original line number Diff line number Diff line Loading @@ -81,7 +81,7 @@ inline int BinaryFormat::detectFormat(const uint8_t* const dict) { // Format 2 header is as follows: // Magic number (4 bytes) 0x9B 0xC1 0x3A 0xFE // Version number (2 bytes) 0x00 0x02 // Options (2 bytes) must be 0x00 0x00 // Options (2 bytes) // Header size (4 bytes) : integer, big endian return (dict[4] << 8) + dict[5]; default: Loading
native/jni/src/dictionary.cpp +3 −6 Original line number Diff line number Diff line Loading @@ -29,9 +29,7 @@ Dictionary::Dictionary(void *dict, int dictSize, int mmapFd, int dictBufAdjust, int typedLetterMultiplier, int fullWordMultiplier, int maxWordLength, int maxWords) : mDict((unsigned char*) dict), mDictSize(dictSize), mMmapFd(mmapFd), mDictBufAdjust(dictBufAdjust), // Checks whether it has the latest dictionary or the old dictionary IS_LATEST_DICT_VERSION((((unsigned char*) dict)[0] & 0xFF) >= DICTIONARY_VERSION_MIN) { mMmapFd(mmapFd), mDictBufAdjust(dictBufAdjust) { if (DEBUG_DICT) { if (MAX_WORD_LENGTH_INTERNAL < maxWordLength) { AKLOGI("Max word length (%d) is greater than %d", Loading @@ -44,9 +42,8 @@ Dictionary::Dictionary(void *dict, int dictSize, int mmapFd, int dictBufAdjust, maxWords, SUB_QUEUE_MAX_WORDS, maxWordLength); const unsigned int headerSize = BinaryFormat::getHeaderSize(mDict); mUnigramDictionary = new UnigramDictionary(mDict + headerSize, typedLetterMultiplier, fullWordMultiplier, maxWordLength, maxWords, IS_LATEST_DICT_VERSION); mBigramDictionary = new BigramDictionary(mDict + headerSize, maxWordLength, IS_LATEST_DICT_VERSION, true /* hasBigram */, this); fullWordMultiplier, maxWordLength, maxWords); mBigramDictionary = new BigramDictionary(mDict + headerSize, maxWordLength, this); } Dictionary::~Dictionary() { Loading
native/jni/src/dictionary.h +0 −2 Original line number Diff line number Diff line Loading @@ -39,7 +39,6 @@ class Dictionary { codesSize, flags, outWords, frequencies); } // TODO: Call mBigramDictionary instead of mUnigramDictionary int getBigrams(unsigned short *word, int length, int *codes, int codesSize, unsigned short *outWords, int *frequencies, int maxWordLength, int maxBigrams) { return mBigramDictionary->getBigrams(word, length, codes, codesSize, outWords, frequencies, Loading Loading @@ -68,7 +67,6 @@ class Dictionary { const int mMmapFd; const int mDictBufAdjust; const bool IS_LATEST_DICT_VERSION; UnigramDictionary *mUnigramDictionary; BigramDictionary *mBigramDictionary; WordsPriorityQueuePool *mWordsPriorityQueuePool; Loading