mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-29 06:52:34 +03:00
85a5a13e4c
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@3633 1f5c12ca-751b-0410-a591-d2e778427230
27 lines
463 B
Perl
Executable File
27 lines
463 B
Perl
Executable File
#!/usr/bin/perl -w
|
|
|
|
use strict;
|
|
|
|
my ($size,$in,$out) = @ARGV;
|
|
|
|
open(IN,$in);
|
|
open(OUT,">$out");
|
|
binmode(IN, ":utf8");
|
|
binmode(OUT, ":utf8");
|
|
|
|
while(<IN>) {
|
|
my $first = 1;
|
|
chomp; s/\s+/ /g; s/^ //; s/ $//;
|
|
foreach my $word (split) {
|
|
if (length($word) > $size) {
|
|
$word = substr($word,length($word)-$size);
|
|
}
|
|
print OUT " " unless $first;
|
|
$first = 0;
|
|
print OUT lc($word);
|
|
}
|
|
print OUT "\n";
|
|
}
|
|
close(OUT);
|
|
close(IN);
|