Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9320451f authored by Keisuke Kuroyanagi's avatar Keisuke Kuroyanagi Committed by Android Git Automerger
Browse files

am 8faa1a44: Merge "Merge NOT_A_VALID_WORD_POS into NOT_A_DICT_POS."

* commit '8faa1a44':
  Merge NOT_A_VALID_WORD_POS into NOT_A_DICT_POS.
parents 51c78871 8faa1a44
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -292,7 +292,6 @@ 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_A_VALID_WORD_POS (-99)
#define NOT_A_CODE_POINT (-1)
#define NOT_A_DISTANCE (-1)
#define NOT_A_COORDINATE (-1)
+3 −3
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ class DicNode {
        mIsUsed = true;
        mIsCachedForNextSuggestion = false;
        mDicNodeProperties.init(
                NOT_A_VALID_WORD_POS /* pos */, rootGroupPos, NOT_A_CODE_POINT /* nodeCodePoint */,
                NOT_A_DICT_POS /* pos */, rootGroupPos, NOT_A_CODE_POINT /* nodeCodePoint */,
                NOT_A_PROBABILITY /* probability */, false /* isTerminal */,
                true /* hasChildren */, false /* isBlacklistedOrNotAWord */, 0 /* depth */,
                0 /* terminalDepth */);
@@ -125,7 +125,7 @@ class DicNode {
        mIsUsed = true;
        mIsCachedForNextSuggestion = dicNode->mIsCachedForNextSuggestion;
        mDicNodeProperties.init(
                NOT_A_VALID_WORD_POS /* pos */, rootGroupPos, NOT_A_CODE_POINT /* nodeCodePoint */,
                NOT_A_DICT_POS /* pos */, rootGroupPos, NOT_A_CODE_POINT /* nodeCodePoint */,
                NOT_A_PROBABILITY /* probability */, false /* isTerminal */,
                true /* hasChildren */, false /* isBlacklistedOrNotAWord */,  0 /* depth */,
                0 /* terminalDepth */);
@@ -234,7 +234,7 @@ class DicNode {
    }

    bool isFirstWord() const {
        return mDicNodeState.mDicNodeStatePrevWord.getPrevWordNodePos() == NOT_A_VALID_WORD_POS;
        return mDicNodeState.mDicNodeStatePrevWord.getPrevWordNodePos() == NOT_A_DICT_POS;
    }

    bool isCompletion(const int inputSize) const {
+1 −1
Original line number Diff line number Diff line
@@ -89,7 +89,7 @@ namespace latinime {
    const int unigramProbability = node->getProbability();
    const int wordPos = node->getPos();
    const int prevWordPos = node->getPrevWordPos();
    if (NOT_A_VALID_WORD_POS == wordPos || NOT_A_VALID_WORD_POS == prevWordPos) {
    if (NOT_A_DICT_POS == wordPos || NOT_A_DICT_POS == prevWordPos) {
        // Note: Normally wordPos comes from the dictionary and should never equal
        // NOT_A_VALID_WORD_POS.
        return dictionaryStructurePolicy->getProbability(unigramProbability,
+2 −2
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ class DicNodeStatePrevWord {
 public:
    AK_FORCE_INLINE DicNodeStatePrevWord()
            : mPrevWordCount(0), mPrevWordLength(0), mPrevWordStart(0), mPrevWordProbability(0),
              mPrevWordNodePos(NOT_A_VALID_WORD_POS) {
              mPrevWordNodePos(NOT_A_DICT_POS) {
        memset(mPrevWord, 0, sizeof(mPrevWord));
        memset(mPrevSpacePositions, 0, sizeof(mPrevSpacePositions));
    }
@@ -41,7 +41,7 @@ class DicNodeStatePrevWord {
        mPrevWordCount = 0;
        mPrevWordStart = 0;
        mPrevWordProbability = -1;
        mPrevWordNodePos = NOT_A_VALID_WORD_POS;
        mPrevWordNodePos = NOT_A_DICT_POS;
        memset(mPrevSpacePositions, 0, sizeof(mPrevSpacePositions));
    }

+3 −3
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ int BigramDictionary::getPredictions(const int *prevWord, const int prevWordLeng
            mDictionaryStructurePolicy->getBigramsStructurePolicy(), pos);
    while (bigramsIt.hasNext()) {
        bigramsIt.next();
        if (bigramsIt.getBigramPos() == NOT_A_VALID_WORD_POS) {
        if (bigramsIt.getBigramPos() == NOT_A_DICT_POS) {
            continue;
        }
        const int codePointCount = mDictionaryStructurePolicy->
@@ -146,7 +146,7 @@ int BigramDictionary::getBigramListPositionForWord(const int *prevWord, const in
    if (0 >= prevWordLength) return NOT_A_DICT_POS;
    int pos = mDictionaryStructurePolicy->getTerminalNodePositionOfWord(prevWord, prevWordLength,
            forceLowerCaseSearch);
    if (NOT_A_VALID_WORD_POS == pos) return NOT_A_DICT_POS;
    if (NOT_A_DICT_POS == pos) return NOT_A_DICT_POS;
    return mDictionaryStructurePolicy->getBigramsPositionOfNode(pos);
}

@@ -157,7 +157,7 @@ bool BigramDictionary::isValidBigram(const int *word0, int length0, const int *w
    if (NOT_A_DICT_POS == pos) return false;
    int nextWordPos = mDictionaryStructurePolicy->getTerminalNodePositionOfWord(word1, length1,
            false /* forceLowerCaseSearch */);
    if (NOT_A_VALID_WORD_POS == nextWordPos) return false;
    if (NOT_A_DICT_POS == nextWordPos) return false;

    BinaryDictionaryBigramsIterator bigramsIt(
            mDictionaryStructurePolicy->getBigramsStructurePolicy(), pos);
Loading