am 29432f84: Create a new directory for layout-related implementations

* commit '29432f843a8cd6ffb2be286104964592e80d77c9':
  Create a new directory for layout-related implementations
This commit is contained in:
Ken Wakasa 2013-05-30 03:59:35 -07:00 committed by Android Git Automerger
commit f002debdfe
23 changed files with 143 additions and 122 deletions

View file

@ -53,10 +53,6 @@ LATIN_IME_CORE_SRC_FILES := \
dictionary.cpp \
dic_traverse_wrapper.cpp \
digraph_utils.cpp \
proximity_info.cpp \
proximity_info_params.cpp \
proximity_info_state.cpp \
proximity_info_state_utils.cpp \
unigram_dictionary.cpp \
words_priority_queue.cpp \
suggest/core/suggest.cpp \
@ -64,6 +60,11 @@ LATIN_IME_CORE_SRC_FILES := \
dic_node.cpp \
dic_node_utils.cpp \
dic_nodes_cache.cpp) \
$(addprefix suggest/core/layout/, \
proximity_info.cpp \
proximity_info_params.cpp \
proximity_info_state.cpp \
proximity_info_state_utils.cpp) \
suggest/core/policy/weighting.cpp \
suggest/core/session/dic_traverse_session.cpp \
suggest/policyimpl/gesture/gesture_suggest_policy_factory.cpp \

View file

@ -17,10 +17,11 @@
#define LOG_TAG "LatinIME: jni: ProximityInfo"
#include "com_android_inputmethod_keyboard_ProximityInfo.h"
#include "defines.h"
#include "jni.h"
#include "jni_common.h"
#include "proximity_info.h"
#include "suggest/core/layout/proximity_info.h"
namespace latinime {

View file

@ -21,8 +21,8 @@
#include "char_utils.h"
#include "correction.h"
#include "defines.h"
#include "proximity_info_state.h"
#include "suggest_utils.h"
#include "suggest/core/layout/proximity_info_state.h"
#include "suggest/core/layout/touch_position_correction_utils.h"
#include "suggest/policyimpl/utils/edit_distance.h"
#include "suggest/policyimpl/utils/damerau_levenshtein_edit_distance_policy.h"
@ -676,8 +676,8 @@ inline static bool isUpperCase(unsigned short c) {
if (i < adjustedProximityMatchedCount) {
multiplyIntCapped(typedLetterMultiplier, &finalFreq);
}
const float factor =
SuggestUtils::getLengthScalingFactor(static_cast<float>(squaredDistance));
const float factor = TouchPositionCorrectionUtils::getLengthScalingFactor(
static_cast<float>(squaredDistance));
if (factor > 0.0f) {
multiplyRate(static_cast<int>(factor * 100.0f), &finalFreq);
} else if (squaredDistance == PROXIMITY_CHAR_WITHOUT_DISTANCE_INFO) {

View file

@ -21,7 +21,7 @@
#include "correction_state.h"
#include "defines.h"
#include "proximity_info_state.h"
#include "suggest/core/layout/proximity_info_state.h"
namespace latinime {

View file

@ -1,53 +0,0 @@
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef LATINIME_GEOMETRY_UTILS_H
#define LATINIME_GEOMETRY_UTILS_H
#include <cmath>
#include "defines.h"
#define ROUND_FLOAT_10000(f) ((f) < 1000.0f && (f) > 0.001f) \
? (floorf((f) * 10000.0f) / 10000.0f) : (f)
namespace latinime {
static inline float SQUARE_FLOAT(const float x) { return x * x; }
static AK_FORCE_INLINE float getAngle(const int x1, const int y1, const int x2, const int y2) {
const int dx = x1 - x2;
const int dy = y1 - y2;
if (dx == 0 && dy == 0) return 0.0f;
return atan2f(static_cast<float>(dy), static_cast<float>(dx));
}
static AK_FORCE_INLINE float getAngleDiff(const float a1, const float a2) {
const float deltaA = fabsf(a1 - a2);
const float diff = ROUND_FLOAT_10000(deltaA);
if (diff > M_PI_F) {
const float normalizedDiff = 2.0f * M_PI_F - diff;
return ROUND_FLOAT_10000(normalizedDiff);
}
return diff;
}
static AK_FORCE_INLINE int getDistanceInt(const int x1, const int y1, const int x2,
const int y2) {
return static_cast<int>(hypotf(static_cast<float>(x1 - x2), static_cast<float>(y1 - y2)));
}
} // namespace latinime
#endif // LATINIME_GEOMETRY_UTILS_H

View file

@ -22,8 +22,8 @@
#include "dic_node_utils.h"
#include "dic_node_vector.h"
#include "multi_bigram_map.h"
#include "proximity_info.h"
#include "proximity_info_state.h"
#include "suggest/core/layout/proximity_info.h"
#include "suggest/core/layout/proximity_info_state.h"
namespace latinime {

View file

@ -0,0 +1,59 @@
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef LATINIME_GEOMETRY_UTILS_H
#define LATINIME_GEOMETRY_UTILS_H
#include <cmath>
#include "defines.h"
#define ROUND_FLOAT_10000(f) ((f) < 1000.0f && (f) > 0.001f) \
? (floorf((f) * 10000.0f) / 10000.0f) : (f)
namespace latinime {
class GeometryUtils {
public:
static inline float SQUARE_FLOAT(const float x) { return x * x; }
static AK_FORCE_INLINE float getAngle(const int x1, const int y1, const int x2, const int y2) {
const int dx = x1 - x2;
const int dy = y1 - y2;
if (dx == 0 && dy == 0) return 0.0f;
return atan2f(static_cast<float>(dy), static_cast<float>(dx));
}
static AK_FORCE_INLINE float getAngleDiff(const float a1, const float a2) {
const float deltaA = fabsf(a1 - a2);
const float diff = ROUND_FLOAT_10000(deltaA);
if (diff > M_PI_F) {
const float normalizedDiff = 2.0f * M_PI_F - diff;
return ROUND_FLOAT_10000(normalizedDiff);
}
return diff;
}
static AK_FORCE_INLINE int getDistanceInt(const int x1, const int y1, const int x2,
const int y2) {
return static_cast<int>(hypotf(static_cast<float>(x1 - x2), static_cast<float>(y1 - y2)));
}
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(GeometryUtils);
};
} // namespace latinime
#endif // LATINIME_GEOMETRY_UTILS_H

View file

@ -14,6 +14,8 @@
* limitations under the License.
*/
#include "suggest/core/layout/proximity_info.h"
#include <cstring>
#include <cmath>
@ -22,10 +24,9 @@
#include "additional_proximity_chars.h"
#include "char_utils.h"
#include "defines.h"
#include "geometry_utils.h"
#include "jni.h"
#include "proximity_info.h"
#include "proximity_info_params.h"
#include "suggest/core/layout/geometry_utils.h"
#include "suggest/core/layout/proximity_info_params.h"
namespace latinime {
@ -58,7 +59,7 @@ ProximityInfo::ProximityInfo(JNIEnv *env, const jstring localeJStr,
MOST_COMMON_KEY_WIDTH_SQUARE(mostCommonKeyWidth * mostCommonKeyWidth),
MOST_COMMON_KEY_HEIGHT(mostCommonKeyHeight),
NORMALIZED_SQUARED_MOST_COMMON_KEY_HYPOTENUSE(1.0f +
SQUARE_FLOAT(static_cast<float>(mostCommonKeyHeight) /
GeometryUtils::SQUARE_FLOAT(static_cast<float>(mostCommonKeyHeight) /
static_cast<float>(mostCommonKeyWidth))),
CELL_WIDTH((keyboardWidth + gridWidth - 1) / gridWidth),
CELL_HEIGHT((keyboardHeight + gridHeight - 1) / gridHeight),
@ -150,7 +151,7 @@ float ProximityInfo::getNormalizedSquaredDistanceFromCenterFloatG(
const float touchY = static_cast<float>(y);
const float keyWidth = static_cast<float>(getMostCommonKeyWidth());
return ProximityInfoUtils::getSquaredDistanceFloat(centerX, centerY, touchX, touchY)
/ SQUARE_FLOAT(keyWidth);
/ GeometryUtils::SQUARE_FLOAT(keyWidth);
}
int ProximityInfo::getCodePointOf(const int keyIndex) const {
@ -173,7 +174,7 @@ void ProximityInfo::initializeG() {
for (int i = 0; i < KEY_COUNT; i++) {
mKeyKeyDistancesG[i][i] = 0;
for (int j = i + 1; j < KEY_COUNT; j++) {
mKeyKeyDistancesG[i][j] = getDistanceInt(
mKeyKeyDistancesG[i][j] = GeometryUtils::getDistanceInt(
mCenterXsG[i], mCenterYsG[i], mCenterXsG[j], mCenterYsG[j]);
mKeyKeyDistancesG[j][i] = mKeyKeyDistancesG[i][j];
}

View file

@ -20,7 +20,7 @@
#include "defines.h"
#include "hash_map_compat.h"
#include "jni.h"
#include "proximity_info_utils.h"
#include "suggest/core/layout/proximity_info_utils.h"
namespace latinime {

View file

@ -15,7 +15,7 @@
*/
#include "defines.h"
#include "proximity_info_params.h"
#include "suggest/core/layout/proximity_info_params.h"
namespace latinime {
const float ProximityInfoParams::NOT_A_DISTANCE_FLOAT = -1.0f;

View file

@ -14,6 +14,8 @@
* limitations under the License.
*/
#include "suggest/core/layout/proximity_info_state.h"
#include <cstring> // for memset() and memcpy()
#include <sstream> // for debug prints
#include <vector>
@ -21,10 +23,9 @@
#define LOG_TAG "LatinIME: proximity_info_state.cpp"
#include "defines.h"
#include "geometry_utils.h"
#include "proximity_info.h"
#include "proximity_info_state.h"
#include "proximity_info_state_utils.h"
#include "suggest/core/layout/geometry_utils.h"
#include "suggest/core/layout/proximity_info.h"
#include "suggest/core/layout/proximity_info_state_utils.h"
namespace latinime {

View file

@ -23,8 +23,8 @@
#include "char_utils.h"
#include "defines.h"
#include "hash_map_compat.h"
#include "proximity_info_params.h"
#include "proximity_info_state_utils.h"
#include "suggest/core/layout/proximity_info_params.h"
#include "suggest/core/layout/proximity_info_state_utils.h"
namespace latinime {

View file

@ -14,16 +14,17 @@
* limitations under the License.
*/
#include "suggest/core/layout/proximity_info_state_utils.h"
#include <cmath>
#include <cstring> // for memset()
#include <sstream> // for debug prints
#include <vector>
#include "defines.h"
#include "geometry_utils.h"
#include "proximity_info.h"
#include "proximity_info_params.h"
#include "proximity_info_state_utils.h"
#include "suggest/core/layout/geometry_utils.h"
#include "suggest/core/layout/proximity_info.h"
#include "suggest/core/layout/proximity_info_params.h"
namespace latinime {
@ -103,12 +104,12 @@ namespace latinime {
const int time = times ? times[i] : -1;
if (i > 1) {
const float prevAngle = getAngle(
const float prevAngle = GeometryUtils::getAngle(
inputXCoordinates[i - 2], inputYCoordinates[i - 2],
inputXCoordinates[i - 1], inputYCoordinates[i - 1]);
const float currentAngle = getAngle(
const float currentAngle = GeometryUtils::getAngle(
inputXCoordinates[i - 1], inputYCoordinates[i - 1], x, y);
sumAngle += getAngleDiff(prevAngle, currentAngle);
sumAngle += GeometryUtils::getAngleDiff(prevAngle, currentAngle);
}
if (pushTouchPoint(proximityInfo, maxPointToKeyLength, i, c, x, y, time,
@ -157,7 +158,8 @@ namespace latinime {
const float sweetSpotCenterY = proximityInfo->getSweetSpotCenterYAt(keyIndex);
const float inputX = static_cast<float>((*sampledInputXs)[inputIndex]);
const float inputY = static_cast<float>((*sampledInputYs)[inputIndex]);
return SQUARE_FLOAT(inputX - sweetSpotCenterX) + SQUARE_FLOAT(inputY - sweetSpotCenterY);
return GeometryUtils::SQUARE_FLOAT(inputX - sweetSpotCenterX)
+ GeometryUtils::SQUARE_FLOAT(inputY - sweetSpotCenterY);
}
/* static */ float ProximityInfoStateUtils::calculateNormalizedSquaredDistance(
@ -174,7 +176,8 @@ namespace latinime {
}
const float squaredDistance = calculateSquaredDistanceFromSweetSpotCenter(proximityInfo,
sampledInputXs, sampledInputYs, keyIndex, inputIndex);
const float squaredRadius = SQUARE_FLOAT(proximityInfo->getSweetSpotRadiiAt(keyIndex));
const float squaredRadius = GeometryUtils::SQUARE_FLOAT(
proximityInfo->getSweetSpotRadiiAt(keyIndex));
return squaredDistance / squaredRadius;
}
@ -285,7 +288,7 @@ namespace latinime {
if (i < sampledInputSize - 1 && j >= (*sampledInputIndice)[i + 1]) {
break;
}
length += getDistanceInt(xCoordinates[j], yCoordinates[j],
length += GeometryUtils::getDistanceInt(xCoordinates[j], yCoordinates[j],
xCoordinates[j + 1], yCoordinates[j + 1]);
duration += times[j + 1] - times[j];
}
@ -296,7 +299,7 @@ namespace latinime {
break;
}
// TODO: use mSampledLengthCache instead?
length += getDistanceInt(xCoordinates[j], yCoordinates[j],
length += GeometryUtils::getDistanceInt(xCoordinates[j], yCoordinates[j],
xCoordinates[j + 1], yCoordinates[j + 1]);
duration += times[j + 1] - times[j];
}
@ -349,7 +352,7 @@ namespace latinime {
const int y1 = (*sampledInputYs)[index0];
const int x2 = (*sampledInputXs)[index1];
const int y2 = (*sampledInputYs)[index1];
return getAngle(x1, y1, x2, y2);
return GeometryUtils::getAngle(x1, y1, x2, y2);
}
// Calculating point to key distance for all near keys and returning the distance between
@ -411,9 +414,9 @@ namespace latinime {
}
const int baseSampleRate = mostCommonKeyWidth;
const int distPrev = getDistanceInt(sampledInputXs->back(), sampledInputYs->back(),
(*sampledInputXs)[size - 2], (*sampledInputYs)[size - 2])
* ProximityInfoParams::DISTANCE_BASE_SCALE;
const int distPrev = GeometryUtils::getDistanceInt(sampledInputXs->back(),
sampledInputYs->back(), (*sampledInputXs)[size - 2],
(*sampledInputYs)[size - 2]) * ProximityInfoParams::DISTANCE_BASE_SCALE;
float score = 0.0f;
// Location
@ -425,10 +428,11 @@ namespace latinime {
score += ProximityInfoParams::LOCALMIN_DISTANCE_AND_NEAR_TO_KEY_SCORE;
}
// Angle
const float angle1 = getAngle(x, y, sampledInputXs->back(), sampledInputYs->back());
const float angle2 = getAngle(sampledInputXs->back(), sampledInputYs->back(),
const float angle1 = GeometryUtils::getAngle(x, y, sampledInputXs->back(),
sampledInputYs->back());
const float angle2 = GeometryUtils::getAngle(sampledInputXs->back(), sampledInputYs->back(),
(*sampledInputXs)[size - 2], (*sampledInputYs)[size - 2]);
const float angleDiff = getAngleDiff(angle1, angle2);
const float angleDiff = GeometryUtils::getAngleDiff(angle1, angle2);
// Save corner
if (distPrev > baseSampleRate * ProximityInfoParams::CORNER_CHECK_DISTANCE_THRESHOLD_SCALE
@ -472,13 +476,13 @@ namespace latinime {
}
// Check if the last point should be skipped.
if (isLastPoint && size > 0) {
if (getDistanceInt(x, y, sampledInputXs->back(), sampledInputYs->back())
if (GeometryUtils::getDistanceInt(x, y, sampledInputXs->back(), sampledInputYs->back())
* ProximityInfoParams::LAST_POINT_SKIP_DISTANCE_SCALE < mostCommonKeyWidth) {
// This point is not used because it's too close to the previous point.
if (DEBUG_GEO_FULL) {
AKLOGI("p0: size = %zd, x = %d, y = %d, lx = %d, ly = %d, dist = %d, "
"width = %d", size, x, y, sampledInputXs->back(),
sampledInputYs->back(), getDistanceInt(
sampledInputYs->back(), GeometryUtils::getDistanceInt(
x, y, sampledInputXs->back(), sampledInputYs->back()),
mostCommonKeyWidth
/ ProximityInfoParams::LAST_POINT_SKIP_DISTANCE_SCALE);
@ -499,7 +503,7 @@ namespace latinime {
// Pushing point information.
if (size > 0) {
sampledLengthCache->push_back(
sampledLengthCache->back() + getDistanceInt(
sampledLengthCache->back() + GeometryUtils::getDistanceInt(
x, y, sampledInputXs->back(), sampledInputYs->back()));
} else {
sampledLengthCache->push_back(0);
@ -540,7 +544,8 @@ namespace latinime {
while (start > 0 && tempBeelineDistance < lookupRadius) {
tempTime += times[start] - times[start - 1];
--start;
tempBeelineDistance = getDistanceInt(x0, y0, xCoordinates[start], yCoordinates[start]);
tempBeelineDistance = GeometryUtils::getDistanceInt(x0, y0, xCoordinates[start],
yCoordinates[start]);
}
// Exclusive unless this is an edge point
if (start > 0 && start < actualInputIndex) {
@ -553,7 +558,8 @@ namespace latinime {
while (end < (inputSize - 1) && tempBeelineDistance < lookupRadius) {
tempTime += times[end + 1] - times[end];
++end;
tempBeelineDistance = getDistanceInt(x0, y0, xCoordinates[end], yCoordinates[end]);
tempBeelineDistance = GeometryUtils::getDistanceInt(x0, y0, xCoordinates[end],
yCoordinates[end]);
}
// Exclusive unless this is an edge point
if (end > actualInputIndex && end < (inputSize - 1)) {
@ -571,7 +577,7 @@ namespace latinime {
const int y2 = yCoordinates[start];
const int x3 = xCoordinates[end];
const int y3 = yCoordinates[end];
const int beelineDistance = getDistanceInt(x2, y2, x3, y3);
const int beelineDistance = GeometryUtils::getDistanceInt(x2, y2, x3, y3);
int adjustedStartTime = times[start];
if (start == 0 && actualInputIndex == 0 && inputSize > 1) {
adjustedStartTime += ProximityInfoParams::FIRST_POINT_TIME_OFFSET_MILLIS;
@ -613,7 +619,7 @@ namespace latinime {
}
const float previousDirection = getDirection(sampledInputXs, sampledInputYs, index - 1, index);
const float nextDirection = getDirection(sampledInputXs, sampledInputYs, index, index + 1);
const float directionDiff = getAngleDiff(previousDirection, nextDirection);
const float directionDiff = GeometryUtils::getAngleDiff(previousDirection, nextDirection);
return directionDiff;
}
@ -636,7 +642,7 @@ namespace latinime {
}
const float previousDirection = getDirection(sampledInputXs, sampledInputYs, index0, index1);
const float nextDirection = getDirection(sampledInputXs, sampledInputYs, index1, index2);
return getAngleDiff(previousDirection, nextDirection);
return GeometryUtils::getAngleDiff(previousDirection, nextDirection);
}
// This function basically converts from a length to an edit distance. Accordingly, it's obviously

View file

@ -22,8 +22,8 @@
#include "additional_proximity_chars.h"
#include "char_utils.h"
#include "defines.h"
#include "geometry_utils.h"
#include "hash_map_compat.h"
#include "suggest/core/layout/geometry_utils.h"
namespace latinime {
class ProximityInfoUtils {
@ -87,7 +87,7 @@ class ProximityInfoUtils {
static inline float getSquaredDistanceFloat(const float x1, const float y1, const float x2,
const float y2) {
return SQUARE_FLOAT(x1 - x2) + SQUARE_FLOAT(y1 - y2);
return GeometryUtils::SQUARE_FLOAT(x1 - x2) + GeometryUtils::SQUARE_FLOAT(y1 - y2);
}
static inline float pointToLineSegSquaredDistanceFloat(const float x, const float y,
@ -98,7 +98,8 @@ class ProximityInfoUtils {
const float ray2y = y2 - y1;
const float dotProduct = ray1x * ray2x + ray1y * ray2y;
const float lineLengthSqr = SQUARE_FLOAT(ray2x) + SQUARE_FLOAT(ray2y);
const float lineLengthSqr = GeometryUtils::SQUARE_FLOAT(ray2x)
+ GeometryUtils::SQUARE_FLOAT(ray2y);
const float projectionLengthSqr = dotProduct / lineLengthSqr;
float projectionX;
@ -121,12 +122,14 @@ class ProximityInfoUtils {
public:
NormalDistribution(const float u, const float sigma)
: mU(u), mSigma(sigma),
mPreComputedNonExpPart(1.0f / sqrtf(2.0f * M_PI_F * SQUARE_FLOAT(sigma))),
mPreComputedExponentPart(-1.0f / (2.0f * SQUARE_FLOAT(sigma))) {}
mPreComputedNonExpPart(1.0f / sqrtf(2.0f * M_PI_F
* GeometryUtils::SQUARE_FLOAT(sigma))),
mPreComputedExponentPart(-1.0f / (2.0f * GeometryUtils::SQUARE_FLOAT(sigma))) {}
float getProbabilityDensity(const float x) const {
const float shiftedX = x - mU;
return mPreComputedNonExpPart * expf(mPreComputedExponentPart * SQUARE_FLOAT(shiftedX));
return mPreComputedNonExpPart
* expf(mPreComputedExponentPart * GeometryUtils::SQUARE_FLOAT(shiftedX));
}
private:

View file

@ -14,14 +14,14 @@
* limitations under the License.
*/
#ifndef LATINIME_SUGGEST_UTILS_H
#define LATINIME_SUGGEST_UTILS_H
#ifndef LATINIME_TOUCH_POSITION_CORRECTION_UTILS_H
#define LATINIME_TOUCH_POSITION_CORRECTION_UTILS_H
#include "defines.h"
#include "proximity_info_params.h"
namespace latinime {
class SuggestUtils {
class TouchPositionCorrectionUtils {
public:
// TODO: (OLD) Remove
static float getLengthScalingFactor(const float normalizedSquaredDistance) {
@ -82,7 +82,7 @@ class SuggestUtils {
}
}
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(SuggestUtils);
DISALLOW_IMPLICIT_CONSTRUCTORS(TouchPositionCorrectionUtils);
};
} // namespace latinime
#endif // LATINIME_SUGGEST_UTILS_H
#endif // LATINIME_TOUCH_POSITION_CORRECTION_UTILS_H

View file

@ -23,8 +23,8 @@
#include "defines.h"
#include "jni.h"
#include "multi_bigram_map.h"
#include "proximity_info_state.h"
#include "suggest/core/dicnode/dic_nodes_cache.h"
#include "suggest/core/layout/proximity_info_state.h"
namespace latinime {

View file

@ -19,11 +19,11 @@
#include "char_utils.h"
#include "dictionary.h"
#include "digraph_utils.h"
#include "proximity_info.h"
#include "suggest/core/dicnode/dic_node.h"
#include "suggest/core/dicnode/dic_node_priority_queue.h"
#include "suggest/core/dicnode/dic_node_vector.h"
#include "suggest/core/dictionary/shortcut_utils.h"
#include "suggest/core/layout/proximity_info.h"
#include "suggest/core/policy/scoring.h"
#include "suggest/core/policy/traversal.h"
#include "suggest/core/policy/weighting.h"

View file

@ -21,9 +21,9 @@
#include "char_utils.h"
#include "defines.h"
#include "proximity_info_state.h"
#include "suggest/core/dicnode/dic_node.h"
#include "suggest/core/dicnode/dic_node_vector.h"
#include "suggest/core/layout/proximity_info_state.h"
#include "suggest/core/policy/traversal.h"
#include "suggest/core/session/dic_traverse_session.h"
#include "suggest/policyimpl/typing/scoring_params.h"

View file

@ -18,8 +18,8 @@
#define LATINIME_TYPING_WEIGHTING_H
#include "defines.h"
#include "suggest_utils.h"
#include "suggest/core/dicnode/dic_node_utils.h"
#include "suggest/core/layout/touch_position_correction_utils.h"
#include "suggest/core/policy/weighting.h"
#include "suggest/core/session/dic_traverse_session.h"
#include "suggest/policyimpl/typing/scoring_params.h"
@ -74,7 +74,7 @@ class TypingWeighting : public Weighting {
// the keyboard (like accented letters)
const float normalizedSquaredLength = traverseSession->getProximityInfoState(0)
->getPointToKeyLength(pointIndex, dicNode->getNodeCodePoint());
const float normalizedDistance = SuggestUtils::getSweetSpotFactor(
const float normalizedDistance = TouchPositionCorrectionUtils::getSweetSpotFactor(
traverseSession->isTouchPositionCorrectionEnabled(), normalizedSquaredLength);
const float weightedDistance = ScoringParams::DISTANCE_WEIGHT_LENGTH * normalizedDistance;

View file

@ -39,6 +39,8 @@ class SuggestOptions{
}
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(SuggestOptions);
// Need to update com.android.inputmethod.latin.NativeSuggestOptions when you add, remove or
// reorder options.
static const int IS_GESTURE = 0;

View file

@ -23,7 +23,7 @@
#include "defines.h"
#include "dictionary.h"
#include "digraph_utils.h"
#include "proximity_info.h"
#include "suggest/core/layout/proximity_info.h"
#include "terminal_attributes.h"
#include "unigram_dictionary.h"
#include "words_priority_queue.h"