Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbojar <bojar@1f5c12ca-751b-0410-a591-d2e778427230>2006-08-10 22:53:12 +0400
committerbojar <bojar@1f5c12ca-751b-0410-a591-d2e778427230>2006-08-10 22:53:12 +0400
commitb65eafacc671aa53d751325cda328991e139f26e (patch)
tree9b5782e1ed7af83bd0ef8fcea8c47a4d6a1897fc /scripts
parente88ba116b9ba3a0c76ec5fdfdc24e211499354b6 (diff)
die if no refs found, report also number of refs and sents used
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@622 1f5c12ca-751b-0410-a591-d2e778427230
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/generic/multi-bleu.perl8
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/generic/multi-bleu.perl b/scripts/generic/multi-bleu.perl
index 9d767107c..fd472777a 100755
--- a/scripts/generic/multi-bleu.perl
+++ b/scripts/generic/multi-bleu.perl
@@ -17,6 +17,8 @@ while(-e "$stem$ref") {
}
&add_to_ref($stem,\@REF) if -e $stem;
+die "No reference sentences found!" if 0 == scalar @REF;
+
sub add_to_ref {
my ($file,$REF) = @_;
my $s=0;
@@ -102,14 +104,16 @@ my $bleu = $brevity_penalty * exp((my_log( $CORRECT[1]/$TOTAL[1] ) +
my_log( $CORRECT[3]/$TOTAL[3] ) +
my_log( $CORRECT[4]/$TOTAL[4] ) ) / 4);
-printf "BLEU = %.2f, %.1f/%.1f/%.1f/%.1f (BP=%.3f, ration=%.3f)\n",
+printf "BLEU = %.2f, %.1f/%.1f/%.1f/%.1f (BP=%.3f, ration=%.3fi, %i sents, %i refs)\n",
100*$bleu,
100*$CORRECT[1]/$TOTAL[1],
100*$CORRECT[2]/$TOTAL[2],
100*$CORRECT[3]/$TOTAL[3],
100*$CORRECT[4]/$TOTAL[4],
$brevity_penalty,
- $length_translation / $length_reference;
+ $length_translation / $length_reference,
+ scalar @REF,
+ scalar @{$REF[0]};
sub my_log {
return -9999999999 unless $_[0];