From 945adc48b08d8cbc1084b0e13a68876db707b816 Mon Sep 17 00:00:00 2001 From: redpony Date: Fri, 29 Oct 2010 14:07:45 +0000 Subject: more wa git-svn-id: https://ws10smt.googlecode.com/svn/trunk@701 ec762483-ff6d-05da-a07a-a48fb63a330f --- word-aligner/support/make_lex_grammar.pl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'word-aligner/support') diff --git a/word-aligner/support/make_lex_grammar.pl b/word-aligner/support/make_lex_grammar.pl index e4cbf7ba..8d38abda 100755 --- a/word-aligner/support/make_lex_grammar.pl +++ b/word-aligner/support/make_lex_grammar.pl @@ -35,7 +35,7 @@ my %sizes = (); while() { chomp; my ($f, $e, $lp) = split /\s+/; - $model1{$f}->{$e} = 1e-12 + exp($lp); + $model1{$f}->{$e} = sprintf("%.5g", 1e-12 + exp($lp)); $sizes{$f}++; } close M1; @@ -185,7 +185,11 @@ for my $f (sort keys %fdict) { my $total_eandf = $ecounts{$e} + $fcounts{$f}; my $dice = 2 * $efcount / $total_eandf; my @feats; - if (defined $m1 && $ADD_MODEL1) { push @feats, "Model1=$m1"; my $m1d = $m1 * $dice; push @feats, "M1Dice=$m1d"; } + if (defined $m1 && $ADD_MODEL1) { + push @feats, "Model1=$m1"; + my $m1d = sprintf("%.5g", $m1 * $dice); + push @feats, "M1Dice=$m1d"; + } if ($ADD_MODEL1 && !defined $m1) { push @feats, "NoModel1=1"; } if ($ADD_FIDENT && $efcount > $MIN_FEATURE_COUNT) { $fc++; -- cgit v1.2.3