Clabbers - An anagram tool (rev. 39)


Table of Contents

Preamble
Using Clabbers
Downloads

Preamble

I've played Scrabble [1] for years and I never seem to tire of it. The technical part of my brain wondered if there was a way to find out every valid word possible for a given rack of letters, including blanks. Well here we are: Clabbers.

Clabbers is a couple of Perl scripts, a word list and a SQL schema. It was designed for use with PostgreSQL though I see no reason why it can't be ported to other database back ends. Please feel free, encouraged in fact, to do so.

The software can run with almost any word list at all, I've included the SOWPODS word list as a good example. The almost qualification is more a restriction of the database back end, specifically if it can have table names containing non A to Z letters.



[1] Scrabble is the registered trademark of Mattel and/or J. W. Spears, depending on where you live. Wherever I use the word in these pages please mentally insert all the appropriate copyright and trademark paraphenalia.

Using Clabbers

I'm assuming that you already have PostgreSQL installed and configured, you will also need the Perl DBI:Pg library. The schema included will work for any word list that uses the plain A to Z alphabet.

If you use Debian, you can install everything needed with:

aptitude install postgresql libdbd-pg-perl

Assuming that we start with an empty database called sowpods which is owned by a user of the same name, we need to load the schema:

psql --user sowpods -f sowpods_schema.sql sowpods

This will create 27 tables and several indexes. We next need to insert the words into the database.

make-clabbers-index.pl 

This will take some time to process, it's about 1.6 million INSERTs in total for the SOWPODS wordlist but once done you should be ready to go. To test try:

clabbers.pl and_

If all is well, this will give you all possible words for those three letter plus one blank tile.

martin@winter:~clabbers-0.0.4# ./clabbers.pl and_

2 (42) : aa ab ad ae ag ah ai al am an ar as at aw ax ay ba da de di do ea ed
en fa ha id in ka la ma na ne no nu ny od on pa ta un ya

3 (74) : add ado ads adz aid ain ana and ane ani ann ant any ard awn bad ban
cad can dab dad dae dag dah dak dal dam dan dap das daw day den din don dun ean
end fad fan gad gan had han lad mad man mna nab nae nag nah nam nan nap nas nat
naw nay ned nid nod oda pad pan rad ran sad san tad tan van wad wan

4 (22) : ands band damn dang dank dans dant darn dawn dean dona duan fand hand
land mand nada nard pand rand sand wand

You can also restrict the word set returned to those containing a particular string. Given the word set used above, we could only return words containing aw like this:

martin@winter:~/clabbers/trunk$ ./clabbers.pl and_ aw

2 (1) : aw

3 (3) : awn daw naw

4 (1) : dawn

Downloads

Clabbers is free software released under the GNU Public Licence. I welcome feedback and suggestions for improvements.

The latest version of Clabbers is 0.0.6 and you can download it here.

The work-in-progress version of Clabbers can be downloaded using Subversion.

svn co http://svn.hinterlands.org/clabbers/trunk/