class SpellingAlphabet::ITU

Word set for ITU Phonetic Alphabet and Figure Code. life.itu.int/radioclub/rr/ap14.htm

Constants

LETTER_WORD
WORD_LETTER
WORD_TABLE

Public Class Methods

interpret(text) click to toggle source

Converts each word to the original letter.

# File lib/spelling_alphabet/itu.rb, line 57
def self.interpret(text)
  text.split(" ").map {|w| WORD_LETTER.fetch(w, w)}.join("")
end
spellout(text) click to toggle source

Converts each letter to the corresponding word.

# File lib/spelling_alphabet/itu.rb, line 52
def self.spellout(text)
  text.delete(" ").chars.map {|c| LETTER_WORD.fetch(c.upcase, c)}.join(" ")
end