From 1c2f1ada8305e36defa8572da687a4596bf083ea Mon Sep 17 00:00:00 2001 From: Keisuke Kuroyanagi Date: Fri, 27 Jun 2014 17:59:21 +0900 Subject: Find multiple previous word information to support n-gram. Bug: 14425059 Change-Id: Ieace636334a9b2a094527341d4fcfc05958296c5 --- java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java') 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); -- cgit v1.2.3-83-g751a