miwafu/bin/count-leading-syllables

48 lines
1,003 B
Text
Raw Normal View History

#!/usr/bin/perl
#
# Setup
#
# Directives
use strict;
use warnings;
# Modules
use File::Basename;
2015-01-10 16:56:39 +00:00
#
# Syllables
#
my @SYLLABLES = qw@a wa ra ma pa ba ha na da ta za sa ga ka fa e we re
me pe be he ne de te ze se ge ke fe i wi ri mi pi bi hi ni chi ji shi
gi ki fi o wo ro mo po bo ho no do to jo so go ko fo u wu ru mu pu bu
hu nu tsu zu su gu ku fu ya rya mya pya bya hya nya chya jya shya gya
kya yo ryo myo pyo byo hyo nyo chyo jyo shyo gyo kyo yu ryu myu pyu
byu hyu nyu chyu jyu shyu gyu kyu n@;
#
# Figure out the directory
#
my $script_directory = dirname($0);
my $root_directory = dirname($script_directory);
my $dict_directory = "$root_directory/src/dictionary";
print "$dict_directory\n";
#
# Go through the syllable files and build up the counts.
#
2015-01-10 16:56:39 +00:00
foreach my $syllable (@SYLLABLES)
{
# Figure out the counts for this directory.
my @count = glob("$dict_directory/$syllable/*.yaml");
my $count = scalar(@count);
# Write it out.
printf "%3d %s\n", $count, basename($syllable);
}