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

Commit 42bbcd69 authored by Jean Chalard's avatar Jean Chalard Committed by Android (Google) Code Review
Browse files

Merge "Allow reading a binary dictionary even without proximity info."

parents b400f821 e93b1f22
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) {