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

Commit 4caf5941 authored by Ken Wakasa's avatar Ken Wakasa
Browse files

Follow up to I907150be994c4f9ffc030c063de521eeb177d3e1

Change-Id: I8779d397b0ebe2abbf7c3fbc1a79a1a0939c04f0
parent cbb1ee48
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -289,7 +289,6 @@ static inline void prof_out(void) {

#define CALIBRATE_SCORE_BY_TOUCH_COORDINATES true
#define SUGGEST_MULTIPLE_WORDS true
#define USE_SUGGEST_INTERFACE_FOR_TYPING true
#define SUGGEST_INTERFACE_OUTPUT_SCALE 1000000.0f

// The following "rate"s are used as a multiplier before dividing by 100, so they are in percent.
+7 −1
Original line number Diff line number Diff line
@@ -918,11 +918,15 @@ inline static bool isUpperCase(unsigned short c) {

// In dictionary.cpp, getSuggestion() method,
// When USE_SUGGEST_INTERFACE_FOR_TYPING is true:
//
//   // TODO: Revise the following logic thoroughly by referring to the logic
//   // marked as "Otherwise" below.
//   SUGGEST_INTERFACE_OUTPUT_SCALE was multiplied to the original suggestion scores to convert
//   them to integers.
//     score = (int)((original score) * SUGGEST_INTERFACE_OUTPUT_SCALE)
//   Undo the scaling here to recover the original score.
//     normalizedScore = ((float)score) / SUGGEST_INTERFACE_OUTPUT_SCALE
//
// Otherwise: suggestion scores are computed using the below formula.
// original score
//  := powf(mTypedLetterMultiplier (this is defined 2),
@@ -965,9 +969,11 @@ inline static bool isUpperCase(unsigned short c) {
    // so, 0 <= distance / afterLength <= 1
    const float weight = 1.0f - static_cast<float>(distance) / static_cast<float>(afterLength);

    if (USE_SUGGEST_INTERFACE_FOR_TYPING) {
    // TODO: Revise the following logic thoroughly by referring to...
    if (true /* USE_SUGGEST_INTERFACE_FOR_TYPING */) {
        return (static_cast<float>(score) / SUGGEST_INTERFACE_OUTPUT_SCALE) * weight;
    }
    // ...this logic.
    const float maxScore = score >= S_INT_MAX ? static_cast<float>(S_INT_MAX)
            : static_cast<float>(MAX_INITIAL_SCORE)
                    * powf(static_cast<float>(TYPED_LETTER_MULTIPLIER),