aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/DictionaryFactory.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2011-09-29 21:07:22 +0900
committerJean Chalard <jchalard@google.com>2011-09-30 16:00:07 +0900
commit673cebf9e97289b3b0cd343ff7193dff69684a48 (patch)
treec8f7c1c333406080f3b830456f09e949cf1e05f8 /java/src/com/android/inputmethod/latin/DictionaryFactory.java
parentdb096d681f40b8547b4ce83d07d8d8b54e30634e (diff)
downloadlatinime-673cebf9e97289b3b0cd343ff7193dff69684a48.tar.gz
latinime-673cebf9e97289b3b0cd343ff7193dff69684a48.tar.xz
latinime-673cebf9e97289b3b0cd343ff7193dff69684a48.zip
Make use of the FULL_EDIT_DISTANCE flag.
In effect, this stops the spell checker from suggesting overly long words. More precisely, it takes advantage of the new facility that takes into account the whole length of the dictionary word when computing scores, so words much longer than the input word will see their score demoted accordingly. Bug: 5384578 Change-Id: I326cd7c87c3080e7fa8729f78517f8ba13672a9b
Diffstat (limited to 'java/src/com/android/inputmethod/latin/DictionaryFactory.java')
-rw-r--r--java/src/com/android/inputmethod/latin/DictionaryFactory.java25
1 files changed, 21 insertions, 4 deletions
diff --git a/java/src/com/android/inputmethod/latin/DictionaryFactory.java b/java/src/com/android/inputmethod/latin/DictionaryFactory.java
index dfaad26bc..1607f86a8 100644
--- a/java/src/com/android/inputmethod/latin/DictionaryFactory.java
+++ b/java/src/com/android/inputmethod/latin/DictionaryFactory.java
@@ -34,7 +34,7 @@ public class DictionaryFactory {
private static String TAG = DictionaryFactory.class.getSimpleName();
/**
- * Initializes a dictionary from a dictionary pack.
+ * Initializes a dictionary from a dictionary pack, with explicit flags.
*
* This searches for a content provider providing a dictionary pack for the specified
* locale. If none is found, it falls back to using the resource passed as fallBackResId
@@ -42,10 +42,11 @@ public class DictionaryFactory {
* @param context application context for reading resources
* @param locale the locale for which to create the dictionary
* @param fallbackResId the id of the resource to use as a fallback if no pack is found
+ * @param flagArray an array of flags to use
* @return an initialized instance of DictionaryCollection
*/
- public static DictionaryCollection createDictionaryFromManager(Context context, Locale locale,
- int fallbackResId) {
+ public static DictionaryCollection createDictionaryFromManager(final Context context,
+ final Locale locale, final int fallbackResId, final Flag[] flagArray) {
if (null == locale) {
Log.e(TAG, "No locale defined for dictionary");
return new DictionaryCollection(createBinaryDictionary(context, fallbackResId, locale));
@@ -57,7 +58,7 @@ public class DictionaryFactory {
if (null != assetFileList) {
for (final AssetFileAddress f : assetFileList) {
final BinaryDictionary binaryDictionary =
- new BinaryDictionary(context, f.mFilename, f.mOffset, f.mLength, null);
+ new BinaryDictionary(context, f.mFilename, f.mOffset, f.mLength, flagArray);
if (binaryDictionary.isValidDictionary()) {
dictList.add(binaryDictionary);
}
@@ -71,6 +72,22 @@ public class DictionaryFactory {
}
/**
+ * Initializes a dictionary from a dictionary pack, with default flags.
+ *
+ * This searches for a content provider providing a dictionary pack for the specified
+ * locale. If none is found, it falls back to using the resource passed as fallBackResId
+ * as a dictionary.
+ * @param context application context for reading resources
+ * @param locale the locale for which to create the dictionary
+ * @param fallbackResId the id of the resource to use as a fallback if no pack is found
+ * @return an initialized instance of DictionaryCollection
+ */
+ public static DictionaryCollection createDictionaryFromManager(final Context context,
+ final Locale locale, final int fallbackResId) {
+ return createDictionaryFromManager(context, locale, fallbackResId, null);
+ }
+
+ /**
* Initializes a dictionary from a raw resource file
* @param context application context for reading resources
* @param resId the resource containing the raw binary dictionary