#! perl -w #srand(1); #$VV=3; #$CC=4; for (qw/a e i o u ai oo /) { $vowel_h{$_}=1; } for (qw/q x y h w/) { $weird{$_}=1; } for ("b".."z") { push @consonant,$_ unless $vowel_h{$_} or $weird{$_}; } for (qw/th sh ch st /) { push @consonant,$_; } @end_consonant=@consonant; for (qw/x/) { push @end_consonant,$_; } @begin_consonant=@consonant; for (qw/w y wh/) { # kn gn push @begin_consonant,$_; } for (qw/ rt mp nt nk lt nd ng rs rd ct ns rm lf ll lp/) { push @end_consonant, $_; push @consonant,$_; } for (qw/fr tr br pr gr sp cr kr tw h pl kl cl gl sl bl/) { push @begin_consonant, $_; push @consonant,$_; } for (qw/rn vn np ld gn sk/) { push @consonant,$_; } @vowel=keys %vowel_h; @b_vowel=@vowel; for (qw/yy ee/) { push @vowel,$_; } #print @consonant,"\n"; for (;;) { print &wordit,"\n";; } #print "\n"; sub wordit { my $ct=0; my $w=""; if (rand 1 < 0.5) { $w.=&rand_select(@begin_consonant); } $w.=&rand_select(@b_vowel); for (1..3) { last if (rand 1 > 0.5); $w.=&rand_select(@consonant); $w.=&rand_select(@vowel); $ct++; } if (rand 1 < 0.5) { $w.=&rand_select(@end_consonant); #print $ct," "; } $w =~ s/yy/y/g; $w; #print "\n"; } sub rand_select { my $a=$_[rand (scalar@_)]; if (length$a>1) { $_[rand (scalar@_)]; } else { $a } } #gunzip < kens-corpus.gz | perl -pwe 's/[aeoiuy-]/ /g' | perl -nlwae 'for(@F){$f{$_}++}END{for (keys %f){next if /^.$/;print "$f{$_} $_"}}' | sort -n