diff options
author | 2012-06-15 17:49:42 -0700 | |
---|---|---|
committer | 2012-06-17 15:02:15 -0700 | |
commit | 6080f6878b10916013a8a5e1d5f58f8041452c56 (patch) | |
tree | 27500029af16183dcf8c9974b3b7c9e17230f6f1 /java/src/com/android/inputmethod/latin/Suggest.java | |
parent | 4b91046759b49108f750b0b4a58ed8cd74e155dc (diff) | |
download | latinime-6080f6878b10916013a8a5e1d5f58f8041452c56.tar.gz latinime-6080f6878b10916013a8a5e1d5f58f8041452c56.tar.xz latinime-6080f6878b10916013a8a5e1d5f58f8041452c56.zip |
Remove non-dictionary words and digit touch data.
Output to the ResearchLogger is now queued and only flushed if the word
the user was working on is a dictionary word.
multi-project commit with Ic713ec00777fbdcf4a937b3c77b995257e100fc7
Bug: 6188932
Change-Id: I9de15227ff51be23083d9096f1c1b3d83802fff7
Diffstat (limited to 'java/src/com/android/inputmethod/latin/Suggest.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/Suggest.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index 68b7b913f..7398c82fa 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -65,7 +65,7 @@ public class Suggest implements Dictionary.WordCallback { private static final boolean DBG = LatinImeLogger.sDBG; - private boolean mHasMainDictionary; + private Dictionary mMainDictionary; private ContactsBinaryDictionary mContactsDict; private WhitelistDictionary mWhiteListDictionary; private final ConcurrentHashMap<String, Dictionary> mUnigramDictionaries = @@ -98,7 +98,7 @@ public class Suggest implements Dictionary.WordCallback { final long startOffset, final long length, final Locale locale) { final Dictionary mainDict = DictionaryFactory.createDictionaryForTest(context, dictionary, startOffset, length /* useFullEditDistance */, false, locale); - mHasMainDictionary = null != mainDict; + mMainDictionary = mainDict; addOrReplaceDictionary(mUnigramDictionaries, DICT_KEY_MAIN, mainDict); addOrReplaceDictionary(mBigramDictionaries, DICT_KEY_MAIN, mainDict); initWhitelistAndAutocorrectAndPool(context, locale); @@ -129,15 +129,15 @@ public class Suggest implements Dictionary.WordCallback { } public void resetMainDict(final Context context, final Locale locale) { - mHasMainDictionary = false; + mMainDictionary = null; new Thread("InitializeBinaryDictionary") { @Override public void run() { final DictionaryCollection newMainDict = DictionaryFactory.createMainDictionaryFromManager(context, locale); - mHasMainDictionary = null != newMainDict && !newMainDict.isEmpty(); addOrReplaceDictionary(mUnigramDictionaries, DICT_KEY_MAIN, newMainDict); addOrReplaceDictionary(mBigramDictionaries, DICT_KEY_MAIN, newMainDict); + mMainDictionary = newMainDict; } }.start(); } @@ -145,7 +145,11 @@ public class Suggest implements Dictionary.WordCallback { // The main dictionary could have been loaded asynchronously. Don't cache the return value // of this method. public boolean hasMainDictionary() { - return mHasMainDictionary; + return null != mMainDictionary && mMainDictionary.isInitialized(); + } + + public Dictionary getMainDictionary() { + return mMainDictionary; } public ContactsBinaryDictionary getContactsDictionary() { @@ -365,7 +369,7 @@ public class Suggest implements Dictionary.WordCallback { // language, and it will unexpectedly auto-correct. For example, if the user types in // English with no dictionary and has a "Will" in their contact list, "will" would // always auto-correct to "Will" which is unwanted. Hence, no main dict => no auto-correct. - && mHasMainDictionary; + && hasMainDictionary(); boolean autoCorrectionAvailable = hasAutoCorrection; if (correctionMode == CORRECTION_FULL || correctionMode == CORRECTION_FULL_BIGRAM) { @@ -511,7 +515,7 @@ public class Suggest implements Dictionary.WordCallback { for (final Dictionary dictionary : dictionaries) { dictionary.close(); } - mHasMainDictionary = false; + mMainDictionary = null; } // TODO: Resolve the inconsistencies between the native auto correction algorithms and |