No commit activity in last 3 years
No release in over 3 years
Supports Latin alphabets and Japanese kana.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.11
~> 10.0
~> 3.0
 Project Readme

SpellingAlphabet

SpellingAlphabet is a conversion module for spelling alphabet (phonetic alphabet).

Supports Latin alphabets and Japanese kana.

Installation

Add this line to your application's Gemfile:

gem 'spelling_alphabet'

And then execute:

$ bundle

Or install it yourself as:

$ gem install spelling_alphabet

Usage

Gem

In your ruby source, write the line below:

require "spelling_alphabet"

Letters to Words

SpellingAlphabet::ITU.spellout("ABC") #=> "Alfa Bravo Charlie"
SpellingAlphabet::Japanese.spellout("イロハ") #=> "いろはのイ ローマのロ はがきのハ"

Words to letters

SpellingAlphabet::ITU.interpret("Yankee Zulu Nadazero")).to eq("YZ0")
SpellingAlphabet::Japanese.interpret("朝日のア いろはのイ 上野のウ") # => "アイウ"

Command

SpellingAlphabet gem also includes "spellout" command which converts given words to a sequence of spelling alphabet.

> spellout -h
Usage: spellout [options] WORDS
Convert WORDS to a sequence of spelling alphabet(phonetic alphabet)

Options:
    -w, --word-set=WORD_SET          Speify the word set for conversion (default: ITU)
    -i, --interpret                  Interpret WORDS instead of spellingout

Supported word sets:
   ITU       ITU Phonetic Alphabet and Figure Code
   ICAO      ICAO Radiotelephony Alphabet
   Japanese  Japanese radiotelephony alphabet (requires UTF-8 environment)

Here are some examples:

> spellout a b 1
Alfa Bravo Unaone

> spellout -i Alfa Bravo Unaone
AB1

> spellout -w Japanese 1
数字のひと

Development

Test

Run the tests in spec directory:

$ cd spelling_alphabet
$ rake spec

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/hashimoton/spelling_alphabet.

License

The gem is available as open source under the terms of the MIT License.