Rhyming Dictionary 0.9
Rhyming Dictionary is a command-line driven rhyming dictionary that supports about 127,000 words.
What is this thing?
Why it's a rhyming dictionary, of course! But more specifically, it's a command-line program that takes a word and returns to you a formatted list of all words that rhyme with it. The default response is a perfect rhyme (which is probably what you want). Or you can get a syllable count of a certain word ("whitening" has 2-3 syllables, etc.). Previous versions included homophone and consonant match options but are no longer available in 0.3. If there is enough demand, I will re-add them.
However, if you don't want to deal with the command-line, you can also use my existing code as part of a CGI or GUI-based program with a minimal of effort. I plan to import Perl and PHP code at some point, but not right away. I'd rather not deal with Perl if I can avoid it.
Why did you write this?
Because all the other rhyming dictionaries I've seen were either in dead tree format (which takes awhile to flip through), or were web-only (which would force me to be online constantly to use them) and I didn't like either approach. So I wrote one I could use on my machine for when it wasn't on the network that didn't take up a lot of resources and worked very fast. I believe I have succeeded.
Step 1: Edit the Makefile
Change BINPATH to where you'd like the "rhyme" binary installed (the default is /usr/bin) and change the RHYMEPATH to where you'd like the Rhyming Dictionary database files installed (the default is /usr/share/rhyme). These database files will be about 10 megabytes, so make sure you have enough room. Also included is a man page, so feel free to adjust the MANPATH to where you would like it installed (the default is /usr/share/man/man1).
Step 2: Build it
Type "make". You'll notice that a "compile" binary is created first. This program generates GDBM files from the included text files and will take quite awhile to complete. Why? Because GDBM files aren't actually cross-platform. For example, Sun Sparc GDBM files don't work on Linux x86 and vice-versa. The compile step ensures that the created GDBM files *will* work on your machine. The actual building of the "rhyme" binary should be quite simple.
Step 3: Install it
As an administrator, type "make install". This will place the "rhyme" binary in the BINPATH directory and the "words.db","rhymes.db" and "multiple.db" files in the RHYMEPATH directory. If you'd like to move these files at any time, you can use the RHYMEPATH environment variable to point "rhyme" to the new location.
And you should be all set! As long as the BINPATH is in your path (most likely), you should be able to type "rhyme" and get the words you're looking for. The performance of GDBM is similar to that of the old MySQL version but with only half the steps to install.
If you find you don't like or need the dictionary any longer, "make uninstall" will remove its files from your system so long as they haven't moved since installation. By design, the install doesn't spray files all over your system. So cleanup or upgrading should pose no problems.
Uninstalling old MySQL data
As promised, if you're upgrading from an older version you most likely have unneeded rhyme data sitting in MySQL. To remove it, first connect to MySQL as an administrator. Try:
mysql -u root -p
at a UNIX prompt and give it the proper MySQL root password. If successful, you should see something like:
Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 51 to server version: 3.22.32
Type 'help' for help.
which indicates you are now connected. At the mysql> prompt, you can now type:
drop database rhymedict;
and the data should be removed. But there's probably still a guest user present on MySQL which should also be removed. Do this by typing:
delete from mysql.user where User="rhymeguest" and Host="localhost";
and the guest user should be removed. That's it! Just type "quit;" to exit MySQL and don't look back. Future versions of the Rhyming Dictionary will no longer use MySQL to store rhyming data. If you have no other use for MySQL, feel free to remove it from your system entirely.
Usage: rhyme [OPTIONS] < word >
Search type: (perfect rhyme is default)
-s, --syllable returns only the number of syllables
-m, --merged multiple pronunciations are merged
-i, --interactive interactive mode
-h, --help this help message
-v, --version this program's version
RHYMEPATH the directory of the database files
The output is ordered by syllable count and alphabetized
What's New in This Release:
· After taking another break from pronunciation-building, I've eliminated the Python scripts (except for the test script, which I may keep) entirely. The reason for the scripts was to pre-parse the full dictionary into easily-digestible text files. That way, I could use Python for that ugly (and slow) grunt work without having to require the user to have Python installed - since the pre-parsed text would be included along with the dictionary.
· But that wastes a lot of space and is rather painful to download over a 56k connection. So, I could either require everyone to have Python installed in order to save some space, or re-implement the GDBM-maker in C. The result is that the new GDBM-maker is a lot faster than the old one and is slightly smarter about handling multiple pronunciations.
· At any rate, expect the next version to come in a much smaller tarball than before.
· I've also stumbled upon a stupid bug in the merging routine that prints the words out of order. So, I'm going to release version 0.9 with that bug fixed and wait until version .10 to add a lot more words.