diff options
author | 2011-06-30 17:15:32 +0900 | |
---|---|---|
committer | 2011-06-30 17:22:19 +0900 | |
commit | ffefdb6c1a4a7dfc0cebc071979b0a816fe89304 (patch) | |
tree | 6ad312f6184169ea04b0d49ac4131659c71e58cb /native/src | |
parent | 980d6b6fef34e8716feb405aa8902d9f7fd37195 (diff) | |
download | latinime-ffefdb6c1a4a7dfc0cebc071979b0a816fe89304.tar.gz latinime-ffefdb6c1a4a7dfc0cebc071979b0a816fe89304.tar.xz latinime-ffefdb6c1a4a7dfc0cebc071979b0a816fe89304.zip |
Cleanup.
Function renaming, moving around for future patch readability
Change-Id: Id33b961cf2e899b5a3c9189951d2199aba801666
Diffstat (limited to 'native/src')
-rw-r--r-- | native/src/unigram_dictionary.cpp | 8 | ||||
-rw-r--r-- | native/src/unigram_dictionary.h | 19 |
2 files changed, 13 insertions, 14 deletions
diff --git a/native/src/unigram_dictionary.cpp b/native/src/unigram_dictionary.cpp index d01f9c024..3c25eda03 100644 --- a/native/src/unigram_dictionary.cpp +++ b/native/src/unigram_dictionary.cpp @@ -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); } diff --git a/native/src/unigram_dictionary.h b/native/src/unigram_dictionary.h index 7183b208e..1aeace63c 100644 --- a/native/src/unigram_dictionary.h +++ b/native/src/unigram_dictionary.h @@ -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); } |