Refactor personalization dictionary
Bug: 9429906 Change-Id: I1fa4b045b21687e96de101a97e9593b0884d626fmain
parent
cdc8fcd644
commit
d4528b88e1
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue