diff options
author | 2011-01-26 23:51:53 -0800 | |
---|---|---|
committer | 2011-01-26 23:51:53 -0800 | |
commit | dae444d0fd0fac1dcb33332e01eeaa0d4e510d15 (patch) | |
tree | a3d236b5ef3b2d1abca514534f7e9de4dc49da18 | |
parent | 3e5462a75017c2bdbcb45a1516269df9a4ed8de1 (diff) | |
parent | 588d2a525c444c0126f88791fcb097deba5d4644 (diff) | |
download | latinime-dae444d0fd0fac1dcb33332e01eeaa0d4e510d15.tar.gz latinime-dae444d0fd0fac1dcb33332e01eeaa0d4e510d15.tar.xz latinime-dae444d0fd0fac1dcb33332e01eeaa0d4e510d15.zip |
am 588d2a52: Merge "Handle the last char correctly in excessive char correction algortihm." into honeycomb
* commit '588d2a525c444c0126f88791fcb097deba5d4644':
Handle the last char correctly in excessive char correction algortihm.
-rw-r--r-- | native/src/unigram_dictionary.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/native/src/unigram_dictionary.cpp b/native/src/unigram_dictionary.cpp index 06dd39aaa..e27939d86 100644 --- a/native/src/unigram_dictionary.cpp +++ b/native/src/unigram_dictionary.cpp @@ -461,8 +461,9 @@ inline bool UnigramDictionary::processCurrentNode(const int pos, const int depth int childPosition; bool terminal; int freq; + bool isSameAsUserTypedLength = false; - if (excessivePos == depth) ++inputIndex; + if (excessivePos == depth && inputIndex < mInputLength - 1) ++inputIndex; *nextSiblingPosition = Dictionary::setDictionaryValues(DICT, IS_LATEST_DICT_VERSION, pos, &c, &childPosition, &terminal, &freq); @@ -496,7 +497,8 @@ inline bool UnigramDictionary::processCurrentNode(const int pos, const int depth // If inputIndex is greater than mInputLength, that means there is no // proximity chars. So, we don't need to check proximity. const int addedWeight = matchedProximityCharId == 0 ? TYPED_LETTER_MULTIPLIER : 1; - const bool isSameAsUserTypedLength = mInputLength == inputIndex + 1; + bool isSameAsUserTypedLength = mInputLength == inputIndex + 1 + || (excessivePos == mInputLength - 1 && inputIndex == mInputLength - 2); if (isSameAsUserTypedLength && terminal) { onTerminalWhenUserTypedLengthIsSameAsInputLength(mWord, inputIndex, depth, snr, skipPos, excessivePos, transposedPos, freq, addedWeight); @@ -514,7 +516,8 @@ inline bool UnigramDictionary::processCurrentNode(const int pos, const int depth } // If inputIndex is greater than mInputLength, that means there are no proximity chars. - if (mInputLength <= *newInputIndex) { + // TODO: Check if this can be isSameAsUserTypedLength only. + if (isSameAsUserTypedLength || mInputLength <= *newInputIndex) { *newTraverseAllNodes = true; } // get the count of nodes and increment childAddress. |