number-parser icon indicating copy to clipboard operation
number-parser copied to clipboard

Adding support for decimal and negative numbers

Open arnavkapoor opened this issue 5 years ago • 2 comments

Opening a new ticket for adding support for decimal and negative numbers. More details for the same discussed here.

Expected outcomes

> parse("he scored fifty three point six percent in the finals")
he scored 53.6 percent in the finals

> parse_number("twelve point seven")
12.7

> parse_number("minus 9.4")
-9.4

arnavkapoor avatar Jun 19 '20 21:06 arnavkapoor

It may make sense to keep separate issues for each.

Also, for decimal numbers, https://docs.python.org/3/library/decimal.html should probably either be used, or be usable (á la parse_float=Decimal of json.loads).

Gallaecio avatar Jun 22 '20 18:06 Gallaecio

Regarding decimal numbers, I've seen that the CLDR files contain the infinity word for about 26 locales, so it could be a good idea to add them in the future as float(inf). I didn't think it deeply, just wanted to add this idea here to avoid forgetting it.

noviluni avatar Jul 06 '20 14:07 noviluni