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.999196),
amount=[IngredientAmount(quantity='3',
unit='pounds',
text='3 pounds',
confidence=0.998769,
APPROXIMATE=False,
SINGULAR=False)],
preparation=IngredientText(text='cut into 2 inch chunks', confidence=0.995614),
comment=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: 14982
Correct: 14021
Incorrect: 961
-> 93.59% correct
Word-level results:
Total: 105360
Correct: 102741
Incorrect: 2619
-> 97.51% 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.0b8.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1fb93136cb93c2911095036798f032b1901fa96e5376835c01ae5642a48f495 |
|
MD5 | 515c086ca384c241bc12d32f2d74bb90 |
|
BLAKE2b-256 | 895f5546783f3f75e34ffef356366f28c87e3683796ea283e023ba19865c97b3 |
Hashes for ingredient_parser_nlp-0.1.0b8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cbe6da0d02ae89710866126c7ee8ef55736b03be6c8016c972da9b87ca5861f3 |
|
MD5 | 4fc0484c8b4a08b3328af0053cd00dce |
|
BLAKE2b-256 | a94b5a2b81cee63dee6b6438a3ec61cdfe49380c0ce59380bf59655bf19e3cd8 |