mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-25 12:52:29 +03:00
First attempt at fixing missing-backoffs bug in lmplz
This commit is contained in:
parent
52a1056f9e
commit
061aac9e3b
@ -25,6 +25,10 @@ class Callback {
|
||||
|
||||
~Callback() {
|
||||
for (std::size_t i = 0; i < backoffs_.size(); ++i) {
|
||||
if(prune_thresholds_[i + 1] > 0)
|
||||
while(backoffs_[i])
|
||||
++backoffs_[i];
|
||||
|
||||
if (backoffs_[i]) {
|
||||
std::cerr << "Backoffs do not match for order " << (i + 1) << std::endl;
|
||||
abort();
|
||||
@ -50,10 +54,8 @@ class Callback {
|
||||
uint64_t current_hash = util::MurmurHashNative(gram.begin(), gram.Order() * sizeof(WordIndex));
|
||||
|
||||
const HashGamma *hashed_backoff = static_cast<const HashGamma*>(backoffs_[order_minus_1].Get());
|
||||
while(backoffs_[order_minus_1] && current_hash != hashed_backoff->hash_value) {
|
||||
while(current_hash != hashed_backoff->hash_value && ++backoffs_[order_minus_1])
|
||||
hashed_backoff = static_cast<const HashGamma*>(backoffs_[order_minus_1].Get());
|
||||
++backoffs_[order_minus_1];
|
||||
}
|
||||
|
||||
if(current_hash == hashed_backoff->hash_value) {
|
||||
pay.complete.backoff = log10(hashed_backoff->gamma);
|
||||
|
Loading…
Reference in New Issue
Block a user