An anagram of a word or phrase is the result of rearranging its letters to form another meaningful word or phrase. For example, an anagram of “anagram finder” is “garden in a farm” (work it out!).
This page describes, in Unix manual page style, a C++ program available for downloading from this site which finds English language anagrams for a phrase. The program is available as source code compatible with any current C++ compiler or as a ready-to-run 32-bit Windows executable.
Anagrams are generated based on the official dictionary (second edition) of that crossword game whose name you cannot mention without having lawyers burst out of your screen brandishing menacing documents, courtesy of Grady Ward's Moby Words compilation. We search the dictionary in decreasing order of word length, as longer words tend to produce more interesting anagrams. Only alphabetic characters are considered in anagrams, and accented characters are “flattened” by removing the accents.
Users may create their own dictionaries from word lists; this permits supporting other languages and vocabularies, for example, using only words which appeared in the works of Shakespeare. If you create interesting dictionaries and wish to share them, please get in touch—we'll be glad to host them on this site.
anagram – find anagrams for phrase
anagram [ options ] [ 'target phrase' [ seed… ] ]
anagram finds anagrams or permutations of words in the target phrase. If one or more seed words is given, only anagrams containing all of those words will be shown. The target and seed may be specified by options or CGI program environment variables as well as on the command line.
Options are specified on the command line prior to the input and output file names (if any). Options may appear in any order. Long options beginning with “--” may be abbreviated to any unambiguous prefix; single-letter options introduced by a single “-” may be aggregated.
Output is written to standard output and may be redirected or piped to another program in the usual manner. When generating HTML as a CGI program, it is the responsibility of the shell script which invokes anagram to emit the Content-type: text/html and blank line which precedes the HTML. This permits changing the type to text/plain for debugging.
The standard dictionary includes many extremely obscure words, including all the curious short words permitted in That Crossword Game. Consequently, anagrams of phrases with many high-frequency letters will often include these words. Sorting through them all can be tedious and (see below) time consuming. Somebody ought to edit the dictionary and create an “interesting word” list which excludes the esoterica.
Long phrases containing many high-frequency letters may have tens or hundreds of millions of anagrams, not counting permutations. If you launch such a search, be aware of the potential consequences. If you're setting up the program on a server, you may want to limit the resources it can consume.
If you find errors in this program or document, please report them to Bravo Uniform Golf Sierra @ Foxtrot Oscar Uniform Romeo Mike India Lima Alpha Bravo Decimal Charlie Hotel. If you don't have any idea what I just said, please consult this document.
Prior releases remain available.
Last update: January 26th, 2011