Help Message #
The help message of spellout provides detailed information on how to use the CLI tool:
Usage: spellout [OPTIONS] [ARGS]...
Arguments:
[ARGS]... The words to encode using the specified phonetic code.
Gives '-' read from stdin. No arguments also reads from stdin.
Options:
-c, --code <CODE> Specify the phonetic code for encoding/decoding the input text.
Default is NATO. Use `--list` option to see all available codes.
-l, --list Prints the available phonetic codes.
-p, --print Prints the phonetic codes for the given type.
--only-code Prints the only phonetic code for the given words.
-d, --decode Decodes given phonetic codes into string.
--input <FILE> Specify the path to a custom phonetic code file.
-h, --help Print help
-V, --version Print versionExamples #
Basic Conversion #
$ spellout "Hello World"
H Hotel
e Echo
l Lima
l Lima
o Oscar
W Whiskey
o Oscar
r Romeo
l Lima
d Delta Using a Different Phonetic Code #
Convert a Japanese phrase using the japanese alphabet.
$ spellout -c japanese "ใใใซใกใฏ"
ใ ๅญใฉใใฎใณ
ใ ใใใพใใฎใณ
ใซ ๆฅๆฌใฎไบ
ใก ใกใฉใใฎใ
ใฏ ่ๆธใฎใListing Available Codes #
$ spellout -l
chp
english
eu
france
indonesia
international
italia
nato
netherlands
philippines
sweden
uk
usaairpots
japanesePrinting a Full Alphabet #
$ spellout -c uk --print
A Able
B Baker
C Charlie
D Dog
E Easy
F Fox
G George
H How
I Item
J Jig
K King
L Love
M Mike
N Nan
O Oboe
P Peter
Q Queen
R Roger
S Samuel
T Tare
U Uncle
V Victor
W William
X X-ray
Y Yoke
Z ZebraUsing a Custom File #
Define your own codes in a file (e.g., my_codes.txt):
A,Apple
B,Ball
C,CatAnd use it with the --input option:
$ spellout --input my_codes.txt "CAB"
C Cat
A Apple
B BallDecoding Phonetic Codes #
$ spellout --only-code "Hello World" | tee codes.txt
Hotel
Echo
Lima
Lima
Oscar
Whiskey
Oscar
Romeo
Lima
Delta
$ cat codes.txt | spellout --decode
HELLO WORLD๐ณ Docker Available #
You can also run spellout using Docker:
docker run --rm -it ghcr.io/tamada/spellout:latest "Hello World"
H Hotel
e Echo
l Lima
l Lima
o Oscar
W Whiskey
o Oscar
r Romeo
l Lima
d DeltaAvailable tags #
latest(the latest version ofno-features-glibc)$VERSION-no_features_glibc$VERSION-no_features-musl$VERSION-unicode_normalization_glibc$VERSION-unicode_normalization_musl
$VERSION is the version of spellout (e.g., 0.1.0).
Library Usage #
To use spellout in your Rust project, add it to your Cargo.toml:
[dependencies]
spellout = "0.1.0" # Check for the latest versionExample: Convert a word using a predefined alphabet #
use spellout::{CodesBuilder, PhoneticCode};
fn main() {
// Build the UK phonetic alphabet
let codes = CodesBuilder::build(PhoneticCode::Uk);
// Convert a word and print the results
let word = "Hello";
for (char, code) in codes.convert(word) {
if let Some(c) = code {
println!("{} {}", char, c.code());
} else {
println!("{} ", char);
}
}
}Supported Alphabets #
spellout supports the following built-in phonetic alphabets:
chpenglisheufranceindonesia(Based on NATO)internationalitaliajapanesenato(Default)netherlandsphilippines(Based on NATO)swedenukusaairpots(Based on NATO)