5 open( my $f, "text.txt" ) ;
\r
9 $text .= $_ while (<$f>) ;
\r
12 my @a = split /[^\w'-]/, $text ;
\r
13 foreach my $w (@a) {
\r
14 $words{$w} += 1 if $w ;
\r
16 for (my $j = 1; $j < 30; ++$j ) {
\r
17 for ( my $i = 0; $i + $j - 1 < @a; $i += 1 ) {
\r
19 for ( my $k = 0; $k < $j; ++$k ) {
\r
20 $s .= ' '.$a[$i+$k];
\r
22 $s =~ /\s*(\S.+\S)\s*/;
\r
29 open (my $dst, ">dictionary.txt") ;
\r
33 $nCount++ foreach (keys %words) ;
\r
34 print $dst $nCount, "\n" ;
\r
36 print "Generate test dictionary...\n" ;
\r
37 print $dst $_, "\n" foreach (keys %words) ;
\r