Merge "Several cleanups"

main
Ken Wakasa 2014-03-17 10:04:23 +00:00 committed by Android (Google) Code Review
commit 6784f95b06
3 changed files with 11 additions and 18 deletions

View File

@ -344,10 +344,6 @@ static inline void prof_out(void) {
#define MAX_POINTER_COUNT 1 #define MAX_POINTER_COUNT 1
#define MAX_POINTER_COUNT_G 2 #define MAX_POINTER_COUNT_G 2
// DEBUG
#define INPUTLENGTH_FOR_DEBUG (-1)
#define MIN_OUTPUT_INDEX_FOR_DEBUG (-1)
#define DISALLOW_DEFAULT_CONSTRUCTOR(TypeName) \ #define DISALLOW_DEFAULT_CONSTRUCTOR(TypeName) \
TypeName() = delete TypeName() = delete

View File

@ -32,15 +32,14 @@ class TypingScoring : public Scoring {
public: public:
static const TypingScoring *getInstance() { return &sInstance; } static const TypingScoring *getInstance() { return &sInstance; }
AK_FORCE_INLINE bool getMostProbableString( AK_FORCE_INLINE bool getMostProbableString(const DicTraverseSession *const traverseSession,
const DicTraverseSession *const traverseSession, const int terminalSize, const int terminalSize, const float languageWeight, int *const outputCodePoints,
const float languageWeight, int *const outputCodePoints, int *const type, int *const type, int *const freq) const {
int *const freq) const {
return false; return false;
} }
AK_FORCE_INLINE void safetyNetForMostProbableString(const int scoreCount, AK_FORCE_INLINE void safetyNetForMostProbableString(const int scoreCount, const int maxScore,
const int maxScore, int *const outputCodePoints, int *const scores) const { int *const outputCodePoints, int *const scores) const {
} }
AK_FORCE_INLINE float getAdjustedLanguageWeight(DicTraverseSession *const traverseSession, AK_FORCE_INLINE float getAdjustedLanguageWeight(DicTraverseSession *const traverseSession,
@ -48,9 +47,9 @@ class TypingScoring : public Scoring {
return 1.0f; return 1.0f;
} }
AK_FORCE_INLINE int calculateFinalScore(const float compoundDistance, AK_FORCE_INLINE int calculateFinalScore(const float compoundDistance, const int inputSize,
const int inputSize, const ErrorTypeUtils::ErrorType containedErrorTypes, const ErrorTypeUtils::ErrorType containedErrorTypes, const bool forceCommit,
const bool forceCommit, const bool boostExactMatches) const { const bool boostExactMatches) const {
const float maxDistance = ScoringParams::DISTANCE_WEIGHT_LANGUAGE const float maxDistance = ScoringParams::DISTANCE_WEIGHT_LANGUAGE
+ static_cast<float>(inputSize) * ScoringParams::TYPING_MAX_OUTPUT_SCORE_PER_INPUT; + static_cast<float>(inputSize) * ScoringParams::TYPING_MAX_OUTPUT_SCORE_PER_INPUT;
float score = ScoringParams::TYPING_BASE_OUTPUT_SCORE - compoundDistance / maxDistance; float score = ScoringParams::TYPING_BASE_OUTPUT_SCORE - compoundDistance / maxDistance;
@ -85,8 +84,8 @@ class TypingScoring : public Scoring {
return true; return true;
} }
AK_FORCE_INLINE bool sameAsTyped( AK_FORCE_INLINE bool sameAsTyped(const DicTraverseSession *const traverseSession,
const DicTraverseSession *const traverseSession, const DicNode *const dicNode) const { const DicNode *const dicNode) const {
return traverseSession->getProximityInfoState(0)->sameAsTyped( return traverseSession->getProximityInfoState(0)->sameAsTyped(
dicNode->getOutputWordBuf(), dicNode->getNodeCodePointCount()); dicNode->getOutputWordBuf(), dicNode->getNodeCodePointCount());
} }

View File

@ -72,8 +72,6 @@ class TypingWeighting : public Weighting {
float getMatchedCost(const DicTraverseSession *const traverseSession, float getMatchedCost(const DicTraverseSession *const traverseSession,
const DicNode *const dicNode, DicNode_InputStateG *inputStateG) const { const DicNode *const dicNode, DicNode_InputStateG *inputStateG) const {
const int pointIndex = dicNode->getInputIndex(0); const int pointIndex = dicNode->getInputIndex(0);
// Note: min() required since length can be MAX_POINT_TO_KEY_LENGTH for characters not on
// the keyboard (like accented letters)
const float normalizedSquaredLength = traverseSession->getProximityInfoState(0) const float normalizedSquaredLength = traverseSession->getProximityInfoState(0)
->getPointToKeyLength(pointIndex, ->getPointToKeyLength(pointIndex,
CharUtils::toBaseLowerCase(dicNode->getNodeCodePoint())); CharUtils::toBaseLowerCase(dicNode->getNodeCodePoint()));