Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match of specific ingredients to ingredients should be canonicalized #7063

Closed
stephanegigandet opened this issue Jul 13, 2022 · 0 comments · Fixed by #7131
Closed

Match of specific ingredients to ingredients should be canonicalized #7063

stephanegigandet opened this issue Jul 13, 2022 · 0 comments · Fixed by #7131
Labels
🐛 bug This is a bug, not a feature request.

Comments

@stephanegigandet
Copy link
Contributor

Describe the bug

We parse the origins of ingredients field to store origins of specific ingredients, and then use this info to complement the ingredients extracted from the list of ingredients.

But the matching does not work for ingredients that are not in the taxonomy, as we get ids that are not taxonomized.

e.g.

specific_ingredients: [
{
id: "fr:coquillettes",
ingredient: "coquillettes",
origins: "en:italy",
text: "Origine des coquillettes : Italie."
},
{
id: "fr:Comté AOP 4 mois",
ingredient: "Comté AOP 4 mois",
origins: "en:france",
text: "Origine du Comté AOP 4 mois : France."
},
{
id: "fr:jambon supérieur",
ingredient: "jambon supérieur",
origins: "en:france",
text: "Origine du jambon supérieur : France."
},
{
id: "en:white-wine",
ingredient: "Vin blanc",
origins: "en:europe",
text: "Origine du Vin blanc : Europe."
},
{
id: "en:parmesan",
ingredient: "parmesan",
origins: "en:italy",
text: "Origine du parmesan : Italie"
},
{
id: "fr:Origine Crème UHT",
ingredient: "Origine Crème UHT",
origins: "en:france",
text: "Origine Crème UHT : France."
}
],

Needs to be matched to:

ingredients: [
{
id: "fr:Coquillettes",
percent: 61.6,
percent_estimate: 61.6,
text: "Coquillettes"
},
{
id: "fr:Comté 4 mois",
labels: "en:pdo",
percent: 4.8,
percent_estimate: 4.8,
text: "Comté 4 mois"
},
{
id: "fr:Jambon supérieur",
percent: 14,
percent_estimate: 14,
text: "Jambon supérieur"
},
{
id: "en:white-wine",
origins: "en:europe",
percent: 0.3,
percent_estimate: 0.3,
text: "Vin blanc",
vegan: "maybe",
vegetarian: "yes"
},
{
id: "en:uht-cream",
percent: 7.56,
percent_estimate: 7.56,
text: "Crème UHT",
vegan: "no",
vegetarian: "yes"
},
{
id: "en:fresh-cream",
percent: 4.76,
percent_estimate: 4.76,
text: "Crème fraiche",
vegan: "no",
vegetarian: "yes"
},
{
id: "fr:Parmesan poudre",
percent: 5.6,
percent_estimate: 5.6,
text: "Parmesan poudre"
},
{
id: "fr:Persil plat",
percent: 1.4,
percent_estimate: 1.38,
text: "Persil plat"
}
],

To Reproduce

https://world.openfoodfacts.org/cgi/test_ingredients_analysis.pl?ingredients_text=Peaches.+Some+unknown+ingredient%2C+another+unknown+ingredient.%0D%0A%0D%0AOrigin+of+peaches%3A+Spain.+Origin+of+some+unknown+ingredient%3A+France.+origin+of+Another+Unknown+Ingredient%3A+Malta&type=add&action=process&submit=Envoyer

Expected behavior

Match should be insensitive to case and accents.

Screenshots

No response

Additional context

No response

Type of device

Other

Browser version

No response

Number of products impacted

No response

Time per product

No response

@stephanegigandet stephanegigandet added the 🐛 bug This is a bug, not a feature request. label Jul 13, 2022
stephanegigandet added a commit that referenced this issue Jul 26, 2022
…gredients (#7131)

* fix: use normalized ids for untaxonomized ingredients and specific ingredients #7063

* fix issue with specific ingredients

* fix tests

Co-authored-by: Alex Garel <alex@garel.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug This is a bug, not a feature request.
Projects
1 participant