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
commit670356efa26cd3bba3bf7047701e9fad1aeed0cb (patch)
treeb8d5e3d1364933dca3301a9579ef7531dfd14c1b /rescore
parentd52db01a2e224869c6ea72a4a234e888c6fd756c (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";
}