-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtophonetic.py
executable file
·99 lines (94 loc) · 1.95 KB
/
tophonetic.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/usr/bin/python
#Translates argv[] into NATO phonetics for proper and clean phone communications.
#Fred Dinkler IV
import os
import sys
phones={
'-':'Dash',
'.':'Period|(Full) Stop|Decimal (point)',
'?':'Question|Interrogation mark|Point',
'!':'Exclamation mark|Bang',
'@':'At symbol|Ampersat',
"#":'Number sign|Pound|Hash',
'$':'Dollar sign',
'%':'Percent sign',
'^':'Caret',
'&':'Ampersand',
'*':'Asterisk|Star|Splat',
'(':'Left paren|Left round brackets',
')':'Right paren|Right round brackets',
'-':'Hyphen|Minus',
'=':'Equals sign|Equality sign',
'_':'Underscore|Understrike|Underbar|Low line',
'+':'Plus sign',
'{':'Left curly bracket|Left brace',
'}':'Right curly bracket|Right brace',
'[':'Left square bracket|Left bracket',
']':'Right square bracket|Right bracket',
';':'Semicolon',
':':'Colon',
'\'':'Single quote|Apostrophe',
'"':'Double quote|Quotation marks',
'<':'Less-than (sign)',
'>':'Greater-than (sign)',
',':'Coma',
'/':'(forward) Slash|Stroke',
'|':'Vertical bar|Broken bar|Pipe|OR',
'\\':'Backslash|Backslant|Backslant',
'`':'Backtick|Backquote|Grave',
'~':'Tilde',
'0':'Zero|Naught|Nil',
'1':'Wun (One)',
'2':'Two',
'3':'Tree (Three)',
'4':'Fower (Four)',
'5':'Fife (Five)',
'6':'Six',
'7':'Seven',
'8':'Ait (Eight)',
'9':'Niner (Nine)',
'A':'Alpha',
'B':'Bravo',
'C':'Charlie',
'D':'Delta',
'E':'Echo',
'F':'Foxtrot',
'G':'Golf',
'H':'Hotel',
'I':'India',
'J':'Juliet',
'K':'Kilo',
'L':'Lima',
'M':'Mike',
'N':'November',
'O':'Oscar',
'P':'Papa',
'Q':'Quebec',
'R':'Romeo',
'S':'Sierra',
'T':'Tango',
'U':'Uniform',
'V':'Victor',
'W':'Whiskey',
'X':'X-ray',
'Y':'Yankee',
'Z':'Zulu'
}
del sys.argv[0]
for word in sys.argv:
if len(sys.argv) > 1:
print("\n\t" + word + "\n")
for char in word:
if str.isalpha(char):
if str.islower(char):
case=" lowercase "
else:
case=" CAPITAL "
let=str.upper(char)
print(char + case + phones[let])
else:
case=" "
try:
print(char + case + phones[char])
except:
print(char)