Resolve a TODO: bury some implementation detail in native (A110)

The fact that prediction does not accept a null argument is an
implementation detail, it should not be visible to Java code.

Change-Id: I3a156b323b6db9353de898d33f3f7c81751cecb1
main
Jean Chalard 2012-07-11 16:47:22 +09:00
parent 18d76afa91
commit 3b57631b60
3 changed files with 5 additions and 8 deletions

View File

@ -122,8 +122,6 @@ public class BinaryDictionary extends Dictionary {
}
}
// TODO: move this test to native code.
if (composerSize <= 1 && TextUtils.isEmpty(prevWord)) return null;
final InputPointers ips = composer.getInputPointers();
final int codesSize = isGesture ? ips.getPointerSize() : composerSize;
// proximityInfo and/or prevWordForBigrams may not be null.

View File

@ -194,12 +194,10 @@ public class Suggest {
}
if (wordComposerForLookup.size() <= 1) {
// At first character typed, search only the bigrams
if (!TextUtils.isEmpty(prevWordForBigram)) {
for (final String key : mDictionaries.keySet()) {
final Dictionary dictionary = mDictionaries.get(key);
suggestionsSet.addAll(dictionary.getSuggestions(wordComposerForLookup,
prevWordForBigram, proximityInfo));
}
for (final String key : mDictionaries.keySet()) {
final Dictionary dictionary = mDictionaries.get(key);
suggestionsSet.addAll(dictionary.getSuggestions(
wordComposerForLookup, prevWordForBigram, proximityInfo));
}
} else {
// At second character typed, search the unigrams (scores being affected by bigrams)

View File

@ -60,6 +60,7 @@ class Dictionary {
int getBigrams(const int32_t *word, int length, int *codes, int codesSize,
unsigned short *outWords, int *frequencies) const {
if (length <= 0) return 0;
return mBigramDictionary->getBigrams(word, length, codes, codesSize, outWords, frequencies);
}