|
|
|
|
|
|
|
|
|
|
|
tenThousandPos = 4 |
|
|
|
hundredMillionPos = 9 |
|
txtDigit = ['', 'μ', 'λ°±', 'μ²', 'λ§', 'μ΅'] |
|
txtNumber = ['', 'μΌ', 'μ΄', 'μΌ', 'μ¬', 'μ€', 'μ‘', 'μΉ ', 'ν', 'ꡬ'] |
|
txtPoint = 'μ© ' |
|
|
|
def digit2txt(strNum): |
|
resultStr = '' |
|
digitCount = 0 |
|
|
|
|
|
for ch in strNum: |
|
|
|
if ch == ',': |
|
continue |
|
|
|
elif ch == '.': |
|
break |
|
digitCount = digitCount + 1 |
|
|
|
|
|
digitCount = digitCount-1 |
|
index = 0 |
|
|
|
while True: |
|
notShowDigit = False |
|
ch = strNum[index] |
|
|
|
|
|
if ch == ',': |
|
index = index + 1 |
|
if index >= len(strNum): |
|
break; |
|
continue |
|
|
|
if ch == '.': |
|
|
|
if strNum[index - 1] == '0' and not resultStr: |
|
resultStr = 'μ' |
|
resultStr += txtPoint |
|
else: |
|
|
|
|
|
|
|
if(digitCount >= 1) and (digitCount != tenThousandPos) and (digitCount != hundredMillionPos) and int(ch) == 1: |
|
resultStr = resultStr + '' |
|
elif int(ch) == 0: |
|
resultStr = resultStr + '' |
|
|
|
if (digitCount != tenThousandPos) and (digitCount != hundredMillionPos): |
|
notShowDigit = True |
|
else: |
|
resultStr = resultStr + txtNumber[int(ch)] |
|
|
|
|
|
|
|
if digitCount > hundredMillionPos: |
|
if not notShowDigit: |
|
resultStr = resultStr + txtDigit[digitCount-hundredMillionPos] |
|
|
|
elif digitCount > tenThousandPos: |
|
if not notShowDigit: |
|
resultStr = resultStr + txtDigit[digitCount-tenThousandPos] |
|
else: |
|
if not notShowDigit: |
|
resultStr = resultStr + txtDigit[digitCount] |
|
|
|
if digitCount <= 0: |
|
digitCount = 0 |
|
else: |
|
digitCount = digitCount - 1 |
|
index = index + 1 |
|
if index >= len(strNum): |
|
break; |
|
return resultStr |
|
|
|
|
|
NATIVE_MAP_ONES = { |
|
|
|
"ν": 1, "λ": 2, "μΈ": 3, "λ·": 4, "λ€μ―": 5, |
|
"μ¬μ―": 6, "μΌκ³±": 7, "μ¬λ": 8, "μν": 9, |
|
|
|
|
|
} |
|
|
|
MAP_TENS = { |
|
"μ΄": 10, "μ€λ¬Ό": 20, "μλ₯Έ": 30, "λ§ν": 40, "μ°": 50, |
|
"μμ": 60, "μΌν": 70, "μ¬λ ": 80, "μν": 90 |
|
} |
|
|
|
|
|
def NNGdigit2txt(number): |
|
|
|
|
|
|
|
korean_number = "" |
|
number = int(number) |
|
|
|
if number >= 100: |
|
korean_number = digit2txt(str(number)) |
|
elif number < 10: |
|
for key, value in NATIVE_MAP_ONES.items(): |
|
if value == number: |
|
return key |
|
else: |
|
tens = number // 10 |
|
ones = number % 10 |
|
|
|
for key, value in MAP_TENS.items(): |
|
if value == tens * 10: |
|
korean_number += key |
|
|
|
for key, value in NATIVE_MAP_ONES.items(): |
|
if value == ones: |
|
korean_number += key |
|
|
|
return korean_number |
|
|
|
def CSign2txt(csign): |
|
currency_symbols = { |
|
"$": "λ¬λ¬", |
|
"β¬": "μ λ‘", |
|
"Β£": "νμ΄λ", |
|
"Β₯": "μ", |
|
"οΏ¦": "μ" |
|
} |
|
|
|
return currency_symbols.get(csign, "") |