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

Commit ffefdb6c authored by Jean Chalard's avatar Jean Chalard
Browse files

Cleanup.

Function renaming, moving around for future patch readability

Change-Id: Id33b961cf2e899b5a3c9189951d2199aba801666
parent 980d6b6f
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -866,7 +866,7 @@ bool UnigramDictionary::getSplitTwoWordsSuggestion(const int inputLength,
    const int newWordLength = firstWordLength + secondWordLength + 1;
    // Allocating variable length array on stack
    unsigned short word[newWordLength];
    const int firstFreq = getBestWordFreq(firstWordStartPos, firstWordLength, mWord);
    const int firstFreq = getMostFrequentWordLike(firstWordStartPos, firstWordLength, mWord);
    if (DEBUG_DICT) {
        LOGI("First freq: %d", firstFreq);
    }
@@ -876,7 +876,7 @@ bool UnigramDictionary::getSplitTwoWordsSuggestion(const int inputLength,
        word[i] = mWord[i];
    }

    const int secondFreq = getBestWordFreq(secondWordStartPos, secondWordLength, mWord);
    const int secondFreq = getMostFrequentWordLike(secondWordStartPos, secondWordLength, mWord);
    if (DEBUG_DICT) {
        LOGI("Second  freq:  %d", secondFreq);
    }
@@ -997,7 +997,7 @@ bool UnigramDictionary::getSplitTwoWordsSuggestion(const int inputLength,
    const int newWordLength = firstWordLength + secondWordLength + 1;
    // Allocating variable length array on stack
    unsigned short word[newWordLength];
    const int firstFreq = getBestWordFreq(firstWordStartPos, firstWordLength, mWord);
    const int firstFreq = getMostFrequentWordLike(firstWordStartPos, firstWordLength, mWord);
    if (DEBUG_DICT) {
        LOGI("First freq: %d", firstFreq);
    }
@@ -1007,7 +1007,7 @@ bool UnigramDictionary::getSplitTwoWordsSuggestion(const int inputLength,
        word[i] = mWord[i];
    }

    const int secondFreq = getBestWordFreq(secondWordStartPos, secondWordLength, mWord);
    const int secondFreq = getMostFrequentWordLike(secondWordStartPos, secondWordLength, mWord);
    if (DEBUG_DICT) {
        LOGI("Second  freq:  %d", secondFreq);
    }
+9 −10
Original line number Diff line number Diff line
@@ -62,20 +62,11 @@ private:
            const int maxDepth);
    bool sameAsTyped(const unsigned short *word, int length) const;
    bool addWord(unsigned short *word, int length, int frequency);
    void addWordAlternatesSpellings(const uint8_t* const root, int pos, int depth, int finalFreq);
    void getWordsRec(const int childrenCount, const int pos, const int depth, const int maxDepth,
            const bool traverseAllNodes, const int snr, const int inputIndex, const int diffs,
            const int skipPos, const int excessivePos, const int transposedPos, int *nextLetters,
            const int nextLettersSize);
    bool getSplitTwoWordsSuggestion(const int inputLength,
            const int firstWordStartPos, const int firstWordLength,
            const int secondWordStartPos, const int secondWordLength, const bool isSpaceProximity);
    bool getMissingSpaceWords(const int inputLength, const int missingSpacePos);
    bool getMistypedSpaceWords(const int inputLength, const int spaceProximityPos);
    // Keep getWordsOld for comparing performance between getWords and getWordsOld
    void getWordsOld(const int initialPos, const int inputLength, const int skipPos,
            const int excessivePos, const int transposedPos, int *nextLetters,
            const int nextLettersSize);
    int calculateFinalFreq(const int inputIndex, const int depth, const int snr, const int skipPos,
            const int excessivePos, const int transposedPos, const int freq,
            const bool sameLength) const;
@@ -95,13 +86,21 @@ private:
            int *nextLetters, const int nextLettersSize, int *newCount, int *newChildPosition,
            bool *newTraverseAllNodes, int *newSnr, int*newInputIndex, int *newDiffs,
            int *nextSiblingPosition, int *nextOutputIndex);
    bool existsAdjacentProximityChars(const int inputIndex, const int inputLength) const;
    void getWordsRec(const int childrenCount, const int pos, const int depth, const int maxDepth,
            const bool traverseAllNodes, const int snr, const int inputIndex, const int diffs,
            const int skipPos, const int excessivePos, const int transposedPos, int *nextLetters,
            const int nextLettersSize);
    // Keep getWordsOld for comparing performance between getWords and getWordsOld
    void getWordsOld(const int initialPos, const int inputLength, const int skipPos,
            const int excessivePos, const int transposedPos, int *nextLetters,
            const int nextLettersSize);
    int getMostFrequentWordLike(const int startInputIndex, const int inputLength,
            unsigned short *word);
    // Process a node by considering missing space
    bool processCurrentNodeForExactMatch(const int firstChildPos,
            const int startInputIndex, const int depth, unsigned short *word,
            int *newChildPosition, int *newCount, bool *newTerminal, int *newFreq, int *siblingPos);
    bool existsAdjacentProximityChars(const int inputIndex, const int inputLength) const;
    inline const int* getInputCharsAt(const int index) const {
        return mInputCodes + (index * MAX_PROXIMITY_CHARS);
    }