DP_AlphaWords CFML Custom Tag

Download | Revision History |Usage | Example Output | Resources

The DP_AlphaWords Custom Tag provides a simple method for converting arbitrary text to list of words which help to disambiguate spelling. For example the word "CAT" may be translated to "Charlie Alfa Tango".

This translation is useful when communicating information where spelling is crucial (computer passwords, names, license plate numbers, etc) over the phone or radio. It may also be useful when presenting potentially ambigious information such as randomly generated user names or passwords.

  • The tag can output a simple list, a verbose script suitable for reading or an array of objects for programmatic display of the data. The verbose output support several formatting options.
  • The tag supports several alphabet standards.
  • The tag supports most typable english characters and will translate them to their names. For example the character "}" will be translated to "Right Curly Brace".

The tag supports the following alphabets:

  • NATO: The NATO phonetic alphabet (used by most international and military agencies). Source.
  • LAPD: The Los Angeles Police Department alphabet (used by most law enforcement and emergency service agencies in the US). Source.
  • Army1916: From the 1916 Signal Book. Source.
  • Army1939: From the 1939 Basic Field Manual FM-24-5 Signal Communications","1939. Source.
  • Army1944: Radio News Vol. 31 No. 2, 1944. Source.
  • RAF1924: 1924–1942. Source.
  • RAF1942: 1942–1943. Source.
  • RAF1943: 1943–1956. Source.
  • Gorey: From "The Gashleycrumb Tinies" by Edward Gorey, 1963. Used with respectful adoration, but without permission.
  • Grover: From "Grover and the Twenty-Six Scoops" by Patricia Thackray featured in "The Sesame Street Bedtime Storybook". Used with fond memory and love, but without permission.

Download back to top

This tag requires Macromedia's Cold Fusion development enviroment, version 5.x or later. All downloads and code are covered by our Source Code Policy.

DP_AlphaWords.zip, 4.71kb Zip-Format Archive

Revision History back to top

September 10, 2006 Version 1.0

  • Complete rewrite.
  • New documentation.
  • Dropped CF 4.x support.

July 25, 2004

  • Removed documentation from the downloadable archive to ease maintenance.

June 24, 2000

  • Initial Release.

Usage back to top

The tag takes a string and presents it using one of nine "alpha word" encoding alphabets. For example the tag might take the string "ABC" and return the standard NATO encoding of "Alfa Bravo Charlie". It can also present more detailed information to enforce case, class of the character and symbol names.

This is useful in many technical support arenas. For example relating a complex serial number or activation code to a customer over the phone is made much easy and clearer.

If you find the tag useful and use it on your site please let us know!

Tag Usage

The DP_AlphaWords takes seven parameters:

InputRequired. The string to be converted.
OutputVarOption (defaults to "AlphaConversion"). The name of the variable to be used for outputing the results of the conversion.
AlphaSetOptional (defaults to NATO). The alphabet set to use in the conversion. Acceptable values are "NATO", "LAPD", "Army1916", "Army1939", "Army1944", "RAF1924", "RAF1942", "RAF1943", "Gorey" or "Grover".
OutputStyleOptional (defaults to Simple). Determines the style of output. Acceptable values are:
  • Simple: Each character is translated directly to the corrosponding word.
  • Verbose: Each character is presented again and translated to a phrase including character type and case information in addition to the corrosponding word.
  • Array: The string is converted to an array where each element is a struct with information about the character. These structs have the following keys:
    • Char: The character itself.
    • Code: The ASCII code of the character.
    • Trans: The "translation" of the character (depends upon the Alphabet set used).
    • Type: The type of character. Value will be one of the following: "Lowercase", "Uppercase", "Number", "Unknown" or "Symbol".
OutputPrefixOptional (defaults to an empty string). This string will be prefixed (inserted before) to the translation of each character. This argument is ignored if the OutputStyle is "Array".
OutputPostfixOptional (defaults to a single space). This string will be postfixed (inserted after) to the translation of each character. This argument is ignored if the OutputStyle is "Array".
OutputIncludeCSSOptional (defaults to false). If true the output will be tagged with CSS identifiers (using span tags) which the developer can set. These declarations are "dpAlphaWords_Char" (applied to the character in Verbose-style output) and "dpAlphaWords_Trans" (applied to the translation). Note that for long inputs including CSS can dramtically increase the size of the output.

Tag Output

The tag outputs the variable defined with the "OutputVar" parameter. The content of the variable depends upon the valiu of the "OutputStyle" parameter.

Tag Example

The following example converts the string "qle1h50hO" (which contains some ambiguous characters) to a simple NATO alpha conversion:

<CFModule   Template = "DP_AlphaWords.cfm"
            AlphaSet = "NATO"
            Input = "qle1h50ho"
            OutputVar = "AlphaConversion"
            OutputStyle = "Simple">

If case were important to the application you might use the "Verbose" output type as in the following call. Note that we use the "OutputPostfix" parameter to insert an HTML break at the end of each line of output:

<CFModule   Template = "DP_AlphaWords.cfm"
            AlphaSet = "NATO"
            Input="qle1h50ho"
            OutputVar="AlphaConversion"
            OutputStyle="Verbose"
			OutputPostfix = "<br>">

"Verbose" is especially good for phone applications as it produces a "script"-like output that's very easy to read.

Example Tag Output back to top

Asking for "qle1h50ho" in simple NATO conversion returns the following in the "AlphaConversion" variable:

"Quebec Lima Echo One Hotel Five Zero Hotel Oscar"

The same string using the "Verbose" setting would returns the following in the "AlphaConversion" variable:

Lowercase "q" as in Quebec
Lowercase "l" as in Lima
Lowercase "e" as in Echo
The Number One
Lowercase "h" as in Hotel
The Number Five
The Number Zero
Lowercase "h" as in Hotel
Uppercase "O" as in Oscar

Other Resources back to top

Other resources to help you make the most of this component including code walkthroughs and supporting systems and external web links.

DP_AlphaWords Example
A simple free form example of DP_AlphaWords.
DP_AlphaWords for JavaScript
A JavaScript version of the tag useful for client-side implementions, Action Script or other ECMAScript environments.

796 Current Sessions; Time: 08:22:29 09-09-2010; Tick: 62