Loading java/src/com/android/inputmethod/latin/BinaryDictionary.java +2 −2 Original line number Diff line number Diff line Loading @@ -162,7 +162,7 @@ public class BinaryDictionary extends Dictionary { } if (len > 0) { callback.addWord(mOutputChars_bigrams, start, len, mBigramScores[j], mDicTypeId, DataType.BIGRAM); mDicTypeId, Dictionary.BIGRAM); } } } Loading @@ -182,7 +182,7 @@ public class BinaryDictionary extends Dictionary { } if (len > 0) { callback.addWord(mOutputChars, start, len, mScores[j], mDicTypeId, DataType.UNIGRAM); Dictionary.UNIGRAM); } } } Loading java/src/com/android/inputmethod/latin/Dictionary.java +5 −6 Original line number Diff line number Diff line Loading @@ -33,9 +33,8 @@ public abstract class Dictionary { */ protected static final int FULL_WORD_SCORE_MULTIPLIER = 2; public static enum DataType { UNIGRAM, BIGRAM } public static final int UNIGRAM = 0; public static final int BIGRAM = 1; /** * Interface to be implemented by classes requesting words to be fetched from the dictionary. Loading @@ -51,11 +50,11 @@ public abstract class Dictionary { * @param score the score of occurrence. This is normalized between 1 and 255, but * can exceed those limits * @param dicTypeId of the dictionary where word was from * @param dataType tells type of this data * @param dataType tells type of this data, either UNIGRAM or BIGRAM * @return true if the word was added, false if no more words are required */ boolean addWord(char[] word, int wordOffset, int wordLength, int score, int dicTypeId, DataType dataType); int dataType); } /** Loading @@ -64,7 +63,7 @@ public abstract class Dictionary { * @param composer the key sequence to match * @param callback the callback object to send matched words to as possible candidates * @param proximityInfo the object for key proximity. May be ignored by some implementations. * @see WordCallback#addWord(char[], int, int, int, int, DataType) * @see WordCallback#addWord(char[], int, int, int, int, int) */ abstract public void getWords(final WordComposer composer, final WordCallback callback, final ProximityInfo proximityInfo); Loading java/src/com/android/inputmethod/latin/ExpandableDictionary.java +3 −3 Original line number Diff line number Diff line Loading @@ -301,7 +301,7 @@ public class ExpandableDictionary extends Dictionary { finalFreq = computeSkippedWordFinalFreq(freq, snr, mInputLength); } if (!callback.addWord(word, 0, depth + 1, finalFreq, mDicTypeId, DataType.UNIGRAM)) { Dictionary.UNIGRAM)) { return; } } Loading Loading @@ -342,7 +342,7 @@ public class ExpandableDictionary extends Dictionary { snr * addedAttenuation, mInputLength); } callback.addWord(word, 0, depth + 1, finalFreq, mDicTypeId, DataType.UNIGRAM); Dictionary.UNIGRAM); } } if (children != null) { Loading Loading @@ -506,7 +506,7 @@ public class ExpandableDictionary extends Dictionary { } while (node != null); callback.addWord(mLookedUpString, index, MAX_WORD_LENGTH - index, freq, mDicTypeId, DataType.BIGRAM); Dictionary.BIGRAM); } } Loading java/src/com/android/inputmethod/latin/LatinImeLogger.java +1 −2 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import android.content.SharedPreferences; import android.view.inputmethod.EditorInfo; import com.android.inputmethod.keyboard.Keyboard; import com.android.inputmethod.latin.Dictionary.DataType; import java.util.List; Loading Loading @@ -75,7 +74,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang public static void onStartSuggestion(CharSequence previousWords) { } public static void onAddSuggestedWord(String word, int typeId, DataType dataType) { public static void onAddSuggestedWord(String word, int typeId, int dataType) { } public static void onSetKeyboard(Keyboard kb) { Loading java/src/com/android/inputmethod/latin/Suggest.java +6 −6 Original line number Diff line number Diff line Loading @@ -298,7 +298,7 @@ public class Suggest implements Dictionary.WordCallback { if (typedWord != null) { // Treating USER_TYPED as UNIGRAM suggestion for logging now. LatinImeLogger.onAddSuggestedWord(typedWord, Suggest.DIC_USER_TYPED, Dictionary.DataType.UNIGRAM); Dictionary.UNIGRAM); } mConsideredWord = consideredWord; Loading Loading @@ -417,12 +417,12 @@ public class Suggest implements Dictionary.WordCallback { @Override public boolean addWord(final char[] word, final int offset, final int length, int score, final int dicTypeId, final Dictionary.DataType dataType) { Dictionary.DataType dataTypeForLog = dataType; final int dicTypeId, final int dataType) { int dataTypeForLog = dataType; final ArrayList<CharSequence> suggestions; final int[] sortedScores; final int prefMaxSuggestions; if(dataType == Dictionary.DataType.BIGRAM) { if (dataType == Dictionary.BIGRAM) { suggestions = mBigramSuggestions; sortedScores = mBigramScores; prefMaxSuggestions = PREF_MAX_BIGRAMS; Loading Loading @@ -450,11 +450,11 @@ public class Suggest implements Dictionary.WordCallback { } } } else { if (dataType == Dictionary.DataType.UNIGRAM) { if (dataType == Dictionary.UNIGRAM) { // Check if the word was already added before (by bigram data) int bigramSuggestion = searchBigramSuggestion(word,offset,length); if(bigramSuggestion >= 0) { dataTypeForLog = Dictionary.DataType.BIGRAM; dataTypeForLog = Dictionary.BIGRAM; // turn freq from bigram into multiplier specified above double multiplier = (((double) mBigramScores[bigramSuggestion]) / MAXIMUM_BIGRAM_FREQUENCY) Loading Loading
java/src/com/android/inputmethod/latin/BinaryDictionary.java +2 −2 Original line number Diff line number Diff line Loading @@ -162,7 +162,7 @@ public class BinaryDictionary extends Dictionary { } if (len > 0) { callback.addWord(mOutputChars_bigrams, start, len, mBigramScores[j], mDicTypeId, DataType.BIGRAM); mDicTypeId, Dictionary.BIGRAM); } } } Loading @@ -182,7 +182,7 @@ public class BinaryDictionary extends Dictionary { } if (len > 0) { callback.addWord(mOutputChars, start, len, mScores[j], mDicTypeId, DataType.UNIGRAM); Dictionary.UNIGRAM); } } } Loading
java/src/com/android/inputmethod/latin/Dictionary.java +5 −6 Original line number Diff line number Diff line Loading @@ -33,9 +33,8 @@ public abstract class Dictionary { */ protected static final int FULL_WORD_SCORE_MULTIPLIER = 2; public static enum DataType { UNIGRAM, BIGRAM } public static final int UNIGRAM = 0; public static final int BIGRAM = 1; /** * Interface to be implemented by classes requesting words to be fetched from the dictionary. Loading @@ -51,11 +50,11 @@ public abstract class Dictionary { * @param score the score of occurrence. This is normalized between 1 and 255, but * can exceed those limits * @param dicTypeId of the dictionary where word was from * @param dataType tells type of this data * @param dataType tells type of this data, either UNIGRAM or BIGRAM * @return true if the word was added, false if no more words are required */ boolean addWord(char[] word, int wordOffset, int wordLength, int score, int dicTypeId, DataType dataType); int dataType); } /** Loading @@ -64,7 +63,7 @@ public abstract class Dictionary { * @param composer the key sequence to match * @param callback the callback object to send matched words to as possible candidates * @param proximityInfo the object for key proximity. May be ignored by some implementations. * @see WordCallback#addWord(char[], int, int, int, int, DataType) * @see WordCallback#addWord(char[], int, int, int, int, int) */ abstract public void getWords(final WordComposer composer, final WordCallback callback, final ProximityInfo proximityInfo); Loading
java/src/com/android/inputmethod/latin/ExpandableDictionary.java +3 −3 Original line number Diff line number Diff line Loading @@ -301,7 +301,7 @@ public class ExpandableDictionary extends Dictionary { finalFreq = computeSkippedWordFinalFreq(freq, snr, mInputLength); } if (!callback.addWord(word, 0, depth + 1, finalFreq, mDicTypeId, DataType.UNIGRAM)) { Dictionary.UNIGRAM)) { return; } } Loading Loading @@ -342,7 +342,7 @@ public class ExpandableDictionary extends Dictionary { snr * addedAttenuation, mInputLength); } callback.addWord(word, 0, depth + 1, finalFreq, mDicTypeId, DataType.UNIGRAM); Dictionary.UNIGRAM); } } if (children != null) { Loading Loading @@ -506,7 +506,7 @@ public class ExpandableDictionary extends Dictionary { } while (node != null); callback.addWord(mLookedUpString, index, MAX_WORD_LENGTH - index, freq, mDicTypeId, DataType.BIGRAM); Dictionary.BIGRAM); } } Loading
java/src/com/android/inputmethod/latin/LatinImeLogger.java +1 −2 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import android.content.SharedPreferences; import android.view.inputmethod.EditorInfo; import com.android.inputmethod.keyboard.Keyboard; import com.android.inputmethod.latin.Dictionary.DataType; import java.util.List; Loading Loading @@ -75,7 +74,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang public static void onStartSuggestion(CharSequence previousWords) { } public static void onAddSuggestedWord(String word, int typeId, DataType dataType) { public static void onAddSuggestedWord(String word, int typeId, int dataType) { } public static void onSetKeyboard(Keyboard kb) { Loading
java/src/com/android/inputmethod/latin/Suggest.java +6 −6 Original line number Diff line number Diff line Loading @@ -298,7 +298,7 @@ public class Suggest implements Dictionary.WordCallback { if (typedWord != null) { // Treating USER_TYPED as UNIGRAM suggestion for logging now. LatinImeLogger.onAddSuggestedWord(typedWord, Suggest.DIC_USER_TYPED, Dictionary.DataType.UNIGRAM); Dictionary.UNIGRAM); } mConsideredWord = consideredWord; Loading Loading @@ -417,12 +417,12 @@ public class Suggest implements Dictionary.WordCallback { @Override public boolean addWord(final char[] word, final int offset, final int length, int score, final int dicTypeId, final Dictionary.DataType dataType) { Dictionary.DataType dataTypeForLog = dataType; final int dicTypeId, final int dataType) { int dataTypeForLog = dataType; final ArrayList<CharSequence> suggestions; final int[] sortedScores; final int prefMaxSuggestions; if(dataType == Dictionary.DataType.BIGRAM) { if (dataType == Dictionary.BIGRAM) { suggestions = mBigramSuggestions; sortedScores = mBigramScores; prefMaxSuggestions = PREF_MAX_BIGRAMS; Loading Loading @@ -450,11 +450,11 @@ public class Suggest implements Dictionary.WordCallback { } } } else { if (dataType == Dictionary.DataType.UNIGRAM) { if (dataType == Dictionary.UNIGRAM) { // Check if the word was already added before (by bigram data) int bigramSuggestion = searchBigramSuggestion(word,offset,length); if(bigramSuggestion >= 0) { dataTypeForLog = Dictionary.DataType.BIGRAM; dataTypeForLog = Dictionary.BIGRAM; // turn freq from bigram into multiplier specified above double multiplier = (((double) mBigramScores[bigramSuggestion]) / MAXIMUM_BIGRAM_FREQUENCY) Loading