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.0b6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec0f8f7c674b407a07181d657fa8b70eb6a519384201975b4c8914975fb368ef |
|
MD5 | 61344edfeab7389e60bf72c386e0fff9 |
|
BLAKE2b-256 | 25565f584cd865520846b237f58ebb88735db6750eacf8c5eb87dccf562a1b65 |
Hashes for ingredient_parser_nlp-0.1.0b6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a80b9fada15af27440878780dfac76d9a612f2d7f78f80c02a1b79cc0d01a13 |
|
MD5 | 2320ee04e42045722ed6369fa54d132f |
|
BLAKE2b-256 | bb1e6a5e2455ae407bfe602bb1dc5038626160f8171a39e7f77fab7d6086bd3f |