aboutsummaryrefslogtreecommitdiffstats
path: root/native/jni/src
diff options
context:
space:
mode:
Diffstat (limited to 'native/jni/src')
-rw-r--r--native/jni/src/char_utils.cpp6
-rw-r--r--native/jni/src/proximity_info_state.cpp18
-rw-r--r--native/jni/src/proximity_info_state.h4
-rw-r--r--native/jni/src/proximity_info_state_utils.cpp12
-rw-r--r--native/jni/src/proximity_info_state_utils.h3
5 files changed, 11 insertions, 32 deletions
diff --git a/native/jni/src/char_utils.cpp b/native/jni/src/char_utils.cpp
index f1148f4d4..8d917ea74 100644
--- a/native/jni/src/char_utils.cpp
+++ b/native/jni/src/char_utils.cpp
@@ -1070,12 +1070,14 @@ const unsigned short BASE_CHARS[BASE_CHARS_SIZE] = {
/* U+0418 */ 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
// U+0419: Manually changed from 0418 to 0419
/* U+0420 */ 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427,
- /* U+0428 */ 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F,
+ /* U+0428 */ 0x0428, 0x0429, 0x042C, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F,
+ // U+042A: Manually changed from 042A to 042C
/* U+0430 */ 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437,
/* U+0438 */ 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F,
// U+0439: Manually changed from 0438 to 0439
/* U+0440 */ 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447,
- /* U+0448 */ 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F,
+ /* U+0448 */ 0x0448, 0x0449, 0x044C, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F,
+ // U+044A: Manually changed from 044A to 044C
/* U+0450 */ 0x0435, 0x0435, 0x0452, 0x0433, 0x0454, 0x0455, 0x0456, 0x0456,
/* U+0458 */ 0x0458, 0x0459, 0x045A, 0x045B, 0x043A, 0x0438, 0x0443, 0x045F,
/* U+0460 */ 0x0460, 0x0461, 0x0462, 0x0463, 0x0464, 0x0465, 0x0466, 0x0467,
diff --git a/native/jni/src/proximity_info_state.cpp b/native/jni/src/proximity_info_state.cpp
index 00e7ffc6c..7ec3c5400 100644
--- a/native/jni/src/proximity_info_state.cpp
+++ b/native/jni/src/proximity_info_state.cpp
@@ -156,15 +156,14 @@ void ProximityInfoState::initInputParams(const int pointerId, const float maxPoi
}
}
-// 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.
float ProximityInfoState::getPointToKeyLength(
- const int inputIndex, const int codePoint, const float scale) const {
+ const int inputIndex, const int codePoint) const {
const int keyId = mProximityInfo->getKeyIndexOf(codePoint);
if (keyId != NOT_AN_INDEX) {
const int index = inputIndex * mProximityInfo->getKeyCount() + keyId;
- return min(mSampledDistanceCache_G[index] * scale, mMaxPointToKeyLength);
+ return min(mSampledDistanceCache_G[index], mMaxPointToKeyLength);
}
if (isSkippableCodePoint(codePoint)) {
return 0.0f;
@@ -173,19 +172,10 @@ float ProximityInfoState::getPointToKeyLength(
return static_cast<float>(MAX_VALUE_FOR_WEIGHTING);
}
-float ProximityInfoState::getPointToKeyLength_G(const int inputIndex, const int codePoint) const {
- return getPointToKeyLength(inputIndex, codePoint, 1.0f);
-}
-
-// TODO: Remove the "scale" parameter
float ProximityInfoState::getPointToKeyByIdLength(
- const int inputIndex, const int keyId, const float scale) const {
+ const int inputIndex, const int keyId) const {
return ProximityInfoStateUtils::getPointToKeyByIdLength(mMaxPointToKeyLength,
- &mSampledDistanceCache_G, mProximityInfo->getKeyCount(), inputIndex, keyId, scale);
-}
-
-float ProximityInfoState::getPointToKeyByIdLength(const int inputIndex, const int keyId) const {
- return getPointToKeyByIdLength(inputIndex, keyId, 1.0f);
+ &mSampledDistanceCache_G, mProximityInfo->getKeyCount(), inputIndex, keyId);
}
// In the following function, c is the current character of the dictionary word currently examined.
diff --git a/native/jni/src/proximity_info_state.h b/native/jni/src/proximity_info_state.h
index dd1eb764f..224240b00 100644
--- a/native/jni/src/proximity_info_state.h
+++ b/native/jni/src/proximity_info_state.h
@@ -147,10 +147,8 @@ class ProximityInfoState {
return mIsContinuationPossible;
}
- float getPointToKeyByIdLength(const int inputIndex, const int keyId, const float scale) const;
float getPointToKeyByIdLength(const int inputIndex, const int keyId) const;
- float getPointToKeyLength(const int inputIndex, const int codePoint, const float scale) const;
- float getPointToKeyLength_G(const int inputIndex, const int codePoint) const;
+ float getPointToKeyLength(const int inputIndex, const int codePoint) const;
ProximityType getProximityType(const int index, const int codePoint,
const bool checkProximityChars, int *proximityIndex = 0) const;
diff --git a/native/jni/src/proximity_info_state_utils.cpp b/native/jni/src/proximity_info_state_utils.cpp
index 2ca39f9e3..7cbc88cff 100644
--- a/native/jni/src/proximity_info_state_utils.cpp
+++ b/native/jni/src/proximity_info_state_utils.cpp
@@ -634,27 +634,19 @@ 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_VALUE_FOR_WEIGHTING);
}
-/* 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);
-}
-
// Updates probabilities of aligning to some keys and skipping.
// Word suggestion should be based on this probabilities.
/* static */ void ProximityInfoStateUtils::updateAlignPointProbabilities(
diff --git a/native/jni/src/proximity_info_state_utils.h b/native/jni/src/proximity_info_state_utils.h
index d55730aca..a7f4a3425 100644
--- a/native/jni/src/proximity_info_state_utils.h
+++ b/native/jni/src/proximity_info_state_utils.h
@@ -81,9 +81,6 @@ class ProximityInfoStateUtils {
std::vector<std::vector<int> > *sampledSearchKeyVectors);
static float getPointToKeyByIdLength(const float maxPointToKeyLength,
const std::vector<float> *const SampledDistanceCache_G, const int keyCount,
- const int inputIndex, const int keyId, const float scale);
- static float getPointToKeyByIdLength(const float maxPointToKeyLength,
- const std::vector<float> *const SampledDistanceCache_G, const int keyCount,
const int inputIndex, const int keyId);
static void initGeometricDistanceInfos(const ProximityInfo *const proximityInfo,
const int sampledInputSize, const int lastSavedInputSize,