From 9715cc4ed58defe71906de6fae3c0bbfac05a80c Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Wed, 21 Mar 2012 15:26:45 +0900 Subject: [PATCH] Fix a bug where the returned number of bigrams was incorrect Bug: 6191885 Change-Id: I1daa4d2eaeec5f5c1a4eef79221fd7de357763e9 --- native/src/bigram_dictionary.cpp | 5 +++-- 1 file 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; }