1This is a completely from-scratch rewrite of the "an" anagram
2generator.
3
4It is a clean room reimplementation inspired by the algorithm by
5Richard Jones and Julian Assange.  It fully supports accented words
6(to the extent that libicu allows).
7
8Algorithm:
9
10* Given a phrase, convert it to a standard form (fold case and remove
11  any accents and marks), generate the set of letters that are unique
12  to that phrase (an alphabet), and generate a bit pattern describing
13  the letter frequencies.
14
15* Read the dictionary into a word list, converting the words into the
16  standard form, and discarding any words which are longer than the
17  phrase or don't contain letters which can be made from the
18  phrase. Produce letter frequency bitpatterns for each word.
19
20* Maintain a current bit pattern, which starts as the phrase's bit pattern.
21
22* Step through the word list, finding words that have a bit pattern
23  which is a subset of the current bit pattern. For each word that
24  matches, push the current word onto a stack, then recurse into the
25  "step through the word list" starting at the current we are looking
26  at, and with a new current bit pattern that has the letter
27  frequencies of the current word subtracted. If we've been able to
28  exactly match the phrase length, print out the word stack. Pop the
29  current word off the stack, and step on to the next word until we
30  run out of words.
31