summaryrefslogtreecommitdiff
path: root/rescore
diff options
context:
space:
mode:
authorredpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-12-05 01:42:19 +0000
committerredpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-12-05 01:42:19 +0000
commita50b6162b1c5b18473db9de98aa1fa73620b9af9 (patch)
tree5a61803ff88354b341ea5546ab0ef9860ee727f2 /rescore
parent5694fc704f0c7b040c28f88a034e67a1ed19d3ba (diff)
small changes
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@740 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'rescore')
-rwxr-xr-xrescore/rescore_inv_model1.pl14
1 files changed, 9 insertions, 5 deletions
diff --git a/rescore/rescore_inv_model1.pl b/rescore/rescore_inv_model1.pl
index 4fc3cfcc..780452f5 100755
--- a/rescore/rescore_inv_model1.pl
+++ b/rescore/rescore_inv_model1.pl
@@ -76,13 +76,17 @@ sub rescore {
my @hyps = @$rh;
my @feats = @$rf;
my $nhyps = scalar @hyps;
+ my %cache = ();
print STDERR "RESCORING SENTENCE id=$id (# hypotheses=$nhyps)...\n";
for (my $i=0; $i < $nhyps; $i++) {
- my $score = 0;
- if ($reverse_model) {
- die "not implemented";
- } else {
- $score = m1_prob($src, $hyps[$i]);
+ my $score = $cache{$hyps[$i]};
+ if (!defined $score) {
+ if ($reverse_model) {
+ die "not implemented";
+ } else {
+ $score = m1_prob($src, $hyps[$i]);
+ }
+ $cache{$hyps[$i]} = $score;
}
print "$id ||| $hyps[$i] ||| $feats[$i] $feature_name=$score\n";
}