aboutsummaryrefslogtreecommitdiffstats
path: root/native/src/correction.h
diff options
context:
space:
mode:
authorsatok <satok@google.com>2012-01-12 02:58:35 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-01-12 02:58:35 -0800
commit21814c56f0859a2d83d1ecc29f4a74210c4497a1 (patch)
treef6236e3c6040f91d381738db515d1a1bb0df422f /native/src/correction.h
parentab34a4a7f53e1426a5cc4cd7a7fefde38a82e499 (diff)
parentbe0cf72253f15bff6abdeaa79f60a56f06ab7b86 (diff)
downloadlatinime-21814c56f0859a2d83d1ecc29f4a74210c4497a1.tar.gz
latinime-21814c56f0859a2d83d1ecc29f4a74210c4497a1.tar.xz
latinime-21814c56f0859a2d83d1ecc29f4a74210c4497a1.zip
Merge "Move auto correction thresthold to the native code"
Diffstat (limited to 'native/src/correction.h')
-rw-r--r--native/src/correction.h24
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