Theiling Online    Sitemap    Conlang Mailing List HQ   

Re: A tale of a programming conlanger

From:Charles <catty@...>
Date:Thursday, August 19, 1999, 18:30
taliesin the storyteller wrote:

> > So, where can we download the source? Sounds mighty interesting. > > I scrapped it all and made a lettercounter (no digraphs) from scratch. > I'll probably expand on it, but I have to figure out what it is I really > want to use it for first...
OK, I couldn't resist any longer, and spent 5 minutes writing this: #!/usr/bin/perl -w while (<>) { doit( $_ ); } sub doit { my $zz = shift; my $jj; # single letter census $jj = lc $zz; while ($jj =~ s/(.)//) { $cnt{ "single $1" } ++ } # all digraphs $jj = lc $zz; while ($jj =~ s/(.)(.)/$2/) { $cnt{ "digraph $1$2" } ++ } } for $xx (sort keys %cnt) { print "$cnt{ $xx }\t$xx\n"; } Then ran Herodotus (in English translation) through it, got: 246581 single 160145 single e 116218 single t 96888 single a 90818 single h 84214 single o 80998 single s 79738 single n 76991 single i 68727 single r 52893 digraph t 52259 digraph th 48441 digraph e 48260 single d 47453 digraph he 38648 single l 29480 single c 29130 single m 28426 digraph a Etc. Python may consider itself hereby challenged ...