Fill up a map of bigram addresses for lookup.

We don't want to do a linear search on each terminal when there
may be 100+ bigrams for a given word because that would be
disastrous for performance. Also, we need to resolve each bigram
address anyway.
This change resolves the addresses at first and puts them in a
balanced tree so that lookup will be O(log(n)).

Bug: 6313806
Change-Id: Ibf088035870b9acb41e948f0ab7af4726f2cee24
diff --git a/native/jni/src/dictionary.h b/native/jni/src/dictionary.h
index e0feeaf..a2b0491 100644
--- a/native/jni/src/dictionary.h
+++ b/native/jni/src/dictionary.h
@@ -17,6 +17,8 @@
 #ifndef LATINIME_DICTIONARY_H
 #define LATINIME_DICTIONARY_H
 
+#include <map>
+
 #include "bigram_dictionary.h"
 #include "char_utils.h"
 #include "correction.h"
@@ -39,6 +41,9 @@
         // If none, it's zero.
         const int bigramListPosition = !prevWordChars ? 0
                 : mBigramDictionary->getBigramListPositionForWord(prevWordChars, prevWordLength);
+        std::map<int, int> bigramMap;
+        mBigramDictionary->fillBigramAddressToFrequencyMap(prevWordChars, prevWordLength,
+                &bigramMap);
         return mUnigramDictionary->getSuggestions(proximityInfo, mWordsPriorityQueuePool,
                 mCorrection, xcoordinates, ycoordinates, codes, codesSize, bigramListPosition,
                 useFullEditDistance, outWords, frequencies);