openfoodfacts / openfoodfacts-hungergames

One click Mini-Games for Open Food Facts for: categories, labels, weight, brands, logos… We'd need to port and improve nutrition and ingredients from the old version.
9 stars 14 forks source link

Add Open Food Facts autosuggest in category and label games #51

Open teolemon opened 4 years ago

teolemon commented 4 years ago

Add autosuggest in the category and label games

Rationale: it's often difficult to guess the exact name to filter with, and if just one S is missing, or CAPSLOCK is enabled, there is no match.

Proposed solution Use the Open Food Facts autosuggest APIs and JQUERY to let the user find categories. The API is multilingual by default, so nothing more to do. https://world.openfoodfacts.org/cgi/suggest.pl?tagtype=categories&term=ca https://world.openfoodfacts.org/cgi/suggest.pl?tagtype=labels&term=ca

alexfauquette commented 3 years ago

Same problem as issue #180 The results of autosuggest are translated fields whereas we need translation keys for robotoff

For example, the autosuggest returns Organic whereas we need en:organic. This means we have to guess the language

alexfauquette commented 2 years ago

Seems that by adding parameter lc=en or lc=fr, ... we can choose the language in which labels/categories are sent

https://world.openfoodfacts.org/cgi/suggest.pl?tagtype=labels&term=organ&lc=en => returns organic https://world.openfoodfacts.org/cgi/suggest.pl?tagtype=labels&term=organ&lc=fr => returns empty list

A solution to get keys would be to have a look at the taxonomy used by robotoff: https://github.com/openfoodfacts/robotoff/tree/master/data/taxonomies

See if it worths importing all the tags

Jagrutiti commented 2 years ago

Hi @teolemon this issue interests me.

I want to do the required changes. I would need details like which file to start with, and a little more information. Thanks.