Added a script to count leading syllables.

This commit is contained in:
Dylan R. E. Moonfire 2014-12-05 09:05:27 -06:00
parent ec8b12ab35
commit 7ce79c4d5d

37
bin/count-leading-syllables Executable file
View file

@ -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);
}