Stop dividing unigram probability by 2 for backoff.

Bug: 13197276
Change-Id: I8eaa24b6f710383a8d257e3ec28c37a1a1da8e31
This commit is contained in:
Keisuke Kuroyanagi 2014-02-26 19:40:18 +09:00
parent e55d44c535
commit b368089dbf
2 changed files with 7 additions and 6 deletions

View file

@ -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) {

View file

@ -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;