{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Manual Recipe Creation based on Popular Yummly Recipes" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import sys\n", "sys.path.append(\"../\")\n", "sys.path.append(\"../EvolutionaryAlgorithm/\")" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ " \n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ " \n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stderr", "output_type": "stream", "text": [ "../EvolutionaryAlgorithm/EvolutionaryAlgorithm.py:60: TqdmExperimentalWarning:\n", "\n", "Using `tqdm.autonotebook.tqdm` in notebook mode. Use `tqdm.tqdm` instead to force console mode (e.g. in jupyter console)\n", "\n" ] } ], "source": [ "import EvolutionaryAlgorithm as EA" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "def ingredient_nodes(ing_list):\n", " d = {}\n", " for ing in ing_list:\n", " d[ing] = EA.IngredientNode(ing)\n", " return d" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "def act(d, act, ing):\n", " a = EA.ActionNode(act)\n", " \n", " p_a = d[ing]\n", " \n", " while p_a.parent() is not None:\n", " p_a = p_a.parent()\n", " \n", " a.add_child(p_a)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "def mix(d, ing_a, ing_b):\n", " p_a = d[ing_a]\n", " p_b = d[ing_b]\n", " \n", " while p_a.parent() is not None:\n", " p_a = p_a.parent()\n", " while p_b.parent() is not None:\n", " p_b = p_b.parent()\n", " \n", " m = EA.MixNode()\n", " m.add_child(p_a)\n", " m.add_child(p_b)\n", " \n", " " ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "def get_root(d):\n", " parents = set()\n", " for n in d:\n", " p = d[n]\n", " while p.parent() is not None:\n", " p = p.parent()\n", " parents.add(p)\n", " \n", " pp = list(parents)\n", " if len(pp) == 1:\n", " pp[0].simplify()\n", " return pp[0]\n", " \n", " m = EA.MixNode()\n", " for p in pp:\n", " m.add_child(p)\n", " m.simplify()\n", " return m" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "%3\n", "\n", "\n", "\n", "15\n", "\n", " \n", "mix\n", "node score: 0.6000\n", "\n", "\n", "\n", "14\n", "\n", " \n", "bake\n", "node score: 0.7500\n", "\n", "\n", "\n", "15->14\n", "\n", "\n", "\n", "\n", "\n", "9\n", "\n", " \n", "wash\n", "node score: 1.0000\n", "\n", "\n", "\n", "15->9\n", "\n", "\n", "\n", "\n", "\n", "6\n", "\n", " \n", "cheese\n", "node score:1.0000\n", "\n", "\n", "\n", "15->6\n", "\n", "\n", "\n", "\n", "\n", "10\n", "\n", " \n", "heat\n", "node score: 0.0000\n", "\n", "\n", "\n", "15->10\n", "\n", "\n", "\n", "\n", "\n", "13\n", "\n", " \n", "mix\n", "node score: 0.5000\n", "\n", "\n", "\n", "14->13\n", "\n", "\n", "\n", "\n", "\n", "0\n", "\n", " \n", "salt\n", "node score:1.0000\n", "\n", "\n", "\n", "13->0\n", "\n", "\n", "\n", "\n", "\n", "2\n", "\n", " \n", "mozarella cheese\n", "node score:1.0000\n", "\n", "\n", "\n", "13->2\n", "\n", "\n", "\n", "\n", "\n", "3\n", "\n", " \n", "noodle\n", "node score:1.0000\n", "\n", "\n", "\n", "13->3\n", "\n", "\n", "\n", "\n", "\n", "8\n", "\n", " \n", "dice\n", "node score: 1.0000\n", "\n", "\n", "\n", "13->8\n", "\n", "\n", "\n", "\n", "\n", "1\n", "\n", " \n", "onion\n", "node score:1.0000\n", "\n", "\n", "\n", "8->1\n", "\n", "\n", "\n", "\n", "\n", "4\n", "\n", " \n", "spinach\n", "node score:1.0000\n", "\n", "\n", "\n", "9->4\n", "\n", "\n", "\n", "\n", "\n", "7\n", "\n", " \n", "spring onion\n", "node score:1.0000\n", "\n", "\n", "\n", "10->7\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "**Ingredients**:\n", " * spring onion\n", " * noodle\n", " * salt\n", " * spinach\n", " * mozarella cheese\n", " * cheese\n", " * onion\n", "\n", "\n", "**Instructions**:\n", "\n", "| Step | Instruction |\n", "| ----:|:----------- |\n", "| 1 | dice onion and mix it with salt, mozarella cheese and noodle. Then bake it. |\n", "| 2 | wash spinach, heat spring onion and mix it with cheese and mix it together with the results of step 1. |\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# ingredients:\n", "\n", "d = ingredient_nodes([\n", " \"salt\",\n", " \"onion\",\n", " \"mozarella cheese\",\n", " \"noodle\",\n", " \"spinach\",\n", " \"cheese\",\n", " \"cheese\",\n", " \"spring onion\"\n", "])\n", "\n", "act(d, \"dice\", \"onion\")\n", "act(d, \"wash\", \"spinach\")\n", "\n", "act(d, \"heat\", \"spring onion\")\n", "\n", "mix(d, \"salt\", \"onion\")\n", "mix(d, \"salt\", \"noodle\")\n", "mix(d, \"salt\", \"mozarella cheese\")\n", "act(d, \"bake\", \"noodle\")\n", "\n", "\n", "r = get_root(d)\n", "\n", "display(r.dot())\n", "display(r.to_instruction().to_markdown())\n" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'lasagne_recipe.dot'" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "r.dot().save(\"lasagne_recipe.dot\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Easy Fried Rice\n", "https://www.yummly.com/recipe/Easy-Fried-Rice-2306391#directions" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* Ingredients" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "%3\n", "\n", "\n", "\n", "83\n", "\n", " \n", "mix\n", "node score: 0.8947\n", "\n", "\n", "\n", "67\n", "\n", " \n", "sesame oil\n", "node score:0.5000\n", "\n", "\n", "\n", "83->67\n", "\n", "\n", "\n", "\n", "\n", "82\n", "\n", " \n", "fry\n", "node score: 0.3750\n", "\n", "\n", "\n", "83->82\n", "\n", "\n", "\n", "\n", "\n", "62\n", "\n", " \n", "pepper\n", "node score:0.5000\n", "\n", "\n", "\n", "83->62\n", "\n", "\n", "\n", "\n", "\n", "61\n", "\n", " \n", "salt\n", "node score:0.5000\n", "\n", "\n", "\n", "83->61\n", "\n", "\n", "\n", "\n", "\n", "69\n", "\n", " \n", "whisk\n", "node score: 1.0000\n", "\n", "\n", "\n", "83->69\n", "\n", "\n", "\n", "\n", "\n", "81\n", "\n", " \n", "mix\n", "node score: 0.9545\n", "\n", "\n", "\n", "82->81\n", "\n", "\n", "\n", "\n", "\n", "66\n", "\n", " \n", "oyster sauce\n", "node score:1.0000\n", "\n", "\n", "\n", "81->66\n", "\n", "\n", "\n", "\n", "\n", "77\n", "\n", " \n", "saute\n", "node score: 1.0000\n", "\n", "\n", "\n", "81->77\n", "\n", "\n", "\n", "\n", "\n", "65\n", "\n", " \n", "soy sauce\n", "node score:1.0000\n", "\n", "\n", "\n", "81->65\n", "\n", "\n", "\n", "\n", "\n", "70\n", "\n", " \n", "cook\n", "node score: 1.0000\n", "\n", "\n", "\n", "81->70\n", "\n", "\n", "\n", "\n", "\n", "71\n", "\n", " \n", "slice\n", "node score: 1.0000\n", "\n", "\n", "\n", "81->71\n", "\n", "\n", "\n", "\n", "\n", "76\n", "\n", " \n", "mix\n", "node score: 1.0000\n", "\n", "\n", "\n", "77->76\n", "\n", "\n", "\n", "\n", "\n", "68\n", "\n", " \n", "melt\n", "node score: 1.0000\n", "\n", "\n", "\n", "76->68\n", "\n", "\n", "\n", "\n", "\n", "59\n", "\n", " \n", "carrot\n", "node score:0.5000\n", "\n", "\n", "\n", "76->59\n", "\n", "\n", "\n", "\n", "\n", "58\n", "\n", " \n", "pea\n", "node score:1.0000\n", "\n", "\n", "\n", "76->58\n", "\n", "\n", "\n", "\n", "\n", "60\n", "\n", " \n", "garlic clove\n", "node score:0.5000\n", "\n", "\n", "\n", "76->60\n", "\n", "\n", "\n", "\n", "\n", "56\n", "\n", " \n", "butter\n", "node score:1.0000\n", "\n", "\n", "\n", "68->56\n", "\n", "\n", "\n", "\n", "\n", "63\n", "\n", " \n", "rice\n", "node score:1.0000\n", "\n", "\n", "\n", "70->63\n", "\n", "\n", "\n", "\n", "\n", "64\n", "\n", " \n", "onion\n", "node score:1.0000\n", "\n", "\n", "\n", "71->64\n", "\n", "\n", "\n", "\n", "\n", "57\n", "\n", " \n", "egg\n", "node score:0.5000\n", "\n", "\n", "\n", "69->57\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "**Ingredients**:\n", " * oyster sauce\n", " * carrot\n", " * soy sauce\n", " * onion\n", " * butter\n", " * sesame oil\n", " * pepper\n", " * egg\n", " * rice\n", " * salt\n", " * garlic clove\n", " * pea\n", "\n", "\n", "**Instructions**:\n", "\n", "| Step | Instruction |\n", "| ----:|:----------- |\n", "| 1 | melt butter and mix it with carrot, pea and garlic clove. Then saute it. |\n", "| 2 | cook rice, slice onion and mix it with oyster sauce and soy sauce and mix it together with the results of step 1. Then fry it. |\n", "| 3 | whisk egg and mix it with sesame oil, pepper and salt and mix it together with the results of step 2. |\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# ingredients:\n", "\n", "d = ingredient_nodes([\n", " \"butter\",\n", " \"egg\",\n", " \"pea\",\n", " \"carrot\",\n", " \"garlic clove\",\n", " \"salt\",\n", " \"pepper\",\n", " \"rice\",\n", " \"onion\",\n", " \"soy sauce\",\n", " \"oyster sauce\",\n", " \"sesame oil\"\n", "])\n", "\n", "# actions\n", "\n", "act(d, \"melt\", \"butter\")\n", "act(d, \"whisk\", \"egg\")\n", "act(d, \"cook\", \"rice\")\n", "act(d, \"slice\", \"onion\")\n", "mix(d, \"salt\", \"egg\")\n", "mix(d, \"pepper\", \"egg\")\n", "mix(d, \"butter\", \"garlic clove\")\n", "mix (d, \"pea\", \"butter\")\n", "mix (d, \"carrot\", \"butter\")\n", "act(d, \"saute\", \"butter\")\n", "mix (d, \"butter\", \"rice\")\n", "mix (d, \"butter\", \"onion\")\n", "mix (d, \"soy sauce\", \"butter\")\n", "mix (d, \"oyster sauce\", \"butter\")\n", "act(d, \"fry\", \"rice\")\n", "\n", "r = get_root(d)\n", "\n", "display(r.dot())\n", "display(r.to_instruction().to_markdown())\n", "with open(\"curated_rice_0.md\", \"w\") as f:\n", " f.write(r.to_instruction().to_markdown().data)\n", " f.close()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Easy Lazy Day Lasagna\n", "https://www.momontimeout.com/lazy-day-lasagna/?utm_campaign=yummly" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "%3\n", "\n", "\n", "\n", "97\n", "\n", " \n", "bake\n", "node score: 1.0000\n", "\n", "\n", "\n", "96\n", "\n", " \n", "mix\n", "node score: 0.9286\n", "\n", "\n", "\n", "97->96\n", "\n", "\n", "\n", "\n", "\n", "88\n", "\n", " \n", "ricotta cheese\n", "node score:1.0000\n", "\n", "\n", "\n", "96->88\n", "\n", "\n", "\n", "\n", "\n", "86\n", "\n", " \n", "pasta sauce\n", "node score:1.0000\n", "\n", "\n", "\n", "96->86\n", "\n", "\n", "\n", "\n", "\n", "84\n", "\n", " \n", "noodle\n", "node score:1.0000\n", "\n", "\n", "\n", "96->84\n", "\n", "\n", "\n", "\n", "\n", "89\n", "\n", " \n", "mozzarella cheese\n", "node score:1.0000\n", "\n", "\n", "\n", "96->89\n", "\n", "\n", "\n", "\n", "\n", "93\n", "\n", " \n", "simmer\n", "node score: 1.0000\n", "\n", "\n", "\n", "96->93\n", "\n", "\n", "\n", "\n", "\n", "92\n", "\n", " \n", "mix\n", "node score: 1.0000\n", "\n", "\n", "\n", "93->92\n", "\n", "\n", "\n", "\n", "\n", "87\n", "\n", " \n", "water\n", "node score:1.0000\n", "\n", "\n", "\n", "92->87\n", "\n", "\n", "\n", "\n", "\n", "91\n", "\n", " \n", "brown\n", "node score: 1.0000\n", "\n", "\n", "\n", "92->91\n", "\n", "\n", "\n", "\n", "\n", "85\n", "\n", " \n", "ground beef\n", "node score:1.0000\n", "\n", "\n", "\n", "91->85\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "**Ingredients**:\n", " * water\n", " * mozzarella cheese\n", " * pasta sauce\n", " * ground beef\n", " * ricotta cheese\n", " * noodle\n", "\n", "\n", "**Instructions**:\n", "\n", "| Step | Instruction |\n", "| ----:|:----------- |\n", "| 1 | brown ground beef and mix it with water. Then simmer it. |\n", "| 2 | Mix ricotta cheese, pasta sauce, noodle and mozzarella cheese and mix it together with the results of step 1. Then bake it. |\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "\n", "d = ingredient_nodes([\n", " \"noodle\",\n", " \"ground beef\",\n", " \"pasta sauce\",\n", " \"water\",\n", " \"ricotta cheese\",\n", " \"mozzarella cheese\"\n", "])\n", "\n", "# actions\n", "\n", "mix (d, \"noodle\", \"pasta sauce\")\n", "act(d, \"brown\", \"ground beef\")\n", "mix (d, \"water\", \"ground beef\")\n", "act(d, \"simmer\", \"ground beef\")\n", "mix (d, \"noodle\", \"ricotta cheese\")\n", "mix (d, \"noodle\", \"mozzarella cheese\")\n", "mix (d, \"noodle\", \"ground beef\")\n", "act(d, \"bake\", \"noodle\")\n", "\n", "r = get_root(d)\n", "\n", "display(r.dot())\n", "display(r.to_instruction().to_markdown())\n", "with open(\"curated_noodle_0.md\", \"w\") as f:\n", " f.write(r.to_instruction().to_markdown().data)\n", " f.close()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Firecracker Chicken\n", "https://www.melskitchencafe.com/firecracker-chicken/?utm_campaign=yummly" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "%3\n", "\n", "\n", "\n", "125\n", "\n", " \n", "mix\n", "node score: 0.7778\n", "\n", "\n", "\n", "122\n", "\n", " \n", "bake\n", "node score: 0.5000\n", "\n", "\n", "\n", "125->122\n", "\n", "\n", "\n", "\n", "\n", "123\n", "\n", " \n", "steam\n", "node score: 1.0000\n", "\n", "\n", "\n", "125->123\n", "\n", "\n", "\n", "\n", "\n", "100\n", "\n", " \n", "water\n", "node score:0.5000\n", "\n", "\n", "\n", "125->100\n", "\n", "\n", "\n", "\n", "\n", "101\n", "\n", " \n", "cider vinegar\n", "node score:0.5000\n", "\n", "\n", "\n", "125->101\n", "\n", "\n", "\n", "\n", "\n", "121\n", "\n", " \n", "mix\n", "node score: 0.6923\n", "\n", "\n", "\n", "122->121\n", "\n", "\n", "\n", "\n", "\n", "99\n", "\n", " \n", "sugar\n", "node score:1.0000\n", "\n", "\n", "\n", "121->99\n", "\n", "\n", "\n", "\n", "\n", "98\n", "\n", " \n", "hot sauce\n", "node score:1.0000\n", "\n", "\n", "\n", "121->98\n", "\n", "\n", "\n", "\n", "\n", "119\n", "\n", " \n", "cook\n", "node score: 0.6667\n", "\n", "\n", "\n", "121->119\n", "\n", "\n", "\n", "\n", "\n", "118\n", "\n", " \n", "mix\n", "node score: 0.7333\n", "\n", "\n", "\n", "119->118\n", "\n", "\n", "\n", "\n", "\n", "107\n", "\n", " \n", "cornstach\n", "node score:1.0000\n", "\n", "\n", "\n", "118->107\n", "\n", "\n", "\n", "\n", "\n", "105\n", "\n", " \n", "salt\n", "node score:1.0000\n", "\n", "\n", "\n", "118->105\n", "\n", "\n", "\n", "\n", "\n", "112\n", "\n", " \n", "cut\n", "node score: 1.0000\n", "\n", "\n", "\n", "118->112\n", "\n", "\n", "\n", "\n", "\n", "117\n", "\n", " \n", "heat\n", "node score: 1.0000\n", "\n", "\n", "\n", "118->117\n", "\n", "\n", "\n", "\n", "\n", "111\n", "\n", " \n", "whisk\n", "node score: 1.0000\n", "\n", "\n", "\n", "118->111\n", "\n", "\n", "\n", "\n", "\n", "106\n", "\n", " \n", "pepper\n", "node score:1.0000\n", "\n", "\n", "\n", "118->106\n", "\n", "\n", "\n", "\n", "\n", "104\n", "\n", " \n", "chicken breast\n", "node score:1.0000\n", "\n", "\n", "\n", "112->104\n", "\n", "\n", "\n", "\n", "\n", "103\n", "\n", " \n", "canola oil\n", "node score:1.0000\n", "\n", "\n", "\n", "117->103\n", "\n", "\n", "\n", "\n", "\n", "110\n", "\n", " \n", "beat\n", "node score: 1.0000\n", "\n", "\n", "\n", "111->110\n", "\n", "\n", "\n", "\n", "\n", "108\n", "\n", " \n", "egg\n", "node score:0.5000\n", "\n", "\n", "\n", "110->108\n", "\n", "\n", "\n", "\n", "\n", "109\n", "\n", " \n", "rice\n", "node score:1.0000\n", "\n", "\n", "\n", "123->109\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "**Ingredients**:\n", " * water\n", " * cornstach\n", " * canola oil\n", " * sugar\n", " * hot sauce\n", " * cider vinegar\n", " * chicken breast\n", " * egg\n", " * pepper\n", " * rice\n", " * salt\n", "\n", "\n", "**Instructions**:\n", "\n", "| Step | Instruction |\n", "| ----:|:----------- |\n", "| 1 | beat and whisk egg |\n", "| 2 | cut chicken breast, heat canola oil and mix it with cornstach, salt and pepper and mix it together with the results of step 1. Then cook it. |\n", "| 3 | Mix sugar and hot sauce and mix it together with the results of step 2. Then bake it. |\n", "| 4 | steam rice and mix it with water and cider vinegar and mix it together with the results of step 3. |\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "\n", "d = ingredient_nodes([\n", " \"hot sauce\",\n", " \"sugar\",\n", " \"water\",\n", " \"cider vinegar\",\n", " \"salt\",\n", " \"canola oil\",\n", " \"chicken breast\",\n", " \"salt\",\n", " \"pepper\",\n", " \"cornstach\",\n", " \"egg\",\n", " \"rice\"\n", " \n", "])\n", "\n", "# actions\n", "\n", "act(d, \"beat\", \"egg\")\n", "act(d, \"whisk\", \"egg\")\n", "act(d, \"cut\", \"chicken breast\")\n", "mix(d, \"chicken breast\", \"salt\")\n", "mix(d, \"chicken breast\", \"pepper\")\n", "mix(d, \"cornstach\", \"chicken breast\")\n", "\n", "mix(d, \"chicken breast\", \"egg\")\n", "\n", "act(d, \"heat\", \"canola oil\")\n", "\n", "mix(d, \"chicken breast\", \"canola oil\")\n", "\n", "act(d, \"cook\", \"chicken breast\")\n", "\n", "mix(d, \"sugar\", \"hot sauce\")\n", "mix(d, \"hot sauce\", \"chicken breast\")\n", "act(d, \"bake\", \"chicken breast\")\n", "\n", "act(d, \"steam\", \"rice\")\n", "mix(d, \"chicken breast\", \"rice\")\n", "\n", "r = get_root(d)\n", "\n", "display(r.dot())\n", "display(r.to_instruction().to_markdown())\n", "with open(\"curated_rice_1.md\", \"w\") as f:\n", " f.write(r.to_instruction().to_markdown().data)\n", " f.close()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Italian Drunken Noodles\n", "https://www.yummly.com/recipe/Italian-Drunken-Noodles-1835835#directions" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "%3\n", "\n", "\n", "\n", "151\n", "\n", " \n", "mix\n", "node score: 0.6667\n", "\n", "\n", "\n", "150\n", "\n", " \n", "drain\n", "node score: 1.0000\n", "\n", "\n", "\n", "151->150\n", "\n", "\n", "\n", "\n", "\n", "133\n", "\n", " \n", "basil\n", "node score:0.5000\n", "\n", "\n", "\n", "151->133\n", "\n", "\n", "\n", "\n", "\n", "132\n", "\n", " \n", "parsley\n", "node score:0.5000\n", "\n", "\n", "\n", "151->132\n", "\n", "\n", "\n", "\n", "\n", "146\n", "\n", " \n", "simmer\n", "node score: 0.8571\n", "\n", "\n", "\n", "151->146\n", "\n", "\n", "\n", "\n", "\n", "149\n", "\n", " \n", "cook\n", "node score: 1.0000\n", "\n", "\n", "\n", "150->149\n", "\n", "\n", "\n", "\n", "\n", "134\n", "\n", " \n", "egg noodle\n", "node score:1.0000\n", "\n", "\n", "\n", "149->134\n", "\n", "\n", "\n", "\n", "\n", "145\n", "\n", " \n", "mix\n", "node score: 0.8947\n", "\n", "\n", "\n", "146->145\n", "\n", "\n", "\n", "\n", "\n", "143\n", "\n", " \n", "dice\n", "node score: 1.0000\n", "\n", "\n", "\n", "145->143\n", "\n", "\n", "\n", "\n", "\n", "130\n", "\n", " \n", "white wine\n", "node score:1.0000\n", "\n", "\n", "\n", "145->130\n", "\n", "\n", "\n", "\n", "\n", "140\n", "\n", " \n", "saute\n", "node score: 1.0000\n", "\n", "\n", "\n", "145->140\n", "\n", "\n", "\n", "\n", "\n", "129\n", "\n", " \n", "garlic clove\n", "node score:0.5000\n", "\n", "\n", "\n", "145->129\n", "\n", "\n", "\n", "\n", "\n", "137\n", "\n", " \n", "heat\n", "node score: 1.0000\n", "\n", "\n", "\n", "145->137\n", "\n", "\n", "\n", "\n", "\n", "131\n", "\n", " \n", "tomato\n", "node score:1.0000\n", "\n", "\n", "\n", "143->131\n", "\n", "\n", "\n", "\n", "\n", "139\n", "\n", " \n", "mix\n", "node score: 1.0000\n", "\n", "\n", "\n", "140->139\n", "\n", "\n", "\n", "\n", "\n", "127\n", "\n", " \n", "salt\n", "node score:1.0000\n", "\n", "\n", "\n", "139->127\n", "\n", "\n", "\n", "\n", "\n", "138\n", "\n", " \n", "dice\n", "node score: 1.0000\n", "\n", "\n", "\n", "139->138\n", "\n", "\n", "\n", "\n", "\n", "128\n", "\n", " \n", "pepper\n", "node score:1.0000\n", "\n", "\n", "\n", "138->128\n", "\n", "\n", "\n", "\n", "\n", "136\n", "\n", " \n", "mix\n", "node score: 1.0000\n", "\n", "\n", "\n", "137->136\n", "\n", "\n", "\n", "\n", "\n", "135\n", "\n", " \n", "olive oil\n", "node score:1.0000\n", "\n", "\n", "\n", "136->135\n", "\n", "\n", "\n", "\n", "\n", "126\n", "\n", " \n", "sausage\n", "node score:1.0000\n", "\n", "\n", "\n", "136->126\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "**Ingredients**:\n", " * sausage\n", " * egg noodle\n", " * olive oil\n", " * tomato\n", " * parsley\n", " * salt\n", " * pepper\n", " * basil\n", " * garlic clove\n", " * white wine\n", "\n", "\n", "**Instructions**:\n", "\n", "| Step | Instruction |\n", "| ----:|:----------- |\n", "| 1 | cook and drain egg noodle |\n", "| 2 | dice pepper and mix it with salt. Then saute it. |\n", "| 3 | Mix olive oil and sausage. Then heat it. |\n", "| 4 | dice tomato and mix it with white wine and garlic clove and mix it together with the results of step 2 and step 3. Then simmer it. |\n", "| 5 | Mix basil and parsley and mix it together with the results of step 1 and step 4. |\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "\n", "d = ingredient_nodes([\n", " \"sausage\",\n", " \"salt\",\n", " \"pepper\",\n", " \"garlic clove\",\n", " \"white wine\",\n", " \"tomato\",\n", " \"parsley\",\n", " \"basil\",\n", " \"egg noodle\",\n", " \"olive oil\"\n", "])\n", "\n", "# actions\n", "\n", "mix (d, \"olive oil\", \"sausage\")\n", "act (d, \"heat\", \"sausage\")\n", "act (d, \"dice\", \"pepper\")\n", "mix (d, \"pepper\", \"salt\")\n", "act (d, \"saute\", \"pepper\")\n", "mix (d, \"pepper\", \"garlic clove\")\n", "mix (d, \"white wine\", \"pepper\")\n", "act (d, \"dice\", \"tomato\")\n", "mix (d, \"tomato\", \"pepper\")\n", "mix (d, \"sausage\", \"pepper\")\n", "act (d, \"simmer\", \"sausage\")\n", "mix (d, \"parsley\", \"pepper\")\n", "mix (d, \"basil\", \"pepper\")\n", "\n", "act(d, \"cook\", \"egg noodle\")\n", "act(d, \"drain\", \"egg noodle\")\n", "\n", "mix(d, \"egg noodle\", \"sausage\")\n", "\n", "r = get_root(d)\n", "\n", "display(r.dot())\n", "display(r.to_instruction().to_markdown())\n", "with open(\"curated_noodle_1.md\", \"w\") as f:\n", " f.write(r.to_instruction().to_markdown().data)\n", " f.close()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Italian Pasta Salad\n", "https://www.yummly.com/recipe/Italian-Pasta-Salad-9104504#directions" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "%3\n", "\n", "\n", "\n", "173\n", "\n", " \n", "refrigerate\n", "node score: 0.6250\n", "\n", "\n", "\n", "172\n", "\n", " \n", "mix\n", "node score: 0.9630\n", "\n", "\n", "\n", "173->172\n", "\n", "\n", "\n", "\n", "\n", "162\n", "\n", " \n", "chop\n", "node score: 1.0000\n", "\n", "\n", "\n", "172->162\n", "\n", "\n", "\n", "\n", "\n", "163\n", "\n", " \n", "slice\n", "node score: 1.0000\n", "\n", "\n", "\n", "172->163\n", "\n", "\n", "\n", "\n", "\n", "166\n", "\n", " \n", "drain\n", "node score: 1.0000\n", "\n", "\n", "\n", "172->166\n", "\n", "\n", "\n", "\n", "\n", "155\n", "\n", " \n", "cheese\n", "node score:1.0000\n", "\n", "\n", "\n", "172->155\n", "\n", "\n", "\n", "\n", "\n", "158\n", "\n", " \n", "dressing\n", "node score:1.0000\n", "\n", "\n", "\n", "172->158\n", "\n", "\n", "\n", "\n", "\n", "164\n", "\n", " \n", "dice\n", "node score: 1.0000\n", "\n", "\n", "\n", "172->164\n", "\n", "\n", "\n", "\n", "\n", "154\n", "\n", " \n", "tomato\n", "node score:0.5000\n", "\n", "\n", "\n", "172->154\n", "\n", "\n", "\n", "\n", "\n", "161\n", "\n", " \n", "peel\n", "node score: 1.0000\n", "\n", "\n", "\n", "162->161\n", "\n", "\n", "\n", "\n", "\n", "153\n", "\n", " \n", "cucumber\n", "node score:1.0000\n", "\n", "\n", "\n", "161->153\n", "\n", "\n", "\n", "\n", "\n", "156\n", "\n", " \n", "black olive\n", "node score:1.0000\n", "\n", "\n", "\n", "163->156\n", "\n", "\n", "\n", "\n", "\n", "165\n", "\n", " \n", "cook\n", "node score: 1.0000\n", "\n", "\n", "\n", "166->165\n", "\n", "\n", "\n", "\n", "\n", "160\n", "\n", " \n", "mix\n", "node score: 1.0000\n", "\n", "\n", "\n", "165->160\n", "\n", "\n", "\n", "\n", "\n", "152\n", "\n", " \n", "pasta\n", "node score:1.0000\n", "\n", "\n", "\n", "160->152\n", "\n", "\n", "\n", "\n", "\n", "159\n", "\n", " \n", "salt\n", "node score:1.0000\n", "\n", "\n", "\n", "160->159\n", "\n", "\n", "\n", "\n", "\n", "157\n", "\n", " \n", "red onion\n", "node score:1.0000\n", "\n", "\n", "\n", "164->157\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "**Ingredients**:\n", " * dressing\n", " * black olive\n", " * tomato\n", " * cheese\n", " * red onion\n", " * cucumber\n", " * salt\n", " * pasta\n", "\n", "\n", "**Instructions**:\n", "\n", "| Step | Instruction |\n", "| ----:|:----------- |\n", "| 1 | peel and chop cucumber |\n", "| 2 | Mix pasta and salt. Then cook it. |\n", "| 3 | drain the result of step 2 |\n", "| 4 | slice black olive, dice red onion and mix it with cheese, dressing and tomato and mix it together with the results of step 1 and step 3. Then refrigerate it. |\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "\n", "d = ingredient_nodes([\n", " \"pasta\",\n", " \"cucumber\",\n", " \"tomato\",\n", " \"cheese\",\n", " \"black olive\",\n", " \"red onion\",\n", " \"dressing\",\n", " \"salt\"\n", "])\n", "\n", "# actions\n", "\n", "mix (d, \"salt\", \"pasta\")\n", "act (d, \"peel\", \"cucumber\")\n", "act (d, \"chop\", \"cucumber\")\n", "act (d, \"slice\", \"black olive\")\n", "act (d, \"dice\", \"red onion\")\n", "act (d, \"cook\", \"pasta\")\n", "act (d, \"drain\", \"pasta\")\n", "mix (d, \"pasta\", \"cucumber\")\n", "mix (d, \"pasta\", \"tomato\")\n", "mix (d, \"pasta\", \"cheese\")\n", "mix (d, \"pasta\", \"black olive\")\n", "mix (d, \"pasta\", \"red onion\")\n", "mix (d, \"pasta\", \"dressing\")\n", "\n", "act(d, \"refrigerate\", \"pasta\")\n", "\n", "r = get_root(d)\n", "\n", "display(r.dot())\n", "display(r.to_instruction().to_markdown())\n", "with open(\"curated_noodle_2.md\", \"w\") as f:\n", " f.write(r.to_instruction().to_markdown().data)\n", " f.close()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Mexican Rice\n", "https://www.homesicktexan.com/2008/06/with-beans-comes-rice.html" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "%3\n", "\n", "\n", "\n", "198\n", "\n", " \n", "mix\n", "node score: 0.9762\n", "\n", "\n", "\n", "181\n", "\n", " \n", "lime juice\n", "node score:1.0000\n", "\n", "\n", "\n", "198->181\n", "\n", "\n", "\n", "\n", "\n", "186\n", "\n", " \n", "chop\n", "node score: 1.0000\n", "\n", "\n", "\n", "198->186\n", "\n", "\n", "\n", "\n", "\n", "184\n", "\n", " \n", "salt\n", "node score:0.5000\n", "\n", "\n", "\n", "198->184\n", "\n", "\n", "\n", "\n", "\n", "194\n", "\n", " \n", "cook\n", "node score: 1.0000\n", "\n", "\n", "\n", "198->194\n", "\n", "\n", "\n", "\n", "\n", "189\n", "\n", " \n", "boil\n", "node score: 1.0000\n", "\n", "\n", "\n", "198->189\n", "\n", "\n", "\n", "\n", "\n", "182\n", "\n", " \n", "cilantro\n", "node score:1.0000\n", "\n", "\n", "\n", "186->182\n", "\n", "\n", "\n", "\n", "\n", "193\n", "\n", " \n", "mix\n", "node score: 1.0000\n", "\n", "\n", "\n", "194->193\n", "\n", "\n", "\n", "\n", "\n", "179\n", "\n", " \n", "garlic clove\n", "node score:0.5000\n", "\n", "\n", "\n", "193->179\n", "\n", "\n", "\n", "\n", "\n", "185\n", "\n", " \n", "dice\n", "node score: 1.0000\n", "\n", "\n", "\n", "193->185\n", "\n", "\n", "\n", "\n", "\n", "183\n", "\n", " \n", "ground cumin\n", "node score:1.0000\n", "\n", "\n", "\n", "193->183\n", "\n", "\n", "\n", "\n", "\n", "177\n", "\n", " \n", "olive oil\n", "node score:1.0000\n", "\n", "\n", "\n", "193->177\n", "\n", "\n", "\n", "\n", "\n", "180\n", "\n", " \n", "tomato\n", "node score:0.5000\n", "\n", "\n", "\n", "193->180\n", "\n", "\n", "\n", "\n", "\n", "178\n", "\n", " \n", "onion\n", "node score:1.0000\n", "\n", "\n", "\n", "185->178\n", "\n", "\n", "\n", "\n", "\n", "188\n", "\n", " \n", "mix\n", "node score: 1.0000\n", "\n", "\n", "\n", "189->188\n", "\n", "\n", "\n", "\n", "\n", "175\n", "\n", " \n", "chicken broth\n", "node score:1.0000\n", "\n", "\n", "\n", "188->175\n", "\n", "\n", "\n", "\n", "\n", "176\n", "\n", " \n", "butter\n", "node score:1.0000\n", "\n", "\n", "\n", "188->176\n", "\n", "\n", "\n", "\n", "\n", "174\n", "\n", " \n", "rice\n", "node score:1.0000\n", "\n", "\n", "\n", "188->174\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "**Ingredients**:\n", " * onion\n", " * cilantro\n", " * olive oil\n", " * lime juice\n", " * ground cumin\n", " * tomato\n", " * butter\n", " * rice\n", " * salt\n", " * garlic clove\n", " * chicken broth\n", "\n", "\n", "**Instructions**:\n", "\n", "| Step | Instruction |\n", "| ----:|:----------- |\n", "| 1 | dice onion and mix it with garlic clove, ground cumin, olive oil and tomato. Then cook it. |\n", "| 2 | Mix chicken broth, butter and rice. Then boil it. |\n", "| 3 | chop cilantro and mix it with lime juice and salt and mix it together with the results of step 1 and step 2. |\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "\n", "d = ingredient_nodes([\n", " \"rice\",\n", " \"chicken broth\",\n", " \"butter\",\n", " \"olive oil\",\n", " \"onion\",\n", " \"garlic clove\",\n", " \"tomato\",\n", " \"lime juice\",\n", " \"cilantro\",\n", " \"ground cumin\",\n", " \"salt\"\n", "])\n", "\n", "# actions\n", "\n", "act(d, \"dice\", \"onion\")\n", "act(d, \"chop\", \"cilantro\")\n", "\n", "mix (d, \"rice\", \"chicken broth\")\n", "mix (d, \"rice\", \"butter\")\n", "act (d, \"boil\", \"rice\")\n", "\n", "mix (d, \"olive oil\", \"onion\")\n", "mix (d, \"garlic clove\", \"onion\")\n", "mix (d, \"tomato\", \"onion\")\n", "mix (d, \"ground cumin\", \"onion\")\n", "act (d, \"cook\", \"onion\")\n", "\n", "mix (d, \"rice\", \"onion\")\n", "mix (d, \"lime juice\", \"onion\")\n", "mix (d, \"cilantro\", \"onion\")\n", "\n", "\n", "r = get_root(d)\n", "\n", "display(r.dot())\n", "display(r.to_instruction().to_markdown())\n", "with open(\"curated_rice_2.md\", \"w\") as f:\n", " f.write(r.to_instruction().to_markdown().data)\n", " f.close()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## One Pot Cheesy Taco Pasta\n", "http://www.motherthyme.com/2016/07/one-pot-cheesy-taco-pasta.html?utm_campaign=yummly" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "%3\n", "\n", "\n", "\n", "221\n", "\n", " \n", "mix\n", "node score: 0.7500\n", "\n", "\n", "\n", "205\n", "\n", " \n", "cheese\n", "node score:1.0000\n", "\n", "\n", "\n", "221->205\n", "\n", "\n", "\n", "\n", "\n", "210\n", "\n", " \n", "chop\n", "node score: 1.0000\n", "\n", "\n", "\n", "221->210\n", "\n", "\n", "\n", "\n", "\n", "209\n", "\n", " \n", "tortilla chip\n", "node score:0.5000\n", "\n", "\n", "\n", "221->209\n", "\n", "\n", "\n", "\n", "\n", "211\n", "\n", " \n", "chop\n", "node score: 1.0000\n", "\n", "\n", "\n", "221->211\n", "\n", "\n", "\n", "\n", "\n", "219\n", "\n", " \n", "boil\n", "node score: 0.8333\n", "\n", "\n", "\n", "221->219\n", "\n", "\n", "\n", "\n", "\n", "207\n", "\n", " \n", "avocado\n", "node score:0.5000\n", "\n", "\n", "\n", "221->207\n", "\n", "\n", "\n", "\n", "\n", "206\n", "\n", " \n", "tomato\n", "node score:1.0000\n", "\n", "\n", "\n", "210->206\n", "\n", "\n", "\n", "\n", "\n", "208\n", "\n", " \n", "cilantro\n", "node score:1.0000\n", "\n", "\n", "\n", "211->208\n", "\n", "\n", "\n", "\n", "\n", "218\n", "\n", " \n", "mix\n", "node score: 0.7500\n", "\n", "\n", "\n", "219->218\n", "\n", "\n", "\n", "\n", "\n", "203\n", "\n", " \n", "salsa\n", "node score:1.0000\n", "\n", "\n", "\n", "218->203\n", "\n", "\n", "\n", "\n", "\n", "215\n", "\n", " \n", "drain\n", "node score: 1.0000\n", "\n", "\n", "\n", "218->215\n", "\n", "\n", "\n", "\n", "\n", "202\n", "\n", " \n", "water\n", "node score:1.0000\n", "\n", "\n", "\n", "218->202\n", "\n", "\n", "\n", "\n", "\n", "204\n", "\n", " \n", "pasta\n", "node score:1.0000\n", "\n", "\n", "\n", "218->204\n", "\n", "\n", "\n", "\n", "\n", "214\n", "\n", " \n", "cook\n", "node score: 1.0000\n", "\n", "\n", "\n", "215->214\n", "\n", "\n", "\n", "\n", "\n", "213\n", "\n", " \n", "mix\n", "node score: 1.0000\n", "\n", "\n", "\n", "214->213\n", "\n", "\n", "\n", "\n", "\n", "201\n", "\n", " \n", "black pepper\n", "node score:1.0000\n", "\n", "\n", "\n", "213->201\n", "\n", "\n", "\n", "\n", "\n", "200\n", "\n", " \n", "salt\n", "node score:1.0000\n", "\n", "\n", "\n", "213->200\n", "\n", "\n", "\n", "\n", "\n", "199\n", "\n", " \n", "ground beef\n", "node score:1.0000\n", "\n", "\n", "\n", "213->199\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "**Ingredients**:\n", " * tortilla chip\n", " * water\n", " * salsa\n", " * cilantro\n", " * tomato\n", " * cheese\n", " * black pepper\n", " * salt\n", " * pasta\n", " * ground beef\n", " * avocado\n", "\n", "\n", "**Instructions**:\n", "\n", "| Step | Instruction |\n", "| ----:|:----------- |\n", "| 1 | Mix black pepper, salt and ground beef. Then cook it. |\n", "| 2 | drain the result of step 1 |\n", "| 3 | Mix salsa, water and pasta and mix it together with the results of step 2. Then boil it. |\n", "| 4 | chop tomato, chop cilantro and mix it with cheese, tortilla chip and avocado and mix it together with the results of step 3. |\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "\n", "d = ingredient_nodes([\n", " \"ground beef\",\n", " \"salt\",\n", " \"black pepper\",\n", " \"water\",\n", " \"salsa\",\n", " \"pasta\",\n", " \"cheese\",\n", " \"tomato\",\n", " \"avocado\",\n", " \"cilantro\",\n", " \"tortilla chip\"\n", "])\n", "\n", "# actions\n", "\n", "act (d, \"chop\", \"tomato\")\n", "act (d, \"chop\", \"cilantro\")\n", "\n", "mix (d, \"ground beef\", \"salt\")\n", "mix (d, \"ground beef\", \"black pepper\")\n", "act (d, \"cook\", \"ground beef\")\n", "act (d, \"drain\", \"ground beef\")\n", "\n", "mix (d, \"ground beef\", \"salsa\")\n", "mix (d, \"ground beef\", \"water\")\n", "mix (d, \"ground beef\", \"pasta\")\n", "\n", "act(d, \"boil\", \"pasta\")\n", "\n", "mix (d, \"cheese\", \"pasta\")\n", "\n", "\n", "r = get_root(d)\n", "\n", "display(r.dot())\n", "display(r.to_instruction().to_markdown())\n", "with open(\"curated_noodle_3.md\", \"w\") as f:\n", " f.write(r.to_instruction().to_markdown().data)\n", " f.close()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Spanish Rice and Beans\n", "https://www.yummly.com/recipe/Spanish-Rice-and-Beans-814#directions" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "%3\n", "\n", "\n", "\n", "238\n", "\n", " \n", "mix\n", "node score: 0.6364\n", "\n", "\n", "\n", "229\n", "\n", " \n", "drain\n", "node score: 1.0000\n", "\n", "\n", "\n", "238->229\n", "\n", "\n", "\n", "\n", "\n", "237\n", "\n", " \n", "cook\n", "node score: 1.0000\n", "\n", "\n", "\n", "238->237\n", "\n", "\n", "\n", "\n", "\n", "227\n", "\n", " \n", "salsa\n", "node score:0.5000\n", "\n", "\n", "\n", "238->227\n", "\n", "\n", "\n", "\n", "\n", "228\n", "\n", " \n", "kidney bean\n", "node score:0.0000\n", "\n", "\n", "\n", "229->228\n", "\n", "\n", "\n", "\n", "\n", "236\n", "\n", " \n", "mix\n", "node score: 0.5556\n", "\n", "\n", "\n", "237->236\n", "\n", "\n", "\n", "\n", "\n", "226\n", "\n", " \n", "vegetable broth\n", "node score:1.0000\n", "\n", "\n", "\n", "236->226\n", "\n", "\n", "\n", "\n", "\n", "232\n", "\n", " \n", "heat\n", "node score: 1.0000\n", "\n", "\n", "\n", "236->232\n", "\n", "\n", "\n", "\n", "\n", "225\n", "\n", " \n", "garlic clove\n", "node score:0.5000\n", "\n", "\n", "\n", "236->225\n", "\n", "\n", "\n", "\n", "\n", "230\n", "\n", " \n", "chop\n", "node score: 0.0000\n", "\n", "\n", "\n", "236->230\n", "\n", "\n", "\n", "\n", "\n", "231\n", "\n", " \n", "mix\n", "node score: 1.0000\n", "\n", "\n", "\n", "232->231\n", "\n", "\n", "\n", "\n", "\n", "222\n", "\n", " \n", "oil\n", "node score:1.0000\n", "\n", "\n", "\n", "231->222\n", "\n", "\n", "\n", "\n", "\n", "223\n", "\n", " \n", "rice\n", "node score:1.0000\n", "\n", "\n", "\n", "231->223\n", "\n", "\n", "\n", "\n", "\n", "224\n", "\n", " \n", "white onion\n", "node score:1.0000\n", "\n", "\n", "\n", "230->224\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "**Ingredients**:\n", " * white onion\n", " * salsa\n", " * rice\n", " * vegetable broth\n", " * kidney bean\n", " * garlic clove\n", " * oil\n", "\n", "\n", "**Instructions**:\n", "\n", "| Step | Instruction |\n", "| ----:|:----------- |\n", "| 1 | Mix oil and rice. Then heat it. |\n", "| 2 | chop white onion and mix it with vegetable broth and garlic clove and mix it together with the results of step 1. Then cook it. |\n", "| 3 | drain kidney bean and mix it with salsa and mix it together with the results of step 2. |\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "\n", "d = ingredient_nodes([\n", " \"oil\",\n", " \"rice\",\n", " \"white onion\",\n", " \"garlic clove\",\n", " \"vegetable broth\",\n", " \"salsa\",\n", " \"kidney bean\"\n", "])\n", "\n", "# actions\n", "act (d, \"drain\", \"kidney bean\")\n", "act (d, \"chop\", \"white onion\")\n", "\n", "mix (d, \"rice\", \"oil\")\n", "act(d, \"heat\", \"rice\")\n", "\n", "mix(d, \"rice\", \"white onion\")\n", "mix (d, \"rice\", \"garlic clove\")\n", "mix (d, \"rice\", \"garlic clove\")\n", "\n", "mix (d, \"vegetable broth\", \"rice\")\n", "\n", "act (d, \"cook\", \"rice\")\n", "\n", "r = get_root(d)\n", "\n", "display(r.dot())\n", "display(r.to_instruction().to_markdown())\n", "with open(\"curated_rice_3.md\", \"w\") as f:\n", " f.write(r.to_instruction().to_markdown().data)\n", " f.close()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Vegan Curried Rice\n", "https://www.yummly.com/recipe/Vegan-Curried-Rice-2319743#directions" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "%3\n", "\n", "\n", "\n", "260\n", "\n", " \n", "mix\n", "node score: 0.9167\n", "\n", "\n", "\n", "245\n", "\n", " \n", "pepper\n", "node score:0.5000\n", "\n", "\n", "\n", "260->245\n", "\n", "\n", "\n", "\n", "\n", "251\n", "\n", " \n", "cook\n", "node score: 1.0000\n", "\n", "\n", "\n", "260->251\n", "\n", "\n", "\n", "\n", "\n", "244\n", "\n", " \n", "salt\n", "node score:0.5000\n", "\n", "\n", "\n", "260->244\n", "\n", "\n", "\n", "\n", "\n", "259\n", "\n", " \n", "fry\n", "node score: 0.7143\n", "\n", "\n", "\n", "260->259\n", "\n", "\n", "\n", "\n", "\n", "247\n", "\n", " \n", "rice\n", "node score:1.0000\n", "\n", "\n", "\n", "251->247\n", "\n", "\n", "\n", "\n", "\n", "258\n", "\n", " \n", "mix\n", "node score: 0.9048\n", "\n", "\n", "\n", "259->258\n", "\n", "\n", "\n", "\n", "\n", "241\n", "\n", " \n", "garlic clove\n", "node score:0.5000\n", "\n", "\n", "\n", "258->241\n", "\n", "\n", "\n", "\n", "\n", "239\n", "\n", " \n", "olive oil\n", "node score:1.0000\n", "\n", "\n", "\n", "258->239\n", "\n", "\n", "\n", "\n", "\n", "249\n", "\n", " \n", "chop\n", "node score: 1.0000\n", "\n", "\n", "\n", "258->249\n", "\n", "\n", "\n", "\n", "\n", "240\n", "\n", " \n", "ginger\n", "node score:1.0000\n", "\n", "\n", "\n", "258->240\n", "\n", "\n", "\n", "\n", "\n", "250\n", "\n", " \n", "chop\n", "node score: 1.0000\n", "\n", "\n", "\n", "258->250\n", "\n", "\n", "\n", "\n", "\n", "246\n", "\n", " \n", "water\n", "node score:1.0000\n", "\n", "\n", "\n", "258->246\n", "\n", "\n", "\n", "\n", "\n", "252\n", "\n", " \n", "chop\n", "node score: 1.0000\n", "\n", "\n", "\n", "258->252\n", "\n", "\n", "\n", "\n", "\n", "242\n", "\n", " \n", "carrot\n", "node score:1.0000\n", "\n", "\n", "\n", "249->242\n", "\n", "\n", "\n", "\n", "\n", "243\n", "\n", " \n", "broccoli\n", "node score:1.0000\n", "\n", "\n", "\n", "250->243\n", "\n", "\n", "\n", "\n", "\n", "248\n", "\n", " \n", "spinach\n", "node score:1.0000\n", "\n", "\n", "\n", "252->248\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "**Ingredients**:\n", " * carrot\n", " * water\n", " * olive oil\n", " * ginger\n", " * pepper\n", " * rice\n", " * broccoli\n", " * salt\n", " * garlic clove\n", " * spinach\n", "\n", "\n", "**Instructions**:\n", "\n", "| Step | Instruction |\n", "| ----:|:----------- |\n", "| 1 | chop carrot, chop broccoli, chop spinach and mix it with garlic clove, olive oil, ginger and water. Then fry it. |\n", "| 2 | cook rice and mix it with pepper and salt and mix it together with the results of step 1. |\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "\n", "d = ingredient_nodes([\n", " \"olive oil\",\n", " \"ginger\",\n", " \"garlic clove\",\n", " \"carrot\",\n", " \"broccoli\",\n", " \"salt\",\n", " \"pepper\",\n", " \"water\",\n", " \"rice\",\n", " \"spinach\"\n", "])\n", "\n", "# actions\n", "act(d, \"chop\", \"carrot\")\n", "act(d, \"chop\", \"broccoli\")\n", "act(d, \"cook\",\"rice\")\n", "act(d, \"chop\", \"spinach\")\n", "\n", "mix(d, \"olive oil\", \"ginger\")\n", "mix(d, \"olive oil\", \"garlic clove\")\n", "mix(d, \"olive oil\", \"carrot\")\n", "mix(d, \"olive oil\", \"broccoli\")\n", "mix(d, \"olive oil\", \"water\")\n", "mix(d, \"olive oil\", \"spinach\")\n", "\n", "act(d, \"fry\", \"olive oil\")\n", "\n", "r = get_root(d)\n", "\n", "display(r.dot())\n", "display(r.to_instruction().to_markdown())\n", "with open(\"curated_rice_4.md\", \"w\") as f:\n", " f.write(r.to_instruction().to_markdown().data)\n", " f.close()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Vegetable Ramen Pad Thai\n", "https://www.yummly.com/recipe/Vegetable-Ramen-Pad-Thai-2067502#directions" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "**Ingredients**:\n", " * vegetable\n", " * water\n", " * peanut butter\n", " * teriyaki sauce\n", " * vegetable oil\n", " * ramen noodle\n", " * sriacha sauce\n", "\n", "\n", "**Instructions**:\n", "\n", "| Step | Instruction |\n", "| ----:|:----------- |\n", "| 1 | heat water and mix it with ramen noodle. Then cook it. |\n", "| 2 | drain the result of step 1 |\n", "| 3 | Mix vegetable and vegetable oil. Then cook it. |\n", "| 4 | Mix peanut butter, teriyaki sauce and sriacha sauce and mix it together with the results of step 2 and step 3. |\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "\n", "d = ingredient_nodes([\n", " \"ramen noodle\",\n", " \"vegetable oil\",\n", " \"vegetable\",\n", " \"teriyaki sauce\",\n", " \"water\",\n", " \"peanut butter\",\n", " \"sriacha sauce\"\n", "])\n", "\n", "# actions\n", "act(d, \"heat\", \"water\")\n", "mix(d, \"ramen noodle\", \"water\")\n", "act(d, \"cook\", \"ramen noodle\")\n", "act(d, \"drain\", \"ramen noodle\")\n", "\n", "mix (d, \"vegetable oil\", \"vegetable\")\n", "act(d, \"cook\", \"vegetable\")\n", "\n", "mix (d, \"vegetable\", \"ramen noodle\")\n", "\n", "\n", "r = get_root(d)\n", "\n", "#display(r.dot()) # ← cannot plot tree because some ingredients are unknown!\n", "display(r.to_instruction().to_markdown())\n", "with open(\"curated_noodle_4.md\", \"w\") as f:\n", " f.write(r.to_instruction().to_markdown().data)\n", " f.close()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.5" } }, "nbformat": 4, "nbformat_minor": 4 }