diff options
author | 2011-09-30 05:46:42 -0700 | |
---|---|---|
committer | 2011-09-30 05:46:42 -0700 | |
commit | 7ed6d448db9541e813d57e78598f9ed478641e83 (patch) | |
tree | af9dfa81d99cbcf3a184a6fb307d6daf7b46f7a9 | |
parent | 4d21d9362112856ff0bf111e2260dabe3a93636e (diff) | |
parent | 9ee8c9c45c960dae6fbf0f35e4c84c9c1c85fc3f (diff) | |
download | latinime-7ed6d448db9541e813d57e78598f9ed478641e83.tar.gz latinime-7ed6d448db9541e813d57e78598f9ed478641e83.tar.xz latinime-7ed6d448db9541e813d57e78598f9ed478641e83.zip |
am 9ee8c9c4: Calibrate score by touch coordinates
* commit '9ee8c9c45c960dae6fbf0f35e4c84c9c1c85fc3f':
Calibrate score by touch coordinates
-rw-r--r-- | native/src/correction.cpp | 16 | ||||
-rw-r--r-- | native/src/defines.h | 2 |
2 files changed, 18 insertions, 0 deletions
diff --git a/native/src/correction.cpp b/native/src/correction.cpp index 308cca227..5128c2e5c 100644 --- a/native/src/correction.cpp +++ b/native/src/correction.cpp @@ -555,6 +555,8 @@ int Correction::RankingAlgorithm::calculateFinalFreq(const int inputIndex, const const int transposedCount = correction->mTransposedCount / 2; const int excessiveCount = correction->mExcessiveCount + correction->mTransposedCount % 2; const int proximityMatchedCount = correction->mProximityCount; + const int equivalentCharStrongCount = correction->mEquivalentCharStrongCount; + const int equivalentCharWeakCount = correction->mEquivalentCharWeakCount; const bool lastCharExceeded = correction->mLastCharExceeded; const bool useFullEditDistance = correction->mUseFullEditDistance; const int outputLength = outputIndex + 1; @@ -664,6 +666,20 @@ int Correction::RankingAlgorithm::calculateFinalFreq(const int inputIndex, const multiplyRate(WORDS_WITH_PROXIMITY_CHARACTER_DEMOTION_RATE, &finalFreq); } + for (int i = 0; i < equivalentCharStrongCount; ++i) { + if (DEBUG_DICT_FULL) { + LOGI("equivalent char strong"); + } + multiplyRate(WORDS_WITH_EQUIVALENT_CHAR_STRONG_PROMOTION_RATE, &finalFreq); + } + + for (int i = 0; i < equivalentCharWeakCount; ++i) { + if (DEBUG_DICT_FULL) { + LOGI("equivalent char weak"); + } + multiplyRate(WORDS_WITH_EQUIVALENT_CHAR_WEAK_DEMOTION_RATE, &finalFreq); + } + const int errorCount = adjustedProximityMatchedCount > 0 ? adjustedProximityMatchedCount : (proximityMatchedCount + transposedCount); diff --git a/native/src/defines.h b/native/src/defines.h index 6c619d1ab..dab862924 100644 --- a/native/src/defines.h +++ b/native/src/defines.h @@ -180,6 +180,8 @@ static void dumpWord(const unsigned short* word, const int length) { #define WORDS_WITH_EXCESSIVE_CHARACTER_DEMOTION_RATE 75 #define WORDS_WITH_EXCESSIVE_CHARACTER_OUT_OF_PROXIMITY_DEMOTION_RATE 75 #define WORDS_WITH_TRANSPOSED_CHARACTERS_DEMOTION_RATE 60 +#define WORDS_WITH_EQUIVALENT_CHAR_STRONG_PROMOTION_RATE 105 +#define WORDS_WITH_EQUIVALENT_CHAR_WEAK_DEMOTION_RATE 95 #define FULL_MATCHED_WORDS_PROMOTION_RATE 120 #define WORDS_WITH_PROXIMITY_CHARACTER_DEMOTION_RATE 90 #define WORDS_WITH_MATCH_SKIP_PROMOTION_RATE 105 |