diff options
author | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-07-19 23:40:30 +0000 |
---|---|---|
committer | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-07-19 23:40:30 +0000 |
commit | 190ad8ae1e131ac0e29ff975b0d6502f3cc57af6 (patch) | |
tree | 7016b7671bfa385a1b3e4a8ab4c2a2544e5208df /vest/mr_vest_generate_mapper_input.cc | |
parent | 7d31056d098694b85847d9f75d3870913661e73b (diff) |
fixed oracle generate, detailed score info with --verbose
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@329 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'vest/mr_vest_generate_mapper_input.cc')
-rw-r--r-- | vest/mr_vest_generate_mapper_input.cc | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/vest/mr_vest_generate_mapper_input.cc b/vest/mr_vest_generate_mapper_input.cc index f66b5082..5ab5c689 100644 --- a/vest/mr_vest_generate_mapper_input.cc +++ b/vest/mr_vest_generate_mapper_input.cc @@ -183,20 +183,27 @@ struct oracle_directions { Sentences model_hyps; - vector<OracleBleu::ScoreP> model_scores; + vector<ScoreP> model_scores; bool have_doc; void Init() { have_doc=!decoder_translations_file.empty(); if (have_doc) { model_hyps.Load(decoder_translations_file); + if (verbose) model_hyps.Print(cerr,5); model_scores.resize(model_hyps.size()); + if (dev_set_size!=model_hyps.size()) { + cerr<<"You supplied decoder_translations with a different number of lines ("<<model_hyps.size()<<") than dev_set_size ("<<dev_set_size<<")"<<endl; + abort(); + } + cerr << "Scoring model translations " << model_hyps << endl; for (int i=0;i<model_hyps.size();++i) { - //FIXME: what is scoreccand? with / without clipping? do without for consistency w/ oracle + //TODO: what is scoreCcand? without clipping? do without for consistency w/ oracle model_scores[i]=oracle.ds[i]->ScoreCandidate(model_hyps[i]); - if (verbose) cerr<<"Before model["<<i<<"]: "<<ds().ScoreDetails()<<endl; - if (verbose) cerr<<"model["<<i<<"]: "<<model_scores[i]->ScoreDetails()<<endl; - oracle.doc_score->PlusEquals(*model_scores[i]); - if (verbose) cerr<<"After model["<<i<<"]: "<<ds().ScoreDetails()<<endl; + assert(model_scores[i]); + if (verbose) cerr<<"Before model["<<i<<"]: "<<ds().ScoreDetails()<<endl; + if (verbose) cerr<<"model["<<i<<"]: "<<model_scores[i]->ScoreDetails()<<endl; + oracle.doc_score->PlusEquals(*model_scores[i]); + if (verbose) cerr<<"After model["<<i<<"]: "<<ds().ScoreDetails()<<endl; } //TODO: compute doc bleu stats for each sentence, then when getting oracle temporarily exclude stats for that sentence (skip regular score updating) } @@ -249,8 +256,12 @@ struct oracle_directions { o=oracle.ComputeOracle(oracle.MakeMetadata(hg,i),&hg,origin); if (verbose) { cerr << o; - cerr<<"After oracle: "<<ds().ScoreDetails()<<endl - <<" oracle="<<oracle.GetScore(o.hope.sentence,i)->ScoreDetails()<<endl + ScoreP hopesc=oracle.GetScore(o.hope.sentence,i); + oracle.doc_score->PlusEquals(*hopesc,1); + cerr<<"With hope: "<<ds().ScoreDetails()<<endl; + oracle.doc_score->PlusEquals(*hopesc,-1); + cerr<<"Without hope: "<<ds().ScoreDetails()<<endl; + cerr<<" oracle="<<oracle.GetScore(o.hope.sentence,i)->ScoreDetails()<<endl <<" model="<<oracle.GetScore(o.model.sentence,i)->ScoreDetails()<<endl; if (have_doc) cerr<<" doc (should = model): "<<model_scores[i]->ScoreDetails()<<endl; |