mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Pull up some common code again (A99)
Change-Id: I9e9f5664bb12bb25d74c8a076a6ee1024c708145
This commit is contained in:
parent
8eaeb60e7f
commit
860a9f85ff
@ -114,6 +114,15 @@ public class BinaryDictionary extends Dictionary {
|
|||||||
// TODO: toLowerCase in the native code
|
// TODO: toLowerCase in the native code
|
||||||
final int[] prevWordCodePointArray = (null == prevWord)
|
final int[] prevWordCodePointArray = (null == prevWord)
|
||||||
? null : StringUtils.toCodePointArray(prevWord.toString());
|
? null : StringUtils.toCodePointArray(prevWord.toString());
|
||||||
|
final int composerSize = composer.size();
|
||||||
|
|
||||||
|
if (composerSize <= 1 || !composer.isBatchMode()) {
|
||||||
|
if (composerSize > MAX_WORD_LENGTH - 1) return null;
|
||||||
|
for (int i = 0; i < composerSize; i++) {
|
||||||
|
mInputCodes[i] = composer.getCodeAt(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final int count;
|
final int count;
|
||||||
if (composer.size() <= 1) {
|
if (composer.size() <= 1) {
|
||||||
count = TextUtils.isEmpty(prevWord) ? -1 : getBigramsInternal(composer,
|
count = TextUtils.isEmpty(prevWord) ? -1 : getBigramsInternal(composer,
|
||||||
@ -142,9 +151,6 @@ public class BinaryDictionary extends Dictionary {
|
|||||||
private int getBigramsInternal(final WordComposer codes,
|
private int getBigramsInternal(final WordComposer codes,
|
||||||
final int[] previousWord) {
|
final int[] previousWord) {
|
||||||
int codesSize = codes.size();
|
int codesSize = codes.size();
|
||||||
if (codesSize > 0) {
|
|
||||||
mInputCodes[0] = codes.getCodeAt(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int count = getBigramsNative(mNativeDict, previousWord, previousWord.length, mInputCodes,
|
int count = getBigramsNative(mNativeDict, previousWord, previousWord.length, mInputCodes,
|
||||||
codesSize, mOutputChars, mOutputScores, MAX_WORD_LENGTH, MAX_BIGRAMS);
|
codesSize, mOutputChars, mOutputScores, MAX_WORD_LENGTH, MAX_BIGRAMS);
|
||||||
@ -165,11 +171,6 @@ public class BinaryDictionary extends Dictionary {
|
|||||||
codesSize = ips.getPointerSize();
|
codesSize = ips.getPointerSize();
|
||||||
} else {
|
} else {
|
||||||
codesSize = codes.size();
|
codesSize = codes.size();
|
||||||
// Won't deal with really long words.
|
|
||||||
if (codesSize > MAX_WORD_LENGTH - 1) return -1;
|
|
||||||
for (int i = 0; i < codesSize; i++) {
|
|
||||||
mInputCodes[i] = codes.getCodeAt(i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return getSuggestionsNative(mNativeDict, proximityInfo.getNativeProximityInfo(),
|
return getSuggestionsNative(mNativeDict, proximityInfo.getNativeProximityInfo(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user