summaryrefslogtreecommitdiff
path: root/corpus/cut-corpus.pl
diff options
context:
space:
mode:
authorChris Dyer <cdyer@allegro.clab.cs.cmu.edu>2012-11-14 20:33:51 -0500
committerChris Dyer <cdyer@allegro.clab.cs.cmu.edu>2012-11-14 20:33:51 -0500
commit7928695272b000de7142b91e05959a8fab6b1d2a (patch)
tree59fdff666e938512a34f772f04a1a247704a246f /corpus/cut-corpus.pl
parent41ec6ee5146c92cdb1c279267a5058fe42f8a644 (diff)
major mert clean up, stuff for simple system demo
Diffstat (limited to 'corpus/cut-corpus.pl')
-rwxr-xr-xcorpus/cut-corpus.pl16
1 files changed, 16 insertions, 0 deletions
diff --git a/corpus/cut-corpus.pl b/corpus/cut-corpus.pl
new file mode 100755
index 00000000..fc9cce3b
--- /dev/null
+++ b/corpus/cut-corpus.pl
@@ -0,0 +1,16 @@
+#!/usr/bin/perl -w
+use strict;
+die "Usage: $0 N\nSplits a corpus separated by ||| symbols and returns the Nth field\n" unless scalar @ARGV > 0;
+
+my $x = shift @ARGV;
+die "N must be numeric" unless $x =~ /^\d+$/;
+$x--;
+
+while(<>) {
+ chomp;
+ my @fields = split / \|\|\| /;
+ my $y = $fields[$x];
+ if (!defined $y) { $y= ''; }
+ print "$y\n";
+}
+