From d4528b88e132ce2f25e45455a073b81385fcbd81 Mon Sep 17 00:00:00 2001 From: Satoshi Kataoka Date: Thu, 22 Aug 2013 19:51:46 +0900 Subject: [PATCH] Refactor personalization dictionary Bug: 9429906 Change-Id: I1fa4b045b21687e96de101a97e9593b0884d626f --- .../personalization/PersonalizationDictionaryHelper.java | 8 +++----- .../PersonalizationDictionaryUpdateSession.java | 8 ++++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryHelper.java b/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryHelper.java index 6798f1360..7c2f29c86 100644 --- a/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryHelper.java +++ b/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryHelper.java @@ -33,16 +33,14 @@ public class PersonalizationDictionaryHelper { private static final ConcurrentHashMap> sLangUserHistoryDictCache = CollectionUtils.newConcurrentHashMap(); + private static final ConcurrentHashMap> + sLangPersonalizationDictCache = CollectionUtils.newConcurrentHashMap(); + private static final ConcurrentHashMap> sLangPersonalizationPredictionDictCache = CollectionUtils.newConcurrentHashMap(); - private static final ConcurrentHashMap> - sLangPersonalizationDictCache = - CollectionUtils.newConcurrentHashMap(); - public static UserHistoryPredictionDictionary getUserHistoryPredictionDictionary( final Context context, final String locale, final SharedPreferences sp) { synchronized (sLangUserHistoryDictCache) { diff --git a/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryUpdateSession.java b/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryUpdateSession.java index 978804951..ab3de801c 100644 --- a/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryUpdateSession.java +++ b/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryUpdateSession.java @@ -16,8 +16,6 @@ package com.android.inputmethod.latin.personalization; -import com.android.inputmethod.latin.ExpandableBinaryDictionary; - import android.content.Context; import java.lang.ref.WeakReference; @@ -49,9 +47,9 @@ public abstract class PersonalizationDictionaryUpdateSession { // TODO: Use a dynamic binary dictionary instead public WeakReference mDictionary; public WeakReference mPredictionDictionary; - public final String mLocale; + public final String mSystemLocale; public PersonalizationDictionaryUpdateSession(String locale) { - mLocale = locale; + mSystemLocale = locale; } public abstract void onDictionaryReady(); @@ -104,6 +102,7 @@ public abstract class PersonalizationDictionaryUpdateSession { onDictionaryClosed(context); } + // TODO: Support multi locale to add bigram public void addBigramToPersonalizationDictionary(String word0, String word1, boolean isValid, int frequency) { final DynamicPredictionDictionaryBase dictionary = getPredictionDictionary(); @@ -114,6 +113,7 @@ public abstract class PersonalizationDictionaryUpdateSession { } // Bulk import + // TODO: Support multi locale to add bigram public void addBigramsToPersonalizationDictionary( final ArrayList lmParams) { final DynamicPredictionDictionaryBase dictionary = getPredictionDictionary();