Allow reading a binary dictionary even without proximity info.

This prepares the way for spell checking, which is to be done
without context so without proximity info.

Bug: 4176026
Change-Id: I1b4bfaefe2611e1b484acdf3c33598cb80f81ff4
main
Jean Chalard 2011-06-01 17:12:25 +09:00
parent 75f812aff9
commit e93b1f2209
4 changed files with 4 additions and 4 deletions

View File

@ -196,8 +196,9 @@ public class BinaryDictionary extends Dictionary {
Arrays.fill(outputChars, (char) 0);
Arrays.fill(scores, 0);
final int proximityInfo = keyboard == null ? 0 : keyboard.getProximityInfo();
return getSuggestionsNative(
mNativeDict, keyboard.getProximityInfo(),
mNativeDict, proximityInfo,
codes.getXCoordinates(), codes.getYCoordinates(), mInputCodes, codesSize,
mFlags, outputChars, scores);
}

View File

@ -131,7 +131,6 @@ static int latinime_BinaryDictionary_getSuggestions(JNIEnv *env, jobject object,
Dictionary *dictionary = (Dictionary*)dict;
if (!dictionary) return 0;
ProximityInfo *pInfo = (ProximityInfo*)proximityInfo;
if (!pInfo) return 0;
int *xCoordinates = env->GetIntArrayElements(xCoordinatesArray, NULL);
int *yCoordinates = env->GetIntArrayElements(yCoordinatesArray, NULL);

View File

@ -53,7 +53,7 @@ bool Dictionary::hasBigram() {
return ((mDict[1] & 0xFF) == 1);
}
// TODO: use uint16_t instead of unsigned short
// TODO: use uint32_t instead of unsigned short
bool Dictionary::isValidWord(unsigned short *word, int length) {
if (IS_LATEST_DICT_VERSION) {
return (isValidWordRec(DICTIONARY_HEADER_SIZE, word, 0, length) != NOT_VALID_WORD);

View File

@ -233,7 +233,7 @@ void UnigramDictionary::getWordSuggestions(const ProximityInfo *proximityInfo,
PROF_END(5);
PROF_START(6);
if (SUGGEST_WORDS_WITH_SPACE_PROXIMITY) {
if (SUGGEST_WORDS_WITH_SPACE_PROXIMITY && proximityInfo) {
// The first and last "mistyped spaces" are taken care of by excessive character handling
for (int i = 1; i < codesSize - 1; ++i) {
if (DEBUG_DICT) {