aboutsummaryrefslogtreecommitdiffstats
path: root/native/jni/src/proximity_info_state_utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'native/jni/src/proximity_info_state_utils.cpp')
-rw-r--r--native/jni/src/proximity_info_state_utils.cpp20
1 files changed, 6 insertions, 14 deletions
diff --git a/native/jni/src/proximity_info_state_utils.cpp b/native/jni/src/proximity_info_state_utils.cpp
index 2bf327fcc..ccb28bc8c 100644
--- a/native/jni/src/proximity_info_state_utils.cpp
+++ b/native/jni/src/proximity_info_state_utils.cpp
@@ -209,7 +209,7 @@ namespace latinime {
* ProximityInfoParams::NORMALIZED_SQUARED_DISTANCE_SCALING_FACTOR);
} else {
normalizedSquaredDistances[i * MAX_PROXIMITY_CHARS_SIZE + j] =
- (j == 0) ? EQUIVALENT_CHAR_WITHOUT_DISTANCE_INFO :
+ (j == 0) ? MATCH_CHAR_WITHOUT_DISTANCE_INFO :
PROXIMITY_CHAR_WITHOUT_DISTANCE_INFO;
}
if (DEBUG_PROXIMITY_CHARS) {
@@ -634,25 +634,17 @@ namespace latinime {
return getAngleDiff(previousDirection, nextDirection);
}
-// TODO: Remove the "scale" parameter
// This function basically converts from a length to an edit distance. Accordingly, it's obviously
// wrong to compare with mMaxPointToKeyLength.
/* static */ float ProximityInfoStateUtils::getPointToKeyByIdLength(const float maxPointToKeyLength,
const std::vector<float> *const SampledDistanceCache_G, const int keyCount,
- const int inputIndex, const int keyId, const float scale) {
+ const int inputIndex, const int keyId) {
if (keyId != NOT_AN_INDEX) {
const int index = inputIndex * keyCount + keyId;
- return min((*SampledDistanceCache_G)[index] * scale, maxPointToKeyLength);
+ return min((*SampledDistanceCache_G)[index], maxPointToKeyLength);
}
// If the char is not a key on the keyboard then return the max length.
- return static_cast<float>(MAX_POINT_TO_KEY_LENGTH);
-}
-
-/* static */ float ProximityInfoStateUtils::getPointToKeyByIdLength(const float maxPointToKeyLength,
- const std::vector<float> *const SampledDistanceCache_G, const int keyCount,
- const int inputIndex, const int keyId) {
- return getPointToKeyByIdLength(
- maxPointToKeyLength, SampledDistanceCache_G, keyCount, inputIndex, keyId, 1.0f);
+ return static_cast<float>(MAX_VALUE_FOR_WEIGHTING);
}
// Updates probabilities of aligning to some keys and skipping.
@@ -678,7 +670,7 @@ namespace latinime {
const float currentAngle = getPointAngle(sampledInputXs, sampledInputYs, i);
const float speedRate = (*sampledSpeedRates)[i];
- float nearestKeyDistance = static_cast<float>(MAX_POINT_TO_KEY_LENGTH);
+ float nearestKeyDistance = static_cast<float>(MAX_VALUE_FOR_WEIGHTING);
for (int j = 0; j < keyCount; ++j) {
if ((*SampledNearKeySets)[i].test(j)) {
const float distance = getPointToKeyByIdLength(
@@ -1016,7 +1008,7 @@ namespace latinime {
float sumLogProbability = 0.0f;
// TODO: Current implementation is greedy algorithm. DP would be efficient for many cases.
for (int i = 0; i < sampledInputSize && index < MAX_WORD_LENGTH - 1; ++i) {
- float minLogProbability = static_cast<float>(MAX_POINT_TO_KEY_LENGTH);
+ float minLogProbability = static_cast<float>(MAX_VALUE_FOR_WEIGHTING);
int character = NOT_AN_INDEX;
for (hash_map_compat<int, float>::const_iterator it = (*charProbabilities)[i].begin();
it != (*charProbabilities)[i].end(); ++it) {