nielstron / quantulum3

Library for unit extraction - fork of quantulum for python3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Measurements containing purely unicode fractions not found.

bajisci opened this issue · comments

Describe the bug
A clear and concise description of what the bug is.

If the value of the measurement in the text to be parsed is purely a unicode fraction, for example "½", with no integers in front, the parser does not find the value and unit. However, if the value is "1½", it properly finds it as 1.5.

To Reproduce
Steps to reproduce the behavior:

from quantulum3.parser import parse

text = "½ cup food"
fraction = parse(text)
print(f"fraction only is: {fraction}")

text2 = "1½ cup food"
intandfraction = parse(text2)
print(f"when using an int and fraction: {intandfraction}")

This code results in:
fraction only is:[]
when using an int and fraction:[Quantity(1.5, "Unit(name="cup", entity=Entity("volume"), uri=Cup_(unit))")]

Expected behavior
A clear and concise description of what you expected to happen.

I expected to receive 0.5 as the value when the text contains the unicode fraction ½

Screenshots
If applicable, add screenshots to help explain your problem.

Additional information:

  • Python Version: 3.7.7
  • Classifier activated/ sklearn installed: yes
  • OS: Win10 64bit