Skip to content

Commit

Permalink
Inserted 50 new ingredients with 2 new categories (snack, mushroom) a…
Browse files Browse the repository at this point in the history
…nd removed dessert
  • Loading branch information
TurconiAndrea committed Jul 27, 2021
1 parent 0863e6f commit aa53cc2
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 4 deletions.
Binary file modified recipe_tagger/data/ingredient_embedding.npy
Binary file not shown.
11 changes: 10 additions & 1 deletion recipe_tagger/foodcategory.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
"""
Module containg all the necessary class for the package.
FoodCategory is a Enum class representing the category of ingredient.
CategorySynset is a class representing the wordnet synset of a category.
"""

from enum import Enum

from nltk.corpus import wordnet
Expand All @@ -18,7 +24,8 @@ class FoodCategory(Enum):
condiment = 7
nut = 8
seafood = 9
dessert = 10
snack = 10
mushroom = 11


class CategorySynset:
Expand All @@ -42,4 +49,6 @@ class CategorySynset:
wordnet.synset(f"{FoodCategory.condiment.name}.n.01"),
wordnet.synset(f"{FoodCategory.nut.name}.n.01"),
wordnet.synset(f"{FoodCategory.seafood.name}.n.01"),
wordnet.synset(f"{FoodCategory.snack.name}.n.01"),
wordnet.synset(f"{FoodCategory.mushroom.name}.n.01"),
]
5 changes: 5 additions & 0 deletions recipe_tagger/recipe_tagger.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
"""
Module containg all the main methods of the package.
"""


import io
import pkgutil
import re
Expand Down
9 changes: 7 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
"""
Setup file for pubblication.
"""


import pathlib

from setuptools import find_packages, setup
Expand All @@ -11,14 +16,14 @@
setup(
name="recipe-tagger",
packages=find_packages(include=["recipe_tagger"]),
version="0.3.5",
version="0.3.6",
description="A library for tagging and classify recipes",
author="Andrea Turconi",
license="MIT",
long_description=README,
long_description_content_type="text/markdown",
url="https://github.com/TurconiAndrea/recipe-tagger",
download_url="https://github.com/TurconiAndrea/recipe-tagger/archive/refs/tags/0.3.5.tar.gz",
download_url="https://github.com/TurconiAndrea/recipe-tagger/archive/refs/tags/0.3.6.tar.gz",
keywords=["food", "recipe", "tag", "tagging", "ingredient"],
install_requires=[
"wikipedia-api",
Expand Down
8 changes: 7 additions & 1 deletion tests/test_recipe_tagger.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
"""
Module containg all the tests provided for the package.
"""

import pytest

from recipe_tagger import recipe_tagger
Expand Down Expand Up @@ -41,7 +45,7 @@ def test_add_ingredient():
Test for add_ingredient method.
Test is passed only if the provided ingredient is not into the embedding.
"""
assert recipe_tagger.add_ingredient("milk", "dairy") == True
assert recipe_tagger.add_ingredient("milk", "dairy") == False


# @pytest.mark.skip()
Expand Down Expand Up @@ -82,6 +86,8 @@ def test_get_ingredient_class():
assert recipe_tagger.get_ingredient_class("chicken") == "meat"
assert recipe_tagger.get_ingredient_class("cattle") == "meat"
assert recipe_tagger.get_ingredient_class("milk") == "dairy"
assert recipe_tagger.get_ingredient_class("porcini") == "mushroom"
assert recipe_tagger.get_ingredient_class("chips") == "snack"


# @pytest.mark.skip()
Expand Down

0 comments on commit aa53cc2

Please sign in to comment.