Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e93b1f22 authored by Jean Chalard's avatar Jean Chalard
Browse files

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
parent 75f812af
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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);
    }
+0 −1
Original line number Diff line number Diff line
@@ -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);
+1 −1
Original line number Diff line number Diff line
@@ -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);
+1 −1
Original line number Diff line number Diff line
@@ -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) {