Skip to content

Incorrect parsing of number followed by single letters #9

@grhawk

Description

@grhawk

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")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions