diff options
author | 2012-08-12 11:10:48 +0900 | |
---|---|---|
committer | 2012-08-13 10:48:37 +0900 | |
commit | bcec82de66f52655593dc233346f11468f5077a0 (patch) | |
tree | 2237aa0f754e3ab44ccfac034f5ef6e17ffda724 /native/jni/src/correction.cpp | |
parent | 814510305c21b3081414e75e040dec4b73f6cdf3 (diff) | |
download | latinime-bcec82de66f52655593dc233346f11468f5077a0.tar.gz latinime-bcec82de66f52655593dc233346f11468f5077a0.tar.xz latinime-bcec82de66f52655593dc233346f11468f5077a0.zip |
Clean up constructors
And, use C++ style casts and use float math functions rather than double ones to save memory space.
Also, stop using FloatMath and NativeUtils as standard Math methods are faster now.
See http://code.google.com/p/android/issues/detail?id=36199 and https://android-review.googlesource.com/40700
multi-project commit with I4259fb5ab8a15ac5760a7f04fc8f4c860529f04a
Change-Id: I0b81cff8c91769f7559a59b9528c75a5aabb4211
Diffstat (limited to 'native/jni/src/correction.cpp')
-rw-r--r-- | native/jni/src/correction.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/native/jni/src/correction.cpp b/native/jni/src/correction.cpp index b18b35e8c..e1f9db92d 100644 --- a/native/jni/src/correction.cpp +++ b/native/jni/src/correction.cpp @@ -1092,7 +1092,7 @@ int Correction::RankingAlgorithm::editDistance(const unsigned short *before, // In dictionary.cpp, getSuggestion() method, // suggestion scores are computed using the below formula. // original score -// := pow(mTypedLetterMultiplier (this is defined 2), +// := powf(mTypedLetterMultiplier (this is defined 2), // (the number of matched characters between typed word and suggested word)) // * (individual word's score which defined in the unigram dictionary, // and this score is defined in range [0, 255].) @@ -1104,11 +1104,11 @@ int Correction::RankingAlgorithm::editDistance(const unsigned short *before, // capitalization, then treat it as if the score was 255. // - If before.length() == after.length() // => multiply by mFullWordMultiplier (this is defined 2)) -// So, maximum original score is pow(2, min(before.length(), after.length())) * 255 * 2 * 1.2 +// So, maximum original score is powf(2, min(before.length(), after.length())) * 255 * 2 * 1.2 // For historical reasons we ignore the 1.2 modifier (because the measure for a good // autocorrection threshold was done at a time when it didn't exist). This doesn't change // the result. -// So, we can normalize original score by dividing pow(2, min(b.l(),a.l())) * 255 * 2. +// So, we can normalize original score by dividing powf(2, min(b.l(),a.l())) * 255 * 2. /* static */ float Correction::RankingAlgorithm::calcNormalizedScore(const unsigned short *before, @@ -1130,7 +1130,7 @@ float Correction::RankingAlgorithm::calcNormalizedScore(const unsigned short *be } const float maxScore = score >= S_INT_MAX ? S_INT_MAX : MAX_INITIAL_SCORE - * pow(static_cast<float>(TYPED_LETTER_MULTIPLIER), + * powf(static_cast<float>(TYPED_LETTER_MULTIPLIER), static_cast<float>(min(beforeLength, afterLength - spaceCount))) * FULL_WORD_MULTIPLIER; |