mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Stop dividing unigram probability by 2 for backoff.
Bug: 13197276 Change-Id: I8eaa24b6f710383a8d257e3ec28c37a1a1da8e31
This commit is contained in:
parent
e55d44c535
commit
b368089dbf
@ -30,6 +30,7 @@ const int ForgettingCurveUtils::MAX_UNIGRAM_COUNT_AFTER_GC = 10000;
|
||||
const int ForgettingCurveUtils::MAX_BIGRAM_COUNT = 12000;
|
||||
const int ForgettingCurveUtils::MAX_BIGRAM_COUNT_AFTER_GC = 10000;
|
||||
|
||||
const int ForgettingCurveUtils::MULTIPLIER_TWO_IN_PROBABILITY_SCALE = 8;
|
||||
const int ForgettingCurveUtils::MAX_COMPUTED_PROBABILITY = 127;
|
||||
const int ForgettingCurveUtils::DECAY_INTERVAL_SECONDS = 2 * 60 * 60;
|
||||
|
||||
@ -84,7 +85,9 @@ const ForgettingCurveUtils::ProbabilityTable ForgettingCurveUtils::sProbabilityT
|
||||
} else if (bigramProbability == NOT_A_PROBABILITY) {
|
||||
return min(backoff(unigramProbability), MAX_COMPUTED_PROBABILITY);
|
||||
} else {
|
||||
return min(max(unigramProbability, bigramProbability), MAX_COMPUTED_PROBABILITY);
|
||||
// TODO: Investigate better way to handle bigram probability.
|
||||
return min(max(unigramProbability, bigramProbability + MULTIPLIER_TWO_IN_PROBABILITY_SCALE),
|
||||
MAX_COMPUTED_PROBABILITY);
|
||||
}
|
||||
}
|
||||
|
||||
@ -137,11 +140,8 @@ const ForgettingCurveUtils::ProbabilityTable ForgettingCurveUtils::sProbabilityT
|
||||
|
||||
// See comments in ProbabilityUtils::backoff().
|
||||
/* static */ int ForgettingCurveUtils::backoff(const int unigramProbability) {
|
||||
if (unigramProbability == NOT_A_PROBABILITY) {
|
||||
return NOT_A_PROBABILITY;
|
||||
} else {
|
||||
return max(unigramProbability - 8, 0);
|
||||
}
|
||||
// See TODO comments in ForgettingCurveUtils::getProbability().
|
||||
return unigramProbability;
|
||||
}
|
||||
|
||||
/* static */ int ForgettingCurveUtils::getElapsedTimeStepCount(const int timestamp) {
|
||||
|
@ -72,6 +72,7 @@ class ForgettingCurveUtils {
|
||||
std::vector<std::vector<std::vector<int> > > mTables;
|
||||
};
|
||||
|
||||
static const int MULTIPLIER_TWO_IN_PROBABILITY_SCALE;
|
||||
static const int MAX_COMPUTED_PROBABILITY;
|
||||
static const int DECAY_INTERVAL_SECONDS;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user