diff options
author | Chris Dyer <cdyer@cs.cmu.edu> | 2012-02-08 18:32:12 -0500 |
---|---|---|
committer | Chris Dyer <cdyer@cs.cmu.edu> | 2012-02-08 18:32:12 -0500 |
commit | fd536297d4d7ea12dd74f3f3bb96f9ccfa02d2c4 (patch) | |
tree | 3406595bb8c198ab833d3756adf54399fed97bb7 /mteval | |
parent | 400d60b20e9e480b0eff9843404a4cb9f8bd02cc (diff) |
oops, broke mbr when i switched to the new scoring API
Diffstat (limited to 'mteval')
-rw-r--r-- | mteval/mbr_kbest.cc | 5 |
1 files changed, 4 insertions, 1 deletions
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<string>(); 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<string>(); @@ -101,12 +102,14 @@ int main(int argc, char** argv) { double mbr_loss = numeric_limits<double>::max(); for (int i = 0 ; i < list.size(); ++i) { const vector<vector<WordID> > refs(1, list[i].first); + boost::shared_ptr<SegmentEvaluator> 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(); |