Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

annotation up to 600, label finalizer moved from dietary_preferences … #23

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion project/modules/label_extractor_model/annotations.json

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions project/modules/label_finalizer.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# Rules in Label Finalizer:
# Diatary Preferences
#
from objects import Country


def finalizeTags(recipe):
for label in recipe.labels:
for key in Country.world_countries:
if label in Country.world_countries[key]:
recipe.labels.append(key)
recipe.labels = list(set(recipe.labels)) # removes duplicates
if 'MEAT' not in recipe.labels:
recipe.labels.append('VEGETARIAN')
if 'ANIMAL' not in recipe.labels:
recipe.labels.append('VEGAN')
if 'SEAFOOD' in recipe.labels:
recipe.labels.append('PESCETARIAN')
if 'NUT' not in recipe.labels:
recipe.labels.append('NUTFREE')
if 'STAMPLEFOOD' not in recipe.labels:
recipe.labels.append('LOWCARB')