GithubHelp home page GithubHelp logo

boxydog / ingredient-parser Goto Github PK

View Code? Open in Web Editor NEW

This project forked from strangetom/ingredient-parser

0.0 0.0 0.0 113.3 MB

A tool to parse recipe ingredients into structured data

Home Page: https://ingredient-parser.readthedocs.io/en/latest/

License: MIT License

JavaScript 0.98% Python 90.33% CSS 3.34% Jinja 5.36%

ingredient-parser's Introduction

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.999193),
    size=None,
    amount=[IngredientAmount(quantity='3',
                             unit=<Unit('pound')>,
                             text='3 pounds',
                             confidence=0.999906,,
                             APPROXIMATE=False,
                             SINGULAR=False)],
    preparation=IngredientText(text='cut into 2 inch chunks', confidence=0.999193),
    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:
	Accuracy: 94.24%

Word-level results:
	Accuracy 97.73%
	Precision (micro) 97.72%
	Recall (micro) 97.73%
	F1 score (micro) 97.72%

Development

The development dependencies are in the requirements-dev.txt file. Details on the training process can be found in the Model Guide documentation.

Before committing anything, install pre-commit and run

pre-commit install

to install the pre-commit hooks.

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

Screen shot of web app

This requires the development dependencies to be installed.

The dependencies for building the documentation are in the requirements-doc.txt file.

ingredient-parser's People

Contributors

strangetom avatar boxydog avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.