diff --git a/recipe_tagger/data/ingredient_embedding.npy b/recipe_tagger/data/ingredient_embedding.npy index c715339..2a4aa53 100644 Binary files a/recipe_tagger/data/ingredient_embedding.npy and b/recipe_tagger/data/ingredient_embedding.npy differ diff --git a/recipe_tagger/foodcategory.py b/recipe_tagger/foodcategory.py index b5598c2..d364363 100644 --- a/recipe_tagger/foodcategory.py +++ b/recipe_tagger/foodcategory.py @@ -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 @@ -18,7 +24,8 @@ class FoodCategory(Enum): condiment = 7 nut = 8 seafood = 9 - dessert = 10 + snack = 10 + mushroom = 11 class CategorySynset: @@ -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"), ] diff --git a/recipe_tagger/recipe_tagger.py b/recipe_tagger/recipe_tagger.py index 78fabc8..c0dce9b 100644 --- a/recipe_tagger/recipe_tagger.py +++ b/recipe_tagger/recipe_tagger.py @@ -1,3 +1,8 @@ +""" +Module containg all the main methods of the package. +""" + + import io import pkgutil import re diff --git a/setup.py b/setup.py index 7bcced8..15b48ee 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,8 @@ +""" +Setup file for pubblication. +""" + + import pathlib from setuptools import find_packages, setup @@ -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", diff --git a/tests/test_recipe_tagger.py b/tests/test_recipe_tagger.py index 650da9d..36c27cf 100644 --- a/tests/test_recipe_tagger.py +++ b/tests/test_recipe_tagger.py @@ -1,3 +1,7 @@ +""" +Module containg all the tests provided for the package. +""" + import pytest from recipe_tagger import recipe_tagger @@ -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() @@ -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()