Merge "Remove doesAutoCorrectValidWord()." into lmp-dev

main
Keisuke Kuroyanagi 2014-07-31 07:25:21 +00:00 committed by Android (Google) Code Review
commit 57574b98c2
3 changed files with 2 additions and 13 deletions

View File

@ -37,7 +37,6 @@ class Scoring {
DicNode *const terminals, const int size) const = 0; DicNode *const terminals, const int size) const = 0;
virtual float getDoubleLetterDemotionDistanceCost( virtual float getDoubleLetterDemotionDistanceCost(
const DicNode *const terminalDicNode) const = 0; const DicNode *const terminalDicNode) const = 0;
virtual bool doesAutoCorrectValidWord() const = 0;
virtual bool autoCorrectsToMultiWordSuggestionIfTop() const = 0; virtual bool autoCorrectsToMultiWordSuggestionIfTop() const = 0;
virtual bool sameAsTyped(const DicTraverseSession *const traverseSession, virtual bool sameAsTyped(const DicTraverseSession *const traverseSession,
const DicNode *const dicNode) const = 0; const DicNode *const dicNode) const = 0;

View File

@ -117,8 +117,7 @@ const int SuggestionsOutputUtils::MIN_LEN_FOR_MULTI_WORD_AUTOCORRECT = 16;
const int finalScore = scoringPolicy->calculateFinalScore( const int finalScore = scoringPolicy->calculateFinalScore(
compoundDistance, traverseSession->getInputSize(), compoundDistance, traverseSession->getInputSize(),
terminalDicNode->getContainedErrorTypes(), terminalDicNode->getContainedErrorTypes(),
(forceCommitMultiWords && terminalDicNode->hasMultipleWords()) (forceCommitMultiWords && terminalDicNode->hasMultipleWords()),
|| (isValidWord && scoringPolicy->doesAutoCorrectValidWord()),
boostExactMatches); boostExactMatches);
// Don't output invalid or blocked offensive words. However, we still need to submit their // Don't output invalid or blocked offensive words. However, we still need to submit their
@ -145,12 +144,7 @@ const int SuggestionsOutputUtils::MIN_LEN_FOR_MULTI_WORD_AUTOCORRECT = 16;
traverseSession->getDictionaryStructurePolicy() traverseSession->getDictionaryStructurePolicy()
->getShortcutPositionOfPtNode(terminalDicNode->getPtNodePos())); ->getShortcutPositionOfPtNode(terminalDicNode->getPtNodePos()));
const bool sameAsTyped = scoringPolicy->sameAsTyped(traverseSession, terminalDicNode); const bool sameAsTyped = scoringPolicy->sameAsTyped(traverseSession, terminalDicNode);
const int shortcutBaseScore = scoringPolicy->doesAutoCorrectValidWord() ? outputShortcuts(&shortcutIt, finalScore, sameAsTyped, outSuggestionResults);
scoringPolicy->calculateFinalScore(compoundDistance,
traverseSession->getInputSize(),
terminalDicNode->getContainedErrorTypes(),
true /* forceCommit */, boostExactMatches) : finalScore;
outputShortcuts(&shortcutIt, shortcutBaseScore, sameAsTyped, outSuggestionResults);
} }
} }

View File

@ -69,10 +69,6 @@ class TypingScoring : public Scoring {
return 0.0f; return 0.0f;
} }
AK_FORCE_INLINE bool doesAutoCorrectValidWord() const {
return false;
}
AK_FORCE_INLINE bool autoCorrectsToMultiWordSuggestionIfTop() const { AK_FORCE_INLINE bool autoCorrectsToMultiWordSuggestionIfTop() const {
return true; return true;
} }