diff options
author | bojar <bojar@1f5c12ca-751b-0410-a591-d2e778427230> | 2006-08-13 09:35:02 +0400 |
---|---|---|
committer | bojar <bojar@1f5c12ca-751b-0410-a591-d2e778427230> | 2006-08-13 09:35:02 +0400 |
commit | 840441dc1a128def154cdd05d3151358c7656cf5 (patch) | |
tree | 6b764d1f8944affa99f3c8c6cc61cc91285e2d6d /scripts | |
parent | dfe2e581871a449a3502a2b7a5cab03b808c2567 (diff) |
die if phrase mismatch discovered
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@688 1f5c12ca-751b-0410-a591-d2e778427230
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/training/train-factored-phrase-model.perl | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/scripts/training/train-factored-phrase-model.perl b/scripts/training/train-factored-phrase-model.perl index f1c99d158..537c04203 100755 --- a/scripts/training/train-factored-phrase-model.perl +++ b/scripts/training/train-factored-phrase-model.perl @@ -1099,6 +1099,7 @@ sub score_phrase { open(TABLE,">$___MODEL_DIR/phrase-table.$factor") or die "Can't write $___MODEL_DIR/phrase-table.$factor"; my $i=0; + my $mismatch = 0; while(my $f2n = <F2N>) { $i++; my $n2f = <N2F>; @@ -1106,12 +1107,15 @@ sub score_phrase { my ($english2,$foreign2,$p2) = split(/ \|\|\| /,$f2n); chop($p2); if ($english ne $english2 || $foreign ne $foreign2) { print STDERR "mismatch line $i: ($english ne $english2 || $foreign ne $foreign2)\n"; + $mismatch++; + last if $mismatch > 10; next; } print TABLE "$english ||| $foreign ||| $p $p2 2.718\n"; } close(N2F); close(F2N); + die "There were mismatches! (printed only first 10)" if $mismatch; if (! $debug) { safesystem("rm -f $___MODEL_DIR/phrase-table-half.$factor.*") or die;} if (! $debug) { safesystem("rm -f $___MODEL_DIR/extract*sorted*") or die;} safesystem("rm -f $___MODEL_DIR/phrase-table.$factor.gz") or die; |