q-m / food-ingredient-parser-ruby

Extract the structure of ingredient lists on food products
MIT License
16 stars 2 forks source link

Ingredients with note containing amount not parsed #25

Open wvengen opened 3 months ago

wvengen commented 3 months ago

The ingredient declaration

Pork, Paprika, Salt, Maize Dextrose, Maize Dextrin, Garlic, Paprika Oil, Stabiliser: Pentasodium Triphosphate, Antioxidant: Sodium Erythorbate, Preservative: Sodium Nitrite, Filled into natural Pork casings, Prepared with 120g of Pork per 100g of product

is not parsed at all by the strict parser.

wvengen commented 3 months ago

This is because of the "120g" in the last 'ingredient' (that is a note, but not recognised as such, because syntaxically it is part of the ingredients). A smaller example that shows this issue is:

a, x 1g z

wvengen commented 3 months ago

This could also be solved with #18 (recognizing it as an ingredient note).