diff --git a/bin/count-leading-syllables b/bin/count-leading-syllables new file mode 100755 index 0000000..3b2f6c9 --- /dev/null +++ b/bin/count-leading-syllables @@ -0,0 +1,37 @@ +#!/usr/bin/perl + +# +# Setup +# + +# Directives +use strict; +use warnings; + +# Modules +use File::Basename; + +# +# Figure out the directory +# + +my $script_directory = dirname($0); +my $root_directory = dirname($script_directory); +my $dict_directory = "$root_directory/dictionary"; + +# +# Go through the syllable files and build up the counts. +# + +foreach my $syllable (glob("$dict_directory/*")) +{ + # Ignore non-directories. + next unless $syllable; + + # Figure out the counts for this directory. + my @count = glob("$dict_directory/$syllable/*.markdown"); + my $count = scalar(@count); + + # Write it out. + printf "%3d %s\n", $count, basename($syllable); +}