text2num icon indicating copy to clipboard operation
text2num copied to clipboard

alpha2didgit don't work with "one day"

Open Krozark opened this issue 4 years ago • 3 comments

The lib is pretty cool, but I find a bug with a particular sentence:

alpha2digit("one day", "en") 'one day

Expected : "1 day"

The same is true in french (initial test in fact)

Krozark avatar Jan 08 '21 10:01 Krozark

The current algorithm is unable to make the difference between the number ("one day") and the pronoun ("the one, each one, another one, this one, etc…"). In French it can't do the difference between "un" (number) = "one" and "un" (article) = "a" or "un" pronoun ("j'en veux un"). So, for such words, we don't replace by default, except if another number is next (see unit tests).

rtxm avatar Jan 08 '21 11:01 rtxm

Ok, that make sens. Thanks for you reply. Maybe an option to force the replace for those cases could be added

Krozark avatar Jan 08 '21 11:01 Krozark

Yes. Let's tag this as feature request then.

rtxm avatar Jan 08 '21 11:01 rtxm