summaryrefslogtreecommitdiff
path: root/extools/test_data/make_len_cats.pl
blob: 25ef75fae7e9dfd29109da643ff54fe15ce6b1ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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";
}