From a34bdc395b5ce51a87ff3f550b1025fbe442098a Mon Sep 17 00:00:00 2001
From: Keisuke Kuroyanagi <ksk@google.com>
Date: Tue, 11 Mar 2014 15:20:12 +0900
Subject: [PATCH] Make getWordProperty return reconstructed bigram probability.

Bug: 13403530
Change-Id: I7ed95a54344d8b77b88922093cf3ef0e530fcae6
---
 .../dictionary/structure/v2/patricia_trie_policy.cpp           | 3 ++-
 .../dictionary/structure/v4/ver4_patricia_trie_policy.cpp      | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/native/jni/src/suggest/policyimpl/dictionary/structure/v2/patricia_trie_policy.cpp b/native/jni/src/suggest/policyimpl/dictionary/structure/v2/patricia_trie_policy.cpp
index 84a6ccf33f..5b2402d658 100644
--- a/native/jni/src/suggest/policyimpl/dictionary/structure/v2/patricia_trie_policy.cpp
+++ b/native/jni/src/suggest/policyimpl/dictionary/structure/v2/patricia_trie_policy.cpp
@@ -354,7 +354,8 @@ const WordProperty PatriciaTriePolicy::getWordProperty(const int *const codePoin
                     &word1Probability);
             std::vector<int> word1(bigramWord1CodePoints,
                     bigramWord1CodePoints + word1CodePointCount);
-            bigrams.push_back(WordProperty::BigramProperty(&word1, bigramsIt.getProbability(),
+            const int probability = getProbability(word1Probability, bigramsIt.getProbability());
+            bigrams.push_back(WordProperty::BigramProperty(&word1, probability,
                     NOT_A_TIMESTAMP /* timestamp */, 0 /* level */, 0 /* count */));
         }
     }
diff --git a/native/jni/src/suggest/policyimpl/dictionary/structure/v4/ver4_patricia_trie_policy.cpp b/native/jni/src/suggest/policyimpl/dictionary/structure/v4/ver4_patricia_trie_policy.cpp
index 1a38a27ffe..88ef7a8dfc 100644
--- a/native/jni/src/suggest/policyimpl/dictionary/structure/v4/ver4_patricia_trie_policy.cpp
+++ b/native/jni/src/suggest/policyimpl/dictionary/structure/v4/ver4_patricia_trie_policy.cpp
@@ -388,7 +388,7 @@ const WordProperty Ver4PatriciaTriePolicy::getWordProperty(const int *const code
             const int probability = bigramEntry.hasHistoricalInfo() ?
                     ForgettingCurveUtils::decodeProbability(
                             bigramEntry.getHistoricalInfo(), mHeaderPolicy) :
-                    bigramEntry.getProbability();
+                    getProbability(word1Probability, bigramEntry.getProbability());
             bigrams.push_back(WordProperty::BigramProperty(&word1, probability,
                     historicalInfo->getTimeStamp(), historicalInfo->getLevel(),
                     historicalInfo->getCount()));
-- 
GitLab