aboutsummaryrefslogtreecommitdiffstats
path: root/native/src/correction.cpp
diff options
context:
space:
mode:
authorsatok <satok@google.com>2012-01-27 00:01:27 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-01-27 00:01:27 -0800
commit23f486f770883ed690d897ac71de0184456bf24e (patch)
treecef7457b20c8c8725c1a84ab8741d065a54ff557 /native/src/correction.cpp
parentc882d619bfe6eace7330c2097008500e81d39512 (diff)
parent9955716d0bb8b370eeab3bb4c9ab3108c45c7289 (diff)
downloadlatinime-23f486f770883ed690d897ac71de0184456bf24e.tar.gz
latinime-23f486f770883ed690d897ac71de0184456bf24e.tar.xz
latinime-23f486f770883ed690d897ac71de0184456bf24e.zip
Merge "Merge missing space and mistyped space correction algorithm"
Diffstat (limited to 'native/src/correction.cpp')
-rw-r--r--native/src/correction.cpp29
1 files changed, 10 insertions, 19 deletions
diff --git a/native/src/correction.cpp b/native/src/correction.cpp
index 2458bca86..ee5023532 100644
--- a/native/src/correction.cpp
+++ b/native/src/correction.cpp
@@ -158,10 +158,10 @@ void Correction::checkState() {
}
}
-int Correction::getFreqForSplitTwoWords(const int firstFreq, const int secondFreq,
- const unsigned short *word) {
- return Correction::RankingAlgorithm::calcFreqForSplitTwoWords(
- firstFreq, secondFreq, this, word);
+int Correction::getFreqForSplitTwoWords(const int *freqArray, const int *wordLengthArray,
+ const bool isSpaceProximity, const unsigned short *word) {
+ return Correction::RankingAlgorithm::calcFreqForSplitTwoWords(freqArray, wordLengthArray, this,
+ isSpaceProximity, word);
}
int Correction::getFinalFreq(const int freq, unsigned short **word, int *wordLength) {
@@ -806,21 +806,12 @@ int Correction::RankingAlgorithm::calculateFinalFreq(const int inputIndex, const
/* static */
int Correction::RankingAlgorithm::calcFreqForSplitTwoWords(
- const int firstFreq, const int secondFreq, const Correction* correction,
- const unsigned short *word) {
- const int spaceProximityPos = correction->mSpaceProximityPos;
- const int missingSpacePos = correction->mMissingSpacePos;
- if (DEBUG_DICT) {
- int inputCount = 0;
- if (spaceProximityPos >= 0) ++inputCount;
- if (missingSpacePos >= 0) ++inputCount;
- assert(inputCount <= 1);
- }
- const bool isSpaceProximity = spaceProximityPos >= 0;
- const int inputLength = correction->mInputLength;
- const int firstWordLength = isSpaceProximity ? spaceProximityPos : missingSpacePos;
- const int secondWordLength = isSpaceProximity ? (inputLength - spaceProximityPos - 1)
- : (inputLength - missingSpacePos);
+ const int *freqArray, const int *wordLengthArray, const Correction* correction,
+ const bool isSpaceProximity, const unsigned short *word) {
+ const int firstFreq = freqArray[0];
+ const int secondFreq = freqArray[1];
+ const int firstWordLength = wordLengthArray[0];
+ const int secondWordLength = wordLengthArray[1];
const int typedLetterMultiplier = correction->TYPED_LETTER_MULTIPLIER;
bool firstCapitalizedWordDemotion = false;