summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xrescore/rescore_with_cdec_model.pl8
1 files changed, 5 insertions, 3 deletions
diff --git a/rescore/rescore_with_cdec_model.pl b/rescore/rescore_with_cdec_model.pl
index ea4252cb..6553fe56 100755
--- a/rescore/rescore_with_cdec_model.pl
+++ b/rescore/rescore_with_cdec_model.pl
@@ -101,13 +101,15 @@ sub rescore {
print STDERR "RESCORING SENTENCE id=$id (# hypotheses=$nhyps)...\n";
for (my $i=0; $i < $nhyps; $i++) {
if ($reverse_model) {
- print CDEC_OUT "$hyps[$i] ||| $src\n";
+ print CDEC_OUT "<seg id=\"$id\">$hyps[$i] ||| $src</seg>\n";
} else {
- print CDEC_OUT "$src ||| $hyps[$i]\n";
+ print CDEC_OUT "<seg id=\"$id\">$src ||| $hyps[$i]</seg>\n";
}
my $score = <CDEC_IN>;
chomp $score;
- print "$id ||| $hyps[$i] ||| $feats[$i] $feature_name=$score\n";
+ my @words = split /\s+/, $hyps[$i];
+ my $norm_score = $score / scalar @words;
+ print "$id ||| $hyps[$i] ||| $feats[$i] $feature_name=$score ${feature_name}_norm=$norm_score\n";
}
}