in reply to Found a word from a set of letters

There have been already many solutions w/word list look up posted to this thread. I'll try to give a 'hands on' example (if you work on a windows box).

First, you could download a dictionary from

ftp://ftp.ox.ac.uk/pub/wordlists/american/dic-0294.tar.gz

and put it in a directory, eg. "c:\dic-0294" (extract it *there*, winrar or winzip should work)
You'll see ~30 different files, each containing words of a defined length.

Then, create a Perl script like the ones that have been posted in the thread or use one that is tailored for this dictionary, like:

use strict; use warnings; my $word = shift || 'OLHOSC'; my $fname = sprintf 'length%02d.txt', length $word; # eg. length06.tx +t my $word_key = join '', sort split //, lc $word; # sort lowercase +letters open my $fh, '<', $fname or die "sorry, no such word list available, +Bye!"; while( my $line = <$fh> ) { chomp $line; my $dict_key = join '', sort split //, lc $line; print "$word => $line\n" if $dict_key eq $word_key # bail out here - if only one match is needed } close $fh;

From the *length* of the looked-up word, the name of the dictionary file is built. If you extracted the above archive, then the files with word lengths between 2 and 32 should reside in the current directory.

Regards

mwa

Replies are listed 'Best First'.
Re^2: Found a word from a set of letters
by vnpenguin (Beadle) on Jan 29, 2008 at 19:22 UTC
    Thank you for your suggestion, Regards,