def toAmerican (recipe, removelist): for ingredient in removelist: for item in lists.equivalencies: if item["asian"].lower() in ingredient["name"].lower(): if item['asian'] == '': continue #print "Replacing " + ingredient['name'] + ' with ' + item['american'] recipe.ingredients.append({"name":item["american"], "descriptor": '', "measurement": ingredient['measurement'], 'preparation': ingredient['preparation'], 'quantity': ingredient['quantity']}) recipe.swapStepIngredients(ingredient['name'], item['american']) break elif item["italian"].lower() in ingredient["name"].lower(): if item['italian'] == '': continue #print "Replacing " + ingredient['name'] + ' with ' + item['american'] recipe.ingredients.append({"name":item["american"], "descriptor": '', "measurement": ingredient['measurement'], 'preparation': ingredient['preparation'], 'quantity': ingredient['quantity']}) recipe.swapStepIngredients(ingredient['name'], item['american']) break elif item["mexican"].lower() in ingredient["name"].lower(): if item['mexican'] == '': continue #print "Replacing " + ingredient['name'] + ' with ' + item['american'] recipe.ingredients.append({"name":item["american"], "descriptor": '', "measurement": ingredient['measurement'], 'preparation': ingredient['preparation'], 'quantity': ingredient['quantity']}) recipe.swapStepIngredients(ingredient['name'], item['american']) break return recipe
def tovegetarian(recipe): #identify protein (to remove or substitute) meats = [] for ingredient in recipe.ingredients: for meat in lists.proteins: if meat in ingredient["name"]: meats.append(ingredient) break # remove meat from recipe for meat in meats: recipe.ingredients.remove(meat) type = recipe.getCuisineType() for meat in meats: liquid = False for liquid in lists.liquids: if liquid in meat['name'].lower(): #print "Liquid found!" liquid = True break if liquid == True: #print "Liquid substitution" recipe.ingredients.append({'name': 'vegetable broth', 'descriptor': '', 'measurement': meat['measurement'], 'quantity': meat['quantity'], 'preparation': ''}) recipe.swapStepIngredients(meat['name'], 'vegetable broth') elif type == "american": recipe.ingredients.append({'name':'mushroom', 'descriptor': '', 'measurement': meat['measurement'], 'quantity': meat['quantity'], 'preparation': meat['preparation']}) recipe.swapStepIngredients(meat['name'], 'mushroom') elif type == "italian": recipe.ingredients.append({'name':'eggplant', 'descriptor': '', 'measurement': meat['measurement'], 'quantity': meat['quantity'], 'preparation': meat['preparation']}) recipe.swapStepIngredients(meat['name'], 'eggplant') elif type == "asian": recipe.ingredients.append({'name':'tofu', 'descriptor': '', 'measurement': meat['measurement'], 'quantity': meat['quantity'], 'preparation': meat['preparation']}) recipe.swapStepIngredients(meat['name'], 'tofu') elif type == "mexican": recipe.ingredients.append({'name':'peppers', 'descriptor': '', 'measurement': meat['measurement'], 'quantity': meat['quantity'], 'preparation': 'chopped'}) recipe.swapStepIngredients(meat['name'], 'peppers') return recipe
def tovegetarian(recipe): #identify protein (to remove or substitute) meats = [] for ingredient in recipe.ingredients: for meat in lists.proteins: if meat in ingredient["name"]: meats.append(ingredient) break # remove meat from recipe for meat in meats: recipe.ingredients.remove(meat) type = recipe.getCuisineType() for meat in meats: liquid = False for liquid in lists.liquids: if liquid in meat['name'].lower(): #print "Liquid found!" liquid = True break if liquid == True: #print "Liquid substitution" recipe.ingredients.append({'name': 'vegetable broth', 'descriptor': '', 'measurement': meat['measurement'], 'quantity': meat['quantity'], 'preparation': ''}) recipe.swapStepIngredients(meat['name'], 'vegetable broth') elif type == "american": recipe.ingredients.append({'name':'mushroom', 'descriptor': '', 'measurement': meat['measurement'], 'quantity': meat['quantity'], 'preparation': meat['preparation']}) recipe.swapStepIngredients(meat['name'], 'mushroom') elif type == "italian": recipe.ingredients.append({'name':'eggplant', 'descriptor': '', 'measurement': meat['measurement'], 'quantity': meat['quantity'], 'preparation': meat['preparation']}) recipe.swapStepIngredients(meat['name'], 'eggplant') elif type == "asian": recipe.ingredients.append({'name':'tofu', 'descriptor': '', 'measurement': meat['measurement'], 'quantity': meat['quantity'], 'preparation': meat['preparation']}) recipe.swapStepIngredients(meat['name'], 'tofu') elif type == "mexican": recipe.ingredients.append({'name':'peppers', 'descriptor': '', 'measurement': meat['measurement'], 'quantity': meat['quantity'], 'preparation': 'chopped sauteed'}) recipe.swapStepIngredients(meat['name'], 'peppers') return recipe
def toMexican(recipe, removelist): for ingredient in removelist: for item in lists.equivalencies: if item["american"].lower() in ingredient["name"].lower(): if item['american'] == '': continue recipe.ingredients.append({ "name": item["mexican"], "descriptor": '', "measurement": ingredient['measurement'], 'preparation': ingredient['preparation'], 'quantity': ingredient['quantity'] }) recipe.swapStepIngredients(ingredient['name'], item['mexican']) break if item["italian"].lower() in ingredient["name"].lower(): if item['italian'] == '': continue recipe.ingredients.append({ "name": item["mexican"], "descriptor": '', "measurement": ingredient['measurement'], 'preparation': ingredient['preparation'], 'quantity': ingredient['quantity'] }) recipe.swapStepIngredients(ingredient['name'], item['mexican']) break if item["asian"].lower() in ingredient["name"].lower(): if item['asian'] == '': continue recipe.ingredients.append({ "name": item["mexican"], "descriptor": '', "measurement": ingredient['measurement'], 'preparation': ingredient['preparation'], 'quantity': ingredient['quantity'] }) recipe.swapStepIngredients(ingredient['name'], item['mexican']) break return recipe
def tohealthy(recipe): #change unhealthy cooking methods to healthy ones. for i in range(len(recipe.steps)): method = recipe.steps[i] #stir-fry the healthy way! with vegetable broth instead of oil if recipe.getPrimaryMethod() == "Stir-Fry": for i in range(len(recipe.ingredients)): ingredient = recipe.ingredients[i] if "oil" in ingredient["name"]: recipe.swapStepIngredients(recipe.ingredients[i]["name"], "Vegetable Broth") ingredient["name"] = "Vegetable Broth" ingredient["quantity"] = .5 ingredient["measurement"] = "cups" break #No More Deep Frying! for methods in lists.healthymethods: if methods in method["action"]: recipe.swapStepMethod(recipe.steps[i]["action"], lists.healthymethods[methods]) recipe.steps[i]["action"] = lists.healthymethods[methods] recipe.steps[i][ "time"] = "15-25 minutes or until cooked through" recipe.steps[i]["tools"] = ["baking pan"] recipe.steps.insert( 0, { "action": "preheat oven to 450", "tools": ["Oven"], "ingredients": [], "time": "" }) recipe.primarymethod = "Bake" break #Remove unhealthy ingredients and replace with healthier alternatives for i in range(len(recipe.ingredients)): ingredient = recipe.ingredients[i] for ingredients in lists.healthy: #The "Cambell's" exceptions if "broth" in ingredient["name"]: break elif "soup" in ingredient["name"]: break elif ingredients in ingredient["name"]: recipe.swapStepIngredients(recipe.ingredients[i]["name"], lists.healthy[ingredients]) recipe.ingredients[i]["name"] = lists.healthy[ingredients] break if "cheese" in ingredient["name"]: if recipe.ingredients[i]["quantity"]: recipe.ingredients[i][ "quantity"] = recipe.ingredients[i]["quantity"] / 2 break ## cut down unhealthy ingredient amounts ## caramelizing ## stir fry no oil ## cut down pasta and increase veggies ## cut out mayo ## salad dressings - blue cheese, marinades return recipe