miwafu/bin/count-leading-syllables
D. Moonfire 3b54db3969 feat: switch dictionary entries from Markdown-based to YAML-based
- removed the ATX conversion utility
- switch the syllable counter to use the right path
- added Lexember 2018 and 2017 words

BREAKING CHANGE: Changes the base file format
2018-12-26 17:04:11 -06:00

47 lines
1,003 B
Perl
Executable file

#!/usr/bin/perl
#
# Setup
#
# Directives
use strict;
use warnings;
# Modules
use File::Basename;
#
# 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.
#
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);
}