Difference between revisions of "OCR/Script"

From Open Food Facts wiki
Jump to navigation Jump to search
(Created page with "<pre> # Get all the products that are ingredients complete AND have selected images # Loop through products wget -O - -q -t 1 http://fr.openfoodfacts.org/api/v0/produit/2039...")
 
Tags: Mobile edit Mobile web edit
 
Line 4: Line 4:
 
# Get all the products that are ingredients complete AND have selected images
 
# Get all the products that are ingredients complete AND have selected images
 
# Loop through products
 
# Loop through products
wget -O - -q -t 1 http://fr.openfoodfacts.org/api/v0/produit/20396145.json | jq '.product.states_hierarchy'
+
wget -O - -q -t 1 https://fr.openfoodfacts.org/api/v0/produit/20396145.json | jq '.product.states_hierarchy'
 
string='My long string';
 
string='My long string';
 
if [[ $string == *"en:photos-validated"* ]] and if [[ $string == *"en:ingredients-completed"* ]] then
 
if [[ $string == *"en:photos-validated"* ]] and if [[ $string == *"en:ingredients-completed"* ]] then
Line 10: Line 10:
  
 
if "en:photos-validated" and "en:ingredients-completed" in output:
 
if "en:photos-validated" and "en:ingredients-completed" in output:
wget -O - -q -t 1 http://fr.openfoodfacts.org/api/v0/produit/20396145.json | jq '.product.ingredients_text'
+
wget -O - -q -t 1 https://fr.openfoodfacts.org/api/v0/produit/20396145.json | jq '.product.ingredients_text'
wget -O - -q -t 1 http://fr.openfoodfacts.org/api/v0/produit/20396145.json | jq '.product.image_url'  
+
wget -O - -q -t 1 https://fr.openfoodfacts.org/api/v0/produit/20396145.json | jq '.product.image_url'  
wget -O - -q -t 1 http://fr.openfoodfacts.org/api/v0/produit/20396145.json | jq '.product.image_url' | tesseract  outputocrfull.txt -l fra -psm 3
+
wget -O - -q -t 1 https://fr.openfoodfacts.org/api/v0/produit/20396145.json | jq '.product.image_url' | tesseract  outputocrfull.txt -l fra -psm 3
 
tesseract ingredients.19.full.jpg outputocrfull.txt -l fra -psm 3
 
tesseract ingredients.19.full.jpg outputocrfull.txt -l fra -psm 3
 
diff file1.txt file2.txt
 
diff file1.txt file2.txt

Latest revision as of 19:11, 1 May 2020



# Get all the products that are ingredients complete AND have selected images
# Loop through products
wget -O - -q -t 1 https://fr.openfoodfacts.org/api/v0/produit/20396145.json | jq '.product.states_hierarchy'
string='My long string';
if [[ $string == *"en:photos-validated"* ]] and if [[ $string == *"en:ingredients-completed"* ]] then
  echo "It's there!";fi

if "en:photos-validated" and "en:ingredients-completed" in output:
wget -O - -q -t 1 https://fr.openfoodfacts.org/api/v0/produit/20396145.json | jq '.product.ingredients_text'
wget -O - -q -t 1 https://fr.openfoodfacts.org/api/v0/produit/20396145.json | jq '.product.image_url' 
wget -O - -q -t 1 https://fr.openfoodfacts.org/api/v0/produit/20396145.json | jq '.product.image_url' | tesseract  outputocrfull.txt -l fra -psm 3
tesseract ingredients.19.full.jpg outputocrfull.txt -l fra -psm 3
diff file1.txt file2.txt