diff options
author | 2013-02-15 12:21:16 -0800 | |
---|---|---|
committer | 2013-02-20 19:36:56 -0800 | |
commit | 19e05359e641fff2fee410eda5572011926620a5 (patch) | |
tree | aea1a51684e435ddb243df45638c02f7f3cd9938 /java | |
parent | b6d05aeb7c9d8c1627cd24b1e56bd70c9f50d396 (diff) | |
download | latinime-19e05359e641fff2fee410eda5572011926620a5.tar.gz latinime-19e05359e641fff2fee410eda5572011926620a5.tar.xz latinime-19e05359e641fff2fee410eda5572011926620a5.zip |
[TestPrep3] Add helper method to retrive dictionary
Change-Id: Id6e03c6f8a3e96979d589f0605ac056fcad7e1ff
Diffstat (limited to 'java')
-rw-r--r-- | java/src/com/android/inputmethod/research/MainLogBuffer.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/java/src/com/android/inputmethod/research/MainLogBuffer.java b/java/src/com/android/inputmethod/research/MainLogBuffer.java index 3a87bf1df..182b924fc 100644 --- a/java/src/com/android/inputmethod/research/MainLogBuffer.java +++ b/java/src/com/android/inputmethod/research/MainLogBuffer.java @@ -93,6 +93,11 @@ public abstract class MainLogBuffer extends FixedLogBuffer { mSuggest = suggest; } + private Dictionary getDictionary() { + if (mSuggest == null || !mSuggest.hasMainDictionary()) return null; + return mSuggest.getMainDictionary(); + } + public void resetWordCounter() { mNumWordsUntilSafeToSample = mNumWordsBetweenNGrams; } @@ -137,16 +142,13 @@ public abstract class MainLogBuffer extends FixedLogBuffer { if (mNumWordsUntilSafeToSample > 0) { return false; } - if (mSuggest == null || !mSuggest.hasMainDictionary()) { - // Main dictionary is unavailable. Since we cannot check it, we cannot tell if a - // word is out-of-vocabulary or not. Therefore, we must judge the entire buffer - // contents to potentially pose a privacy risk. - return false; - } // Reload the dictionary in case it has changed (e.g., because the user has changed // languages). - final Dictionary dictionary = mSuggest.getMainDictionary(); + final Dictionary dictionary = getDictionary(); if (dictionary == null) { + // Main dictionary is unavailable. Since we cannot check it, we cannot tell if a + // word is out-of-vocabulary or not. Therefore, we must judge the entire buffer + // contents to potentially pose a privacy risk. return false; } |