aboutsummaryrefslogtreecommitdiffstats
path: root/native/src/bigram_dictionary.cpp
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-03-21 00:55:55 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-03-21 00:55:55 -0700
commit2a7224a6118b74df74b7f6b74db215ead75bc0c2 (patch)
treee768e19245192afd27206ced124c0115968fd0b8 /native/src/bigram_dictionary.cpp
parentf5f53c2fa610fd9ea4588fd7c8c6fc3f36b9247a (diff)
parent9715cc4ed58defe71906de6fae3c0bbfac05a80c (diff)
downloadlatinime-2a7224a6118b74df74b7f6b74db215ead75bc0c2.tar.gz
latinime-2a7224a6118b74df74b7f6b74db215ead75bc0c2.tar.xz
latinime-2a7224a6118b74df74b7f6b74db215ead75bc0c2.zip
Merge "Fix a bug where the returned number of bigrams was incorrect"
Diffstat (limited to 'native/src/bigram_dictionary.cpp')
-rw-r--r--native/src/bigram_dictionary.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/native/src/bigram_dictionary.cpp b/native/src/bigram_dictionary.cpp
index 84048d77d..fa69de854 100644
--- a/native/src/bigram_dictionary.cpp
+++ b/native/src/bigram_dictionary.cpp
@@ -137,9 +137,10 @@ int BigramDictionary::getBigrams(unsigned short *prevWord, int prevWordLength, i
// codesSize == 0 means we are trying to find bigram predictions.
if (codesSize < 1 || checkFirstCharacter(bigramBuffer)) {
const int frequency = UnigramDictionary::MASK_ATTRIBUTE_FREQUENCY & bigramFlags;
- addWordBigram(bigramBuffer, length, frequency);
+ if (addWordBigram(bigramBuffer, length, frequency)) {
+ ++bigramCount;
+ }
}
- ++bigramCount;
} while (0 != (UnigramDictionary::FLAG_ATTRIBUTE_HAS_NEXT & bigramFlags));
return bigramCount;
}