aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/latin')
-rw-r--r--java/src/com/android/inputmethod/latin/Dictionary.java7
-rw-r--r--java/src/com/android/inputmethod/latin/personalization/PersonalizationDicitonary.java61
-rw-r--r--java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryUpdateListener.java21
-rw-r--r--java/src/com/android/inputmethod/latin/personalization/PersonalizationPredictionDicitonary.java46
-rw-r--r--java/src/com/android/inputmethod/latin/personalization/UserHistoryDictionary.java2
5 files changed, 135 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/Dictionary.java b/java/src/com/android/inputmethod/latin/Dictionary.java
index acd7c2aa1..7c3e4a740 100644
--- a/java/src/com/android/inputmethod/latin/Dictionary.java
+++ b/java/src/com/android/inputmethod/latin/Dictionary.java
@@ -35,8 +35,13 @@ public abstract class Dictionary {
public static final String TYPE_CONTACTS = "contacts";
// User dictionary, the system-managed one.
public static final String TYPE_USER = "user";
- // User history dictionary internal to LatinIME.
+ // User history dictionary internal to LatinIME. This assumes bigram prediction for now.
public static final String TYPE_USER_HISTORY = "history";
+ // Personalization binary dictionary internal to LatinIME.
+ public static final String TYPE_PERSONALIZATION = "personalization";
+ // Personalization prediction dictionary internal to LatinIME's Java code.
+ public static final String TYPE_PERSONALIZATION_PREDICTION_IN_JAVA =
+ "personalization_prediction_in_java";
// Spawned by resuming suggestions. Comes from a span that was in the TextView.
public static final String TYPE_RESUMED = "resumed";
protected final String mDictType;
diff --git a/java/src/com/android/inputmethod/latin/personalization/PersonalizationDicitonary.java b/java/src/com/android/inputmethod/latin/personalization/PersonalizationDicitonary.java
new file mode 100644
index 000000000..d3e2dfec9
--- /dev/null
+++ b/java/src/com/android/inputmethod/latin/personalization/PersonalizationDicitonary.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.inputmethod.latin.personalization;
+
+import com.android.inputmethod.latin.Dictionary;
+import com.android.inputmethod.latin.ExpandableBinaryDictionary;
+
+import android.content.Context;
+
+/**
+ * This class is a dictionary for the personalized language model that uses binary dictionary.
+ */
+public class PersonalizationDicitonary extends ExpandableBinaryDictionary {
+ private static final String NAME = "personalization";
+
+ public static void registerUpdateListener(PersonalizationDictionaryUpdateListener listener) {
+ // TODO: Implement
+ }
+
+ /** Locale for which this user history dictionary is storing words */
+ private final String mLocale;
+
+ // Singleton
+ private PersonalizationDicitonary(final Context context, final String locale) {
+ super(context, getFilenameWithLocale(NAME, locale), Dictionary.TYPE_PERSONALIZATION);
+ mLocale = locale;
+ }
+
+ @Override
+ protected void loadDictionaryAsync() {
+ // TODO: Implement
+ }
+
+ @Override
+ protected boolean hasContentChanged() {
+ // TODO: Implement
+ return false;
+ }
+
+ @Override
+ protected boolean needsToReloadBeforeWriting() {
+ // TODO: Implement
+ return false;
+ }
+
+ // TODO: Implement
+}
diff --git a/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryUpdateListener.java b/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryUpdateListener.java
new file mode 100644
index 000000000..2ec0dc00c
--- /dev/null
+++ b/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryUpdateListener.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.inputmethod.latin.personalization;
+
+public class PersonalizationDictionaryUpdateListener {
+ // TODO: Implement
+}
diff --git a/java/src/com/android/inputmethod/latin/personalization/PersonalizationPredictionDicitonary.java b/java/src/com/android/inputmethod/latin/personalization/PersonalizationPredictionDicitonary.java
new file mode 100644
index 000000000..3e7772584
--- /dev/null
+++ b/java/src/com/android/inputmethod/latin/personalization/PersonalizationPredictionDicitonary.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.inputmethod.latin.personalization;
+
+import com.android.inputmethod.latin.Dictionary;
+import com.android.inputmethod.latin.ExpandableDictionary;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+
+/**
+ * This class is a dictionary for the personalized prediction language model implemented in Java.
+ */
+public class PersonalizationPredictionDicitonary extends ExpandableDictionary {
+ public static void registerUpdateListener(PersonalizationDictionaryUpdateListener listener) {
+ // TODO: Implement
+ }
+
+ /** Locale for which this user history dictionary is storing words */
+ private final String mLocale;
+ private final SharedPreferences mPrefs;
+
+ // Singleton
+ private PersonalizationPredictionDicitonary(final Context context, final String locale,
+ final SharedPreferences sp) {
+ super(context, Dictionary.TYPE_PERSONALIZATION_PREDICTION_IN_JAVA);
+ mLocale = locale;
+ mPrefs = sp;
+ }
+
+ // TODO: Implement
+}
diff --git a/java/src/com/android/inputmethod/latin/personalization/UserHistoryDictionary.java b/java/src/com/android/inputmethod/latin/personalization/UserHistoryDictionary.java
index a5d6f0497..a8f1a9e37 100644
--- a/java/src/com/android/inputmethod/latin/personalization/UserHistoryDictionary.java
+++ b/java/src/com/android/inputmethod/latin/personalization/UserHistoryDictionary.java
@@ -53,7 +53,7 @@ import java.util.concurrent.locks.ReentrantLock;
* Locally gathers stats about the words user types and various other signals like auto-correction
* cancellation or manual picks. This allows the keyboard to adapt to the typist over time.
*/
-public final class UserHistoryDictionary extends ExpandableDictionary {
+public class UserHistoryDictionary extends ExpandableDictionary {
private static final String TAG = UserHistoryDictionary.class.getSimpleName();
private static final String NAME = UserHistoryDictionary.class.getSimpleName();
public static final boolean DBG_SAVE_RESTORE = false;