Update the prototype of onAddSuggestedWord - calling side.

We want to get rid of all those IDs in Latin IME.

Change-Id: Ibe08100a5e2976c80abb049889233b4047a686f3
main
Jean Chalard 2012-06-27 16:10:00 +09:00
parent 2db27bcd06
commit 32ff2504a0
3 changed files with 7 additions and 14 deletions

View File

@ -31,9 +31,6 @@ public abstract class Dictionary {
*/ */
protected static final int FULL_WORD_SCORE_MULTIPLIER = 2; protected static final int FULL_WORD_SCORE_MULTIPLIER = 2;
public static final int UNIGRAM = 0;
public static final int BIGRAM = 1;
public static final int NOT_A_PROBABILITY = -1; public static final int NOT_A_PROBABILITY = -1;
/** /**

View File

@ -71,7 +71,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
public static void onStartSuggestion(CharSequence previousWords) { public static void onStartSuggestion(CharSequence previousWords) {
} }
public static void onAddSuggestedWord(String word, int typeId, int dataType) { public static void onAddSuggestedWord(String word, String sourceDictionaryId) {
} }
public static void onSetKeyboard(Keyboard kb) { public static void onSetKeyboard(Keyboard kb) {

View File

@ -57,6 +57,7 @@ public class Suggest {
// If you add a type of dictionary, increment DIC_TYPE_LAST_ID // If you add a type of dictionary, increment DIC_TYPE_LAST_ID
// TODO: this value seems unused. Remove it? // TODO: this value seems unused. Remove it?
public static final int DIC_TYPE_LAST_ID = 6; public static final int DIC_TYPE_LAST_ID = 6;
public static final String DICT_KEY_USER_TYPED = "user_typed";
public static final String DICT_KEY_MAIN = "main"; public static final String DICT_KEY_MAIN = "main";
public static final String DICT_KEY_CONTACTS = "contacts"; public static final String DICT_KEY_CONTACTS = "contacts";
// User dictionary, the system-managed one. // User dictionary, the system-managed one.
@ -232,7 +233,7 @@ public class Suggest {
? typedWord.substring(0, typedWord.length() - mTrailingSingleQuotesCount) ? typedWord.substring(0, typedWord.length() - mTrailingSingleQuotesCount)
: typedWord; : typedWord;
// Treating USER_TYPED as UNIGRAM suggestion for logging now. // Treating USER_TYPED as UNIGRAM suggestion for logging now.
LatinImeLogger.onAddSuggestedWord(typedWord, Suggest.DIC_USER_TYPED, Dictionary.UNIGRAM); LatinImeLogger.onAddSuggestedWord(typedWord, DICT_KEY_USER_TYPED);
if (wordComposer.size() <= 1 && isCorrectionEnabled) { if (wordComposer.size() <= 1 && isCorrectionEnabled) {
// At first character typed, search only the bigrams // At first character typed, search only the bigrams
@ -253,8 +254,7 @@ public class Suggest {
localSuggestions.addAll(dictionary.getBigrams(wordComposer, lowerPrevWord)); localSuggestions.addAll(dictionary.getBigrams(wordComposer, lowerPrevWord));
} }
for (final SuggestedWordInfo localSuggestion : localSuggestions) { for (final SuggestedWordInfo localSuggestion : localSuggestions) {
addWord(localSuggestion, dicTypeId, Dictionary.BIGRAM, addWord(localSuggestion, key, suggestionsContainer, consideredWord);
suggestionsContainer, consideredWord);
} }
} }
} }
@ -278,8 +278,7 @@ public class Suggest {
final ArrayList<SuggestedWordInfo> localSuggestions = dictionary.getWords( final ArrayList<SuggestedWordInfo> localSuggestions = dictionary.getWords(
wordComposerForLookup, prevWordForBigram, proximityInfo); wordComposerForLookup, prevWordForBigram, proximityInfo);
for (final SuggestedWordInfo suggestion : localSuggestions) { for (final SuggestedWordInfo suggestion : localSuggestions) {
addWord(suggestion, dicTypeId, Dictionary.UNIGRAM, addWord(suggestion, key, suggestionsContainer, consideredWord);
suggestionsContainer, consideredWord);
} }
} }
} }
@ -401,10 +400,8 @@ public class Suggest {
private static final SuggestedWordInfoComparator sSuggestedWordInfoComparator = private static final SuggestedWordInfoComparator sSuggestedWordInfoComparator =
new SuggestedWordInfoComparator(); new SuggestedWordInfoComparator();
public boolean addWord(final SuggestedWordInfo wordInfo, public boolean addWord(final SuggestedWordInfo wordInfo, final String dictTypeKey,
final int dicTypeId, final int dataType,
final ArrayList<SuggestedWordInfo> suggestions, final String consideredWord) { final ArrayList<SuggestedWordInfo> suggestions, final String consideredWord) {
int dataTypeForLog = dataType;
final int prefMaxSuggestions = MAX_SUGGESTIONS; final int prefMaxSuggestions = MAX_SUGGESTIONS;
final CharSequence word = wordInfo.mWord; final CharSequence word = wordInfo.mWord;
@ -426,8 +423,7 @@ public class Suggest {
if (suggestions.size() > prefMaxSuggestions) { if (suggestions.size() > prefMaxSuggestions) {
suggestions.remove(prefMaxSuggestions); suggestions.remove(prefMaxSuggestions);
} }
LatinImeLogger.onAddSuggestedWord(transformedWordInfo.mWord.toString(), dicTypeId, LatinImeLogger.onAddSuggestedWord(transformedWordInfo.mWord.toString(), dictTypeKey);
dataTypeForLog);
return true; return true;
} }