Perl_カボチャから句数を計る
とりあえず,以下で簡易的には取れる.
#!/usr/bin/perl
# INPUT $cabocha -f1 -O2 test.txt > test2.txt
$input = &argcut($ARGV[0]);
open(INPUT, "$ARGV[0]") or die "cant open $ARGV[0]";
open(OUT,">$input") or die "cant open $ARGV[0]";
$aster;
$line;
while(<INPUT>){
chomp;
if(/^EOS/){
$line++;
print "$line"."="."$aster\n";
$aster = 0;
}
elsif(/^\*/){
$aster++;
}
}
Link: Programming(5647d)
Last-modified: 2007-10-03 (水) 11:57:48 (6711d)