$Id: README 7 2007-06-29 12:12:23Z thiagof $

Download: descrambler_0.07.tbz

DESCRIPTION
This Lua script will find all anagrams for a given word based on a
dictionary.  To use it you will need a word dictionary (just a flat text
file with one word per line) and a "compiled" version of it.

The original package is at http://www.tcs.eng.br/freesoftware/descrambler/

CONTENTS
createdict.lua - script to "compile" a dictionary
descramble.lua - main script to solve anagrams
dict           - example dictionary file, uncompiled

USAGE
Lua 5.0 is needed.  The scripts assume the binary will be found in
/usr/bin/lua50.  If your binary is on a different location edit the script
files to put the correct path.

The script "descramble.lua" needs a compiled dictionary to work.  All it does
is pre-count the length of the words and store them uniquely in an efficient
format (well, more efficient than a flat text file).

To compile a dictionary, just use the "createdict.lua" script:

$ ./createdict.lua dict > dict.lua
Lines read: 10000... 20000... 30000... 40000... 50000... 60000... 70000...
Writing 73057 words
Writing lengths

Then, run "descramble.lua" passing the name of the dictionary to be used
as a first parameter:
./descramble.lua dict.lua
Loading dictionary dict.lua
Entering command-line mode; q to exit
> 

After the script loads the dictionary you can type any word to look
for anagrams of and press enter:
> mary
mary
myra
army
(in 0.02s)

You can fix letter positions by entering a number and letter after the word:
> mary 1a
Army
(in 0.01s)
> mary 2y
mYra
(in 0.03s)
> myra 4y
marY
armY
(in 0.03s)

You can fix more than one letter by separating the parameters with space:
> myra 4y 2r
aRmY

To quit just enter "q" on an empty line (or press enter on an empty line).

Running the script without passing at least one parameter (the dictionary to
be used) causes it to print a small usage screen:
./descramble.lua
Usage: ./descramble.lua dict.lua [scrambled] [nL ...]

If more than one parameter is given, the script will consider the second one
to be a word to look anagrams.  Subsequent parameters will be considered as
letter fix commands.  Examples:

./descramble.lua dict.lua mary
Loading dictionary dict.lua
mary
myra
army
(in 0.02s)

./descramble.lua dict.lua mary 3r
Loading dictionary dict.lua
maRy
myRa
(in 0.02s)

You can also use the script to "descramble" words.  Example:
./descramble.lua dict.lua nnaaab
Loading dictionary dict.lua
banana
(in 0.09s)

Who would guess "nnaaab" could spell "banana" huh?  amazing.

TODO
- Create command to load dictionary on the command-line mode.
- Fix ugly script error when enter is pressed on an empty line.
- Find something better to do with my spare time.