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

flipAlignment.perl « OSM « scripts - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3c14a4542bc4f4f4235050fb32aceaf30cb4e75e (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/env perl 
  use strict;

  my $file = shift(@ARGV);
  open(MYFILE, $file);
 my @words;
 my $factor_f;
 my $factor_e;
 my $sentence;

  while (<MYFILE>) {
 	chomp;
 	#print "$_\n";
	
	$sentence = "$_";
	@words = split(/ /, $sentence);
	
	foreach (@words) 
	{
 		 my ($factor_f,$factor_e) = split(/\-/,"$_");
		 print $factor_e . " " . $factor_f . " ";
 	} 
	
	print "\n";
 }
 close (MYFILE);