Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 2.8.0 instead.
Reason given by maintainers: No upper limit on Python version set.

Ingredient Parser

The Ingredient Parser package is a Python package for parsing structured information out of recipe ingredient sentences.

1 large onion, finely chopped

becomes

{
    "quantity": 1,
    "unit": "large",
    "name": "onion",
    "comment": "finely chopped"
}

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")
{'sentence': '3 pounds pork shoulder, cut into 2-inch chunks',
 'quantity': '3',
 'unit': 'pound',
 'name': 'pork shoulder',
 'comment': ', cut into 2-inch chunks',
 'other': ''}

# Output confidence for each label
>>> parse_ingredient("3 pounds pork shoulder, cut into 2-inch chunks", confidence=True)
{'sentence': '3 pounds pork shoulder, cut into 2-inch chunks',
 'quantity': '3',
 'unit': 'pound',
 'name': 'pork shoulder',
 'comment': ', cut into 2-inch chunks',
 'other': '',
 'confidence': {'quantity': 0.9986,
  'unit': 0.9967,
  'name': 0.9535,
  'comment': 0.9967,
  'other': 0}}

The returned dictionary has the format

{
    "sentence": str,
    "quantity": str,
    "unit": str,
    "name": str,
    "comment": Union[List[str], str],
    "other": Union[List[str], str]
}

Model accuracy

The model provided in ingredient-parser/ directory has the following accuracy on a test data set of 25%:

Sentence-level results:
	Total: 9277
	Correct: 7689
	-> 82.88%

Word-level results:
	Total: 52931
	Correct: 50051
	-> 94.56%

Development

The development dependencies are in the requirements-dev.txt file.

Note that development includes training the model.

  • Black is used for code formatting.

  • isort is used for import sorting.

  • flake8 is used for linting. Note the line length standard (E501) is ignored.

  • pyrigt is used for type static analysis.

The documentation dependencies are in the requirement-doc.txt file.

Release files for ingredient-parser-nlp 0.1.0a1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ingredient-parser-nlp 0.1.0a1
File Size Uploaded
ingredient_parser_nlp-0.1.0a1.tar.gz 790.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ingredient-parser-nlp 0.1.0a1
File Interpreter ABI Platform
ingredient_parser_nlp-0.1.0a1-py3-none-any.whl Python 3 none any Details

Total release size: 1.6 MB

Release files / ingredient_parser_nlp-0.1.0a1.tar.gz

Download URL ingredient_parser_nlp-0.1.0a1.tar.gz
Size 790.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b4397d79869a16ba1d626e3fc07fc8e5d8d6f59871789c80b19be8e3dc7358ca
BLAKE2b-256 checksum
How to use checksums
efc98c752e891a8b268a5c4e4c3bdbf10f942c227eb0a2eee693494532c5025d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Release files / ingredient_parser_nlp-0.1.0a1-py3-none-any.whl

Download URL ingredient_parser_nlp-0.1.0a1-py3-none-any.whl
Size 787.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cd7f0965e6e0da3400b19ecd9fc0277bdba20a439266eccb7be02d4079f264e5
BLAKE2b-256 checksum
How to use checksums
c04aa232f3c4c5ad37f19fa04d7d73996a33ab9b963600f4354aa30fffab9c27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Release history Release notifications | RSS feed

2.8.0

2 release files

2.7.0

2 release files

2.6.0

2 release files

2.5.0

2 release files

2.4.0

2 release files

2.3.0

2 release files

2.2.0

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

This release

0.1.0a1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page