summaryrefslogtreecommitdiff
path: root/rescore/generate_zmert_params_from_weights.pl
blob: a928789690d042f77289d41801f01c0665a0e073 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/perl -w

my %defaults;
$defaults{'LanguageModel'} = "Opt\t0\t10\t0\t2.5";
$defaults{'EgivenF'} = "Opt\t-5\t0.5\t-3\t0.5";
$defaults{'LexEGivenF'} = "Opt\t-5\t0.5\t-3\t0.5";
$defaults{'LexFGivenE'} = "Opt\t-5\t0.5\t-3\t0.5";
$defaults{'PassThrough'} = "Opt\t-Inf\t+Inf\t-10\t0";
$defaults{'WordPenalty'} = "Opt\t-Inf\t2\t-5\t0";
my $DEFAULT = "Opt\t-Inf\t+Inf\t-1\t+1";

while(<>) {
  next if /^#/;
  chomp;
  next if /^\s*$/;
  s/^\s+//;
  s/\s+$//;
  my ($a,$b) = split /\s+/;
  next unless ($a && $b);
  my $line = $DEFAULT;
  if ($defaults{$a}) { $line = $defaults{$a}; }
  print "$a\t|||\t$b\t$line\n";
}

print "normalization = none\n";