allo-media / text2num

Parse and convert numbers written in French, English, Spanish, Portuguese, German and Catalan into their digit representation.
https://text2num.readthedocs.io
MIT License
102 stars 47 forks source link

[FR] decimal number below 1 not properly formatted with alpha2digit #69

Closed MarieAdler closed 2 years ago

MarieAdler commented 2 years ago

I'm trying to format decimal number.

✔️ It works well with some exemples :

text = "la densité moyenne est de deux virgule cinq"
alpha2digit(text, lang="fr")

Output :
'la densité moyenne est de 2,5'

❌ But the number 0 is duplicated for exemples below 1:

text = "la densité moyenne est de zéro virgule cinq"
alpha2digit(text, lang="fr") 

Output :
'la densité moyenne est de zéro 0,5'

Expected output :
'la densité moyenne est de 0,5'

text2num version = 2.4.0 python version = 3.8.10