diff --git a/mealie/services/parser_services/ingredient_parser.py b/mealie/services/parser_services/ingredient_parser.py index 6f011e501..76a83b7d8 100644 --- a/mealie/services/parser_services/ingredient_parser.py +++ b/mealie/services/parser_services/ingredient_parser.py @@ -252,7 +252,17 @@ class NLPParser(ABCIngredientParser): return self.find_ingredient_match(parsed_ingredient) async def parse_one(self, ingredient_string: str) -> ParsedIngredient: - parsed_ingredient = parse_ingredient(ingredient_string) + database_units = {} + for ingredient_unit in self.data_matcher.units_by_id.values(): + if ingredient_unit.name: + plural_name = ingredient_unit.plural_name or ingredient_unit.name + database_units[plural_name] = ingredient_unit.name + + if ingredient_unit.abbreviation: + plural_abbr = ingredient_unit.plural_abbreviation or ingredient_unit.abbreviation + database_units[plural_abbr] = ingredient_unit.abbreviation + + parsed_ingredient = parse_ingredient(ingredient_string, custom_units=database_units) return self._convert_ingredient(parsed_ingredient) async def parse(self, ingredients: list[str]) -> list[ParsedIngredient]: