mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Remove a meaningless separation (A18)
Change-Id: I267177044c7d7b0d9119839a11057b2bbf41f75f
This commit is contained in:
parent
61e7ec6587
commit
0a79446531
@ -59,10 +59,8 @@ public class Suggest {
|
|||||||
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.
|
||||||
public static final String DICT_KEY_USER = "user";
|
public static final String DICT_KEY_USER = "user";
|
||||||
// User history dictionary for the unigram map, internal to LatinIME
|
// User history dictionary internal to LatinIME
|
||||||
public static final String DICT_KEY_USER_HISTORY_UNIGRAM = "history_unigram";
|
public static final String DICT_KEY_USER_HISTORY = "history";
|
||||||
// User history dictionary for the bigram map, internal to LatinIME
|
|
||||||
public static final String DICT_KEY_USER_HISTORY_BIGRAM = "history_bigram";
|
|
||||||
public static final String DICT_KEY_WHITELIST ="whitelist";
|
public static final String DICT_KEY_WHITELIST ="whitelist";
|
||||||
// TODO: remove this map. This only serves as backward compatibility with a feature
|
// TODO: remove this map. This only serves as backward compatibility with a feature
|
||||||
// that has never been used and has been broken for a while.
|
// that has never been used and has been broken for a while.
|
||||||
@ -71,8 +69,7 @@ public class Suggest {
|
|||||||
static {
|
static {
|
||||||
sDictKeyToDictIndex.put(DICT_KEY_MAIN, DIC_MAIN);
|
sDictKeyToDictIndex.put(DICT_KEY_MAIN, DIC_MAIN);
|
||||||
sDictKeyToDictIndex.put(DICT_KEY_USER, DIC_USER);
|
sDictKeyToDictIndex.put(DICT_KEY_USER, DIC_USER);
|
||||||
sDictKeyToDictIndex.put(DICT_KEY_USER_HISTORY_UNIGRAM, DIC_USER_HISTORY);
|
sDictKeyToDictIndex.put(DICT_KEY_USER_HISTORY, DIC_USER_HISTORY);
|
||||||
sDictKeyToDictIndex.put(DICT_KEY_USER_HISTORY_BIGRAM, DIC_USER_HISTORY);
|
|
||||||
sDictKeyToDictIndex.put(DICT_KEY_CONTACTS, DIC_CONTACTS);
|
sDictKeyToDictIndex.put(DICT_KEY_CONTACTS, DIC_CONTACTS);
|
||||||
sDictKeyToDictIndex.put(DICT_KEY_WHITELIST, DIC_WHITELIST);
|
sDictKeyToDictIndex.put(DICT_KEY_WHITELIST, DIC_WHITELIST);
|
||||||
}
|
}
|
||||||
@ -195,10 +192,8 @@ public class Suggest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setUserHistoryDictionary(UserHistoryDictionary userHistoryDictionary) {
|
public void setUserHistoryDictionary(UserHistoryDictionary userHistoryDictionary) {
|
||||||
addOrReplaceDictionary(mUnigramDictionaries, DICT_KEY_USER_HISTORY_UNIGRAM,
|
addOrReplaceDictionary(mUnigramDictionaries, DICT_KEY_USER_HISTORY, userHistoryDictionary);
|
||||||
userHistoryDictionary);
|
addOrReplaceDictionary(mBigramDictionaries, DICT_KEY_USER_HISTORY, userHistoryDictionary);
|
||||||
addOrReplaceDictionary(mBigramDictionaries, DICT_KEY_USER_HISTORY_BIGRAM,
|
|
||||||
userHistoryDictionary);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAutoCorrectionThreshold(float threshold) {
|
public void setAutoCorrectionThreshold(float threshold) {
|
||||||
@ -269,8 +264,8 @@ public class Suggest {
|
|||||||
}
|
}
|
||||||
for (final SuggestedWordInfo suggestion : suggestions) {
|
for (final SuggestedWordInfo suggestion : suggestions) {
|
||||||
final String suggestionStr = suggestion.mWord.toString();
|
final String suggestionStr = suggestion.mWord.toString();
|
||||||
oldAddWord(suggestionStr.toCharArray(), null, 0, suggestionStr.length(),
|
addWord(suggestionStr.toCharArray(), null, 0, suggestionStr.length(),
|
||||||
suggestion.mScore, dicTypeId, Dictionary.BIGRAM);
|
suggestion.mScore, dicTypeId, Dictionary.BIGRAM, mSuggestions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -287,7 +282,7 @@ public class Suggest {
|
|||||||
// At second character typed, search the unigrams (scores being affected by bigrams)
|
// At second character typed, search the unigrams (scores being affected by bigrams)
|
||||||
for (final String key : mUnigramDictionaries.keySet()) {
|
for (final String key : mUnigramDictionaries.keySet()) {
|
||||||
// Skip UserUnigramDictionary and WhitelistDictionary to lookup
|
// Skip UserUnigramDictionary and WhitelistDictionary to lookup
|
||||||
if (key.equals(DICT_KEY_USER_HISTORY_UNIGRAM) || key.equals(DICT_KEY_WHITELIST))
|
if (key.equals(DICT_KEY_USER_HISTORY) || key.equals(DICT_KEY_WHITELIST))
|
||||||
continue;
|
continue;
|
||||||
final int dicTypeId = sDictKeyToDictIndex.get(key);
|
final int dicTypeId = sDictKeyToDictIndex.get(key);
|
||||||
final Dictionary dictionary = mUnigramDictionaries.get(key);
|
final Dictionary dictionary = mUnigramDictionaries.get(key);
|
||||||
@ -295,8 +290,8 @@ public class Suggest {
|
|||||||
wordComposerForLookup, prevWordForBigram, proximityInfo);
|
wordComposerForLookup, prevWordForBigram, proximityInfo);
|
||||||
for (final SuggestedWordInfo suggestion : suggestions) {
|
for (final SuggestedWordInfo suggestion : suggestions) {
|
||||||
final String suggestionStr = suggestion.mWord.toString();
|
final String suggestionStr = suggestion.mWord.toString();
|
||||||
oldAddWord(suggestionStr.toCharArray(), null, 0, suggestionStr.length(),
|
addWord(suggestionStr.toCharArray(), null, 0, suggestionStr.length(),
|
||||||
suggestion.mScore, dicTypeId, Dictionary.UNIGRAM);
|
suggestion.mScore, dicTypeId, Dictionary.UNIGRAM, mSuggestions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -404,13 +399,11 @@ public class Suggest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Use codepoint instead of char
|
// TODO: Use codepoint instead of char
|
||||||
public boolean oldAddWord(final char[] word, int[] indices, final int offset, final int length,
|
public boolean addWord(final char[] word, int[] indices, final int offset, final int length,
|
||||||
int score, final int dicTypeId, final int dataType) {
|
int score, final int dicTypeId, final int dataType,
|
||||||
|
final ArrayList<SuggestedWordInfo> suggestions) {
|
||||||
int dataTypeForLog = dataType;
|
int dataTypeForLog = dataType;
|
||||||
final ArrayList<SuggestedWordInfo> suggestions;
|
final int prefMaxSuggestions = MAX_SUGGESTIONS;
|
||||||
final int prefMaxSuggestions;
|
|
||||||
suggestions = mSuggestions;
|
|
||||||
prefMaxSuggestions = MAX_SUGGESTIONS;
|
|
||||||
|
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
|
||||||
|
@ -238,8 +238,8 @@ public class AndroidSpellCheckerService extends SpellCheckerService
|
|||||||
mScores = new int[mMaxLength];
|
mScores = new int[mMaxLength];
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized public boolean oldAddWord(char[] word, int[] spaceIndices, int wordOffset,
|
synchronized public boolean addWord(char[] word, int[] spaceIndices, int wordOffset,
|
||||||
int wordLength, int score, int dicTypeId /* unused */, int dataType) {
|
int wordLength, int score) {
|
||||||
final int positionIndex = Arrays.binarySearch(mScores, 0, mLength, score);
|
final int positionIndex = Arrays.binarySearch(mScores, 0, mLength, score);
|
||||||
// binarySearch returns the index if the element exists, and -<insertion index> - 1
|
// binarySearch returns the index if the element exists, and -<insertion index> - 1
|
||||||
// if it doesn't. See documentation for binarySearch.
|
// if it doesn't. See documentation for binarySearch.
|
||||||
@ -784,9 +784,8 @@ public class AndroidSpellCheckerService extends SpellCheckerService
|
|||||||
composer, prevWord, dictInfo.mProximityInfo);
|
composer, prevWord, dictInfo.mProximityInfo);
|
||||||
for (final SuggestedWordInfo suggestion : suggestions) {
|
for (final SuggestedWordInfo suggestion : suggestions) {
|
||||||
final String suggestionStr = suggestion.mWord.toString();
|
final String suggestionStr = suggestion.mWord.toString();
|
||||||
suggestionsGatherer.oldAddWord(suggestionStr.toCharArray(), null, 0,
|
suggestionsGatherer.addWord(suggestionStr.toCharArray(), null, 0,
|
||||||
suggestionStr.length(), suggestion.mScore, 0 /* ignored */,
|
suggestionStr.length(), suggestion.mScore);
|
||||||
Dictionary.UNIGRAM);
|
|
||||||
}
|
}
|
||||||
isInDict = dictInfo.mDictionary.isValidWord(text);
|
isInDict = dictInfo.mDictionary.isValidWord(text);
|
||||||
if (!isInDict && CAPITALIZE_NONE != capitalizeType) {
|
if (!isInDict && CAPITALIZE_NONE != capitalizeType) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user