Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the number in the text #27

Open
hiennguyen92 opened this issue Jul 30, 2022 · 2 comments
Open

the number in the text #27

hiennguyen92 opened this issue Jul 30, 2022 · 2 comments

Comments

@hiennguyen92
Copy link

hiennguyen92 commented Jul 30, 2022

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

thanks. a great library

@tomnyson
Copy link

mee too

@Tuanlase02874
Copy link

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))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants