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

mml-filter.perl « support « ems « scripts - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5b6e0283429e6a57188ecd1091cf7a22b6e90b79 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env perl 

use strict;
use FindBin qw($RealBin);

my ($in,$out,$score,$source_lang,$target_lang,$proportion,$domain,$alignment);

use Getopt::Long;
GetOptions('in=s' => \$in,
           'out=s' => \$out,
           'score=s' => \$score,
           'domain=s' => \$domain,
           'alignment=s' => \$alignment,
           'input-extension=s' => \$source_lang,
           'output-extension=s' => \$target_lang,
           'proportion=f' => \$proportion
    ) or exit(1);

die("ERROR: input corpus stem not specified (-in FILESTEM)") unless defined($in);
die("ERROR: output corpus stem not specified (-out FILESTEM)") unless defined($out);
die("ERROR: score file not specified (-score FILE)") unless defined($score);
die("ERROR: domain file not specified (-domain FILE)") unless defined($domain);
die("ERROR: input extension not specified (-input-extension STRING)") unless defined($source_lang);
die("ERROR: output extension not specified (-output-extension STRING)") unless defined($target_lang);
die("ERROR: proportion not specified (-proportion RATIO)") unless defined($proportion);

open(CONFIG,">$out.ini");
print CONFIG "[general]
strategy = Score
source_language = $source_lang
target_language = $target_lang
input_stem = $in
".(defined($alignment) ? "alignment_stem = $alignment\n" : "").
"output_stem = $out
domain_file = $domain
domain_file_out = $out

[score]
score_file = $score
proportion = $proportion\n";
close(CONFIG);

my $cmd = "$RealBin/mml-filter.py $out.ini";
print STDERR "$cmd\n";
print STDERR `$cmd`;