From beba971260d73f891b67139998d22b3f1ab8a119 Mon Sep 17 00:00:00 2001 From: Tobias Domhan Date: Tue, 10 May 2016 08:57:44 +0000 Subject: [PATCH] bug fix: beam_threshold is in log_10 and needs to be transformed before it's passed the the ttable. --- src/fast_align.cc | 2 +- src/ttables.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/fast_align.cc b/src/fast_align.cc index f5b594c..4f70249 100644 --- a/src/fast_align.cc +++ b/src/fast_align.cc @@ -421,7 +421,7 @@ int main(int argc, char** argv) { } if (!force_align && !conditional_probability_filename.empty()) { cerr << "conditional probabilities: " << conditional_probability_filename << endl; - s2t.ExportToFile(conditional_probability_filename.c_str(), d, beam_threshold); + s2t.ExportToFile(conditional_probability_filename.c_str(), d, pow(10.0, beam_threshold)); } if (force_align) { istream* pin = &cin; diff --git a/src/ttables.h b/src/ttables.h index a20fcdf..444f90e 100644 --- a/src/ttables.h +++ b/src/ttables.h @@ -149,9 +149,10 @@ class TTable { const double threshold = max_p * BEAM_THRESHOLD; for (auto& it : cpd) { const std::string& b = d.Convert(it.first); - double c = log(it.second); - if (c >= threshold) + if (it.second >= threshold) { + double c = log(it.second); file << a << '\t' << b << '\t' << c << std::endl; + } } } file.close();