From a7805e9870430eac3049129d47bebb312d457477 Mon Sep 17 00:00:00 2001 From: Jatin Matani Date: Fri, 6 Feb 2015 13:24:30 -0800 Subject: [PATCH] Add a addOrIncrement term api to DicFacilitator The API is used by the decoder to add term to the dictionary. Change-Id: I607c8c676b7650f3052b2d3ed3f7f656573fca45 --- .../inputmethod/latin/DictionaryFacilitator.java | 6 ++++++ .../inputmethod/latin/DictionaryFacilitatorImpl.java | 11 +++++++++++ .../com/android/inputmethod/latin/NgramContext.java | 4 +++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/java/src/com/android/inputmethod/latin/DictionaryFacilitator.java b/java/src/com/android/inputmethod/latin/DictionaryFacilitator.java index f15434208..a451b672d 100644 --- a/java/src/com/android/inputmethod/latin/DictionaryFacilitator.java +++ b/java/src/com/android/inputmethod/latin/DictionaryFacilitator.java @@ -171,4 +171,10 @@ public interface DictionaryFacilitator { void dumpDictionaryForDebug(final String dictName); ArrayList> getStatsOfEnabledSubDicts(); + + void addOrIncrementTerm(String fileName, + String finalWordToBeAdded, + NgramContext ngramContext, + int increment, + int timeStampInSeconds); } diff --git a/java/src/com/android/inputmethod/latin/DictionaryFacilitatorImpl.java b/java/src/com/android/inputmethod/latin/DictionaryFacilitatorImpl.java index 48fe73be4..4ed94058a 100644 --- a/java/src/com/android/inputmethod/latin/DictionaryFacilitatorImpl.java +++ b/java/src/com/android/inputmethod/latin/DictionaryFacilitatorImpl.java @@ -746,10 +746,12 @@ public class DictionaryFacilitatorImpl implements DictionaryFacilitator { return maxFreq; } + @Override public int getFrequency(final String word) { return getFrequencyInternal(word, false /* isGettingMaxFrequencyOfExactMatches */); } + @Override public int getMaxFrequencyOfExactMatches(final String word) { return getFrequencyInternal(word, true /* isGettingMaxFrequencyOfExactMatches */); } @@ -793,4 +795,13 @@ public class DictionaryFacilitatorImpl implements DictionaryFacilitator { } return statsOfEnabledSubDicts; } + + @Override + public void addOrIncrementTerm(String fileName, + String word, + NgramContext ngramContext, + int increment, + int timeStampInSeconds) { + // Do nothing. + } } diff --git a/java/src/com/android/inputmethod/latin/NgramContext.java b/java/src/com/android/inputmethod/latin/NgramContext.java index 86155e0be..53bec6e59 100644 --- a/java/src/com/android/inputmethod/latin/NgramContext.java +++ b/java/src/com/android/inputmethod/latin/NgramContext.java @@ -108,7 +108,9 @@ public class NgramContext { mPrevWordsCount = prevWordsInfo.length; } - // Create next prevWordsInfo using current prevWordsInfo. + /** + * Create next prevWordsInfo using current prevWordsInfo. + */ @Nonnull public NgramContext getNextNgramContext(final WordInfo wordInfo) { final int nextPrevWordCount = Math.min(