Loading native/jni/src/defines.h +1 −1 Original line number Diff line number Diff line Loading @@ -316,7 +316,7 @@ static inline void prof_out(void) { #define TWO_WORDS_CAPITALIZED_DEMOTION_RATE 50 #define TWO_WORDS_CORRECTION_DEMOTION_BASE 80 #define TWO_WORDS_PLUS_OTHER_ERROR_CORRECTION_DEMOTION_DIVIDER 1 #define ZERO_DISTANCE_PROMOTION_RATE 110 #define ZERO_DISTANCE_PROMOTION_RATE 110.0f #define NEUTRAL_SCORE_SQUARED_RADIUS 8.0f #define HALF_SCORE_SQUARED_RADIUS 32.0f #define MAX_FREQ 255 Loading native/jni/src/suggest_utils.h +7 −3 Original line number Diff line number Diff line Loading @@ -18,11 +18,12 @@ #define LATINIME_SUGGEST_UTILS_H #include "defines.h" #include "proximity_info_state.h" namespace latinime { class SuggestUtils { public: static float getDistanceScalingFactor(float normalizedSquaredDistance) { static float getDistanceScalingFactor(const float normalizedSquaredDistance) { if (normalizedSquaredDistance < 0.0f) { return -1.0f; } Loading @@ -33,8 +34,8 @@ class SuggestUtils { static const float MIN = 0.3f; static const float R1 = NEUTRAL_SCORE_SQUARED_RADIUS; static const float R2 = HALF_SCORE_SQUARED_RADIUS; const float x = static_cast<float>(normalizedSquaredDistance) / ProximityInfoState::NORMALIZED_SQUARED_DISTANCE_SCALING_FACTOR; const float x = normalizedSquaredDistance / static_cast<float>( ProximityInfoState::NORMALIZED_SQUARED_DISTANCE_SCALING_FACTOR); const float factor = max((x < R1) ? (A * (R1 - x) + B * x) / R1 : (B * (R2 - x) + C * (x - R1)) / (R2 - R1), MIN); Loading @@ -48,6 +49,9 @@ class SuggestUtils { // 0 R1 R2 . return factor; } private: DISALLOW_IMPLICIT_CONSTRUCTORS(SuggestUtils); }; } // namespace latinime #endif // LATINIME_SUGGEST_UTILS_H Loading
native/jni/src/defines.h +1 −1 Original line number Diff line number Diff line Loading @@ -316,7 +316,7 @@ static inline void prof_out(void) { #define TWO_WORDS_CAPITALIZED_DEMOTION_RATE 50 #define TWO_WORDS_CORRECTION_DEMOTION_BASE 80 #define TWO_WORDS_PLUS_OTHER_ERROR_CORRECTION_DEMOTION_DIVIDER 1 #define ZERO_DISTANCE_PROMOTION_RATE 110 #define ZERO_DISTANCE_PROMOTION_RATE 110.0f #define NEUTRAL_SCORE_SQUARED_RADIUS 8.0f #define HALF_SCORE_SQUARED_RADIUS 32.0f #define MAX_FREQ 255 Loading
native/jni/src/suggest_utils.h +7 −3 Original line number Diff line number Diff line Loading @@ -18,11 +18,12 @@ #define LATINIME_SUGGEST_UTILS_H #include "defines.h" #include "proximity_info_state.h" namespace latinime { class SuggestUtils { public: static float getDistanceScalingFactor(float normalizedSquaredDistance) { static float getDistanceScalingFactor(const float normalizedSquaredDistance) { if (normalizedSquaredDistance < 0.0f) { return -1.0f; } Loading @@ -33,8 +34,8 @@ class SuggestUtils { static const float MIN = 0.3f; static const float R1 = NEUTRAL_SCORE_SQUARED_RADIUS; static const float R2 = HALF_SCORE_SQUARED_RADIUS; const float x = static_cast<float>(normalizedSquaredDistance) / ProximityInfoState::NORMALIZED_SQUARED_DISTANCE_SCALING_FACTOR; const float x = normalizedSquaredDistance / static_cast<float>( ProximityInfoState::NORMALIZED_SQUARED_DISTANCE_SCALING_FACTOR); const float factor = max((x < R1) ? (A * (R1 - x) + B * x) / R1 : (B * (R2 - x) + C * (x - R1)) / (R2 - R1), MIN); Loading @@ -48,6 +49,9 @@ class SuggestUtils { // 0 R1 R2 . return factor; } private: DISALLOW_IMPLICIT_CONSTRUCTORS(SuggestUtils); }; } // namespace latinime #endif // LATINIME_SUGGEST_UTILS_H