mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-08-17 07:20:48 +03:00
Merge branch 'CompactPT' of https://github.com/moses-smt/mosesdecoder into CompactPT
This commit is contained in:
commit
8ad8f1acf3
@ -25,6 +25,11 @@ class Callback {
|
|||||||
|
|
||||||
~Callback() {
|
~Callback() {
|
||||||
for (std::size_t i = 0; i < backoffs_.size(); ++i) {
|
for (std::size_t i = 0; i < backoffs_.size(); ++i) {
|
||||||
|
|
||||||
|
if(prune_thresholds_[i + 1] > 0)
|
||||||
|
while(backoffs_[i])
|
||||||
|
++backoffs_[i];
|
||||||
|
|
||||||
if (backoffs_[i]) {
|
if (backoffs_[i]) {
|
||||||
std::cerr << "Backoffs do not match for order " << (i + 1) << std::endl;
|
std::cerr << "Backoffs do not match for order " << (i + 1) << std::endl;
|
||||||
abort();
|
abort();
|
||||||
@ -50,10 +55,8 @@ class Callback {
|
|||||||
uint64_t current_hash = util::MurmurHashNative(gram.begin(), gram.Order() * sizeof(WordIndex));
|
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());
|
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());
|
hashed_backoff = static_cast<const HashGamma*>(backoffs_[order_minus_1].Get());
|
||||||
++backoffs_[order_minus_1];
|
|
||||||
}
|
|
||||||
|
|
||||||
if(current_hash == hashed_backoff->hash_value) {
|
if(current_hash == hashed_backoff->hash_value) {
|
||||||
pay.complete.backoff = log10(hashed_backoff->gamma);
|
pay.complete.backoff = log10(hashed_backoff->gamma);
|
||||||
|
Loading…
Reference in New Issue
Block a user