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

Commit 47684fb6 authored by Ken Wakasa's avatar Ken Wakasa Committed by Android (Google) Code Review
Browse files

Merge "Using isSkippableChar instead of '\'' and '-'." into jb-mr1-dev

parents e8db06fc 1cd7ca99
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -631,7 +631,7 @@ Correction::CorrectionType Correction::processCharAndCalcState(
inline static int getQuoteCount(const unsigned short *word, const int length) {
    int quoteCount = 0;
    for (int i = 0; i < length; ++i) {
        if (word[i] == '\'') {
        if (word[i] == SINGLE_QUOTE) {
            ++quoteCount;
        }
    }
+5 −0
Original line number Diff line number Diff line
@@ -27,6 +27,11 @@ namespace latinime {

class Correction;

inline bool isSkippableChar(const uint16_t character) {
    // TODO: Do not hardcode here
    return character == '\'' || character == '-';
}

class ProximityInfo {
 public:
    ProximityInfo(JNIEnv *env, const jstring localeJStr, const int maxProximityCharsSize,
+1 −3
Original line number Diff line number Diff line
@@ -469,9 +469,7 @@ float ProximityInfoState::getPointToKeyLength(const int inputIndex, const int co
        const int index = inputIndex * mProximityInfo->getKeyCount() + keyId;
        return min(mDistanceCache[index] * scale, mMaxPointToKeyLength);
    }
    // TODO: Do not hardcode here
    // No penalty to ' and -
    if (codePoint == '\'' || codePoint == '-') {
    if (isSkippableChar(codePoint)) {
        return 0;
    }
    // If the char is not a key on the keyboard then return the max length.
+0 −1
Original line number Diff line number Diff line
@@ -314,7 +314,6 @@ void UnigramDictionary::initSuggestions(ProximityInfo *proximityInfo, const int
    correction->initCorrection(proximityInfo, inputSize, maxDepth);
}

static const char QUOTE = '\'';
static const char SPACE = ' ';

void UnigramDictionary::getOneWordSuggestions(ProximityInfo *proximityInfo,