diff options
Diffstat (limited to 'scripts/generic/extract-factors.pl')
-rwxr-xr-x | scripts/generic/extract-factors.pl | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/scripts/generic/extract-factors.pl b/scripts/generic/extract-factors.pl deleted file mode 100755 index b3eb998b8..000000000 --- a/scripts/generic/extract-factors.pl +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/perl -w - -#extract-factors.pl: extract only the desired factors from a factored corpus -#usage: extract-factors corpusfile factor-index factor-index ... > outfile -#factor indices start at 0 -#factor indices too large ought to be ignored - -use strict; - -my ($filename, @factors) = @ARGV; -my %indices = map {$_ => 1} @factors; - -open(INFILE, "<$filename") or die "couldn't open '$filename' for read: $!\n"; -while(my $line = <INFILE>) -{ - chop $line; - print join(' ', map {my $i = 0; join('|', grep($indices{$i++}, split(/\|/, $_)))} split(/\s+/, $line)) . "\n"; -} -close(INFILE); |