Merge "Stop promoting auto dictionary words to the user dict."
This commit is contained in:
commit
f4a05624ee
2 changed files with 0 additions and 17 deletions
|
@ -41,13 +41,8 @@ public class AutoDictionary extends ExpandableDictionary {
|
||||||
static final int FREQUENCY_FOR_PICKED = 3;
|
static final int FREQUENCY_FOR_PICKED = 3;
|
||||||
// Weight added to a user typing a new word that doesn't get corrected (or is reverted)
|
// Weight added to a user typing a new word that doesn't get corrected (or is reverted)
|
||||||
static final int FREQUENCY_FOR_TYPED = 1;
|
static final int FREQUENCY_FOR_TYPED = 1;
|
||||||
// A word that is frequently typed and gets promoted to the user dictionary, uses this
|
|
||||||
// frequency.
|
|
||||||
static final int FREQUENCY_FOR_AUTO_ADD = 250;
|
|
||||||
// If the user touches a typed word 2 times or more, it will become valid.
|
// If the user touches a typed word 2 times or more, it will become valid.
|
||||||
private static final int VALIDITY_THRESHOLD = 2 * FREQUENCY_FOR_PICKED;
|
private static final int VALIDITY_THRESHOLD = 2 * FREQUENCY_FOR_PICKED;
|
||||||
// If the user touches a typed word 4 times or more, it will be added to the user dict.
|
|
||||||
private static final int PROMOTION_THRESHOLD = 4 * FREQUENCY_FOR_PICKED;
|
|
||||||
|
|
||||||
private LatinIME mIme;
|
private LatinIME mIme;
|
||||||
// Locale for which this auto dictionary is storing words
|
// Locale for which this auto dictionary is storing words
|
||||||
|
@ -151,11 +146,6 @@ public class AutoDictionary extends ExpandableDictionary {
|
||||||
freq = freq < 0 ? addFrequency : freq + addFrequency;
|
freq = freq < 0 ? addFrequency : freq + addFrequency;
|
||||||
super.addWord(word, freq);
|
super.addWord(word, freq);
|
||||||
|
|
||||||
if (freq >= PROMOTION_THRESHOLD) {
|
|
||||||
mIme.promoteToUserDictionary(word, FREQUENCY_FOR_AUTO_ADD);
|
|
||||||
freq = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
synchronized (mPendingWritesLock) {
|
synchronized (mPendingWritesLock) {
|
||||||
// Write a null frequency if it is to be deleted from the db
|
// Write a null frequency if it is to be deleted from the db
|
||||||
mPendingWrites.put(word, freq == 0 ? null : new Integer(freq));
|
mPendingWrites.put(word, freq == 0 ? null : new Integer(freq));
|
||||||
|
|
|
@ -1635,8 +1635,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
/**
|
/**
|
||||||
* Commits the chosen word to the text field and saves it for later
|
* Commits the chosen word to the text field and saves it for later
|
||||||
* retrieval.
|
* retrieval.
|
||||||
* @param suggestion the suggestion picked by the user to be committed to
|
|
||||||
* the text field
|
|
||||||
*/
|
*/
|
||||||
private void commitBestWord(CharSequence bestWord) {
|
private void commitBestWord(CharSequence bestWord) {
|
||||||
KeyboardSwitcher switcher = mKeyboardSwitcher;
|
KeyboardSwitcher switcher = mKeyboardSwitcher;
|
||||||
|
@ -1924,11 +1922,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void promoteToUserDictionary(String word, int frequency) {
|
|
||||||
if (mUserDictionary.isValidWord(word)) return;
|
|
||||||
mUserDictionary.addWord(word, frequency);
|
|
||||||
}
|
|
||||||
|
|
||||||
public WordComposer getCurrentWord() {
|
public WordComposer getCurrentWord() {
|
||||||
return mWord;
|
return mWord;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue