The Premise

Develop a Java algorithm to generate trees of possible numeronyms for a list of phone numbers.

My Design

  1. Parse Input
    1. Read dictionary file
    2. Discard words containing invalid symbols, or containing too many symbols
    3. Sort words by symbol count, storing each in a separate array
    4. Sort each array by alphanumeric value

  2. For every phone number, generate a list of word combinations or "paths". Begin recursive algorithm with min = 0, max = max_word_size:
    1. If min = max_word_size: save/store the current "path".
    2. Of min = max: End recursion.
    3. Find all word matches for the "sub number" of min → max, using binary search on the array of max-min length words
      • Example: 4754632 from min=2 to max=6 will return "LINE" "LIME" and "KIND" for the subnumber "5463".
    4. Of binary search yielded at least one result, recursively call algorithm with minnew = maxold and maxnew = max_word_size
    5. Recursively call algorithm with minnew = minold-1and maxnew = maxold.

  3. Output to a file using entered settings, and proper printf formatting

How To Use

This numeronym generator needs to be compiled with javac and run using java. It must be provided with a plain text list of words, separated with whitespace, and a input file of phone numbers, where each phone number is on a newline, and area codes are separated with a space. The generator has a couple of adjustable parameters that can be tweaked in the source code.