A Python package to parse structured information from recipe ingredient sentences
Project description
Ingredient Parser
The Ingredient Parser package is a Python package for parsing structured information out of recipe ingredient sentences.
Documentation
Documentation on using the package and training the model can be found at https://ingredient-parser.readthedocs.io/en/latest/.
Quick Start
Install the package using pip
python -m pip install ingredient-parser-nlp
Import the parse_ingredient
function and pass it an ingredient sentence.
>>> from ingredient_parser import parse_ingredient
>>> parse_ingredient("3 pounds pork shoulder, cut into 2-inch chunks")
ParsedIngredient(
name=IngredientText(text='pork shoulder',
confidence=0.989491),
amount=[IngredientAmount(quantity='3',
unit='pounds',
confidence=0.998649,
APPROXIMATE=False,
SINGULAR=False)],
comment=IngredientText(text='cut into 2 inch chunks',
confidence=0.997456),
other=None,
sentence='3 pounds pork shoulder, cut into 2-inch chunks')
Model accuracy
The model used for labelling tokens in sentences, provided in the ingredient-parser/
directory, has the following accuracy on a test data set of 25% of the total data used:
Sentence-level results:
Total: 12044
Correct: 10834
Incorrect: 1210
-> 89.95% correct
Word-level results:
Total: 76299
Correct: 73430
Incorrect: 2869
-> 96.24% correct
Development
The development dependencies are in the requirements-dev.txt
file. Details on the training process can be found in the Model Guide documentation.
There is a simple webapp for testing the parser with ingredient sentences and showing the parsed output. To run the webapp, run the command
>>> flask --app webapp run
This requires the development dependencies to be installed.
The documentation dependencies are in the requirement-doc.txt
file.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for ingredient_parser_nlp-0.1.0b5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d70b391630939183f92f59d616bad0f4df11aa8a50fcbda5dd6ec01c15f41d98 |
|
MD5 | 9aae23a3929a40c864972a258b181173 |
|
BLAKE2b-256 | 11218a2067b4c1c796adaf8bc429956050ed0c1081d17680009dd388015d13f4 |
Hashes for ingredient_parser_nlp-0.1.0b5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7d4e1cc2f396243123fffa255eb09c2aac0940532021df87201923ce66da3c6 |
|
MD5 | 019e57d4f4d9671482148144dfb225d3 |
|
BLAKE2b-256 | 68ac54dabf1c38388bc70d0f35b06312267034b01b6bf73c946f9f1b896c9455 |