vietTTS icon indicating copy to clipboard operation
vietTTS copied to clipboard

the number in the text

Open hiennguyen92 opened this issue 2 years ago • 2 comments

I tried, but It can't seem to handle the number in the text.

thanks. a great library

hiennguyen92 avatar Jul 30 '22 08:07 hiennguyen92

mee too

tomnyson avatar Nov 14 '22 03:11 tomnyson

bạn có thể dùng thư viện để chuyển từ số thành chữ trước khi dùng.

from vietnam_number import n2w def change_vietnamese_number_in_text(intput_text): groups_text = [] for text in intput_text.split(): if text.isdigit(): text = n2w(text)

    elif text.replace(".","").isdigit():
        text = n2w(text)

    elif text.replace(",","").isdigit():
        text = n2w(text)
    
    groups_text.append(text)

# Vietnamese words for numbers 0 to 9


result = ' '.join(groups_text)

return result

intput_text = "Lich su vietnam 15 123 31234 1 3, 1. " print(change_vietnamese_number_in_text(intput_text))

Tuanlase02874 avatar May 09 '23 06:05 Tuanlase02874