summaryrefslogtreecommitdiff
path: root/extools/test_data/make_len_cats.pl
diff options
context:
space:
mode:
authorredpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-06-22 05:12:27 +0000
committerredpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-06-22 05:12:27 +0000
commit7cc92b65a3185aa242088d830e166e495674efc9 (patch)
tree681fe5237612a4e96ce36fb9fabef00042c8ee61 /extools/test_data/make_len_cats.pl
parent37728b8be4d0b3df9da81fdda2198ff55b4b2d91 (diff)
initial checkin
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@2 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'extools/test_data/make_len_cats.pl')
-rwxr-xr-xextools/test_data/make_len_cats.pl23
1 files changed, 23 insertions, 0 deletions
diff --git a/extools/test_data/make_len_cats.pl b/extools/test_data/make_len_cats.pl
new file mode 100755
index 00000000..25ef75fa
--- /dev/null
+++ b/extools/test_data/make_len_cats.pl
@@ -0,0 +1,23 @@
+#!/usr/bin/perl -w
+use strict;
+
+my $max_len = 15;
+my @cat_names = qw( NULL SHORT SHORT MID MID MID LONG LONG LONG LONG LONG VLONG VLONG VLONG VLONG VLONG );
+
+while(<>) {
+ chomp;
+ my @words = split /\s+/;
+ my $len = scalar @words;
+ my @spans;
+ for (my $i =0; $i < $len; $i++) {
+ for (my $k = 1; $k <= $max_len; $k++) {
+ my $j = $i + $k;
+ next if ($j > $len);
+ my $cat = $cat_names[$k];
+ die unless $cat;
+ push @spans, "$i-$j:$cat";
+ }
+ }
+ print "@spans\n";
+}
+