Revert "Workaround to avoid a bug in the batch input bigram dictionary lookup"
This reverts commit 1250cdeab2
This commit is contained in:
parent
1250cdeab2
commit
5e21ea1a35
1 changed files with 4 additions and 8 deletions
|
@ -111,14 +111,9 @@ public class BinaryDictionary extends Dictionary {
|
||||||
Arrays.fill(mInputCodes, WordComposer.NOT_A_CODE);
|
Arrays.fill(mInputCodes, WordComposer.NOT_A_CODE);
|
||||||
Arrays.fill(mOutputChars, (char) 0);
|
Arrays.fill(mOutputChars, (char) 0);
|
||||||
Arrays.fill(mOutputScores, 0);
|
Arrays.fill(mOutputScores, 0);
|
||||||
final boolean isGesture = composer.isBatchMode();
|
|
||||||
final boolean isValidPrevWord = (prevWord == null)
|
|
||||||
// TODO: Remove this check. Unfortunately the current gesture recognition code has
|
|
||||||
// a double-free bug.
|
|
||||||
&& !isGesture;
|
|
||||||
// TODO: toLowerCase in the native code
|
// TODO: toLowerCase in the native code
|
||||||
final int[] prevWordCodePointArray = isValidPrevWord
|
final int[] prevWordCodePointArray = (null == prevWord)
|
||||||
? StringUtils.toCodePointArray(prevWord.toString()) : null;
|
? null : StringUtils.toCodePointArray(prevWord.toString());
|
||||||
final int composerSize = composer.size();
|
final int composerSize = composer.size();
|
||||||
|
|
||||||
if (composerSize <= 1 || !composer.isBatchMode()) {
|
if (composerSize <= 1 || !composer.isBatchMode()) {
|
||||||
|
@ -129,7 +124,7 @@ public class BinaryDictionary extends Dictionary {
|
||||||
}
|
}
|
||||||
|
|
||||||
final int count;
|
final int count;
|
||||||
if (!isGesture && composer.size() <= 1) {
|
if (!composer.isBatchMode() && composer.size() <= 1) {
|
||||||
if (TextUtils.isEmpty(prevWord)) return null;
|
if (TextUtils.isEmpty(prevWord)) return null;
|
||||||
int tmpCount = getBigramsNative(mNativeDict, prevWordCodePointArray,
|
int tmpCount = getBigramsNative(mNativeDict, prevWordCodePointArray,
|
||||||
prevWordCodePointArray.length, mInputCodes, composerSize,
|
prevWordCodePointArray.length, mInputCodes, composerSize,
|
||||||
|
@ -137,6 +132,7 @@ public class BinaryDictionary extends Dictionary {
|
||||||
count = Math.min(tmpCount, MAX_BIGRAMS);
|
count = Math.min(tmpCount, MAX_BIGRAMS);
|
||||||
} else {
|
} else {
|
||||||
final InputPointers ips = composer.getInputPointers();
|
final InputPointers ips = composer.getInputPointers();
|
||||||
|
final boolean isGesture = composer.isBatchMode();
|
||||||
final int codesSize;
|
final int codesSize;
|
||||||
if (isGesture) {
|
if (isGesture) {
|
||||||
codesSize = ips.getPointerSize();
|
codesSize = ips.getPointerSize();
|
||||||
|
|
Loading…
Reference in a new issue