From d39cbca0b9532c8e51d1a42eef2cb2ef2a8d9bf7 Mon Sep 17 00:00:00 2001 From: Rico Sennrich Date: Wed, 17 Sep 2014 17:40:11 +0100 Subject: (optionally) use n-best file for evaluator/return-best-dev this adds support for metrics that rely on alignment / trees --- mert/Data.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mert/Data.cpp') diff --git a/mert/Data.cpp b/mert/Data.cpp index b6e3ed7f9..08e80409f 100644 --- a/mert/Data.cpp +++ b/mert/Data.cpp @@ -135,7 +135,7 @@ void Data::load(const std::string &featfile, const std::string &scorefile) m_score_data->load(scorefile); } -void Data::loadNBest(const string &file) +void Data::loadNBest(const string &file, bool oneBest) { TRACE_ERR("loading nbest from " << file << endl); util::FilePiece in(file.c_str()); @@ -154,6 +154,7 @@ void Data::loadNBest(const string &file) util::TokenIter it(line, util::MultiCharacter("|||")); sentence_index = ParseInt(*it); + if (oneBest && m_score_data->exists(sentence_index)) continue; ++it; sentence = it->as_string(); ++it; -- cgit v1.2.3