Merge "Several cleanups"

This commit is contained in:
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_G 2
// DEBUG
#define INPUTLENGTH_FOR_DEBUG (-1)
#define MIN_OUTPUT_INDEX_FOR_DEBUG (-1)
#define DISALLOW_DEFAULT_CONSTRUCTOR(TypeName) \
TypeName() = delete

View file

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

View file

@ -72,8 +72,6 @@ class TypingWeighting : public Weighting {
float getMatchedCost(const DicTraverseSession *const traverseSession,
const DicNode *const dicNode, DicNode_InputStateG *inputStateG) const {
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)
->getPointToKeyLength(pointIndex,
CharUtils::toBaseLowerCase(dicNode->getNodeCodePoint()));