Update char_utils.py

This commit is contained in:
chrys87 2016-08-26 10:41:37 +02:00 committed by GitHub
parent feeb323ce7
commit d46b37b4e1

View File

@ -36,3 +36,19 @@ def getNextChar(currX,currY, currText):
x += 1
currChar = wrappedLines[y][x]
return x, y, currChar
def getPhonetic(currChar):
if len(currChar) != 1:
return currChar
phoneticsDict = {
"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":"whisky", "X":"x ray",
"Y":"yankee", "Z":"zulu"
}
try:
return phoneticsDict[currChar.upper()]
except:
return currChar