Skip to content

Space in unit not recognized #3

@AlessandroGianfelici

Description

@AlessandroGianfelici

Hi, I have just noticed that the parser fails to parse the unit if there is a space in the unit string.
Here an example:

from parse_ingredients import parse_ingredient
parse_ingredient('100 milli gram sugar')

returns:
Ingredient(name='milli gram sugar', quantity=100.0, unit='', comment='', original_string='100 milli gram sugar')

instead of the expected result, i.e.:
Ingredient(name='sugar', quantity=100.0, unit='milli gram', comment='', original_string='100 milli gram sugar')

even if "milli gram" is in the list of the recognized units.

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