aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
diff options
context:
space:
mode:
authorKeisuke Kuroyanagi <ksk@google.com>2014-06-27 17:59:21 +0900
committerKeisuke Kuroyanagi <ksk@google.com>2014-06-27 17:59:21 +0900
commit1c2f1ada8305e36defa8572da687a4596bf083ea (patch)
tree2a37c03d73a123c8a1e4ee2d66b49a6f7178a8a4 /java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
parent05b1e0d42f9f103516103d4d33e61862c0851e9d (diff)
downloadlatinime-1c2f1ada8305e36defa8572da687a4596bf083ea.tar.gz
latinime-1c2f1ada8305e36defa8572da687a4596bf083ea.tar.xz
latinime-1c2f1ada8305e36defa8572da687a4596bf083ea.zip
Find multiple previous word information to support n-gram.
Bug: 14425059 Change-Id: Ieace636334a9b2a094527341d4fcfc05958296c5
Diffstat (limited to 'java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java')
-rw-r--r--java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
index c9d0dcf60..4ebdcbd70 100644
--- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
+++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
@@ -1882,10 +1882,11 @@ public final class InputLogic {
final CharSequence chosenWordWithSuggestions =
SuggestionSpanUtils.getTextWithSuggestionSpan(mLatinIME, chosenWord,
suggestedWords);
- // Use the 2nd previous word as the previous word because the 1st previous word is the word
- // to be committed.
+ // When we are composing word, get previous words information from the 2nd previous word
+ // because the 1st previous word is the word to be committed. Otherwise get previous words
+ // information from the 1st previous word.
final PrevWordsInfo prevWordsInfo = mConnection.getPrevWordsInfoFromNthPreviousWord(
- settingsValues.mSpacingAndPunctuations, 2);
+ settingsValues.mSpacingAndPunctuations, mWordComposer.isComposingWord() ? 2 : 1);
mConnection.commitText(chosenWordWithSuggestions, 1);
// Add the word to the user history dictionary
performAdditionToUserHistoryDictionary(settingsValues, chosenWord, prevWordsInfo);