Cleanup.
Function renaming, moving around for future patch readability Change-Id: Id33b961cf2e899b5a3c9189951d2199aba801666main
parent
980d6b6fef
commit
ffefdb6c1a
|
@ -866,7 +866,7 @@ bool UnigramDictionary::getSplitTwoWordsSuggestion(const int inputLength,
|
||||||
const int newWordLength = firstWordLength + secondWordLength + 1;
|
const int newWordLength = firstWordLength + secondWordLength + 1;
|
||||||
// Allocating variable length array on stack
|
// Allocating variable length array on stack
|
||||||
unsigned short word[newWordLength];
|
unsigned short word[newWordLength];
|
||||||
const int firstFreq = getBestWordFreq(firstWordStartPos, firstWordLength, mWord);
|
const int firstFreq = getMostFrequentWordLike(firstWordStartPos, firstWordLength, mWord);
|
||||||
if (DEBUG_DICT) {
|
if (DEBUG_DICT) {
|
||||||
LOGI("First freq: %d", firstFreq);
|
LOGI("First freq: %d", firstFreq);
|
||||||
}
|
}
|
||||||
|
@ -876,7 +876,7 @@ bool UnigramDictionary::getSplitTwoWordsSuggestion(const int inputLength,
|
||||||
word[i] = mWord[i];
|
word[i] = mWord[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
const int secondFreq = getBestWordFreq(secondWordStartPos, secondWordLength, mWord);
|
const int secondFreq = getMostFrequentWordLike(secondWordStartPos, secondWordLength, mWord);
|
||||||
if (DEBUG_DICT) {
|
if (DEBUG_DICT) {
|
||||||
LOGI("Second freq: %d", secondFreq);
|
LOGI("Second freq: %d", secondFreq);
|
||||||
}
|
}
|
||||||
|
@ -997,7 +997,7 @@ bool UnigramDictionary::getSplitTwoWordsSuggestion(const int inputLength,
|
||||||
const int newWordLength = firstWordLength + secondWordLength + 1;
|
const int newWordLength = firstWordLength + secondWordLength + 1;
|
||||||
// Allocating variable length array on stack
|
// Allocating variable length array on stack
|
||||||
unsigned short word[newWordLength];
|
unsigned short word[newWordLength];
|
||||||
const int firstFreq = getBestWordFreq(firstWordStartPos, firstWordLength, mWord);
|
const int firstFreq = getMostFrequentWordLike(firstWordStartPos, firstWordLength, mWord);
|
||||||
if (DEBUG_DICT) {
|
if (DEBUG_DICT) {
|
||||||
LOGI("First freq: %d", firstFreq);
|
LOGI("First freq: %d", firstFreq);
|
||||||
}
|
}
|
||||||
|
@ -1007,7 +1007,7 @@ bool UnigramDictionary::getSplitTwoWordsSuggestion(const int inputLength,
|
||||||
word[i] = mWord[i];
|
word[i] = mWord[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
const int secondFreq = getBestWordFreq(secondWordStartPos, secondWordLength, mWord);
|
const int secondFreq = getMostFrequentWordLike(secondWordStartPos, secondWordLength, mWord);
|
||||||
if (DEBUG_DICT) {
|
if (DEBUG_DICT) {
|
||||||
LOGI("Second freq: %d", secondFreq);
|
LOGI("Second freq: %d", secondFreq);
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,20 +62,11 @@ private:
|
||||||
const int maxDepth);
|
const int maxDepth);
|
||||||
bool sameAsTyped(const unsigned short *word, int length) const;
|
bool sameAsTyped(const unsigned short *word, int length) const;
|
||||||
bool addWord(unsigned short *word, int length, int frequency);
|
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,
|
bool getSplitTwoWordsSuggestion(const int inputLength,
|
||||||
const int firstWordStartPos, const int firstWordLength,
|
const int firstWordStartPos, const int firstWordLength,
|
||||||
const int secondWordStartPos, const int secondWordLength, const bool isSpaceProximity);
|
const int secondWordStartPos, const int secondWordLength, const bool isSpaceProximity);
|
||||||
bool getMissingSpaceWords(const int inputLength, const int missingSpacePos);
|
bool getMissingSpaceWords(const int inputLength, const int missingSpacePos);
|
||||||
bool getMistypedSpaceWords(const int inputLength, const int spaceProximityPos);
|
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,
|
int calculateFinalFreq(const int inputIndex, const int depth, const int snr, const int skipPos,
|
||||||
const int excessivePos, const int transposedPos, const int freq,
|
const int excessivePos, const int transposedPos, const int freq,
|
||||||
const bool sameLength) const;
|
const bool sameLength) const;
|
||||||
|
@ -95,13 +86,21 @@ private:
|
||||||
int *nextLetters, const int nextLettersSize, int *newCount, int *newChildPosition,
|
int *nextLetters, const int nextLettersSize, int *newCount, int *newChildPosition,
|
||||||
bool *newTraverseAllNodes, int *newSnr, int*newInputIndex, int *newDiffs,
|
bool *newTraverseAllNodes, int *newSnr, int*newInputIndex, int *newDiffs,
|
||||||
int *nextSiblingPosition, int *nextOutputIndex);
|
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,
|
int getMostFrequentWordLike(const int startInputIndex, const int inputLength,
|
||||||
unsigned short *word);
|
unsigned short *word);
|
||||||
// Process a node by considering missing space
|
// Process a node by considering missing space
|
||||||
bool processCurrentNodeForExactMatch(const int firstChildPos,
|
bool processCurrentNodeForExactMatch(const int firstChildPos,
|
||||||
const int startInputIndex, const int depth, unsigned short *word,
|
const int startInputIndex, const int depth, unsigned short *word,
|
||||||
int *newChildPosition, int *newCount, bool *newTerminal, int *newFreq, int *siblingPos);
|
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 {
|
inline const int* getInputCharsAt(const int index) const {
|
||||||
return mInputCodes + (index * MAX_PROXIMITY_CHARS);
|
return mInputCodes + (index * MAX_PROXIMITY_CHARS);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue