Open AlessandroGianfelici opened 2 years ago
Hey Alessandro,
That is a consequence of the very rude way I parse recipes in this package which is not easily fixed. One thing I could think about it to do a fuzzy search for unit names instead of directly matching.
That way even typo's can be found (I.E. miligram instead of milligram) easily.
That does, however, impact the performance by a long shot. So it should also probably be optional by setting a flag or something.
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.