Download tools/mosesdecoder/scripts/training/wrappers/make-factor-stem.perl from Quagmire1/wiki-cased: direct link, hf CLI and curl.
- Browser
- Download file 603 Bytes
-
https://huggingface.co/Quagmire1/wiki-cased/resolve/main/tools/mosesdecoder/scripts/training/wrappers/make-factor-stem.perl
- Command line
-
hf download hf://Quagmire1/wiki-cased/tools/mosesdecoder/scripts/training/wrappers/make-factor-stem.perl
-
curl -L -o make-factor-stem.perl https://huggingface.co/Quagmire1/wiki-cased/resolve/main/tools/mosesdecoder/scripts/training/wrappers/make-factor-stem.perl
603 Bytes
| #!/usr/bin/env perl | |
| # | |
| # This file is part of moses. Its use is licensed under the GNU Lesser General | |
| # Public License version 2.1 or, at your option, any later version. | |
| use warnings; | |
| 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,0,$size); | |
| } | |
| print OUT " " unless $first; $first = 0; | |
| print OUT $word; | |
| } | |
| print OUT "\n"; | |
| } | |
| close(OUT); | |
| close(IN); | |