Skip to content

Parsing issue for '1 -2 teaspoons of garlic powder' #21

@jayaddison

Description

@jayaddison

Describe the bug
The phrase 1 -2 teaspoons of garlic powder (with a space between the 1 and -2 -- presumably intended to mean 1-2 as a range from one-to-two) parses with an empty ingredient name.

To Reproduce

>>> import ingreedypy
>>> c = ingreedypy.Ingreedy()
>>> c.parse('1 -2 teaspoons of garlic powder')
{'quantity': [{'unit': None, 'unit_type': None, 'amount': 1}], 'ingredient': None}

Expected behavior

>>> import ingreedypy
>>> c = ingreedypy.Ingreedy()
>>> c.parse('1 -2 teaspoons of garlic powder')
{'quantity': [{'unit': 'teaspoon', 'unit_type': 'english', 'amount': 2}], 'ingredient': 'garlic powder'}

(we don't yet support parsing a min/max range of values -- however, 2 is what is returned as the amount when the existing code parses 1-2 teaspoons of garlic powder, so the suggested expected output above seems least-divergent)

Screenshots
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions