From fd536297d4d7ea12dd74f3f3bb96f9ccfa02d2c4 Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Wed, 8 Feb 2012 18:32:12 -0500 Subject: oops, broke mbr when i switched to the new scoring API --- mteval/mbr_kbest.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mteval/mbr_kbest.cc b/mteval/mbr_kbest.cc index b5e4750c..2bd31566 100644 --- a/mteval/mbr_kbest.cc +++ b/mteval/mbr_kbest.cc @@ -77,6 +77,7 @@ int main(int argc, char** argv) { InitCommandLine(argc, argv, &conf); const string smetric = conf["evaluation_metric"].as(); EvaluationMetric* metric = EvaluationMetric::Instance(smetric); + const bool is_loss = (UppercaseString(smetric) == "TER"); const bool output_list = conf.count("output_list") > 0; const string file = conf["input"].as(); @@ -101,12 +102,14 @@ int main(int argc, char** argv) { double mbr_loss = numeric_limits::max(); for (int i = 0 ; i < list.size(); ++i) { const vector > refs(1, list[i].first); + boost::shared_ptr segeval = metric-> + CreateSegmentEvaluator(refs); double wl_acc = 0; for (int j = 0; j < list.size(); ++j) { if (i != j) { SufficientStats ss; - metric->ComputeSufficientStatistics(list[j].first, refs, &ss); + segeval->Evaluate(list[j].first, &ss); double loss = 1.0 - metric->ComputeScore(ss); if (is_loss) loss = 1.0 - loss; double weighted_loss = loss * (joints[j] / marginal).as_float(); -- cgit v1.2.3