Added a script to count leading syllables.
This commit is contained in:
parent
ec8b12ab35
commit
7ce79c4d5d
1 changed files with 37 additions and 0 deletions
37
bin/count-leading-syllables
Executable file
37
bin/count-leading-syllables
Executable 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);
|
||||||
|
}
|
Loading…
Reference in a new issue