summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-21 21:04:04 +0000
committergraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-21 21:04:04 +0000
commitcd2264b189a732f9252492118af373f8c60e2f25 (patch)
tree680a7e817c794984a5d4f245b2ccaf82a41c252a
parent3ad1e7415eca7d75b16c1e0e0f4f3558f13d400d (diff)
verbose() instead of redundant flag
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@363 ec762483-ff6d-05da-a07a-a48fb63a330f
-rwxr-xr-xvest/dist-vest.pl1
-rw-r--r--vest/mr_vest_generate_mapper_input.cc19
-rw-r--r--vest/scorer.cc2
3 files changed, 11 insertions, 11 deletions
diff --git a/vest/dist-vest.pl b/vest/dist-vest.pl
index c9c11d23..97b72f45 100755
--- a/vest/dist-vest.pl
+++ b/vest/dist-vest.pl
@@ -75,6 +75,7 @@ if (GetOptions(
"normalize=s" => \$normalize,
"pmem=s" => \$pmem,
"rand-directions=i" => \$rand_directions,
+ "random_directions=i" => \$rand_directions,
"no-primary!" => \$noprimary,
"max-similarity=s" => \$maxsim,
"oracle-directions=i" => \$oraclen,
diff --git a/vest/mr_vest_generate_mapper_input.cc b/vest/mr_vest_generate_mapper_input.cc
index 5ab5c689..f1179839 100644
--- a/vest/mr_vest_generate_mapper_input.cc
+++ b/vest/mr_vest_generate_mapper_input.cc
@@ -132,7 +132,6 @@ struct oracle_directions {
}
UseConf(*conf);
- verbose=oracle.verbose;
return;
bad_cmdline:
cerr << dcmdline_options << endl;
@@ -145,11 +144,11 @@ struct oracle_directions {
Run();
return 0;
}
- bool verbose;
+ bool verbose() const { return oracle.verbose; }
void Run() {
AddPrimaryAndRandomDirections();
AddOracleDirections();
- compress_similar(directions,max_similarity,&cerr,true,verbose);
+ compress_similar(directions,max_similarity,&cerr,true,verbose());
Print();
}
@@ -189,7 +188,7 @@ struct oracle_directions {
have_doc=!decoder_translations_file.empty();
if (have_doc) {
model_hyps.Load(decoder_translations_file);
- if (verbose) model_hyps.Print(cerr,5);
+ 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;
@@ -200,10 +199,10 @@ struct oracle_directions {
//TODO: what is scoreCcand? without clipping? do without for consistency w/ oracle
model_scores[i]=oracle.ds[i]->ScoreCandidate(model_hyps[i]);
assert(model_scores[i]);
- if (verbose) cerr<<"Before model["<<i<<"]: "<<ds().ScoreDetails()<<endl;
- if (verbose) cerr<<"model["<<i<<"]: "<<model_scores[i]->ScoreDetails()<<endl;
+ 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;
+ 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)
}
@@ -243,7 +242,7 @@ struct oracle_directions {
Oracle &o=oracles[i];
if (o.is_null()) {
if (have_doc) {
- if (verbose) cerr<<"Before removing i="<<i<<" "<<ds().ScoreDetails()<<"\n";
+ if (verbose()) cerr<<"Before removing i="<<i<<" "<<ds().ScoreDetails()<<"\n";
adjust_doc(i,-1);
}
ReadFile rf(forest_file(i));
@@ -252,9 +251,9 @@ struct oracle_directions {
Timer t("Loading forest from JSON "+forest_file(i));
HypergraphIO::ReadFromJSON(rf.stream(), &hg);
}
- if (verbose) cerr<<"Before oracle["<<i<<"]: "<<ds().ScoreDetails()<<endl;
+ if (verbose()) cerr<<"Before oracle["<<i<<"]: "<<ds().ScoreDetails()<<endl;
o=oracle.ComputeOracle(oracle.MakeMetadata(hg,i),&hg,origin);
- if (verbose) {
+ if (verbose()) {
cerr << o;
ScoreP hopesc=oracle.GetScore(o.hope.sentence,i);
oracle.doc_score->PlusEquals(*hopesc,1);
diff --git a/vest/scorer.cc b/vest/scorer.cc
index 5671de38..70fdef34 100644
--- a/vest/scorer.cc
+++ b/vest/scorer.cc
@@ -483,7 +483,7 @@ void SentenceScorer::ComputeErrorSurface(const ViterbiEnvelope& ve, ErrorSurface
void BLEUScore::ScoreDetails(string* details) const {
char buf[2000];
- vector<float> precs(min(N(),4));
+ vector<float> precs(max(N(),4));
float bp;
float bleu = ComputeScore(&precs, &bp);
for (int i=N();i<4;++i)