summaryrefslogtreecommitdiff
path: root/dtrain/dtrain.cc
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2011-10-13 23:50:28 +0200
committerPatrick Simianer <p@simianer.de>2011-10-13 23:50:28 +0200
commitb03d01f22df3c5e27014bf32748baacc10c7d360 (patch)
treeb3336a13331099e8372af6c51ad508c7772c3177 /dtrain/dtrain.cc
parentb9641702ba7aa86e9cc7ed0d4fffa4dd6271cc8f (diff)
fixed approx bleu
Diffstat (limited to 'dtrain/dtrain.cc')
-rw-r--r--dtrain/dtrain.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/dtrain/dtrain.cc b/dtrain/dtrain.cc
index 25858738..f679c9f6 100644
--- a/dtrain/dtrain.cc
+++ b/dtrain/dtrain.cc
@@ -105,12 +105,13 @@ main(int argc, char** argv)
string scorer_str = cfg["scorer"].as<string>();
LocalScorer* scorer;
if (scorer_str == "bleu") {
+ scorer = dynamic_cast<BleuScorer*>(new BleuScorer);
} else if (scorer_str == "stupid_bleu") {
scorer = dynamic_cast<StupidBleuScorer*>(new StupidBleuScorer);
} else if (scorer_str == "smooth_bleu") {
scorer = dynamic_cast<SmoothBleuScorer*>(new SmoothBleuScorer);
} else if (scorer_str == "approx_bleu") {
- scorer = dynamic_cast<StupidBleuScorer*>(new StupidBleuScorer); // FIXME
+ scorer = dynamic_cast<ApproxBleuScorer*>(new ApproxBleuScorer(N));
} else {
cerr << "Don't know scoring metric: '" << scorer_str << "', exiting." << endl;
exit(1);
@@ -145,7 +146,7 @@ main(int argc, char** argv)
// input
string input_fn = cfg["input"].as<string>();
ReadFile input(input_fn);
- // buffer input for t > 0
+ // buffer input for t > 0
vector<string> src_str_buf; // source strings
vector<vector<WordID> > ref_ids_buf; // references as WordID vecs
vector<string> weights_files; // remember weights for each iteration
@@ -341,6 +342,8 @@ main(int argc, char** argv)
} // input loop
+ if (scorer_str == "approx_bleu") scorer->Reset();
+
if (t == 0) {
in_sz = ii; // remember size of input (# lines)
grammar_buf_out.close();