Loading native/jni/src/defines.h +1 −1 Original line number Diff line number Diff line Loading @@ -292,7 +292,7 @@ static inline void prof_out(void) { // of the binary dictionary where a {key,value} string pair scheme is used. #define LARGEST_INT_DIGIT_COUNT 11 #define NOT_VALID_WORD (-99) #define NOT_A_VALID_WORD_POS (-99) #define NOT_A_CODE_POINT (-1) #define NOT_A_DISTANCE (-1) #define NOT_A_COORDINATE (-1) Loading native/jni/src/suggest/core/dicnode/dic_node.h +3 −3 Original line number Diff line number Diff line Loading @@ -112,7 +112,7 @@ class DicNode { mIsUsed = true; mIsCachedForNextSuggestion = false; mDicNodeProperties.init( NOT_A_DICT_POS, rootGroupPos, NOT_A_DICT_POS /* attributesPos */, NOT_A_VALID_WORD_POS /* pos */, rootGroupPos, NOT_A_DICT_POS /* attributesPos */, NOT_A_CODE_POINT /* nodeCodePoint */, NOT_A_PROBABILITY /* probability */, false /* isTerminal */, true /* hasChildren */, false /* isBlacklistedOrNotAWord */, 0 /* depth */, 0 /* terminalDepth */); Loading @@ -125,7 +125,7 @@ class DicNode { mIsUsed = true; mIsCachedForNextSuggestion = dicNode->mIsCachedForNextSuggestion; mDicNodeProperties.init( NOT_A_DICT_POS, rootGroupPos, NOT_A_DICT_POS /* attributesPos */, NOT_A_VALID_WORD_POS /* pos */, rootGroupPos, NOT_A_DICT_POS /* attributesPos */, NOT_A_CODE_POINT /* nodeCodePoint */, NOT_A_PROBABILITY /* probability */, false /* isTerminal */, true /* hasChildren */, false /* isBlacklistedOrNotAWord */, 0 /* depth */, 0 /* terminalDepth */); Loading Loading @@ -231,7 +231,7 @@ class DicNode { } bool isFirstWord() const { return mDicNodeState.mDicNodeStatePrevWord.getPrevWordNodePos() == NOT_VALID_WORD; return mDicNodeState.mDicNodeStatePrevWord.getPrevWordNodePos() == NOT_A_VALID_WORD_POS; } bool isCompletion(const int inputSize) const { Loading native/jni/src/suggest/core/dicnode/dic_node_state_prevword.h +2 −2 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ class DicNodeStatePrevWord { public: AK_FORCE_INLINE DicNodeStatePrevWord() : mPrevWordCount(0), mPrevWordLength(0), mPrevWordStart(0), mPrevWordProbability(0), mPrevWordNodePos(0) { mPrevWordNodePos(NOT_A_VALID_WORD_POS) { memset(mPrevWord, 0, sizeof(mPrevWord)); memset(mPrevSpacePositions, 0, sizeof(mPrevSpacePositions)); } Loading @@ -41,7 +41,7 @@ class DicNodeStatePrevWord { mPrevWordCount = 0; mPrevWordStart = 0; mPrevWordProbability = -1; mPrevWordNodePos = NOT_VALID_WORD; mPrevWordNodePos = NOT_A_VALID_WORD_POS; memset(mPrevSpacePositions, 0, sizeof(mPrevSpacePositions)); } Loading native/jni/src/suggest/core/dicnode/dic_node_utils.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -179,8 +179,9 @@ namespace latinime { const int unigramProbability = node->getProbability(); const int wordPos = node->getPos(); const int prevWordPos = node->getPrevWordPos(); if (NOT_VALID_WORD == wordPos || NOT_VALID_WORD == prevWordPos) { // Note: Normally wordPos comes from the dictionary and should never equal NOT_VALID_WORD. if (NOT_A_VALID_WORD_POS == wordPos || NOT_A_VALID_WORD_POS == prevWordPos) { // Note: Normally wordPos comes from the dictionary and should never equal // NOT_A_VALID_WORD_POS. return ProbabilityUtils::backoff(unigramProbability); } if (multiBigramMap) { Loading native/jni/src/suggest/core/dictionary/bigram_dictionary.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -153,7 +153,7 @@ int BigramDictionary::getBigramListPositionForWord(const int *prevWord, const in if (0 >= prevWordLength) return 0; int pos = mBinaryDictionaryInfo->getStructurePolicy()->getTerminalNodePositionOfWord( mBinaryDictionaryInfo, prevWord, prevWordLength, forceLowerCaseSearch); if (NOT_VALID_WORD == pos) return 0; if (NOT_A_VALID_WORD_POS == pos) return 0; return BinaryFormat::getBigramListPositionForWordPosition( mBinaryDictionaryInfo->getDictRoot(), pos); } Loading Loading @@ -181,7 +181,7 @@ bool BigramDictionary::isValidBigram(const int *word0, int length0, const int *w if (0 == pos) return false; int nextWordPos = mBinaryDictionaryInfo->getStructurePolicy()->getTerminalNodePositionOfWord( mBinaryDictionaryInfo, word1, length1, false /* forceLowerCaseSearch */); if (NOT_VALID_WORD == nextWordPos) return false; if (NOT_A_VALID_WORD_POS == nextWordPos) return false; for (BinaryDictionaryBigramsIterator bigramsIt(mBinaryDictionaryInfo, pos); bigramsIt.hasNext(); /* no-op */) { Loading Loading
native/jni/src/defines.h +1 −1 Original line number Diff line number Diff line Loading @@ -292,7 +292,7 @@ static inline void prof_out(void) { // of the binary dictionary where a {key,value} string pair scheme is used. #define LARGEST_INT_DIGIT_COUNT 11 #define NOT_VALID_WORD (-99) #define NOT_A_VALID_WORD_POS (-99) #define NOT_A_CODE_POINT (-1) #define NOT_A_DISTANCE (-1) #define NOT_A_COORDINATE (-1) Loading
native/jni/src/suggest/core/dicnode/dic_node.h +3 −3 Original line number Diff line number Diff line Loading @@ -112,7 +112,7 @@ class DicNode { mIsUsed = true; mIsCachedForNextSuggestion = false; mDicNodeProperties.init( NOT_A_DICT_POS, rootGroupPos, NOT_A_DICT_POS /* attributesPos */, NOT_A_VALID_WORD_POS /* pos */, rootGroupPos, NOT_A_DICT_POS /* attributesPos */, NOT_A_CODE_POINT /* nodeCodePoint */, NOT_A_PROBABILITY /* probability */, false /* isTerminal */, true /* hasChildren */, false /* isBlacklistedOrNotAWord */, 0 /* depth */, 0 /* terminalDepth */); Loading @@ -125,7 +125,7 @@ class DicNode { mIsUsed = true; mIsCachedForNextSuggestion = dicNode->mIsCachedForNextSuggestion; mDicNodeProperties.init( NOT_A_DICT_POS, rootGroupPos, NOT_A_DICT_POS /* attributesPos */, NOT_A_VALID_WORD_POS /* pos */, rootGroupPos, NOT_A_DICT_POS /* attributesPos */, NOT_A_CODE_POINT /* nodeCodePoint */, NOT_A_PROBABILITY /* probability */, false /* isTerminal */, true /* hasChildren */, false /* isBlacklistedOrNotAWord */, 0 /* depth */, 0 /* terminalDepth */); Loading Loading @@ -231,7 +231,7 @@ class DicNode { } bool isFirstWord() const { return mDicNodeState.mDicNodeStatePrevWord.getPrevWordNodePos() == NOT_VALID_WORD; return mDicNodeState.mDicNodeStatePrevWord.getPrevWordNodePos() == NOT_A_VALID_WORD_POS; } bool isCompletion(const int inputSize) const { Loading
native/jni/src/suggest/core/dicnode/dic_node_state_prevword.h +2 −2 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ class DicNodeStatePrevWord { public: AK_FORCE_INLINE DicNodeStatePrevWord() : mPrevWordCount(0), mPrevWordLength(0), mPrevWordStart(0), mPrevWordProbability(0), mPrevWordNodePos(0) { mPrevWordNodePos(NOT_A_VALID_WORD_POS) { memset(mPrevWord, 0, sizeof(mPrevWord)); memset(mPrevSpacePositions, 0, sizeof(mPrevSpacePositions)); } Loading @@ -41,7 +41,7 @@ class DicNodeStatePrevWord { mPrevWordCount = 0; mPrevWordStart = 0; mPrevWordProbability = -1; mPrevWordNodePos = NOT_VALID_WORD; mPrevWordNodePos = NOT_A_VALID_WORD_POS; memset(mPrevSpacePositions, 0, sizeof(mPrevSpacePositions)); } Loading
native/jni/src/suggest/core/dicnode/dic_node_utils.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -179,8 +179,9 @@ namespace latinime { const int unigramProbability = node->getProbability(); const int wordPos = node->getPos(); const int prevWordPos = node->getPrevWordPos(); if (NOT_VALID_WORD == wordPos || NOT_VALID_WORD == prevWordPos) { // Note: Normally wordPos comes from the dictionary and should never equal NOT_VALID_WORD. if (NOT_A_VALID_WORD_POS == wordPos || NOT_A_VALID_WORD_POS == prevWordPos) { // Note: Normally wordPos comes from the dictionary and should never equal // NOT_A_VALID_WORD_POS. return ProbabilityUtils::backoff(unigramProbability); } if (multiBigramMap) { Loading
native/jni/src/suggest/core/dictionary/bigram_dictionary.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -153,7 +153,7 @@ int BigramDictionary::getBigramListPositionForWord(const int *prevWord, const in if (0 >= prevWordLength) return 0; int pos = mBinaryDictionaryInfo->getStructurePolicy()->getTerminalNodePositionOfWord( mBinaryDictionaryInfo, prevWord, prevWordLength, forceLowerCaseSearch); if (NOT_VALID_WORD == pos) return 0; if (NOT_A_VALID_WORD_POS == pos) return 0; return BinaryFormat::getBigramListPositionForWordPosition( mBinaryDictionaryInfo->getDictRoot(), pos); } Loading Loading @@ -181,7 +181,7 @@ bool BigramDictionary::isValidBigram(const int *word0, int length0, const int *w if (0 == pos) return false; int nextWordPos = mBinaryDictionaryInfo->getStructurePolicy()->getTerminalNodePositionOfWord( mBinaryDictionaryInfo, word1, length1, false /* forceLowerCaseSearch */); if (NOT_VALID_WORD == nextWordPos) return false; if (NOT_A_VALID_WORD_POS == nextWordPos) return false; for (BinaryDictionaryBigramsIterator bigramsIt(mBinaryDictionaryInfo, pos); bigramsIt.hasNext(); /* no-op */) { Loading