diff options
author | redpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-11-17 02:52:04 +0000 |
---|---|---|
committer | redpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-11-17 02:52:04 +0000 |
commit | 69e918e3e090d3fc28864d0eb77d521f6682a593 (patch) | |
tree | 20394439fa205f3d799c6a5a9a11b9e212d160e4 /rescore/rerank.pl | |
parent | 51da1d896f0b941f506fd3c74f614bfd0c688d46 (diff) |
zmert support
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@730 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'rescore/rerank.pl')
-rwxr-xr-x | rescore/rerank.pl | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/rescore/rerank.pl b/rescore/rerank.pl index 296ae6d5..4a0c5750 100755 --- a/rescore/rerank.pl +++ b/rescore/rerank.pl @@ -39,7 +39,7 @@ while(<HYP>) { my ($id, $hyp, $feats) = split / \|\|\| /; unless (defined $cur) { $cur = $id; } if ($cur ne $id) { - extract_1best(\%hyps); + extract_1best($cur, \%hyps); $cur = $id; %hyps = (); } @@ -53,15 +53,15 @@ while(<HYP>) { } $hyps{"$hyp ||| $feats"} = $tot; } -extract_1best(\%hyps) if defined $cur; +extract_1best($cur, \%hyps) if defined $cur; close HYP; sub extract_1best { - my $rh = shift; + my ($id, $rh) = @_; my %hyps = %$rh; if ($kbest) { for my $hyp (sort { $hyps{$b} <=> $hyps{$a} } keys %hyps) { - print "$hyp\n"; + print "$id ||| $hyp\n"; } } else { my $best_score = undef; @@ -79,8 +79,8 @@ sub extract_1best { sub usage { print <<EOT; -Usage: $0 -w weights.txt -h hyp.nbest.txt - Reranks n-best lists with new weights, extracting the new 1-best entries. +Usage: $0 -w weights.txt -h hyp.nbest.txt [--kbest] + Reranks n-best lists with new weights, extracting the new 1/k-best entries. EOT } |