diff options
author | 2010-01-07 13:08:29 -0800 | |
---|---|---|
committer | 2010-01-07 13:08:29 -0800 | |
commit | a052b69b47223aa9fc5612490ebe96519c8adfca (patch) | |
tree | aecd92d809e2318a6d783d748bbf0da35b9dfb1e /src/com/android/inputmethod/latin/Suggest.java | |
parent | 17d252facb9c2a22baeb9bd13e644ffcf8b1ef4f (diff) | |
parent | e8f1edefeb2375a253d742c7f95e8d91677c7073 (diff) | |
download | latinime-a052b69b47223aa9fc5612490ebe96519c8adfca.tar.gz latinime-a052b69b47223aa9fc5612490ebe96519c8adfca.tar.xz latinime-a052b69b47223aa9fc5612490ebe96519c8adfca.zip |
Merge "Enable auto-correction only if there is a significant size main dictionary."
Diffstat (limited to 'src/com/android/inputmethod/latin/Suggest.java')
-rwxr-xr-x | src/com/android/inputmethod/latin/Suggest.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/com/android/inputmethod/latin/Suggest.java b/src/com/android/inputmethod/latin/Suggest.java index cc9a39cb7..002f23064 100755 --- a/src/com/android/inputmethod/latin/Suggest.java +++ b/src/com/android/inputmethod/latin/Suggest.java @@ -37,7 +37,9 @@ public class Suggest implements Dictionary.WordCallback { public static final int CORRECTION_BASIC = 1; public static final int CORRECTION_FULL = 2; - private Dictionary mMainDict; + private static final int LARGE_DICTIONARY_THRESHOLD = 200 * 1000; + + private BinaryDictionary mMainDict; private Dictionary mUserDictionary; @@ -49,9 +51,7 @@ public class Suggest implements Dictionary.WordCallback { private int[] mPriorities = new int[mPrefMaxSuggestions]; private ArrayList<CharSequence> mSuggestions = new ArrayList<CharSequence>(); - private boolean mIncludeTypedWordIfValid; private ArrayList<CharSequence> mStringPool = new ArrayList<CharSequence>(); - private Context mContext; private boolean mHaveCorrection; private CharSequence mOriginalWord; private String mLowerOriginalWord; @@ -60,7 +60,6 @@ public class Suggest implements Dictionary.WordCallback { public Suggest(Context context, int dictionaryResId) { - mContext = context; mMainDict = new BinaryDictionary(context, dictionaryResId); for (int i = 0; i < mPrefMaxSuggestions; i++) { StringBuilder sb = new StringBuilder(32); @@ -76,6 +75,10 @@ public class Suggest implements Dictionary.WordCallback { mCorrectionMode = mode; } + public boolean hasMainDictionary() { + return mMainDict.getSize() > LARGE_DICTIONARY_THRESHOLD; + } + /** * Sets an optional user dictionary resource to be loaded. The user dictionary is consulted * before the main dictionary, if set. @@ -155,7 +158,6 @@ public class Suggest implements Dictionary.WordCallback { mHaveCorrection = false; collectGarbage(); Arrays.fill(mPriorities, 0); - mIncludeTypedWordIfValid = includeTypedWordIfValid; // Save a lowercase version of the original word mOriginalWord = wordComposer.getTypedWord(); |