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

Commit 0ae5b07b authored by Ken Wakasa's avatar Ken Wakasa
Browse files

Yet another cleanup in ProximityInfoParams

Change-Id: Ice5f5e519f4ccd2e6035010b8fe6b2296ef658d7
parent de1ec79a
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -27,8 +27,6 @@

namespace latinime {

/* static */ const float ProximityInfo::NOT_A_DISTANCE_FLOAT = -1.0f;

static AK_FORCE_INLINE void safeGetOrFillZeroIntArrayRegion(JNIEnv *env, jintArray jArray,
        jsize len, jint *buffer) {
    if (jArray && buffer) {
+0 −1
Original line number Diff line number Diff line
@@ -83,7 +83,6 @@ class ProximityInfo {

 private:
    DISALLOW_IMPLICIT_CONSTRUCTORS(ProximityInfo);
    static const float NOT_A_DISTANCE_FLOAT;

    void initializeG();
    float calculateNormalizedSquaredDistance(const int keyIndex, const int inputIndex) const;
+11 −7
Original line number Diff line number Diff line
@@ -18,14 +18,8 @@
#include "proximity_info_params.h"

namespace latinime {
const int ProximityInfoParams::LOOKUP_RADIUS_PERCENTILE = 50;
const int ProximityInfoParams::FIRST_POINT_TIME_OFFSET_MILLIS = 150;
const int ProximityInfoParams::STRONG_DOUBLE_LETTER_TIME_MILLIS = 600;
const int ProximityInfoParams::MIN_DOUBLE_LETTER_BEELINE_SPEED_PERCENTILE = 5;
const int ProximityInfoParams::NORMALIZED_SQUARED_DISTANCE_SCALING_FACTOR_LOG_2 = 10;
const int ProximityInfoParams::NORMALIZED_SQUARED_DISTANCE_SCALING_FACTOR =
        1 << NORMALIZED_SQUARED_DISTANCE_SCALING_FACTOR_LOG_2;
const float ProximityInfoParams::NOT_A_DISTANCE_FLOAT = -1.0f;
const int ProximityInfoParams::MIN_DOUBLE_LETTER_BEELINE_SPEED_PERCENTILE = 5;

/* Per method constants */
// Used by ProximityInfoStateUtils::initGeometricDistanceInfos()
@@ -93,6 +87,16 @@ const float ProximityInfoParams::SKIP_PROBABALITY_WEIGHT_FOR_PROBABILITY_GAIN =
// Used by ProximityInfoStateUtils::getMostProbableString()
const float ProximityInfoParams::DEMOTION_LOG_PROBABILITY = 0.3f;

// Used by ProximityInfoStateUtils::updateSampledSearchKeysVector()
// TODO: Investigate if this is required
const float ProximityInfoParams::SEARCH_KEY_RADIUS_RATIO = 0.95f;

// Used by ProximityInfoStateUtils::calculateBeelineSpeedRate()
const int ProximityInfoParams::LOOKUP_RADIUS_PERCENTILE = 50;
const int ProximityInfoParams::FIRST_POINT_TIME_OFFSET_MILLIS = 150;
const int ProximityInfoParams::STRONG_DOUBLE_LETTER_TIME_MILLIS = 600;

// Used by ProximityInfoStateUtils::calculateNormalizedSquaredDistance()
const int ProximityInfoParams::NORMALIZED_SQUARED_DISTANCE_SCALING_FACTOR = 1 << 10;

} // namespace latinime
+12 −7
Original line number Diff line number Diff line
@@ -23,13 +23,8 @@ namespace latinime {

class ProximityInfoParams {
 public:
    static const int LOOKUP_RADIUS_PERCENTILE;
    static const int FIRST_POINT_TIME_OFFSET_MILLIS;
    static const int STRONG_DOUBLE_LETTER_TIME_MILLIS;
    static const int MIN_DOUBLE_LETTER_BEELINE_SPEED_PERCENTILE;
    static const int NORMALIZED_SQUARED_DISTANCE_SCALING_FACTOR;
    static const float NOT_A_DISTANCE_FLOAT;
    static const float SEARCH_KEY_RADIUS_RATIO;
    static const int MIN_DOUBLE_LETTER_BEELINE_SPEED_PERCENTILE;

    // Used by ProximityInfoStateUtils::initGeometricDistanceInfos()
    static const float NEAR_KEY_NORMALIZED_SQUARED_THRESHOLD;
@@ -94,9 +89,19 @@ class ProximityInfoParams {
    // Used by ProximityInfoStateUtils::getMostProbableString()
    static const float DEMOTION_LOG_PROBABILITY;

    // Used by ProximityInfoStateUtils::updateSampledSearchKeysVector()
    static const float SEARCH_KEY_RADIUS_RATIO;

    // Used by ProximityInfoStateUtils::calculateBeelineSpeedRate()
    static const int LOOKUP_RADIUS_PERCENTILE;
    static const int FIRST_POINT_TIME_OFFSET_MILLIS;
    static const int STRONG_DOUBLE_LETTER_TIME_MILLIS;

    // Used by ProximityInfoStateUtils::calculateNormalizedSquaredDistance()
    static const int NORMALIZED_SQUARED_DISTANCE_SCALING_FACTOR;

 private:
    DISALLOW_IMPLICIT_CONSTRUCTORS(ProximityInfoParams);
    static const int NORMALIZED_SQUARED_DISTANCE_SCALING_FACTOR_LOG_2;
};
} // namespace latinime
#endif // LATINIME_PROXIMITY_INFO_PARAMS_H