Download tools/mosesdecoder/scripts/ems/support/run-command-on-multiple-refsets.perl from Quagmire1/wiki-cased: direct link, hf CLI and curl.
- Browser
- Download file 860 Bytes
-
https://huggingface.co/Quagmire1/wiki-cased/resolve/main/tools/mosesdecoder/scripts/ems/support/run-command-on-multiple-refsets.perl
- Command line
-
hf download hf://Quagmire1/wiki-cased/tools/mosesdecoder/scripts/ems/support/run-command-on-multiple-refsets.perl
-
curl -L -o run-command-on-multiple-refsets.perl https://huggingface.co/Quagmire1/wiki-cased/resolve/main/tools/mosesdecoder/scripts/ems/support/run-command-on-multiple-refsets.perl
860 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; | |
| die("ERROR: syntax: run-command-on-multiple-refsets.perl cmd in out") | |
| unless scalar @ARGV == 3; | |
| my ($cmd,$in,$out) = @ARGV; | |
| die("ERROR: attempt to run on multiple references, but there is only one") | |
| if -e $in && (! -e "$in.ref0" || -e $in."0"); | |
| die("ERROR: did not find reference '$in.ref0' or '${in}0'") | |
| unless (-e "$in.ref0" || -e $in."0"); | |
| for(my $i=0;-e "$in.ref$i" || -e $in.$i;$i++) { | |
| my $single_cmd = $cmd; | |
| if (! -e "$in.ref$i") { | |
| $single_cmd =~ s/mref-input-file/$in$i/g; | |
| } | |
| else { | |
| $single_cmd =~ s/mref-input-file/$in.ref$i/g; | |
| } | |
| $single_cmd =~ s/mref-output-file/$out.ref$i/g; | |
| system($single_cmd); | |
| } | |