quantulum3
quantulum3 copied to clipboard
Fix erroneous results
The examples don't produce errors on my device (no scipy installed). Yet there are some erroneous outputs:
>>> from quantulum3 import parser
>>> parser.parse("exports decreased from 816 000 t valued at $1943 million in 2012–13 to 934 000 t valued at $1964 million in 2013–14 and 885 000 t valued at $1854 million in 2014–15.")
[Quantity(816, "tonne"), Quantity(1.943e+09, "dollar"), Quantity(1012.5, "dimensionless"), Quantity(934, "tonne"), Quantity(1.964e+09, "dollar"), Quantity(1456, "tonne"), Quantity(1.854e+09, "dollar"), Quantity(1014.5, "dimensionless")]
>>> parser.parse("Acme Inc. re- commenced production at Goondicum in April 2015 but production was paused in August 2015.")
[Quantity(2015, "dimensionless"), Quantity(2015, "dimensionless")]
>>> parser.parse('in 2012–13 to 279 t valued at $13 009 million in 2013–14 and 278 t valued at $13 049 million in 2014–15.')
[Quantity(1012.5, "dimensionless"), Quantity(279, "tonne"), Quantity(2.2e+07, "dollar"), Quantity(1152.5, "tonne"), Quantity(6.2e+07, "dollar"), Quantity(1014.5, "dimensionless")]
>>>
Fixed:
-
[x]
2012-13is interpreted as a range. When the second number is less it should be automatically prefixed with other numbers or ignored right away -
[x]
940 000 tthe three zeroes are simply ignored, resulting in a wrong magnitude -
[ ]
>>> parser.parse("2013-14 and 278 t") [Quantity(1152.5, "tonne")] -
[x] 4,500 tpd -> "tonne pint day" instead of tonne per day
-
[x] The Great Australia mine open cut (south-east of Cloncurry) with a fault visible above the stopes of historical underground workings. -> "degree fahrenheit astronomical unit litre tonne" instead of nothing/ fault
-
[x] Cannington—South 32 Ltd -> "litre tonne day" instead of dimensionless
Based on issue #41 and #40
two problems fixed by #62
2012-13 is ignored by now. Future edits may interpret it differently by automatically prefixing the missing numbers.