Merge "Improve the double letter word promotion logic."
This commit is contained in:
commit
437fa64af3
3 changed files with 6 additions and 22 deletions
|
@ -58,12 +58,6 @@ const int SuggestionsOutputUtils::MIN_LEN_FOR_MULTI_WORD_AUTOCORRECT = 16;
|
||||||
++outputWordIndex;
|
++outputWordIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initial value of the loop index for terminal nodes (words)
|
|
||||||
int doubleLetterTerminalIndex = -1;
|
|
||||||
DoubleLetterLevel doubleLetterLevel = NOT_A_DOUBLE_LETTER;
|
|
||||||
scoringPolicy->searchWordWithDoubleLetter(terminals, terminalSize,
|
|
||||||
&doubleLetterTerminalIndex, &doubleLetterLevel);
|
|
||||||
|
|
||||||
int maxScore = S_INT_MIN;
|
int maxScore = S_INT_MIN;
|
||||||
// Force autocorrection for obvious long multi-word suggestions when the top suggestion is
|
// Force autocorrection for obvious long multi-word suggestions when the top suggestion is
|
||||||
// a long multiple words suggestion.
|
// a long multiple words suggestion.
|
||||||
|
@ -92,8 +86,8 @@ const int SuggestionsOutputUtils::MIN_LEN_FOR_MULTI_WORD_AUTOCORRECT = 16;
|
||||||
if (DEBUG_GEO_FULL) {
|
if (DEBUG_GEO_FULL) {
|
||||||
terminalDicNode->dump("OUT:");
|
terminalDicNode->dump("OUT:");
|
||||||
}
|
}
|
||||||
const float doubleLetterCost = scoringPolicy->getDoubleLetterDemotionDistanceCost(
|
const float doubleLetterCost =
|
||||||
terminalIndex, doubleLetterTerminalIndex, doubleLetterLevel);
|
scoringPolicy->getDoubleLetterDemotionDistanceCost(terminalDicNode);
|
||||||
const float compoundDistance = terminalDicNode->getCompoundDistance(languageWeight)
|
const float compoundDistance = terminalDicNode->getCompoundDistance(languageWeight)
|
||||||
+ doubleLetterCost;
|
+ doubleLetterCost;
|
||||||
const bool isPossiblyOffensiveWord =
|
const bool isPossiblyOffensiveWord =
|
||||||
|
|
|
@ -34,14 +34,10 @@ class Scoring {
|
||||||
int *const type, int *const freq) const = 0;
|
int *const type, int *const freq) const = 0;
|
||||||
virtual void safetyNetForMostProbableString(const int terminalSize,
|
virtual void safetyNetForMostProbableString(const int terminalSize,
|
||||||
const int maxScore, int *const outputCodePoints, int *const frequencies) const = 0;
|
const int maxScore, int *const outputCodePoints, int *const frequencies) const = 0;
|
||||||
// TODO: Make more generic
|
|
||||||
virtual void searchWordWithDoubleLetter(DicNode *terminals, const int terminalSize,
|
|
||||||
int *doubleLetterTerminalIndex, DoubleLetterLevel *doubleLetterLevel) const = 0;
|
|
||||||
virtual float getAdjustedLanguageWeight(DicTraverseSession *const traverseSession,
|
virtual float getAdjustedLanguageWeight(DicTraverseSession *const traverseSession,
|
||||||
DicNode *const terminals, const int size) const = 0;
|
DicNode *const terminals, const int size) const = 0;
|
||||||
virtual float getDoubleLetterDemotionDistanceCost(const int terminalIndex,
|
virtual float getDoubleLetterDemotionDistanceCost(
|
||||||
const int doubleLetterTerminalIndex,
|
const DicNode *const terminalDicNode) const = 0;
|
||||||
const DoubleLetterLevel doubleLetterLevel) const = 0;
|
|
||||||
virtual bool doesAutoCorrectValidWord() 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,
|
||||||
|
|
|
@ -43,11 +43,6 @@ class TypingScoring : public Scoring {
|
||||||
const int maxScore, int *const outputCodePoints, int *const frequencies) const {
|
const int maxScore, int *const outputCodePoints, int *const frequencies) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
AK_FORCE_INLINE void searchWordWithDoubleLetter(DicNode *terminals,
|
|
||||||
const int terminalSize, int *doubleLetterTerminalIndex,
|
|
||||||
DoubleLetterLevel *doubleLetterLevel) const {
|
|
||||||
}
|
|
||||||
|
|
||||||
AK_FORCE_INLINE float getAdjustedLanguageWeight(DicTraverseSession *const traverseSession,
|
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;
|
return 1.0f;
|
||||||
|
@ -77,9 +72,8 @@ class TypingScoring : public Scoring {
|
||||||
return static_cast<int>(score * SUGGEST_INTERFACE_OUTPUT_SCALE);
|
return static_cast<int>(score * SUGGEST_INTERFACE_OUTPUT_SCALE);
|
||||||
}
|
}
|
||||||
|
|
||||||
AK_FORCE_INLINE float getDoubleLetterDemotionDistanceCost(const int terminalIndex,
|
AK_FORCE_INLINE float getDoubleLetterDemotionDistanceCost(
|
||||||
const int doubleLetterTerminalIndex,
|
const DicNode *const terminalDicNode) const {
|
||||||
const DoubleLetterLevel doubleLetterLevel) const {
|
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue