akshaynagpal / w2n

Convert number words (eg. twenty one) to numeric digits (21)
http://w2n.readthedocs.io
MIT License
169 stars 78 forks source link

Performs arithmetic while parsing number ranges #30

Open kathleen-allyo opened 6 years ago

kathleen-allyo commented 6 years ago

When passing in number ranges, such as "four-six", w2n returns "10".

example = "four-six" example_digits = w2n.word_to_num(example)

returns: "10"

I assume it's trying to add these together, but I'm not sure why it would do that. If this is a feature, it should be subtracting; however, I think it's much more likely to be a range of numbers. I would expect "four-six" to either (1) throw a ValueError or (2) return a list of numbers (e.g. ["4", "6"]).

akshaynagpal commented 6 years ago

Thanks @kathleen-allyo for pointing this out. I will look into this ASAP. Meanwhile, you're also welcome to fix the error and submit a Pull Request. If it passes all the tests, it will be merged most probably.

Can be similar/related to #29