Ingredient Parser (Zestful Client)
Overview
Parse recipe ingredient strings into structured data.
Examples
Parse a single ingredient
import json
import parse_ingredient
ingredient = parse_ingredient.parse('2 1/2 tablespoons finely chopped parsley')
print(json.dumps(ingredient.as_dict()))
{
"quantity": 2.5,
"unit": "tablespoon",
"product": "parsley",
"productSizeModifier": null,
"preparationNotes": "finely chopped",
"usdaInfo": {
"category": "Vegetables and Vegetable Products",
"description": "Parsley, fresh",
"fdcId": "170416",
"matchMethod": "exact"
},
"confidence": 0.9858154,
}
Parse multiple ingredients
import json
import parse_ingredient
ingredients = parse_ingredient.parse_multiple([
'½ tsp brown sugar',
'3 large Granny Smith apples'
)
print(json.dumps(ingredients.as_dict()))
[
{
"ingredientRaw": "½ tsp brown sugar",
"ingredientParsed": {
"preparationNotes": "finely chopped",
"product": "brown sugar",
"productSizeModifier": null,
"quantity": 0.5,
"unit": "teaspoon",
"usdaInfo": {
"category": "Sweets",
"description": "Sugars, brown",
"fdcId": "168833",
"matchMethod": "exact"
},
"confidence": 0.9857134,
},
"error": null,
},
{
"ingredientRaw": "3 large Granny Smith apples",
"ingredientParsed": {
"preparationNotes": null,
"product": "Granny Smith apples",
"productSizeModifier": "large",
"quantity": 3.0,
"unit": null,
"usdaInfo": {
"category": "Fruits and Fruit Juices",
"description": "Apples, raw, granny smith, with skin (Includes foods for USDA's Food Distribution Program)",
"fdcId": "168203",
"matchMethod": "exact"
},
"confidence": 0.9741028,
},
"error": null,
}
]
Parse ingredients using RapidAPI
If you have a RapidAPI subscription to Zestful, you can use your API key as follows:
import json
import parse_ingredient
# Replace this with your key from RapidAPI
# https://rapidapi.com/zestfuldata/api/recipe-and-ingredient-analysis
RAPID_API_KEY = 'your-rapid-api-key'
client = parse_ingredient.client(rapid_api_key=RAPID_API_KEY)
ingredient = client.parse_ingredient('2 1/2 tablespoons finely chopped parsley')
print(json.dumps(ingredient.as_dict()))
Use private Zestful server
If you have a private Zestful ingredient parsing server as part of an Enterprise plan, you can use the library as follows:
import json
import parse_ingredient
ENDPOINT_URL = 'https://zestful.yourdomain.com'
client = parse_ingredient.client(endpoint_url=ENDPOINT_URL)
ingredient = client.parse_ingredient('2 1/2 tablespoons finely chopped parsley')
print(json.dumps(ingredient.as_dict()))
Installation
From pip
pip install zestful-parse-ingredient
From source
git clone https://github.com/mtlynch/zestful-client.git
cd zestful-client
pip install .
How does it work?
The library sends ingredient parsing requests to a remote Zestful ingredient parsing server. By default, the library uses the demo instance of Zestful. For production usage, you should set a RapidAPI key or private Zestful server instance address.
Limitations
Without a subscription, you can only parse 30 ingredients per day. To parse an unlimited number of ingredients, purchase a subscription from Zestful.
Full documentation
For full documentation of each result field, see the official Zestful API documentation.
Metadata
Release files for zestful-parse-ingredient 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| zestful-parse-ingredient-0.0.7.tar.gz | 4.7 kB | Without provenance | Details for zestful-parse-ingredient-0.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| zestful_parse_ingredient-0.0.7-py3-none-any.whl | Python 3 | none | any | Details for zestful_parse_ingredient-0.0.7-py3-none-any.whl |
Total release size: 11.0 kB
Release files / zestful-parse-ingredient-0.0.7.tar.gz
| Download URL | zestful-parse-ingredient-0.0.7.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
96ae183c49e5909bb53be7ccbafcee5a51dd49892823c976fc6e3c616dec549b
|
|
BLAKE2b-256 checksum How to use checksums |
815f64efc0dc5c1bee2370c34abb2a09d3afee3308ca8708b74cd832a0308f10
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.9.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.3
|
Release files / zestful_parse_ingredient-0.0.7-py3-none-any.whl
| Download URL | zestful_parse_ingredient-0.0.7-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d902832f72fae2b95b5f9d5bec80945b6711c6ea1c2f8ceb53c7c93def00fac3
|
|
BLAKE2b-256 checksum How to use checksums |
8cd5260f58b8eb7557c9d704007d4141f49e8ae23e5c268d23d84e6b4c0a7883
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.9.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.3
|
Security for zestful-parse-ingredient 0.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.