NAME

agram - Basic anagrammer

VERSION

This documentation refers to agram version 0.85.

USAGE

  agram -s scare
  scare 5: carse caser ceras scare scrae

  agram -s scare -d /custom/dictionary/file

  agram -s scare -b
  scare 21: accerse accresce ascare caress caresser carse caser ceras crease creaser reaccess recase recrease resaca scarce scare scarer scarrer scrae searce searcer

  agram -c pear pare
  yes

REQUIRED ARGUMENTS

-s word(s)

Specify one or more words to search for. Will find every anagram of each word and print them out.

-c words

Specify two words to compare. Prints yes if they are anagrams or no if they aren't. If this option is specified it will take precedence over -s, and the words given after -s will be ignored.

OPTIONS

-d

Invoking agram with the -d option allows the user to set a custom dictionary file for the program to search through. The dictionary file will default to /usr/share/dict/words.

-b

Invoking agram with the -b option ignores the length of the search word and the words in the dictionary file, instead matching simply by their base letters. In other words, when used with the word pear, any word that consists only of the letters a, e, p, and r will be matched. This is considerably slower than a normal anagram match because agram must consider every single word rather than skipping based on length, but will be fixed in the future.

-o

Invoking agram with the -o option returns only the first anagram found. It can be used with any of the search flags.

-q

Quiet mode - doesn't print status messages as it is searching the dictionary file. This option is primarily intended for feeding the output of this program to another program. The output format is: <word> <number of anagrams found>: <space separated list of anagrams>

DESCRIPTION

agram is an anagrammer, or a program that finds the anagrams of words given to it. If two words are anagrams, they consist of the same letters and each letter occurs the same amount of times. While agram goes beyond this functionality with the -b flag, its main purpose is still to find anagrams.

DIAGNOSTICS

Usage message

You forgot to provide either words to compare (see -c) or words to search (see-s)!

Can't find anagrams of single letter words

Every word you provided for -c or -s had one letter or less, meaning there are no anagrams.

Can't open dictionary_file %s

The dictionary file that was provided or the default one was not able to be opened for reading. Make sure you have the pathname correct and that this script has read permission.

DEPENDENCIES

Requires List::MoreUtils.

BUGS AND LIMITATIONS

agram can't piece together complex new sentences or phrases based on seed words. Unfortunately, agram cannot speak english and therefore leaves the really clever anagram stuff up to the humans. :(

Note that you can't bundle single letter command line flags. I'm keeping it like this so that multiple words can still be specified under one -s or -c flag. agram -s scare -o -b

TODO

Optimize

Optimize, optimize, optimize, optimize. Especially when running under the -b flag.

AUTHOR

Lincoln Ombelets <ch.animalbar@gmail.com>

LICENSE & COPYRIGHT

Copyright 2009 Lincoln Ombelets, all rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.