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

mada-wrapper.perl « wrappers « training « scripts - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: eec10a3ef7c97d8850b483cdfcec56836e6ffd5a (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
#!/usr/bin/env perl 

use strict;
use File::Temp qw/tempfile/;
use Getopt::Long "GetOptions";

my $TMPDIR = "tmp";
my $SCHEME = "D2";
my $KEEP_TMP = 0;

GetOptions(
  "scheme=s" => \$SCHEME,
  "tmpdir=s" => \$TMPDIR,
  "keep-tmp" => \$KEEP_TMP
) or die("ERROR: unknown options");

`mkdir -p $TMPDIR`;
my ($dummy, $tmpfile) = tempfile("mada-in-XXXX", DIR=>$TMPDIR, UNLINK=>!$KEEP_TMP);

print STDERR $tmpfile."\n";
open(TMP,">$tmpfile");
while(<STDIN>) { 
  print TMP $_;
}
close(TMP);

my $madadir = "/home/pkoehn/statmt/project/mada-3.2";
`perl $madadir/MADA+TOKAN.pl >/dev/null 2>/dev/null config=$madadir/config-files/template.madaconfig file=$tmpfile TOKAN_SCHEME="SCHEME=$SCHEME"`;

`rm $tmpfile`;
`rm $tmpfile.bw`;
`rm $tmpfile.bw.mada`;
print `cat $tmpfile.bw.mada.tok`;
`rm $tmpfile.bw.mada.tok`;