diff options
author | 2015-02-10 14:54:38 -0800 | |
---|---|---|
committer | 2015-02-11 13:02:41 -0800 | |
commit | 12d80ebead6a1d7f704a5a3af3b6fe3313ceab05 (patch) | |
tree | 3ab839123291ba254aec3189f6c2f20dd30016c8 /java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java | |
parent | 2979fad21384bb595ba2baca8f5bbbfc053be921 (diff) | |
download | latinime-12d80ebead6a1d7f704a5a3af3b6fe3313ceab05.tar.gz latinime-12d80ebead6a1d7f704a5a3af3b6fe3313ceab05.tar.xz latinime-12d80ebead6a1d7f704a5a3af3b6fe3313ceab05.zip |
Remove shortcut support from LatinIME.
Note this change does not affect the native decoder interface.
Change-Id: I73b7dc008a5acaf75a31a36a2d332b5afabd82d0
Diffstat (limited to 'java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java | 53 |
1 files changed, 15 insertions, 38 deletions
diff --git a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java index 413c5b8a1..8c780027b 100644 --- a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java +++ b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java @@ -297,21 +297,18 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { * Adds unigram information of a word to the dictionary. May overwrite an existing entry. */ public void addUnigramEntry(final String word, final int frequency, - final String shortcutTarget, final int shortcutFreq, final boolean isNotAWord, - final boolean isPossiblyOffensive, final int timestamp) { + final boolean isNotAWord, final boolean isPossiblyOffensive, final int timestamp) { updateDictionaryWithWriteLock(new Runnable() { @Override public void run() { - addUnigramLocked(word, frequency, shortcutTarget, shortcutFreq, - isNotAWord, isPossiblyOffensive, timestamp); + addUnigramLocked(word, frequency, isNotAWord, isPossiblyOffensive, timestamp); } }); } protected void addUnigramLocked(final String word, final int frequency, - final String shortcutTarget, final int shortcutFreq, final boolean isNotAWord, - final boolean isPossiblyOffensive, final int timestamp) { - if (!mBinaryDictionary.addUnigramEntry(word, frequency, shortcutTarget, shortcutFreq, + final boolean isNotAWord, final boolean isPossiblyOffensive, final int timestamp) { + if (!mBinaryDictionary.addUnigramEntry(word, frequency, false /* isBeginningOfSentence */, isNotAWord, isPossiblyOffensive, timestamp)) { Log.e(TAG, "Cannot add unigram entry. word: " + word); } @@ -368,31 +365,6 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { } /** - * Dynamically remove the n-gram entry in the dictionary. - */ - @UsedForTesting - public void removeNgramDynamically(@Nonnull final NgramContext ngramContext, - final String word) { - reloadDictionaryIfRequired(); - asyncExecuteTaskWithWriteLock(new Runnable() { - @Override - public void run() { - final BinaryDictionary binaryDictionary = getBinaryDictionary(); - if (binaryDictionary == null) { - return; - } - runGCIfRequiredLocked(true /* mindsBlockByGC */); - if (!binaryDictionary.removeNgramEntry(ngramContext, word)) { - if (DEBUG) { - Log.i(TAG, "Cannot remove n-gram entry."); - Log.i(TAG, " NgramContext: " + ngramContext + ", word: " + word); - } - } - } - }); - } - - /** * Update dictionary for the word with the ngramContext. */ public void updateEntriesForWord(@Nonnull final NgramContext ngramContext, @@ -408,20 +380,29 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { isValidWord, count, timestamp)) { if (DEBUG) { Log.e(TAG, "Cannot update counter. word: " + word - + " context: "+ ngramContext.toString()); + + " context: " + ngramContext.toString()); } } } }); } + /** + * Used by Sketch. + * {@see https://cs.corp.google.com/#android/vendor/unbundled_google/packages/LatinIMEGoogle/tools/sketch/ime-simulator/src/com/android/inputmethod/sketch/imesimulator/ImeSimulator.java&q=updateEntriesForInputEventsCallback&l=286} + */ + @UsedForTesting public interface UpdateEntriesForInputEventsCallback { public void onFinished(); } /** * Dynamically update entries according to input events. + * + * Used by Sketch. + * {@see https://cs.corp.google.com/#android/vendor/unbundled_google/packages/LatinIMEGoogle/tools/sketch/ime-simulator/src/com/android/inputmethod/sketch/imesimulator/ImeSimulator.java&q=updateEntriesForInputEventsCallback&l=286} */ + @UsedForTesting public void updateEntriesForInputEvents( @Nonnull final ArrayList<WordInputEventForPersonalization> inputEvents, final UpdateEntriesForInputEventsCallback callback) { @@ -533,11 +514,6 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { } - protected boolean isValidNgramLocked(final NgramContext ngramContext, final String word) { - if (mBinaryDictionary == null) return false; - return mBinaryDictionary.isValidNgram(ngramContext, word); - } - /** * Loads the current binary dictionary from internal storage. Assumes the dictionary file * exists. @@ -551,6 +527,7 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { Thread.sleep(15000); Log.w(TAG, "End stress in loading"); } catch (InterruptedException e) { + Log.w("Interrupted while loading: " + mDictName, e); } } final BinaryDictionary oldBinaryDictionary = mBinaryDictionary; |