Yet another cleanup in ProximityInfoParams

Change-Id: Ice5f5e519f4ccd2e6035010b8fe6b2296ef658d7
main
Ken Wakasa 2013-02-01 17:01:36 +09:00
parent de1ec79a35
commit 0ae5b07b3b
4 changed files with 23 additions and 17 deletions

View File

@ -27,8 +27,6 @@
namespace latinime { namespace latinime {
/* static */ const float ProximityInfo::NOT_A_DISTANCE_FLOAT = -1.0f;
static AK_FORCE_INLINE void safeGetOrFillZeroIntArrayRegion(JNIEnv *env, jintArray jArray, static AK_FORCE_INLINE void safeGetOrFillZeroIntArrayRegion(JNIEnv *env, jintArray jArray,
jsize len, jint *buffer) { jsize len, jint *buffer) {
if (jArray && buffer) { if (jArray && buffer) {

View File

@ -83,7 +83,6 @@ class ProximityInfo {
private: private:
DISALLOW_IMPLICIT_CONSTRUCTORS(ProximityInfo); DISALLOW_IMPLICIT_CONSTRUCTORS(ProximityInfo);
static const float NOT_A_DISTANCE_FLOAT;
void initializeG(); void initializeG();
float calculateNormalizedSquaredDistance(const int keyIndex, const int inputIndex) const; float calculateNormalizedSquaredDistance(const int keyIndex, const int inputIndex) const;

View File

@ -18,14 +18,8 @@
#include "proximity_info_params.h" #include "proximity_info_params.h"
namespace latinime { 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 float ProximityInfoParams::NOT_A_DISTANCE_FLOAT = -1.0f;
const int ProximityInfoParams::MIN_DOUBLE_LETTER_BEELINE_SPEED_PERCENTILE = 5;
/* Per method constants */ /* Per method constants */
// Used by ProximityInfoStateUtils::initGeometricDistanceInfos() // Used by ProximityInfoStateUtils::initGeometricDistanceInfos()
@ -93,6 +87,16 @@ const float ProximityInfoParams::SKIP_PROBABALITY_WEIGHT_FOR_PROBABILITY_GAIN =
// Used by ProximityInfoStateUtils::getMostProbableString() // Used by ProximityInfoStateUtils::getMostProbableString()
const float ProximityInfoParams::DEMOTION_LOG_PROBABILITY = 0.3f; const float ProximityInfoParams::DEMOTION_LOG_PROBABILITY = 0.3f;
// Used by ProximityInfoStateUtils::updateSampledSearchKeysVector()
// TODO: Investigate if this is required // TODO: Investigate if this is required
const float ProximityInfoParams::SEARCH_KEY_RADIUS_RATIO = 0.95f; 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 } // namespace latinime

View File

@ -23,13 +23,8 @@ namespace latinime {
class ProximityInfoParams { class ProximityInfoParams {
public: 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 NOT_A_DISTANCE_FLOAT;
static const float SEARCH_KEY_RADIUS_RATIO; static const int MIN_DOUBLE_LETTER_BEELINE_SPEED_PERCENTILE;
// Used by ProximityInfoStateUtils::initGeometricDistanceInfos() // Used by ProximityInfoStateUtils::initGeometricDistanceInfos()
static const float NEAR_KEY_NORMALIZED_SQUARED_THRESHOLD; static const float NEAR_KEY_NORMALIZED_SQUARED_THRESHOLD;
@ -94,9 +89,19 @@ class ProximityInfoParams {
// Used by ProximityInfoStateUtils::getMostProbableString() // Used by ProximityInfoStateUtils::getMostProbableString()
static const float DEMOTION_LOG_PROBABILITY; 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: private:
DISALLOW_IMPLICIT_CONSTRUCTORS(ProximityInfoParams); DISALLOW_IMPLICIT_CONSTRUCTORS(ProximityInfoParams);
static const int NORMALIZED_SQUARED_DISTANCE_SCALING_FACTOR_LOG_2;
}; };
} // namespace latinime } // namespace latinime
#endif // LATINIME_PROXIMITY_INFO_PARAMS_H #endif // LATINIME_PROXIMITY_INFO_PARAMS_H