Loading native/jni/src/proximity_info_state.cpp +4 −14 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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. Loading native/jni/src/proximity_info_state.h +1 −3 Original line number Diff line number Diff line Loading @@ -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; Loading native/jni/src/proximity_info_state_utils.cpp +2 −10 Original line number Diff line number Diff line Loading @@ -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( Loading native/jni/src/proximity_info_state_utils.h +0 −3 Original line number Diff line number Diff line Loading @@ -79,9 +79,6 @@ class ProximityInfoStateUtils { const std::vector<NearKeycodesSet> *const SampledNearKeySets, std::vector<NearKeycodesSet> *sampledSearchKeySets, 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); Loading Loading
native/jni/src/proximity_info_state.cpp +4 −14 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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. Loading
native/jni/src/proximity_info_state.h +1 −3 Original line number Diff line number Diff line Loading @@ -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; Loading
native/jni/src/proximity_info_state_utils.cpp +2 −10 Original line number Diff line number Diff line Loading @@ -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( Loading
native/jni/src/proximity_info_state_utils.h +0 −3 Original line number Diff line number Diff line Loading @@ -79,9 +79,6 @@ class ProximityInfoStateUtils { const std::vector<NearKeycodesSet> *const SampledNearKeySets, std::vector<NearKeycodesSet> *sampledSearchKeySets, 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); Loading