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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ingredient_parser_nlp-0.1.0b7.tar.gz.
File metadata
- Download URL: ingredient_parser_nlp-0.1.0b7.tar.gz
- Upload date:
- Size: 445.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
022171ea51741663d368aea59ed770c92e6f8fcde0ac0d830901d63fdf86a960
|
|
| MD5 |
468847e066cab3657152fd97a9f93ede
|
|
| BLAKE2b-256 |
5ebf47958be57744fa40a23c1440d8653a6f801420f59979a1f9de005b0491ee
|
File details
Details for the file ingredient_parser_nlp-0.1.0b7-py3-none-any.whl.
File metadata
- Download URL: ingredient_parser_nlp-0.1.0b7-py3-none-any.whl
- Upload date:
- Size: 440.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86d10006fe4810d913c15792601c04e12055edfa35123ff929db2f9bc9471cb1
|
|
| MD5 |
ab9220b74363a527e0b97f656c1fda29
|
|
| BLAKE2b-256 |
237864e238ba3e78d064cba1bb1f1cc5776bdc57b606cd4d6769f98464b126f4
|