openfoodfacts / openfoodfacts-server

Open Food Facts database, API server and web interface - 🐪🦋 Perl, CSS and JS coders welcome 😊 For helping in Python, see Robotoff or taxonomy-editor
http://openfoodfacts.github.io/openfoodfacts-server/
GNU Affero General Public License v3.0
656 stars 386 forks source link

New data quality facet: brand repeated in product name #3087

Open CharlesNepote opened 4 years ago

CharlesNepote commented 4 years ago

Many people fill the brand in the product name. Example: https://world.openfoodfacts.org/product/5060358171024/lucia-popperley-s-cappucino-popcorn-ten-acre?rev=11

When the "brand" field is completed, we should be able to identify if the product name contains the given brand.

(I understand it's not a big issue.)

muskangarg21 commented 4 years ago

@stephanegigandet in lib/ProductOpener/DataQualityFood.pm in the lines

 
(defined $product_ref->{product_name}) and $match_fr .= " " . $product_ref->{product_name};
(defined $product_ref->{product_name_fr}) and $match_fr .= "  " . $product_ref->{product_name_fr};

I ll find the full product name ? in which var is the brand name stored , is it $product_ref->{brands_tags}

Thanks for the help

stephanegigandet commented 4 years ago

@muskangarg21 : each product has a main language code, stored in $product_ref->{lc} then we can have the product name in different languages, in the field "productname" + [lc] . e.g. product_name_fr for French, product_name_en for English. The value for the main language is copied to "product_name".

The brand name is in the "brands" field. "brands_tags" is a canonical and comma separated version of "brands".

For this bug, it's probably best to use values in "brands", split them by comma, and check if they are contained in any of the "productname" + lc fields. You can get a list of all language codes for the products in the "languages" field (or languages_codes or something like that)

github-actions[bot] commented 4 years ago

Stale issue message

github-actions[bot] commented 8 months ago

This issue has been open 90 days with no activity. Can you give it a little love by linking it to a parent issue, adding relevant labels and projets, creating a mockup if applicable, adding code pointers from https://github.com/openfoodfacts/openfoodfacts-server/blob/main/.github/labeler.yml, giving it a priority, editing the original issue to have a more comprehensive description… Thank you very much for your contribution to 🍊 Open Food Facts