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/.
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.997265),
amount=[IngredientAmount(quantity='3',
unit='pounds',
confidence=0.9991,
APPROXIMATE=False,
SINGULAR=False)],
preparation=IngredientText(text='cut into 2 inch chunks', confidence=0.986157),
comment=None,
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: 12501
Correct: 11515
Incorrect: 986
-> 92.11% correct
Word-level results:
Total: 85262
Correct: 82718
Incorrect: 2544
-> 97.02% 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 web app for testing the parser with ingredient sentences and showing the parsed output. To run the web app, run the command
$ flask --app webapp run
This requires the development dependencies to be installed.
The dependencies for building the documentation are in the requirements-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.0b7.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 022171ea51741663d368aea59ed770c92e6f8fcde0ac0d830901d63fdf86a960 |
|
MD5 | 468847e066cab3657152fd97a9f93ede |
|
BLAKE2b-256 | 5ebf47958be57744fa40a23c1440d8653a6f801420f59979a1f9de005b0491ee |
Hashes for ingredient_parser_nlp-0.1.0b7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86d10006fe4810d913c15792601c04e12055edfa35123ff929db2f9bc9471cb1 |
|
MD5 | ab9220b74363a527e0b97f656c1fda29 |
|
BLAKE2b-256 | 237864e238ba3e78d064cba1bb1f1cc5776bdc57b606cd4d6769f98464b126f4 |