diff options
author | 2012-01-12 18:44:40 +0900 | |
---|---|---|
committer | 2012-01-12 19:56:15 +0900 | |
commit | be0cf72253f15bff6abdeaa79f60a56f06ab7b86 (patch) | |
tree | 2772bbef71714e6c3e8b05a869a9e121bd7fa806 /native/src/correction.h | |
parent | 53f56ddef9f5e9e5eee86b95a9d8e1f2878d5e24 (diff) | |
download | latinime-be0cf72253f15bff6abdeaa79f60a56f06ab7b86.tar.gz latinime-be0cf72253f15bff6abdeaa79f60a56f06ab7b86.tar.xz latinime-be0cf72253f15bff6abdeaa79f60a56f06ab7b86.zip |
Move auto correction thresthold to the native code
bug: 5858137
Change-Id: Ic4b6270c6e51ef4ed25a6a1d8ddd7fdfa70fd78d
Diffstat (limited to 'native/src/correction.h')
-rw-r--r-- | native/src/correction.h | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/native/src/correction.h b/native/src/correction.h index 9ba472955..4012e7e82 100644 --- a/native/src/correction.h +++ b/native/src/correction.h @@ -95,6 +95,23 @@ class Correction { return mCorrectionStates[index].mParentIndex; } + class RankingAlgorithm { + public: + static int calculateFinalFreq(const int inputIndex, const int depth, + const int freq, int *editDistanceTable, const Correction* correction); + static int calcFreqForSplitTwoWords(const int firstFreq, const int secondFreq, + const Correction* correction, const unsigned short *word); + static double calcNormalizedScore(const unsigned short* before, const int beforeLength, + const unsigned short* after, const int afterLength, const int score); + static int editDistance(const unsigned short* before, + const int beforeLength, const unsigned short* after, const int afterLength); + private: + static const int CODE_SPACE = ' '; + static const int MAX_INITIAL_SCORE = 255; + static const int TYPED_LETTER_MULTIPLIER = 2; + static const int FULL_WORD_MULTIPLIER = 2; + }; + private: inline void incrementInputIndex(); inline void incrementOutputIndex(); @@ -153,13 +170,6 @@ class Correction { bool mTransposing; bool mSkipping; - class RankingAlgorithm { - public: - static int calculateFinalFreq(const int inputIndex, const int depth, - const int freq, int *editDistanceTable, const Correction* correction); - static int calcFreqForSplitTwoWords(const int firstFreq, const int secondFreq, - const Correction* correction, const unsigned short *word); - }; }; } // namespace latinime #endif // LATINIME_CORRECTION_H |