From ee4f3c5581e43510d98de1274c6c1c2984c87faf Mon Sep 17 00:00:00 2001 From: armatthews Date: Sun, 17 Jan 2016 04:03:35 -0500 Subject: bug fixes when training with WER --- mteval/ns_wer.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mteval') diff --git a/mteval/ns_wer.cc b/mteval/ns_wer.cc index f9b2bbbb..057ad49e 100644 --- a/mteval/ns_wer.cc +++ b/mteval/ns_wer.cc @@ -18,10 +18,10 @@ void WERMetric::ComputeSufficientStatistics(const std::vector& hyp, const std::vector >& refs, SufficientStats* out) const { out->fields.resize(kNUMFIELDS); - float best_score = hyp.size(); + float best_score = 0; for (size_t i = 0; i < refs.size(); ++i) { float score = cdec::LevenshteinDistance(hyp, refs[i]); - if (score < best_score) { + if (score < best_score || i == 0) { out->fields[kEDITDISTANCE] = score; out->fields[kCHARCOUNT] = refs[i].size(); best_score = score; -- cgit v1.2.3