diff options
author | Chris Dyer <cdyer@cs.cmu.edu> | 2012-04-26 21:19:56 -0400 |
---|---|---|
committer | Chris Dyer <cdyer@cs.cmu.edu> | 2012-04-26 21:19:56 -0400 |
commit | 230cf27272cc7c15ebf7370b9aa8808b5b282426 (patch) | |
tree | 4e31a80a0a697c55bc79a12c79dd9f333f27b44e /rampion | |
parent | a2d4bc2a4370f628f320fe2cc09fa88b81498df0 (diff) |
working rampion, gimpel&smith (2012)
Diffstat (limited to 'rampion')
-rwxr-xr-x | rampion/rampion.pl | 5 | ||||
-rw-r--r-- | rampion/rampion_cccp.cc | 6 |
2 files changed, 8 insertions, 3 deletions
diff --git a/rampion/rampion.pl b/rampion/rampion.pl index fda2bac2..d29c02b3 100755 --- a/rampion/rampion.pl +++ b/rampion/rampion.pl @@ -301,10 +301,13 @@ while (1){ my $score = 0; my $icc = 0; my $inweights="$dir/weights.$im1"; + my $outweights="$dir/weights.$iteration"; $cmd="$MAPINPUT $dir/hgs > $dir/agenda.$im1"; print STDERR "COMMAND:\n$cmd\n"; check_call($cmd); - die "PLEASE IMPL"; + $cmd="$MAPPER $refs_comma_sep -m $metric -i $dir/agenda.$im1 -w $inweights > $outweights"; + check_call($cmd); + $lastWeightsFile = $outweights; $iteration++; print STDERR "\n==========\n"; } diff --git a/rampion/rampion_cccp.cc b/rampion/rampion_cccp.cc index 6eb3ccf3..a04da831 100644 --- a/rampion/rampion_cccp.cc +++ b/rampion/rampion_cccp.cc @@ -58,6 +58,7 @@ struct HypInfo { SufficientStats ss; scorer.Evaluate(hyp, &ss); g = metric->ComputeScore(ss); + if (metric->IsErrorMetric()) g = 1 - g; } vector<WordID> hyp; @@ -91,7 +92,6 @@ int main(int argc, char** argv) { DocumentScorer ds(metric, conf["reference"].as<vector<string> >()); cerr << "Loaded " << ds.size() << " references for scoring with " << evaluation_metric << endl; double goodsign = 1; - if (metric->IsErrorMetric()) goodsign = -goodsign; double badsign = -goodsign; Hypergraph hg; @@ -121,6 +121,8 @@ int main(int argc, char** argv) { vector<HypInfo>& curkbest = kis.back(); is >> file >> sent_id; ReadFile rf(file); + if (kis.size() % 5 == 0) { cerr << '.'; } + if (kis.size() % 200 == 0) { cerr << " [" << kis.size() << "]\n"; } HypergraphIO::ReadFromJSON(rf.stream(), &hg); hg.Reweight(weights); KBest::KBestDerivations<vector<WordID>, ESentenceTraversal> kbest(hg, kbest_size); @@ -132,8 +134,8 @@ int main(int argc, char** argv) { curkbest.push_back(HypInfo(d->yield, d->feature_values, *ds[sent_id], metric)); } } + cerr << "\nHypergraphs loaded.\n"; - cerr << "Hypergraphs loaded.\n"; vector<SparseVector<weight_t> > goals(kis.size()); // f(x_i,y+,h+) SparseVector<weight_t> fear; // f(x,y-,h-) for (unsigned iterp = 1; iterp <= tp; ++iterp) { |