Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect parsing of number followed by single letters #9

Open
grhawk opened this issue Oct 12, 2017 · 1 comment
Open

Incorrect parsing of number followed by single letters #9

grhawk opened this issue Oct 12, 2017 · 1 comment

Comments

@grhawk
Copy link

grhawk commented Oct 12, 2017

Hello,

This is a really nice project and I am using it a lot!
By the way, I found a problem. Parsing the string "404 a" should return "404 dimensionless" but the value of the Quantity obj is wrong (405) and the surface too ("404 a"). Below the log. Hope you can help. In the meantime, I will try to fix this problem by my own but I am using a slightly modified version of your work which is compatible with python3 so I won't be able to do a pull request.

Thank you very much.
Riccardo

In [4]: kk = parser.parse('404 a', verbose=True)
2017-10-12 11:43:25,265 --- Verbose mode
2017-10-12 11:43:25,265 --- Converted string to unicode (assume utf-8 encoding)
2017-10-12 11:43:25,265 --- Original text: "404 a"
2017-10-12 11:43:25,265 --- Clean text: "404 a"
2017-10-12 11:43:25,265 --- Text after numeric conversion: "405.0"
2017-10-12 11:43:25,265 --- Quantity found: {u'value': u'405.0'}
2017-10-12 11:43:25,266 --- 	Uncertainty: None
2017-10-12 11:43:25,266 --- 	Values: [405.0]
2017-10-12 11:43:25,266 --- 	Unit: Unit(name="dimensionless", entity=Entity("dimensionless"), uri=https://en.wikipedia.org/wiki/Dimensionless_quantity)
2017-10-12 11:43:25,266 --- 	Entity: Entity(name="dimensionless", uri=https://en.wikipedia.org/wiki/Dimensionless_quantity)
2017-10-12 11:43:25,266 --- 	Initial span: (0, 5) ("405.0")
2017-10-12 11:43:25,266 --- 	Shifted span: (0, 5) ("404 a")
2017-10-12 11:43:25,267 --- 	Final span: (0, 5) ("404 a")
@nielstron
Copy link

This is because a was not defined as symbol of "year" int the unit file.

I fixed it in my fork as development seems to have ceased here (https://github.com/nielstron/quantulum3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants