Changes

Jump to navigation Jump to search
added examples, format, replace list to table
Line 5: Line 5:  
This part can be done automatically by Open Food Facts when you click on the button to extract.
 
This part can be done automatically by Open Food Facts when you click on the button to extract.
 
We just need to list all possible occurences.
 
We just need to list all possible occurences.
So, we can start with the 4 followings:
+
So, we can start with the 4 followings '''regex types''':
=== Phrases before the ingredients list ===
+
=== '''%phrases_before_ingredients_list''' ===
 
All text that is before the ingredients list, that need to be removed. Usually this is a word like "ingredients".
 
All text that is before the ingredients list, that need to be removed. Usually this is a word like "ingredients".
   −
=== Phrases after the ingredients list ===
+
=== '''%phrases_after_ingredients_list''' ===
 
%phrases_after_ingredients_list
 
%phrases_after_ingredients_list
 
all text that are after the ingredients list, that need to be removed ("store in a cold place", for example).
 
all text that are after the ingredients list, that need to be removed ("store in a cold place", for example).
   −
=== May contain phrases ===
+
=== '''%may_contain_regexps''' ===
The traces should be extracted, but when you click on "Details of the analysis of the ingredients" they should not appear as ingredient (except if one trace-ingredient is not recognized, see previous discussion with Moon Rabbit https://openfoodfacts.slack.com/archives/C06A7LENM/p1690126832563859).
+
The traces should be extracted, but when you click on "Details of the analysis of the ingredients" they should not appear as ingredient (except if one trace-ingredient is not recognized)
   −
=== Ignore phrases ===
+
=== '''%ignore_regexps''' ===
 
%ignore_regexps
 
%ignore_regexps
 
That would be text that is after ingredient list and should be ignored but you keep it because you have allergens list after
 
That would be text that is after ingredient list and should be ignored but you keep it because you have allergens list after
   −
Currently all possible occurences are not yet referenced for all languages. Hence, if you if you see some text that you have to remove when you extract the text, mention it on Slack in the conversation #ingredients
+
WARNING! This will remove the whole phrase! That is, if you have "fruits in different amounts", and you add "in different amounts" in ignore_regexps, that will remove fruits as well! (in that case, you want to use stopwords in the taxonomy instead)
 +
 
 +
 
 +
 
 +
Currently all possible occurrences are not yet referenced for all languages. Hence, if you if you see some text that you have to remove when you extract the text, mention it on Slack in the conversation #ingredients
    
== Implementation ==
 
== Implementation ==
Line 32: Line 36:  
* [[Ingredients list cutting: after phrases|After phrases]]
 
* [[Ingredients list cutting: after phrases|After phrases]]
   −
== Examples ==
+
== Example ==
 
Some example to illustrate which words refer to what part of the raw ingredients extraction.
 
Some example to illustrate which words refer to what part of the raw ingredients extraction.
 
=== [https://world.openfoodfacts.org/product/5281026016014 Thyme cashews] ===
 
=== [https://world.openfoodfacts.org/product/5281026016014 Thyme cashews] ===
Line 44: Line 48:  
https://world.openfoodfacts.org/product/5281026016014/thyme-cashews-alrifai
 
https://world.openfoodfacts.org/product/5281026016014/thyme-cashews-alrifai
   −
=== [https://hr.openfoodfacts.org/product/8606106174564 pear cider] ===
+
== Regex types to be added ==
* Serbian (sr)
+
If you notice a missing regex while editing a product, feel free to add it in this following table.
* Proizvodi i puni
  −
* %phrases_after_ingredients_list
  −
 
  −
=== [https://hr.openfoodfacts.org/product/3858890478358 Boom Box Chocolate Granola] ===
  −
* Croatian (hr)
  −
* Priprema obroka
  −
*%phrases_after_ingredients_list
     −
=== [https://fr.openfoodfacts.org/produit/3330720236012/pate-a-tartiner Pâte à tartiner] ===
+
First row corresponds to the example in the last paragraph.
*French (fr)
+
{| class="wikitable"
*ISSUS DE L'AGRICULTURE BIOLOGIQUE
+
|+
*%phrases_before_ingredients_list
+
!language
=== [https://fr.openfoodfacts.org/produit/3272932000336/terrine-de-campagne Terrine de campagne] ===
+
!product barcode or url
*French (fr)
+
!text
*ORIGINE DES VIANDES: FRANCE
+
!regex type
*%phrases_after_ingredients_list
+
!added
*Origine des viandes: France can be kept. And it appears under "specific_ingredients" in the api: https://world.openfoodfacts.org/api/v2/product/3272932000336
+
|-
 +
|'''EN'''
 +
|'''<nowiki>https://world.openfoodfacts.org/product/5281026016014/thyme-cashews-alrifai</nowiki>'''
 +
|'''Packed in a modified atmosphere.'''
 +
|'''%phrases_after_ingredients_list'''
 +
|'''N'''
 +
|-
 +
|SR
 +
|https://hr.openfoodfacts.org/product/8606106174564/pear-cider-carlsberg
 +
|Proizvodi i puni
 +
|%phrases_after_ingredients_list
 +
|N
 +
|-
 +
|HR
 +
|https://hr.openfoodfacts.org/product/3858890478358/boom-box-chocolate-granola-atlantic-grupa
 +
|Priprema obroka
 +
|%phrases_after_ingredients_list
 +
|N
 +
|-
 +
|HR
 +
|https://hr.openfoodfacts.org/product/3856015303240/krastavci-zvijezda
 +
|Neotvoreno čuvati na sobnoj temperaturi, zaštićeno od sunčeve svjetlosti.
 +
|%phrases_after_ingredients_list
 +
|N
 +
|-
 +
|HR
 +
|https://hr.openfoodfacts.org/product/3850334010728
 +
|Čuvati na temperatu
 +
|%phrases_after_ingredients_list
 +
|N
 +
|-
 +
|HR
 +
|https://hr.openfoodfacts.org/product/3856020263416/pasta-povrtna-vegeta-natur
 +
|Upotreba u jelima
 +
|%phrases_after_ingredients_list
 +
|N
 +
|-
 +
|
 +
|
 +
|
 +
|
 +
|
 +
|-
 +
|FR
 +
|https://fr.openfoodfacts.org/produit/3330720236012/pate-a-tartiner-lucien-georgelin
 +
|ISSUS DE L’AGRICULTURE BIOLOGIQUE
 +
|%phrases_before_ingredients_list
 +
|N
 +
|-
 +
|HR
 +
|https://hr.openfoodfacts.org/product/3856015303240/krastavci-zvijezda
 +
|HR/BiH and sastojci are stopwords, text starts after HR/BiH but list start after sastojci
 +
|%phrases_before_ingredients_list
 +
|N
 +
|-
 +
|
 +
|
 +
|
 +
|
 +
|}
    
== Context ==
 
== Context ==
75

edits

Navigation menu