diff options
-rw-r--r-- | mteval/ns_wer.cc | 4 | ||||
-rw-r--r-- | training/mira/kbest_cut_mira.cc | 2 |
2 files changed, 3 insertions, 3 deletions
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<WordID>& hyp, const std::vector<std::vector<WordID> >& 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; diff --git a/training/mira/kbest_cut_mira.cc b/training/mira/kbest_cut_mira.cc index 724b1853..5d8385c2 100644 --- a/training/mira/kbest_cut_mira.cc +++ b/training/mira/kbest_cut_mira.cc @@ -645,7 +645,7 @@ int main(int argc, char** argv) { ScoreType type = ScoreTypeFromString(metric_name); //establish metric used for tuning - if (type == TER) { + if (type == TER || type == WER) { invert_score = true; } else { invert_score = false; |