Skip to content
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')