aboutsummaryrefslogtreecommitdiffstats
path: root/native/src/bigram_dictionary.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'native/src/bigram_dictionary.cpp')
-rw-r--r--native/src/bigram_dictionary.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/native/src/bigram_dictionary.cpp b/native/src/bigram_dictionary.cpp
index db7734bc7..19b644679 100644
--- a/native/src/bigram_dictionary.cpp
+++ b/native/src/bigram_dictionary.cpp
@@ -134,7 +134,8 @@ int BigramDictionary::getBigrams(unsigned short *prevWord, int prevWordLength, i
const int length = BinaryFormat::getWordAtAddress(root, bigramPos, MAX_WORD_LENGTH,
bigramBuffer);
- if (checkFirstCharacter(bigramBuffer)) {
+ // 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);
}