summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2017-05-11 21:29:51 +0200
committerPacien TRAN-GIRARD2017-05-11 21:29:51 +0200
commitcc36c9613426507cb2b7e726e9c2d217bf862e2e (patch)
tree5b767da5d438d53c662ee422437e587e394e20fd
parent4aea92c4f85fceb4e2a920f7a8beb37ce7d8c04c (diff)
downloaddesktop-utilities-cc36c9613426507cb2b7e726e9c2d217bf862e2e.tar.gz
Add phone speller script
-rwxr-xr-xnato.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/nato.py b/nato.py
new file mode 100755
index 0000000..a8788e0
--- /dev/null
+++ b/nato.py
@@ -0,0 +1,40 @@
1#!/usr/bin/env python3
2
3nato = [
4 'Alfa',
5 'Bravo',
6 'Charlie',
7 'Delta',
8 'Echo',
9 'Foxtrot',
10 'Golf',
11 'Hotel',
12 'India',
13 'Juliet',
14 'Kilo',
15 'Lima',
16 'Mike',
17 'November',
18 'Oscar',
19 'Papa',
20 'Quebec',
21 'Romeo',
22 'Sierra',
23 'Tango',
24 'Uniform',
25 'Victor',
26 'Whiskey',
27 'X-ray',
28 'Yankee',
29 'Zulu',
30]
31
32alphabet = { w[0]: w for w in nato }
33
34def str_to_telephony(phrase):
35 return [ alphabet[c] if c in alphabet else c for c in phrase.upper() ]
36
37
38import sys
39
40print('\n'.join(str_to_telephony(" ".join(sys.argv[1:]))))