am d4528b88: Refactor personalization dictionary

* commit 'd4528b88e132ce2f25e45455a073b81385fcbd81':
  Refactor personalization dictionary
main
Satoshi Kataoka 2013-08-23 03:16:54 -07:00 committed by Android Git Automerger
commit 44579790ad
2 changed files with 7 additions and 9 deletions

View File

@ -33,16 +33,14 @@ public class PersonalizationDictionaryHelper {
private static final ConcurrentHashMap<String, SoftReference<UserHistoryPredictionDictionary>>
sLangUserHistoryDictCache = CollectionUtils.newConcurrentHashMap();
private static final ConcurrentHashMap<String, SoftReference<PersonalizationDictionary>>
sLangPersonalizationDictCache = CollectionUtils.newConcurrentHashMap();
private static final ConcurrentHashMap<String,
SoftReference<PersonalizationPredictionDictionary>>
sLangPersonalizationPredictionDictCache =
CollectionUtils.newConcurrentHashMap();
private static final ConcurrentHashMap<String,
SoftReference<PersonalizationDictionary>>
sLangPersonalizationDictCache =
CollectionUtils.newConcurrentHashMap();
public static UserHistoryPredictionDictionary getUserHistoryPredictionDictionary(
final Context context, final String locale, final SharedPreferences sp) {
synchronized (sLangUserHistoryDictCache) {

View File

@ -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<PersonalizationDictionary> mDictionary;
public WeakReference<DynamicPredictionDictionaryBase> 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<PersonalizationLanguageModelParam> lmParams) {
final DynamicPredictionDictionaryBase dictionary = getPredictionDictionary();