Perplexing results from "<qty> and a half <unit>"
jrd-nonlilly opened this issue · comments
Describe the bug
The parsing of <qty> and a half <unit>
seems broken.
I don't know whether this is a bug or a feature request, because I'm still trying to trace through the code to understand the logic.
To Reproduce
Steps to reproduce the behavior:
- Invoke
parser.parse("two and a half months")
(usingen_US
) - See result:
(1.5, 'month')
- Scratch head
Expected behavior
I expect (2.5, 'month')
. Similarly, "five and a half months" gives (3.0, 'month')
.
Additional information:
- Python Version: 3.8
- Classifier activated/ sklearn installed: no?
- OS: macOS
- Version 10.15.7
It should have been obvious, but upon further reflection there must be logic somewhere that interprets "half" as both "divide this quantity in half" and "add half this quantity", applied in that order.
Thanks for the note! I found the bug and fixed it in the dev branch of this project :)