Loading native/jni/src/dictionary.h +9 −9 Original line number Diff line number Diff line Loading @@ -31,15 +31,15 @@ class UnigramDictionary; class Dictionary { public: // Taken from SuggestedWords.java const static int KIND_TYPED = 0; // What user typed const static int KIND_CORRECTION = 1; // Simple correction/suggestion const static int KIND_COMPLETION = 2; // Completion (suggestion with appended chars) const static int KIND_WHITELIST = 3; // Whitelisted word const static int KIND_BLACKLIST = 4; // Blacklisted word const static int KIND_HARDCODED = 5; // Hardcoded suggestion, e.g. punctuation const static int KIND_APP_DEFINED = 6; // Suggested by the application const static int KIND_SHORTCUT = 7; // A shortcut const static int KIND_PREDICTION = 8; // A prediction (== a suggestion with no input) static const int KIND_TYPED = 0; // What user typed static const int KIND_CORRECTION = 1; // Simple correction/suggestion static const int KIND_COMPLETION = 2; // Completion (suggestion with appended chars) static const int KIND_WHITELIST = 3; // Whitelisted word static const int KIND_BLACKLIST = 4; // Blacklisted word static const int KIND_HARDCODED = 5; // Hardcoded suggestion, e.g. punctuation static const int KIND_APP_DEFINED = 6; // Suggested by the application static const int KIND_SHORTCUT = 7; // A shortcut static const int KIND_PREDICTION = 8; // A prediction (== a suggestion with no input) Dictionary(void *dict, int dictSize, int mmapFd, int dictBufAdjust); Loading native/jni/src/proximity_info.cpp +3 −4 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include "geometry_utils.h" #include "jni.h" #include "proximity_info.h" #include "proximity_info_params.h" namespace latinime { Loading Loading @@ -127,17 +128,15 @@ bool ProximityInfo::hasSpaceProximity(const int x, const int y) const { float ProximityInfo::getNormalizedSquaredDistanceFromCenterFloatG( const int keyId, const int x, const int y) const { const static float verticalSweetSpotScaleForGeometric = 1.1f; const bool correctTouchPosition = hasTouchPositionCorrectionData(); const float centerX = static_cast<float>(correctTouchPosition ? getSweetSpotCenterXAt(keyId) const float centerX = static_cast<float>(correctTouchPosition ? getSweetSpotCenterXAt(keyId) : getKeyCenterXOfKeyIdG(keyId)); const float visualKeyCenterY = static_cast<float>(getKeyCenterYOfKeyIdG(keyId)); float centerY; if (correctTouchPosition) { const float sweetSpotCenterY = static_cast<float>(getSweetSpotCenterYAt(keyId)); const float gapY = sweetSpotCenterY - visualKeyCenterY; centerY = visualKeyCenterY + gapY * verticalSweetSpotScaleForGeometric; centerY = visualKeyCenterY + gapY * ProximityInfoParams::VERTICAL_SWEET_SPOT_SCALE_G; } else { centerY = visualKeyCenterY; } Loading native/jni/src/proximity_info_params.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ namespace latinime { const float ProximityInfoParams::NOT_A_DISTANCE_FLOAT = -1.0f; const int ProximityInfoParams::MIN_DOUBLE_LETTER_BEELINE_SPEED_PERCENTILE = 5; const float ProximityInfoParams::VERTICAL_SWEET_SPOT_SCALE_G = 1.1f; /* Per method constants */ // Used by ProximityInfoStateUtils::initGeometricDistanceInfos() Loading native/jni/src/proximity_info_params.h +1 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ class ProximityInfoParams { public: static const float NOT_A_DISTANCE_FLOAT; static const int MIN_DOUBLE_LETTER_BEELINE_SPEED_PERCENTILE; static const float VERTICAL_SWEET_SPOT_SCALE_G; // Used by ProximityInfoStateUtils::initGeometricDistanceInfos() static const float NEAR_KEY_NORMALIZED_SQUARED_THRESHOLD; Loading Loading
native/jni/src/dictionary.h +9 −9 Original line number Diff line number Diff line Loading @@ -31,15 +31,15 @@ class UnigramDictionary; class Dictionary { public: // Taken from SuggestedWords.java const static int KIND_TYPED = 0; // What user typed const static int KIND_CORRECTION = 1; // Simple correction/suggestion const static int KIND_COMPLETION = 2; // Completion (suggestion with appended chars) const static int KIND_WHITELIST = 3; // Whitelisted word const static int KIND_BLACKLIST = 4; // Blacklisted word const static int KIND_HARDCODED = 5; // Hardcoded suggestion, e.g. punctuation const static int KIND_APP_DEFINED = 6; // Suggested by the application const static int KIND_SHORTCUT = 7; // A shortcut const static int KIND_PREDICTION = 8; // A prediction (== a suggestion with no input) static const int KIND_TYPED = 0; // What user typed static const int KIND_CORRECTION = 1; // Simple correction/suggestion static const int KIND_COMPLETION = 2; // Completion (suggestion with appended chars) static const int KIND_WHITELIST = 3; // Whitelisted word static const int KIND_BLACKLIST = 4; // Blacklisted word static const int KIND_HARDCODED = 5; // Hardcoded suggestion, e.g. punctuation static const int KIND_APP_DEFINED = 6; // Suggested by the application static const int KIND_SHORTCUT = 7; // A shortcut static const int KIND_PREDICTION = 8; // A prediction (== a suggestion with no input) Dictionary(void *dict, int dictSize, int mmapFd, int dictBufAdjust); Loading
native/jni/src/proximity_info.cpp +3 −4 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include "geometry_utils.h" #include "jni.h" #include "proximity_info.h" #include "proximity_info_params.h" namespace latinime { Loading Loading @@ -127,17 +128,15 @@ bool ProximityInfo::hasSpaceProximity(const int x, const int y) const { float ProximityInfo::getNormalizedSquaredDistanceFromCenterFloatG( const int keyId, const int x, const int y) const { const static float verticalSweetSpotScaleForGeometric = 1.1f; const bool correctTouchPosition = hasTouchPositionCorrectionData(); const float centerX = static_cast<float>(correctTouchPosition ? getSweetSpotCenterXAt(keyId) const float centerX = static_cast<float>(correctTouchPosition ? getSweetSpotCenterXAt(keyId) : getKeyCenterXOfKeyIdG(keyId)); const float visualKeyCenterY = static_cast<float>(getKeyCenterYOfKeyIdG(keyId)); float centerY; if (correctTouchPosition) { const float sweetSpotCenterY = static_cast<float>(getSweetSpotCenterYAt(keyId)); const float gapY = sweetSpotCenterY - visualKeyCenterY; centerY = visualKeyCenterY + gapY * verticalSweetSpotScaleForGeometric; centerY = visualKeyCenterY + gapY * ProximityInfoParams::VERTICAL_SWEET_SPOT_SCALE_G; } else { centerY = visualKeyCenterY; } Loading
native/jni/src/proximity_info_params.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ namespace latinime { const float ProximityInfoParams::NOT_A_DISTANCE_FLOAT = -1.0f; const int ProximityInfoParams::MIN_DOUBLE_LETTER_BEELINE_SPEED_PERCENTILE = 5; const float ProximityInfoParams::VERTICAL_SWEET_SPOT_SCALE_G = 1.1f; /* Per method constants */ // Used by ProximityInfoStateUtils::initGeometricDistanceInfos() Loading
native/jni/src/proximity_info_params.h +1 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ class ProximityInfoParams { public: static const float NOT_A_DISTANCE_FLOAT; static const int MIN_DOUBLE_LETTER_BEELINE_SPEED_PERCENTILE; static const float VERTICAL_SWEET_SPOT_SCALE_G; // Used by ProximityInfoStateUtils::initGeometricDistanceInfos() static const float NEAR_KEY_NORMALIZED_SQUARED_THRESHOLD; Loading