some experiments
This commit is contained in:
parent
ff8fe80b01
commit
ad343e6e49
1012
1M_word2vec.ipynb
Normal file
1012
1M_word2vec.ipynb
Normal file
File diff suppressed because it is too large
Load Diff
120
Yummly_word2vec.ipynb
Normal file
120
Yummly_word2vec.ipynb
Normal file
@ -0,0 +1,120 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import numpy as np\n",
|
||||
"import json \n",
|
||||
"from pprint import pprint\n",
|
||||
"from gensim.test.utils import common_texts, get_tmpfile\n",
|
||||
"from gensim.models import Word2Vec\n",
|
||||
"\n",
|
||||
"from json_buffered_reader import JSON_buffered_reader as JSON_br\n",
|
||||
"\n",
|
||||
"import settings"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"* reading in all ingredients with json stream:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"buffered_reader = JSON_br(settings.yummly_train)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"ingredient_sets = []"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for recipe in buffered_reader:\n",
|
||||
" ingredient_sets.append(recipe['ingredients'])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"* training a word2vec approach on the ingredient set"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"model = Word2Vec(ingredient_sets, size=100, window=5, min_count=1, workers=4)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 21,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"0.46477914"
|
||||
]
|
||||
},
|
||||
"execution_count": 21,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"model.wv.similarity('eggs', 'pepper')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"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.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
652
cooking_ingredients.py
Normal file
652
cooking_ingredients.py
Normal file
@ -0,0 +1,652 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
ingredients = [
|
||||
"salt",
|
||||
"garlic",
|
||||
"onions",
|
||||
"olive oil",
|
||||
"water",
|
||||
"sugar",
|
||||
"ground black pepper",
|
||||
"garlic cloves",
|
||||
"butter",
|
||||
"pepper",
|
||||
"all-purpose flour",
|
||||
"vegetable oil",
|
||||
"eggs",
|
||||
"green onions",
|
||||
"kosher salt",
|
||||
"black pepper",
|
||||
"soy sauce",
|
||||
"large eggs",
|
||||
"unsalted butter",
|
||||
"tomatoes",
|
||||
"ground cumin",
|
||||
"carrots",
|
||||
"purple onion",
|
||||
"milk",
|
||||
"extra-virgin olive oil",
|
||||
"red bell pepper",
|
||||
"oil",
|
||||
"chili powder",
|
||||
"jalapeno chilies",
|
||||
"baking powder",
|
||||
"grated parmesan cheese",
|
||||
"chopped cilantro fresh",
|
||||
"corn starch",
|
||||
"chicken broth",
|
||||
"sesame oil",
|
||||
"dried oregano",
|
||||
"cayenne pepper",
|
||||
"scallions",
|
||||
"diced tomatoes",
|
||||
"flour",
|
||||
"lemon juice",
|
||||
"sour cream",
|
||||
"garlic powder",
|
||||
"fresh lemon juice",
|
||||
"lime",
|
||||
"vanilla extract",
|
||||
"fresh parsley",
|
||||
"ginger",
|
||||
"minced garlic",
|
||||
"ground cinnamon",
|
||||
"cooking spray",
|
||||
"fish sauce",
|
||||
"shallots",
|
||||
"fresh ginger",
|
||||
"fresh lime juice",
|
||||
"chopped onion",
|
||||
"brown sugar",
|
||||
"flat leaf parsley",
|
||||
"dry white wine",
|
||||
"honey",
|
||||
"yellow onion",
|
||||
"green bell pepper",
|
||||
"avocado",
|
||||
"canola oil",
|
||||
"lemon",
|
||||
"paprika",
|
||||
"white sugar",
|
||||
"cilantro",
|
||||
"salsa",
|
||||
"rice vinegar",
|
||||
"tomato paste",
|
||||
"cilantro leaves",
|
||||
"whole milk",
|
||||
"boneless skinless chicken breasts",
|
||||
"bay leaves",
|
||||
"heavy cream",
|
||||
"buttermilk",
|
||||
"cumin",
|
||||
"chicken stock",
|
||||
"lime juice",
|
||||
"plum tomatoes",
|
||||
"large garlic cloves",
|
||||
"shrimp",
|
||||
"granulated sugar",
|
||||
"potatoes",
|
||||
"corn tortillas",
|
||||
"fresh basil",
|
||||
"chicken",
|
||||
"sea salt",
|
||||
"freshly ground pepper",
|
||||
"baking soda",
|
||||
"celery",
|
||||
"flour tortillas",
|
||||
"ground turmeric",
|
||||
"coconut milk",
|
||||
"black beans",
|
||||
"ground beef",
|
||||
"cumin seed",
|
||||
"fresh cilantro",
|
||||
"garam masala",
|
||||
"tomato sauce",
|
||||
"dried thyme",
|
||||
"chicken breasts",
|
||||
"crushed red pepper",
|
||||
"sesame seeds",
|
||||
"bay leaf",
|
||||
"zucchini",
|
||||
"ground nutmeg",
|
||||
"green chilies",
|
||||
"cucumber",
|
||||
"worcestershire sauce",
|
||||
"white onion",
|
||||
"red pepper flakes",
|
||||
"ground coriander",
|
||||
"mayonaise",
|
||||
"curry powder",
|
||||
"chopped cilantro",
|
||||
"hot sauce",
|
||||
"tumeric",
|
||||
"mushrooms",
|
||||
"shredded cheddar cheese",
|
||||
"red wine vinegar",
|
||||
"cinnamon",
|
||||
"ground ginger",
|
||||
"cinnamon sticks",
|
||||
"whipping cream",
|
||||
"bacon",
|
||||
"red chili peppers",
|
||||
"warm water",
|
||||
"peanut oil",
|
||||
"coarse salt",
|
||||
"lime wedges",
|
||||
"peeled fresh ginger",
|
||||
"boneless skinless chicken breast halves",
|
||||
"celery ribs",
|
||||
"ground red pepper",
|
||||
"white vinegar",
|
||||
"balsamic vinegar",
|
||||
"large egg yolks",
|
||||
"onion powder",
|
||||
"ground pork",
|
||||
"cream cheese",
|
||||
"cooking oil",
|
||||
"fresh basil leaves",
|
||||
"chopped celery",
|
||||
"oyster sauce",
|
||||
"parmesan cheese",
|
||||
"black peppercorns",
|
||||
"coriander",
|
||||
"dried basil",
|
||||
"dijon mustard",
|
||||
"capers",
|
||||
"crushed red pepper flakes",
|
||||
"leeks",
|
||||
"cold water",
|
||||
"mirin",
|
||||
"clove",
|
||||
"beansprouts",
|
||||
"egg yolks",
|
||||
"large egg whites",
|
||||
"rice",
|
||||
"mozzarella cheese",
|
||||
"cracked black pepper",
|
||||
"raisins",
|
||||
"sweet potatoes",
|
||||
"powdered sugar",
|
||||
"cayenne",
|
||||
"red pepper",
|
||||
"large shrimp",
|
||||
"hoisin sauce",
|
||||
"sliced green onions",
|
||||
"finely chopped onion",
|
||||
"light brown sugar",
|
||||
"medium shrimp",
|
||||
"ketchup",
|
||||
"oregano",
|
||||
"cheese",
|
||||
"fat free less sodium chicken broth",
|
||||
"cornmeal",
|
||||
"sauce",
|
||||
"cheddar cheese",
|
||||
"egg whites",
|
||||
"eggplant",
|
||||
"ground allspice",
|
||||
"low sodium soy sauce",
|
||||
"bell pepper",
|
||||
"spinach",
|
||||
"cherry tomatoes",
|
||||
"beef broth",
|
||||
"fresh oregano",
|
||||
"fresh mint",
|
||||
"crushed tomatoes",
|
||||
"confectioners sugar",
|
||||
"orange",
|
||||
"shredded mozzarella cheese",
|
||||
"spring onions",
|
||||
"chopped garlic",
|
||||
"low sodium chicken broth",
|
||||
"peanuts",
|
||||
"ground pepper",
|
||||
"ground cloves",
|
||||
"italian seasoning",
|
||||
"lemongrass",
|
||||
"spaghetti",
|
||||
"boiling water",
|
||||
"cooked rice",
|
||||
"cabbage",
|
||||
"feta cheese crumbles",
|
||||
"fresh rosemary",
|
||||
"low salt chicken broth",
|
||||
"long-grain rice",
|
||||
"vegetable broth",
|
||||
"white pepper",
|
||||
"active dry yeast",
|
||||
"white wine vinegar",
|
||||
"dark brown sugar",
|
||||
"fennel seeds",
|
||||
"hot pepper sauce",
|
||||
"sake",
|
||||
"chopped fresh thyme",
|
||||
"parsley",
|
||||
"cajun seasoning",
|
||||
"yellow corn meal",
|
||||
"toasted sesame oil",
|
||||
"coriander seeds",
|
||||
"chickpeas",
|
||||
"thyme",
|
||||
"half & half",
|
||||
"light soy sauce",
|
||||
"chopped parsley",
|
||||
"Sriracha",
|
||||
"white wine",
|
||||
"pinenuts",
|
||||
"plain yogurt",
|
||||
"mustard seeds",
|
||||
"shiitake",
|
||||
"chicken thighs",
|
||||
"sweet onion",
|
||||
"vanilla",
|
||||
"pork",
|
||||
"vinegar",
|
||||
"ground white pepper",
|
||||
"shredded Monterey Jack cheese",
|
||||
"frozen peas",
|
||||
"cider vinegar",
|
||||
"basmati rice",
|
||||
"boneless chicken skinless thigh",
|
||||
"hot water",
|
||||
"green pepper",
|
||||
"dark soy sauce",
|
||||
"chiles",
|
||||
"corn",
|
||||
"tomatillos",
|
||||
"fresh ginger root",
|
||||
"fresh thyme",
|
||||
"radishes",
|
||||
"chopped pecans",
|
||||
"saffron threads",
|
||||
"parmigiano reggiano cheese",
|
||||
"smoked paprika",
|
||||
"chopped fresh mint",
|
||||
"juice",
|
||||
"green chile",
|
||||
"lean ground beef",
|
||||
"grated lemon zest",
|
||||
"green beans",
|
||||
"pasta",
|
||||
"enchilada sauce",
|
||||
"prosciutto",
|
||||
"arborio rice",
|
||||
"basil leaves",
|
||||
"ricotta cheese",
|
||||
"dry red wine",
|
||||
"ghee",
|
||||
"cooked chicken",
|
||||
"bread crumbs",
|
||||
"chopped tomatoes",
|
||||
"fresh mushrooms",
|
||||
"dry sherry",
|
||||
"beef",
|
||||
"serrano chile",
|
||||
"tortilla chips",
|
||||
"russet potatoes",
|
||||
"melted butter",
|
||||
"chile pepper",
|
||||
"toasted sesame seeds",
|
||||
"fresh parmesan cheese",
|
||||
"yellow bell pepper",
|
||||
"orange juice",
|
||||
"creole seasoning",
|
||||
"basil",
|
||||
"baby spinach",
|
||||
"chopped green bell pepper",
|
||||
"dry bread crumbs",
|
||||
"taco seasoning",
|
||||
"vegetable oil cooking spray",
|
||||
"andouille sausage",
|
||||
"Shaoxing wine",
|
||||
"white rice",
|
||||
"baguette",
|
||||
"okra",
|
||||
"mango",
|
||||
"apple cider vinegar",
|
||||
"long grain white rice",
|
||||
"romaine lettuce",
|
||||
"peaches",
|
||||
"yukon gold potatoes",
|
||||
"chinese five-spice powder",
|
||||
"pasta sauce",
|
||||
"golden raisins",
|
||||
"roasted red peppers",
|
||||
"refried beans",
|
||||
"sweetened condensed milk",
|
||||
"unsweetened cocoa powder",
|
||||
"linguine",
|
||||
"fine sea salt",
|
||||
"flank steak",
|
||||
"fresh coriander",
|
||||
"grape tomatoes",
|
||||
"bananas",
|
||||
"lemon zest",
|
||||
"cilantro sprigs",
|
||||
"corn kernels",
|
||||
"feta cheese",
|
||||
"rice noodles",
|
||||
"mint leaves",
|
||||
"thai chile",
|
||||
"chopped fresh chives",
|
||||
"nutmeg",
|
||||
"coriander powder",
|
||||
"fresh dill",
|
||||
"marinara sauce",
|
||||
"red wine",
|
||||
"sliced mushrooms",
|
||||
"heavy whipping cream",
|
||||
"garlic paste",
|
||||
"lemon wedge",
|
||||
"yoghurt",
|
||||
"roma tomatoes",
|
||||
"garlic salt",
|
||||
"ham",
|
||||
"greek yogurt",
|
||||
"coconut oil",
|
||||
"napa cabbage",
|
||||
"frozen chopped spinach",
|
||||
"self rising flour",
|
||||
"black olives",
|
||||
"firm tofu",
|
||||
"diced onions",
|
||||
"pork tenderloin",
|
||||
"grated nutmeg",
|
||||
"broccoli",
|
||||
"noodles",
|
||||
"cream",
|
||||
"star anise",
|
||||
"beer",
|
||||
"ground cardamom",
|
||||
"part-skim mozzarella cheese",
|
||||
"green peas",
|
||||
"kalamata",
|
||||
"monterey jack",
|
||||
"evaporated milk",
|
||||
"fresh thyme leaves",
|
||||
"cashew nuts",
|
||||
"vegetables",
|
||||
"curry leaves",
|
||||
"shortening",
|
||||
"salt and ground black pepper",
|
||||
"saffron",
|
||||
"strawberries",
|
||||
"thyme sprigs",
|
||||
"margarine",
|
||||
"tortillas",
|
||||
"almonds",
|
||||
"cauliflower",
|
||||
"bacon slices",
|
||||
"red chili powder",
|
||||
"green olives",
|
||||
"green cabbage",
|
||||
"rice wine",
|
||||
"chipotles in adobo",
|
||||
"red potato",
|
||||
"fresh spinach",
|
||||
"tomato purée",
|
||||
"french bread",
|
||||
"asparagus",
|
||||
"cannellini beans",
|
||||
"minced ginger",
|
||||
"water chestnuts",
|
||||
"chili",
|
||||
"snow peas",
|
||||
"fennel bulb",
|
||||
"chives",
|
||||
"black-eyed peas",
|
||||
"dark sesame oil",
|
||||
"bread",
|
||||
"lasagna noodles",
|
||||
"couscous",
|
||||
"bourbon whiskey",
|
||||
"frozen corn",
|
||||
"broccoli florets",
|
||||
"anchovy fillets",
|
||||
"baking potatoes",
|
||||
"minced onion",
|
||||
"cake flour",
|
||||
"pitted kalamata olives",
|
||||
"guacamole",
|
||||
"fresh orange juice",
|
||||
"all purpose unbleached flour",
|
||||
"sausages",
|
||||
"Mexican cheese blend",
|
||||
"reduced sodium chicken broth",
|
||||
"lettuce leaves",
|
||||
"1% low-fat milk",
|
||||
"arugula",
|
||||
"butternut squash",
|
||||
"unsweetened coconut milk",
|
||||
"brown rice",
|
||||
"spices",
|
||||
"penne pasta",
|
||||
"Tabasco Pepper Sauce",
|
||||
"apples",
|
||||
"peas",
|
||||
"ice water",
|
||||
"vanilla beans",
|
||||
"button mushrooms",
|
||||
"pancetta",
|
||||
"sun-dried tomatoes",
|
||||
"grits",
|
||||
"taco seasoning mix",
|
||||
"bread flour",
|
||||
"vegetable stock",
|
||||
"lettuce",
|
||||
"whole wheat flour",
|
||||
"ground turkey",
|
||||
"goat cheese",
|
||||
"mussels",
|
||||
"dried parsley",
|
||||
"pinto beans",
|
||||
"shredded carrots",
|
||||
"slivered almonds",
|
||||
"pure vanilla extract",
|
||||
"thai basil",
|
||||
"collard greens",
|
||||
"beef stock",
|
||||
"shredded sharp cheddar cheese",
|
||||
"light corn syrup",
|
||||
"light coconut milk",
|
||||
"english cucumber",
|
||||
"sharp cheddar cheese",
|
||||
"provolone cheese",
|
||||
"coconut",
|
||||
"grated lemon peel",
|
||||
"hot red pepper flakes",
|
||||
"dried rosemary",
|
||||
"shredded lettuce",
|
||||
"fettucine",
|
||||
"sliced almonds",
|
||||
"stewed tomatoes",
|
||||
"lard",
|
||||
"almond extract",
|
||||
"dry mustard",
|
||||
"brandy",
|
||||
"salmon fillets",
|
||||
"sliced black olives",
|
||||
"chili sauce",
|
||||
"iceberg lettuce",
|
||||
"kale",
|
||||
"semisweet chocolate",
|
||||
"bread crumb fresh",
|
||||
"chili flakes",
|
||||
"plain flour",
|
||||
"poblano chiles",
|
||||
"pecorino romano cheese",
|
||||
"bamboo shoots",
|
||||
"kidney beans",
|
||||
"olives",
|
||||
"fresh tomatoes",
|
||||
"garbanzo beans",
|
||||
"bittersweet chocolate",
|
||||
"cooked white rice",
|
||||
"cream of tartar",
|
||||
"orange zest",
|
||||
"pecans",
|
||||
"shredded cheese",
|
||||
"mascarpone",
|
||||
"daikon",
|
||||
"mint",
|
||||
"cardamom pods",
|
||||
"cotija",
|
||||
"wonton wrappers",
|
||||
"chipotle chile",
|
||||
"szechwan peppercorns",
|
||||
"grated orange",
|
||||
"seasoning",
|
||||
"chicken legs",
|
||||
"extra firm tofu",
|
||||
"peppercorns",
|
||||
"polenta",
|
||||
"vegetable shortening",
|
||||
"crème fraîche",
|
||||
"asian fish sauce",
|
||||
"meat",
|
||||
"jasmine rice",
|
||||
"italian sausage",
|
||||
"chicken breast halves",
|
||||
"parsley sprigs",
|
||||
"lime zest",
|
||||
"artichoke hearts",
|
||||
"fresh tarragon",
|
||||
"mint sprigs",
|
||||
"sherry vinegar",
|
||||
"panko breadcrumbs",
|
||||
"ice cubes",
|
||||
"garlic chili sauce",
|
||||
"Gochujang base",
|
||||
"seasoning salt",
|
||||
"roasted peanuts",
|
||||
"red cabbage",
|
||||
"chinese rice wine",
|
||||
"salsa verde",
|
||||
"cream cheese, soften",
|
||||
"fresh parsley leaves",
|
||||
"Italian parsley leaves",
|
||||
"ground cayenne pepper",
|
||||
"smoked sausage",
|
||||
"reduced sodium soy sauce",
|
||||
"whole peeled tomatoes",
|
||||
"ancho chile pepper",
|
||||
"white bread",
|
||||
"pimentos",
|
||||
"tequila",
|
||||
"chicken wings",
|
||||
"tofu",
|
||||
"boneless chicken breast",
|
||||
"chopped walnuts",
|
||||
"kaffir lime leaves",
|
||||
"sweet paprika",
|
||||
"caster sugar",
|
||||
"cremini mushrooms",
|
||||
"fat free milk",
|
||||
"pineapple",
|
||||
"ground lamb",
|
||||
"pork shoulder",
|
||||
"dashi",
|
||||
"pesto",
|
||||
"non-fat sour cream",
|
||||
"dried apricot",
|
||||
"queso fresco",
|
||||
"chillies",
|
||||
"seeds",
|
||||
"allspice",
|
||||
"rice flour",
|
||||
"chili pepper",
|
||||
"red curry paste",
|
||||
"ginger root",
|
||||
"marsala wine",
|
||||
"dry yeast",
|
||||
"bok choy",
|
||||
"chopped fresh sage",
|
||||
"jack cheese",
|
||||
"pork belly",
|
||||
"gingerroot",
|
||||
"barbecue sauce",
|
||||
"palm sugar",
|
||||
"vidalia onion",
|
||||
"dried shiitake mushrooms",
|
||||
"sweet chili sauce",
|
||||
"crawfish",
|
||||
"frozen corn kernels",
|
||||
"chili paste",
|
||||
"part-skim ricotta cheese",
|
||||
"granny smith apples",
|
||||
"Italian bread",
|
||||
"peanut butter",
|
||||
"sage leaves",
|
||||
"pizza doughs",
|
||||
"greek style plain yogurt",
|
||||
"turnips",
|
||||
"Thai red curry paste",
|
||||
"creamy peanut butter",
|
||||
"mustard",
|
||||
"unflavored gelatin",
|
||||
"chile powder",
|
||||
"quinoa",
|
||||
"green tomatoes",
|
||||
"corn oil",
|
||||
"dark rum",
|
||||
"ginger paste",
|
||||
"pork sausages",
|
||||
"lump crab meat",
|
||||
"penne",
|
||||
"reduced-fat sour cream",
|
||||
"beets",
|
||||
"yellow squash",
|
||||
"sea scallops",
|
||||
"red lentils",
|
||||
"walnuts",
|
||||
"black mustard seeds",
|
||||
"fresh chives",
|
||||
"poblano peppers",
|
||||
"rosemary",
|
||||
"ice",
|
||||
"crushed garlic",
|
||||
"frozen pastry puff sheets",
|
||||
"kimchi",
|
||||
"Thai fish sauce",
|
||||
"rosemary sprigs",
|
||||
"diced green chilies",
|
||||
"shredded cabbage",
|
||||
"yeast",
|
||||
"paneer",
|
||||
"cooked chicken breasts",
|
||||
"chili oil",
|
||||
"watercress",
|
||||
"catfish fillets",
|
||||
"cardamom",
|
||||
"romano cheese",
|
||||
"whipped cream",
|
||||
"freshly grated parmesan",
|
||||
"maple syrup",
|
||||
"whole kernel corn, drain",
|
||||
"fontina cheese",
|
||||
"dough",
|
||||
"swiss chard",
|
||||
"bow-tie pasta",
|
||||
"molasses",
|
||||
"chorizo sausage",
|
||||
"hard-boiled egg",
|
||||
"marjoram",
|
||||
"curry paste",
|
||||
"sausage casings",
|
||||
"ground chicken",
|
||||
"masa harina",
|
||||
"serrano peppers",
|
||||
"ricotta",
|
||||
"sugar pea",
|
||||
"cornflour",
|
||||
"dried red chile peppers",
|
||||
"pecan halves",
|
||||
"sliced carrots",
|
||||
"baby spinach leaves",
|
||||
"cottage cheese",
|
||||
"dried porcini mushrooms",
|
||||
"hazelnuts",
|
||||
"lemon grass",
|
||||
"beans",
|
||||
"Mexican oregano"
|
||||
]
|
402
cooking_vocab.py
Normal file
402
cooking_vocab.py
Normal file
@ -0,0 +1,402 @@
|
||||
# old source: https://www.enchantedlearning.com/wordlist/cooking.shtml
|
||||
old_cooking_verbs = [
|
||||
'aerate',
|
||||
'age',
|
||||
'bake',
|
||||
'barbecue',
|
||||
'baste',
|
||||
'batter',
|
||||
'beat',
|
||||
'bind',
|
||||
'blacken',
|
||||
'blanch',
|
||||
'blend',
|
||||
'boil',
|
||||
'bone',
|
||||
'braise',
|
||||
'bread',
|
||||
'brew',
|
||||
'broil',
|
||||
'brown',
|
||||
'brush',
|
||||
'burn',
|
||||
'butterfly',
|
||||
'can',
|
||||
'caramelize',
|
||||
'char',
|
||||
'char-broil',
|
||||
'chill',
|
||||
'chop',
|
||||
'chunk',
|
||||
'churn',
|
||||
'clarify',
|
||||
'coddle',
|
||||
'combine',
|
||||
'congeal',
|
||||
'cool',
|
||||
'core',
|
||||
'cream',
|
||||
'cured',
|
||||
'cut',
|
||||
'debone',
|
||||
'decorate',
|
||||
'deep fry',
|
||||
'deglaze',
|
||||
'descale',
|
||||
'devil',
|
||||
'dice',
|
||||
'dip',
|
||||
'dough',
|
||||
'drain',
|
||||
'drizzle',
|
||||
'dry',
|
||||
'escallop',
|
||||
'ferment',
|
||||
'fillet',
|
||||
'filter',
|
||||
'flambe',
|
||||
'flavor',
|
||||
'flip',
|
||||
'fold',
|
||||
'freeze',
|
||||
'French fry',
|
||||
'fricassee',
|
||||
'frost',
|
||||
'froth',
|
||||
'fry',
|
||||
'garnish',
|
||||
'gel',
|
||||
'glaze',
|
||||
'grate',
|
||||
'gratin',
|
||||
'grease',
|
||||
'grill',
|
||||
'grind',
|
||||
'hard boil',
|
||||
'harden',
|
||||
'hash',
|
||||
'heat',
|
||||
'hull',
|
||||
'ice',
|
||||
'infuse',
|
||||
'jell',
|
||||
'juice',
|
||||
'julienne',
|
||||
'knead',
|
||||
'layer',
|
||||
'leaven',
|
||||
'macerate',
|
||||
'marinate',
|
||||
'mash',
|
||||
'measure',
|
||||
'melt',
|
||||
'microwave',
|
||||
'mix',
|
||||
'mold',
|
||||
'oil',
|
||||
'oven fry',
|
||||
'overcook',
|
||||
'pan fry',
|
||||
'parboil',
|
||||
'pare',
|
||||
'peel',
|
||||
'percolate',
|
||||
'pickle',
|
||||
'pit',
|
||||
'poach',
|
||||
'pop',
|
||||
'pour',
|
||||
'precook',
|
||||
'prepare',
|
||||
'preserve',
|
||||
'press',
|
||||
'pressure-cook',
|
||||
'process',
|
||||
'pulp',
|
||||
'puree',
|
||||
'quarter',
|
||||
'raw',
|
||||
'reduce',
|
||||
'refrigerate',
|
||||
'render',
|
||||
'rise',
|
||||
'roast',
|
||||
'roll',
|
||||
'rub',
|
||||
'salt',
|
||||
'saute',
|
||||
'scald',
|
||||
'scallop',
|
||||
'scoop',
|
||||
'score',
|
||||
'scramble',
|
||||
'sear',
|
||||
'season',
|
||||
'separate',
|
||||
'serve',
|
||||
'shell',
|
||||
'shirr',
|
||||
'shred',
|
||||
'shuck',
|
||||
'sieve',
|
||||
'sift',
|
||||
'simmer',
|
||||
'skewer',
|
||||
'skim',
|
||||
'skin',
|
||||
'slice',
|
||||
'sliver',
|
||||
'slow cook',
|
||||
'smoke',
|
||||
'snip',
|
||||
'soak',
|
||||
'soft boil',
|
||||
'souse',
|
||||
'sprinkle',
|
||||
'steam',
|
||||
'steep',
|
||||
'stew',
|
||||
'stir',
|
||||
'stir fry',
|
||||
'strain',
|
||||
'stuff',
|
||||
'sweat',
|
||||
'sweeten',
|
||||
'temper',
|
||||
'tenderize',
|
||||
'thicken',
|
||||
'thin',
|
||||
'toast',
|
||||
'top',
|
||||
'toss',
|
||||
'trim',
|
||||
'truss',
|
||||
'turn',
|
||||
'uncured',
|
||||
'unmold',
|
||||
'warm',
|
||||
'wash',
|
||||
'wedge',
|
||||
'whip',
|
||||
'whisk',
|
||||
'zap',
|
||||
'zest'
|
||||
]
|
||||
|
||||
old_cooking_verbs2 = ['arrange',
|
||||
'baste',
|
||||
'beat',
|
||||
'blend',
|
||||
'brown',
|
||||
'build',
|
||||
'bury',
|
||||
'carve',
|
||||
'check',
|
||||
'chop',
|
||||
'close',
|
||||
'cool',
|
||||
'correct',
|
||||
'cover',
|
||||
'crumple',
|
||||
'cut',
|
||||
'decorate',
|
||||
'discard',
|
||||
'divide',
|
||||
'drape',
|
||||
'drop',
|
||||
'dry',
|
||||
'film',
|
||||
'fold',
|
||||
'follow',
|
||||
'form',
|
||||
'force',
|
||||
'glaze',
|
||||
'insert',
|
||||
'lay',
|
||||
'leave',
|
||||
'lift',
|
||||
'make',
|
||||
'melt',
|
||||
'mince',
|
||||
'mix',
|
||||
'moisten',
|
||||
'mound',
|
||||
'open',
|
||||
'pack',
|
||||
'paint',
|
||||
'pierce',
|
||||
'pour',
|
||||
'prepare',
|
||||
'press',
|
||||
'prick',
|
||||
'pull',
|
||||
'puree',
|
||||
'push',
|
||||
'quarter',
|
||||
'raise',
|
||||
'reduce',
|
||||
'refresh',
|
||||
'reheat',
|
||||
'replace',
|
||||
'return',
|
||||
'ring',
|
||||
'roast',
|
||||
'roll',
|
||||
'salt',
|
||||
'saute',
|
||||
'scatter',
|
||||
'scoop',
|
||||
'scrape',
|
||||
'scrub',
|
||||
'season',
|
||||
'separate',
|
||||
'set',
|
||||
'settle',
|
||||
'shave',
|
||||
'simmer',
|
||||
'skim',
|
||||
'slice',
|
||||
'slide',
|
||||
'slip',
|
||||
'slit',
|
||||
'smear',
|
||||
'soak',
|
||||
'spoon',
|
||||
'spread',
|
||||
'sprinkle',
|
||||
'stir',
|
||||
'strain',
|
||||
'strew',
|
||||
'stuff',
|
||||
'surround',
|
||||
'taste',
|
||||
'thin',
|
||||
'tie',
|
||||
'tilt',
|
||||
'tip',
|
||||
'top',
|
||||
'toss',
|
||||
'trim',
|
||||
'turn',
|
||||
'twist',
|
||||
'warm',
|
||||
'wilt',
|
||||
'wind',
|
||||
'wrap'
|
||||
]
|
||||
|
||||
#https://teflpedia.com/Verbs_used_in_cooking
|
||||
|
||||
cooking_verbs = [
|
||||
'add',
|
||||
'adjust',
|
||||
'arrange',
|
||||
'bake',
|
||||
'baste',
|
||||
'batter',
|
||||
'beat',
|
||||
'blend',
|
||||
'boil',
|
||||
'braise',
|
||||
'break',
|
||||
'bread',
|
||||
'broil',
|
||||
'brown',
|
||||
'brush',
|
||||
'build',
|
||||
'burn',
|
||||
'bury',
|
||||
'carve',
|
||||
'check',
|
||||
'chill',
|
||||
'chop',
|
||||
'clarify',
|
||||
'close',
|
||||
'cook',
|
||||
'cool',
|
||||
'correct',
|
||||
'cover',
|
||||
'crack',
|
||||
'crumple',
|
||||
'curdle',
|
||||
'cut',
|
||||
'debone',
|
||||
'dice',
|
||||
'discard',
|
||||
'drain',
|
||||
'dress',
|
||||
'fillet',
|
||||
'flour',
|
||||
'fold',
|
||||
'freeze',
|
||||
'fry',
|
||||
'garnish',
|
||||
'glaze',
|
||||
'grate',
|
||||
'grind',
|
||||
'grill',
|
||||
'gut',
|
||||
'heat',
|
||||
'knead',
|
||||
'lower',
|
||||
'macerate',
|
||||
'marinate',
|
||||
'mash',
|
||||
'melt',
|
||||
'mince',
|
||||
'mix',
|
||||
'open',
|
||||
'parboil',
|
||||
'peel',
|
||||
'pickle',
|
||||
'place',
|
||||
'poach',
|
||||
'pour',
|
||||
'prepare',
|
||||
'pull',
|
||||
'put',
|
||||
'reduce',
|
||||
'refrigerate',
|
||||
'remove',
|
||||
'rinse',
|
||||
'roast',
|
||||
'rollout',
|
||||
'rollup',
|
||||
'rub',
|
||||
'salt',
|
||||
'sauté',
|
||||
'scoop',
|
||||
'scorch',
|
||||
'scramble',
|
||||
'season',
|
||||
'serve',
|
||||
'set',
|
||||
'simmer',
|
||||
'skim',
|
||||
'slice',
|
||||
'slowcook',
|
||||
'soak',
|
||||
'sour',
|
||||
'spice',
|
||||
'spoon',
|
||||
'spread',
|
||||
'sprinkle',
|
||||
'squeeze',
|
||||
'steam',
|
||||
'steep',
|
||||
'stir',
|
||||
'strain',
|
||||
'sugar',
|
||||
'sweeten',
|
||||
'taste',
|
||||
'thaw',
|
||||
'thicken',
|
||||
'toast',
|
||||
'try',
|
||||
'warm',
|
||||
'wash',
|
||||
'waterdown',
|
||||
'whip',
|
||||
'whisk',
|
||||
'wipe'
|
||||
]
|
213
gensim_sandbox.ipynb
Normal file
213
gensim_sandbox.ipynb
Normal file
@ -0,0 +1,213 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import gensim"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from gensim.test.utils import common_texts, get_tmpfile\n",
|
||||
"from gensim.models import Word2Vec"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"path = get_tmpfile(\"word2vec.model\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'/tmp/word2vec.model'"
|
||||
]
|
||||
},
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"path"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"model = Word2Vec(common_texts, size=100, window=5, min_count=1, workers=4)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"model.save(\"word2vec.model\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"(0, 2)"
|
||||
]
|
||||
},
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"model.train([[\"hello\", \"world\"]], total_examples=1, epochs=1)\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"vector = model.wv['computer']"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"array([-4.1360268e-03, -4.5368457e-03, 4.9407119e-03, -1.2173436e-03,\n",
|
||||
" 1.8632456e-03, -3.0847099e-03, 9.4799127e-04, -2.7400992e-04,\n",
|
||||
" -1.6392355e-03, -2.7422528e-03, -4.2033773e-03, -3.3297916e-03,\n",
|
||||
" 4.1276743e-03, -4.7909385e-03, -3.4512556e-03, -2.4730477e-03,\n",
|
||||
" 3.9467048e-03, -3.1123622e-03, 8.4940199e-04, 1.6509957e-03,\n",
|
||||
" 1.9616839e-03, 2.9326702e-04, 8.3735195e-04, -3.9251014e-03,\n",
|
||||
" 4.4886805e-03, 1.6525604e-03, -6.3597935e-04, 4.5339693e-03,\n",
|
||||
" 3.1772670e-03, -2.1555244e-03, -1.4741931e-03, -3.0088725e-03,\n",
|
||||
" -2.4554132e-05, 1.0471512e-03, 7.2246540e-04, -7.0415600e-04,\n",
|
||||
" 1.0049028e-03, -1.2862401e-03, 4.2546941e-03, 3.7523378e-03,\n",
|
||||
" 4.6063680e-03, 2.5315667e-03, 3.2354944e-04, 1.9442231e-03,\n",
|
||||
" -3.8831339e-03, 3.4721817e-03, 4.8152893e-04, 3.7462877e-03,\n",
|
||||
" -1.1004598e-03, -4.7399257e-03, 2.1483030e-03, 3.3649500e-03,\n",
|
||||
" 4.6523339e-03, 4.3348838e-03, -4.2628059e-03, -2.9411956e-03,\n",
|
||||
" -4.9323966e-03, 4.8694564e-03, -3.2455113e-04, 2.4327010e-04,\n",
|
||||
" -9.5937803e-04, 3.3954745e-03, 1.4546780e-03, 1.4540150e-03,\n",
|
||||
" 3.9641848e-03, 1.0693196e-03, -1.8705493e-03, 4.7259987e-03,\n",
|
||||
" 3.6600775e-03, -4.9972837e-03, -1.0512822e-03, 3.5494359e-03,\n",
|
||||
" -1.2509550e-03, 9.0227136e-04, -5.6869379e-04, 2.4727959e-04,\n",
|
||||
" 1.7441555e-03, 2.0887840e-03, 1.4573885e-03, 3.2532993e-05,\n",
|
||||
" -3.0203401e-03, -4.7087572e-03, -2.2450915e-04, -4.8172413e-04,\n",
|
||||
" 2.2919511e-03, 6.3158554e-04, -4.7253529e-03, 4.0057153e-03,\n",
|
||||
" 2.4692446e-03, -7.6975941e-04, 3.9252751e-03, -2.3655752e-03,\n",
|
||||
" -4.5094200e-04, -4.7492324e-03, -1.3552406e-03, 4.7150920e-03,\n",
|
||||
" 1.2312060e-03, 1.3621986e-03, 2.3288964e-03, -1.1707483e-03],\n",
|
||||
" dtype=float32)"
|
||||
]
|
||||
},
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"vector"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"\u001b[0;31mType:\u001b[0m Word2VecKeyedVectors\n",
|
||||
"\u001b[0;31mString form:\u001b[0m <gensim.models.keyedvectors.Word2VecKeyedVectors object at 0x7f743bd043c8>\n",
|
||||
"\u001b[0;31mFile:\u001b[0m ~/.local/lib/python3.7/site-packages/gensim/models/keyedvectors.py\n",
|
||||
"\u001b[0;31mDocstring:\u001b[0m \n",
|
||||
"Mapping between words and vectors for the :class:`~gensim.models.Word2Vec` model.\n",
|
||||
"Used to perform operations on the vectors such as vector lookup, distance, similarity etc.\n"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"?model.wv"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[['human', 'interface', 'computer'], ['survey', 'user', 'computer', 'system', 'response', 'time'], ['eps', 'user', 'interface', 'system'], ['system', 'human', 'system', 'eps'], ['user', 'response', 'time'], ['trees'], ['graph', 'trees'], ['graph', 'minors', 'trees'], ['graph', 'minors', 'survey']]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"print(common_texts)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"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.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
@ -37,38 +37,56 @@ class JSON_buffered_reader(object):
|
||||
self._close()
|
||||
return
|
||||
|
||||
prev_c = ''
|
||||
|
||||
in_quotes = False
|
||||
|
||||
for c in line:
|
||||
if c == '[':
|
||||
if self.array_d >= self.serialization_array_depth:
|
||||
self.buffer += c
|
||||
self.array_d += 1
|
||||
|
||||
if prev_c == '\\':
|
||||
self.buffer += c
|
||||
prev_c = '' if c == '\\' else c
|
||||
continue
|
||||
elif c == ']':
|
||||
if self.array_d >= self.serialization_array_depth:
|
||||
self.buffer += c
|
||||
self.array_d -= 1
|
||||
elif c == '{':
|
||||
self.object_d += 1
|
||||
self.buffer += c
|
||||
continue
|
||||
elif c == '}':
|
||||
self.object_d -= 1
|
||||
self.buffer += c
|
||||
elif c == ',':
|
||||
if self.array_d == self.serialization_array_depth and self.object_d == 0:
|
||||
continue
|
||||
self.buffer += c
|
||||
elif c == '\n':
|
||||
continue
|
||||
if not in_quotes:
|
||||
if c == '[':
|
||||
if self.array_d >= self.serialization_array_depth:
|
||||
self.buffer += c
|
||||
self.array_d += 1
|
||||
elif c == ']':
|
||||
if self.array_d >= self.serialization_array_depth:
|
||||
self.buffer += c
|
||||
self.array_d -= 1
|
||||
elif c == '{':
|
||||
self.object_d += 1
|
||||
self.buffer += c
|
||||
elif c == '}':
|
||||
self.object_d -= 1
|
||||
self.buffer += c
|
||||
elif c == '"':
|
||||
in_quotes = True
|
||||
self.buffer += c
|
||||
elif c == ',':
|
||||
if not(self.array_d == self.serialization_array_depth and self.object_d == 0):
|
||||
self.buffer += c
|
||||
elif c == '\n' or c == ' ' or c == '\t':
|
||||
continue
|
||||
else:
|
||||
self.buffer += c
|
||||
|
||||
else:
|
||||
if c == '"':
|
||||
in_quotes = False
|
||||
self.buffer += c
|
||||
continue
|
||||
|
||||
assert self.object_d >= 0
|
||||
assert self.array_d >= 0
|
||||
|
||||
prev_c = c
|
||||
|
||||
if self.object_d == 0:
|
||||
if self.array_d == self.serialization_array_depth:
|
||||
if self.array_d == self.serialization_array_depth and len(self.buffer) > 0:
|
||||
self.json_queue.append(self.buffer)
|
||||
self.buffer = r''
|
||||
|
||||
@ -78,7 +96,7 @@ class JSON_buffered_reader(object):
|
||||
def __next__(self):
|
||||
while len(self.json_queue) == 0:
|
||||
if self.eof:
|
||||
return None
|
||||
raise StopIteration
|
||||
self._process_next_line()
|
||||
|
||||
return json.loads(self.json_queue.pop(0))
|
||||
tmp = self.json_queue.pop(0)
|
||||
return json.loads(tmp)
|
||||
|
41
nltk_sandbox.ipynb
Normal file
41
nltk_sandbox.ipynb
Normal file
@ -0,0 +1,41 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import nltk"
|
||||
]
|
||||
},
|
||||
{
|
||||
"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.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
644
sandbox.ipynb
644
sandbox.ipynb
@ -2,18 +2,22 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import numpy as np\n",
|
||||
"import json \n",
|
||||
"from pprint import pprint"
|
||||
"from pprint import pprint\n",
|
||||
"import nltk\n",
|
||||
"import word2vec\n",
|
||||
"from gensim.test.utils import common_texts, get_tmpfile\n",
|
||||
"from gensim.models import Word2Vec"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -22,7 +26,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -38,63 +42,13 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"recipes = JSON_br(settings.one_million_recipes_file)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"i = 0\n",
|
||||
"json_recipes = []\n",
|
||||
"for recipe in recipes:\n",
|
||||
" i += 1\n",
|
||||
" if i == 10:\n",
|
||||
" break\n",
|
||||
" json_recipes.append(recipe)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"[{'text': 'Chop green onions; chop red peppers; peel and grate carrots (save two grated carrots for salads); place all in a medium bowl and toss to mix.'},\n",
|
||||
" {'text': 'Preheat oven to 450 degrees Fahrenheit.'},\n",
|
||||
" {'text': 'Place salmon fillet in middle of a large piece of heavy aluminum foil.'},\n",
|
||||
" {'text': 'Sprinkle salmon with ginger and freshly ground black pepper if you wish.'},\n",
|
||||
" {'text': 'Arrange bowl of veggies on top of salmon, and seal foil tightly to create a tightly sealed pocket.'},\n",
|
||||
" {'text': 'Place in oven and bake for 20 minutes.'},\n",
|
||||
" {'text': 'The veggies will give up some of their liquid, creating more than enough to cook the fish.'},\n",
|
||||
" {'text': 'Cook rice per package instructions.'},\n",
|
||||
" {'text': 'While fish bakes, prepare Salad a La SPORTZ by arranging crackers in single layer on cookie sheet; sprinkle with Parmesan topping.'},\n",
|
||||
" {'text': 'Bake for 1 to 2 minutes in oven with fish, just until lightly browned.'},\n",
|
||||
" {'text': 'Cool.'},\n",
|
||||
" {'text': 'Toss greens (1/2 pound = 8 cups), carrots (grated), tomatoes (halved), and green onions (sliced) in large sized bowl.'},\n",
|
||||
" {'text': 'Toss with dressing.'},\n",
|
||||
" {'text': 'Sprinkle with crackers just before serving.'},\n",
|
||||
" {'text': 'Slice banana and kiwi and toss gently; divide between four dessert cups.'},\n",
|
||||
" {'text': 'Blend cinnamon and sugar into yogurt, and place one-fourth of mixture on each bowl of fruit.'}]"
|
||||
]
|
||||
},
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"json_recipes[0]['instructions']"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
@ -106,7 +60,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -123,7 +77,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -132,7 +86,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -155,482 +109,120 @@
|
||||
" break"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"* filling in summarized datasets"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"summarized_ingredients = []\n",
|
||||
"summarized_instructions = []"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"test = \"\".join([ins + ' ' for ins in instructions[0]])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[['1 tablespoon cornstarch',\n",
|
||||
" '2 tablespoons cold water',\n",
|
||||
" '12 cup boiling water',\n",
|
||||
" '1 teaspoon lemon juice or 1 teaspoon vanilla',\n",
|
||||
" '3 egg whites',\n",
|
||||
" '6 tablespoons sugar'],\n",
|
||||
" ['2 eggs, scrambled',\n",
|
||||
" '2 Tbsp. PHILADELPHIA Chive & Onion Cream Cheese Spread',\n",
|
||||
" '1 English muffin, split, toasted',\n",
|
||||
" '1 KRAFT Singles'],\n",
|
||||
" ['1 lb pumpkin, chopped or 1 lb butternut squash',\n",
|
||||
" '1 large onion, chopped',\n",
|
||||
" '2 large garlic cloves, minced',\n",
|
||||
" '1 tablespoon curry powder',\n",
|
||||
" 'fresh stock (cubes work if needs must)',\n",
|
||||
" '2 (13 1/2 ounce) cans coconut milk',\n",
|
||||
" '200 g smoked salmon',\n",
|
||||
" 'salt and pepper',\n",
|
||||
" 'vegetable oil'],\n",
|
||||
" ['3 x apples, Granny Smith',\n",
|
||||
" '1 c. almonds, slivered',\n",
|
||||
" '1/2 c. almonds, grnd',\n",
|
||||
" '1 x Large eggs',\n",
|
||||
" '1/2 c. sugar (caster)',\n",
|
||||
" '50 gm butter',\n",
|
||||
" '2 sht puff pastry',\n",
|
||||
" '1 x Large eggs',\n",
|
||||
" '1 Tbsp. almonds, slivered',\n",
|
||||
" '1 Tbsp. sugar (caster)'],\n",
|
||||
" ['8 ounces, weight Linguine',\n",
|
||||
" '1 whole Red Bell Pepper, Julienned',\n",
|
||||
" '2 Tablespoons Balsamic Vinegar',\n",
|
||||
" '3 whole Garlic Cloves, Minced',\n",
|
||||
" '1/2 teaspoons Salt',\n",
|
||||
" '1/4 teaspoons Coarsely Ground Black Pepper',\n",
|
||||
" '6 Tablespoons Extra Virgin Olive Oil',\n",
|
||||
" '1 cup Fresh Basil Leaves, Thinly Sliced, Divided',\n",
|
||||
" '2 cups Shredded, Cooked Chicken',\n",
|
||||
" '1 cup Small Fresh Mozzarella Balls, Halved Or Regular Mozzarella Cut Into '\n",
|
||||
" '3/4-inch Cubes',\n",
|
||||
" '1/2 cups Goat Cheese Crumbles'],\n",
|
||||
" ['1 cup all-purpose flour',\n",
|
||||
" '1 teaspoon ground cinnamon',\n",
|
||||
" '3/4 teaspoon baking powder',\n",
|
||||
" '1/4 teaspoon baking soda',\n",
|
||||
" '1/4 teaspoon salt',\n",
|
||||
" '1/4 teaspoon ground nutmeg',\n",
|
||||
" '1/3 cup margarine',\n",
|
||||
" '3/4 cup firmly packed dark brown sugar',\n",
|
||||
" '1 large egg',\n",
|
||||
" '1 teaspoon vanilla extract',\n",
|
||||
" '1 cup diced peeled Rome apple',\n",
|
||||
" '3/4 cup regular oats, uncooked',\n",
|
||||
" '1/2 cup dried currants',\n",
|
||||
" 'Cooking spray',\n",
|
||||
" '1 tablespoon powdered sugar'],\n",
|
||||
" ['6 cups prepared sushi rice (see recipe)',\n",
|
||||
" '2 Hass avocados in 1/2-inch strips',\n",
|
||||
" 'Salt',\n",
|
||||
" '1 pound cucumber, carrot or daikon, or a combination, cut into matchsticks',\n",
|
||||
" '2 sheets nori (7 by 8 inches), cut into confetti',\n",
|
||||
" '2 pounds fillets of fresh salmon, tuna, yellowtail, fluke or striped bass, '\n",
|
||||
" 'in slices 3 inches by 1 inch by 1/4 inch thick',\n",
|
||||
" '1 bunch scallions, cut in thin rings halfway up the green tops',\n",
|
||||
" '2 teaspoons sesame seeds'],\n",
|
||||
" ['1/2 pound grnd beef, ham or possibly chicken',\n",
|
||||
" '1 egg, slightly beaten',\n",
|
||||
" '1/2 c. lowfat milk',\n",
|
||||
" '1/4 c. fine bread crumbs',\n",
|
||||
" '1 1/2 tbsp. finely minced onion',\n",
|
||||
" '1/2 teaspoon salt',\n",
|
||||
" '1/4 teaspoon dry mustard',\n",
|
||||
" 'Few grains pepper',\n",
|
||||
" '2 tbsp. flour',\n",
|
||||
" '1/4 c. Puritan oil',\n",
|
||||
" '1 can condensed tomato or possibly mushroom soup',\n",
|
||||
" '3/4 c. lowfat milk',\n",
|
||||
" '1 1/2 c. cooked or possibly canned mixed vegetables',\n",
|
||||
" '1/2 teaspoon salt'],\n",
|
||||
" ['1- 1/2 cup All-purpose Flour',\n",
|
||||
" '1 Tablespoon White Sugar',\n",
|
||||
" '1/2 teaspoons Salt',\n",
|
||||
" '1/2 cups Vegetable Oil',\n",
|
||||
" '2 Tablespoons Milk'],\n",
|
||||
" ['2 cups peeled, cooked, mashed sweet potatoes*',\n",
|
||||
" '1 1/4 cups sugar',\n",
|
||||
" '1/4 cup (1/2 stick) melted butter',\n",
|
||||
" '2 eggs',\n",
|
||||
" '1 teaspoon vanilla extract, or 1-2 tablespoons bourbon',\n",
|
||||
" '1/4 teaspoon salt',\n",
|
||||
" '1/4 teaspoon cinnamon',\n",
|
||||
" '1/4 teaspoon ground ginger',\n",
|
||||
" '1 cup milk',\n",
|
||||
" 'One 9-inch unbaked pie crust',\n",
|
||||
" '3 egg whites'],\n",
|
||||
" ['1 pkg. (2-layer size) chocolate cake mix',\n",
|
||||
" '14 Oreo Cookies, coarsely chopped',\n",
|
||||
" '1 pkg. (4-serving size) Jell-O Vanilla Instant Pudding',\n",
|
||||
" '1 cup cold milk',\n",
|
||||
" '1/4 cup icing sugar',\n",
|
||||
" '2 cups thawed Cool Whip Whipped Topping',\n",
|
||||
" \"48 Baker's Semi-Sweet Chocolate Chips\"],\n",
|
||||
" ['1 small butternut squash, peeled, diced (about 5 C.)',\n",
|
||||
" '1 medium onion, large dice (1 cup)',\n",
|
||||
" '1 tablespoon olive oil',\n",
|
||||
" '1 apple, skinned, large dice (1 cup)',\n",
|
||||
" '48 ounces chicken broth',\n",
|
||||
" '1 cup half-and-half',\n",
|
||||
" '2 tablespoons parsley, fresh, chopped',\n",
|
||||
" '1 tablespoon thyme, fresh, chopped',\n",
|
||||
" 'crouton (optional)',\n",
|
||||
" 'sour cream (optional)'],\n",
|
||||
" ['1 lb turkey, cut into bite size pieces',\n",
|
||||
" '2 tablespoons Italian dressing',\n",
|
||||
" '2 cups frozen mixed vegetables',\n",
|
||||
" '1 (10 3/4 ounce) can98% fat free condensed cream of chicken soup',\n",
|
||||
" '14 lb Velveeta cheese, cut into 1/2-inch cubes (or store brand)',\n",
|
||||
" '1 sheet frozen puff pastry, thawed (1/2 of 17.3-oz. pkg.)',\n",
|
||||
" '1 egg, beaten'],\n",
|
||||
" ['1 12 cups whole wheat flour',\n",
|
||||
" '3 teaspoons baking powder',\n",
|
||||
" '14 cup extra virgin olive oil',\n",
|
||||
" '2 eggs',\n",
|
||||
" '1 cup skim milk',\n",
|
||||
" '14 teaspoon salt',\n",
|
||||
" '14 teaspoon cinnamon',\n",
|
||||
" '14 teaspoon nutmeg',\n",
|
||||
" '14 teaspoon ground cloves',\n",
|
||||
" '14 teaspoon ginger',\n",
|
||||
" '14 teaspoon vanilla',\n",
|
||||
" '34 cup flax seed',\n",
|
||||
" '3 tablespoons honey',\n",
|
||||
" '1 12 cups blueberries (or any fruit desired)'],\n",
|
||||
" ['1 lb leftover chopped corned beef',\n",
|
||||
" '1 cup shredded cheddar cheese',\n",
|
||||
" '2 tablespoons dried onion flakes',\n",
|
||||
" '1 tablespoon dill or 1 tablespoon sweet relish',\n",
|
||||
" '23 cup mayonnaise',\n",
|
||||
" '6 hamburger buns, buttered and toasted'],\n",
|
||||
" ['1/4 cup heavy cream',\n",
|
||||
" \"1/2 (10 ounce) jar Dickinson's Lemon Curd, or any flavor Dickinson's Fruit \"\n",
|
||||
" 'or Creme Curd',\n",
|
||||
" '1 (4 ounce) package cream cheese, softened',\n",
|
||||
" '1 (15 count) box phyllo dessert cups',\n",
|
||||
" 'Fruit slices, cookie pieces, candy sprinkles, chocolate shavings '\n",
|
||||
" '(optional)'],\n",
|
||||
" ['4 large baking potatoes (2 lb./900 g) Safeway 2 pkg For $5.00 thru 02/09',\n",
|
||||
" '1/2 cup sour cream',\n",
|
||||
" \"1/4 cup Bull's-Eye Bold Original Barbecue Sauce\",\n",
|
||||
" '2 green onions, sliced',\n",
|
||||
" '1/4 cup French fried onions'],\n",
|
||||
" ['2 tablespoons olive oil',\n",
|
||||
" '2 shallots, thinly sliced',\n",
|
||||
" '1 teaspoon minced peeled fresh ginger',\n",
|
||||
" '1/2 cup chopped tart green apple(such as Granny Smith)',\n",
|
||||
" '1/2 cup chopped zucchini',\n",
|
||||
" '1/2 cup chopped seeded red bell pepper',\n",
|
||||
" '1/2 cup chopped seeded green bell pepper',\n",
|
||||
" '1/4 cup chopped carrot',\n",
|
||||
" '1/2 pound crabmeat, drained well, picked over',\n",
|
||||
" '1/4 cup mayonnaise',\n",
|
||||
" '2 tablespoons chopped fresh chives',\n",
|
||||
" '2 tomatoes, peeled, seeded, chopped',\n",
|
||||
" '1/3 cup chopped fresh cilantro',\n",
|
||||
" '2 tablespoons Sherry wine vinegar',\n",
|
||||
" '1 garlic clove, chopped',\n",
|
||||
" 'Pinch of cayenne pepper',\n",
|
||||
" '1/2 cup olive oil',\n",
|
||||
" '2 heads Belgian endive, trimmed, separated into spears',\n",
|
||||
" 'Chopped fresh chives'],\n",
|
||||
" ['2 12 lbs all-purpose flour',\n",
|
||||
" '2 12 tablespoons Crisco',\n",
|
||||
" '1 ounce yeast (2 packages)',\n",
|
||||
" '1 teaspoon sugar',\n",
|
||||
" '1 tablespoon salt',\n",
|
||||
" '2 tablespoons anise seed',\n",
|
||||
" '2 eggs',\n",
|
||||
" '1 cup water',\n",
|
||||
" '1 tablespoon vegetable oil'],\n",
|
||||
" ['1/2 cup semi-sweet chocolate chips',\n",
|
||||
" '1 tbsp water',\n",
|
||||
" '1 tbsp rum',\n",
|
||||
" '1 tbsp vanilla extract ( I add a bit extra)',\n",
|
||||
" '1 3/4 cup powdered sugar',\n",
|
||||
" '1 3/4 cup (7 ounces) ground walnuts',\n",
|
||||
" '1 granulated or decorative sugar'],\n",
|
||||
" ['1- 1/2 cup All-purpose Flour',\n",
|
||||
" '1/4 cups Sugar',\n",
|
||||
" '1/2 Tablespoons Baking Powder',\n",
|
||||
" '1/4 cups Unsalted Butter, Cubed, Cold',\n",
|
||||
" '1 whole Egg, Beaten',\n",
|
||||
" '1/2 cups Ricotta Cheese',\n",
|
||||
" '1 teaspoon Vanilla',\n",
|
||||
" '2 teaspoons Cinnamon',\n",
|
||||
" '2 whole Peaches, Cored, Diced',\n",
|
||||
" '1 Tablespoon Turbinado Sugar',\n",
|
||||
" '1 cup Confectioners Sugar',\n",
|
||||
" '13 cups Milk',\n",
|
||||
" '1/2 teaspoons Cinnamon'],\n",
|
||||
" ['1 cup all-purpose flour',\n",
|
||||
" '1/2 cup chopped walnuts',\n",
|
||||
" '1/4 cup packed brown sugar',\n",
|
||||
" '1/2 cup melted butter',\n",
|
||||
" '2 1/2 cups strawberries, finely chopped',\n",
|
||||
" '1/2 cup white sugar',\n",
|
||||
" '1 tablespoon lemon juice',\n",
|
||||
" '1 (16 ounce) container frozen whipped topping, thawed'],\n",
|
||||
" ['34 cup peanut butter',\n",
|
||||
" '12 cup sugar',\n",
|
||||
" '1 teaspoon vanilla',\n",
|
||||
" '12 teaspoon salt',\n",
|
||||
" '1 34 cups milk',\n",
|
||||
" '2 14 cups whole wheat flour',\n",
|
||||
" '4 teaspoons baking powder'],\n",
|
||||
" ['1/2 c. granulated sugar',\n",
|
||||
" '3/4 c. salt free corn oil',\n",
|
||||
" '1/4 c. egg beaters',\n",
|
||||
" '1 teaspoon grated orange rind',\n",
|
||||
" '1/4 teaspoon orange juice',\n",
|
||||
" '1 tbsp. low sodium baking powder',\n",
|
||||
" '3 1/2 c. flour, all purpose'],\n",
|
||||
" ['1 large about 3 pounds cantaloupe',\n",
|
||||
" '12 cup apple juice',\n",
|
||||
" '1 12 tablespoons lime juice',\n",
|
||||
" '1 12 tablespoons chopped of fresh mint',\n",
|
||||
" '12 cup plain yogurt',\n",
|
||||
" '1 tablespoon honey, if needed',\n",
|
||||
" '1 pinch salt'],\n",
|
||||
" ['3 cups cooked brown rice',\n",
|
||||
" '1 lb ground turkey',\n",
|
||||
" '1 medium onion, chopped',\n",
|
||||
" '1 green bell pepper, seeded and chopped',\n",
|
||||
" '1 (6 ounce) canof small pitted black olives, drained',\n",
|
||||
" '12 cup raisins'],\n",
|
||||
" ['12 chopped sweet melon',\n",
|
||||
" '2 sliced bananas',\n",
|
||||
" '2 chopped guavas',\n",
|
||||
" '1 bunch grapes',\n",
|
||||
" '1 diced apple',\n",
|
||||
" '2 tablespoons orange juice',\n",
|
||||
" '1 cup shelled pomegranate',\n",
|
||||
" '1 cup fresh cream',\n",
|
||||
" '12 teaspoon black pepper',\n",
|
||||
" '1 teaspoon sugar',\n",
|
||||
" 'few fresh mint leaves, for garnishing'],\n",
|
||||
" ['1 12 cups wheat berries',\n",
|
||||
" '8 cups water',\n",
|
||||
" '14 cup chopped almonds, or',\n",
|
||||
" '14 cup toasted pine nuts',\n",
|
||||
" '3 tablespoons vegetable oil',\n",
|
||||
" '1 chopped onion',\n",
|
||||
" '2 minced garlic cloves',\n",
|
||||
" '1 tablespoon mild curry paste',\n",
|
||||
" '14 teaspoon salt',\n",
|
||||
" '3 tablespoons white wine vinegar',\n",
|
||||
" '1 chopped red pepper',\n",
|
||||
" '12 cup chopped mozzarella cheese',\n",
|
||||
" '2 tablespoons chopped parsley'],\n",
|
||||
" ['1 12 cups old fashioned oats',\n",
|
||||
" '1 cup flour, all-purpose',\n",
|
||||
" '12 cup brown sugar, firmly packed',\n",
|
||||
" '1 teaspoon cinnamon',\n",
|
||||
" '12 teaspoon baking soda',\n",
|
||||
" '14 teaspoon salt',\n",
|
||||
" '1 cup orange juice',\n",
|
||||
" '14 cup vegetable oil',\n",
|
||||
" '1 egg, beaten',\n",
|
||||
" '1 teaspoon vanilla',\n",
|
||||
" '6 ounces dried mixed fruit, diced',\n",
|
||||
" '2 tablespoons old fashioned oats'],\n",
|
||||
" ['1-1/4 gal. popped corn',\n",
|
||||
" '1 cup butter',\n",
|
||||
" '2 cups brown sugar, packed',\n",
|
||||
" '1/2 cup light corn syrup',\n",
|
||||
" '1/2 tsp. baking soda',\n",
|
||||
" '1/2 tsp. vanilla'],\n",
|
||||
" ['3 13 lbs mangoes, chopped',\n",
|
||||
" '4 teaspoons garlic',\n",
|
||||
" 'salt',\n",
|
||||
" '3 tablespoons chili powder',\n",
|
||||
" '2 tablespoons cumin powder',\n",
|
||||
" '1 tablespoon cround coriander',\n",
|
||||
" '3 tablespoons masala (or curry powder)',\n",
|
||||
" '1 12 cups honey (agave ok)',\n",
|
||||
" '12 cup cornflour (or potato)',\n",
|
||||
" '2 tablespoons mustard seeds',\n",
|
||||
" 'curry leaf, handfull (if you can find them, I have a curry leaf tree)',\n",
|
||||
" '1 12 cups olive oil'],\n",
|
||||
" ['1 lb. boneless beef sirloin steak, thinly sliced',\n",
|
||||
" '1/4 cup A.1. Original Sauce, divided',\n",
|
||||
" '1/4 cup KRAFT Original Barbecue Sauce',\n",
|
||||
" '1 tsp. GREY POUPON Dijon Mustard'],\n",
|
||||
" ['10 lbs potatoes, peeled',\n",
|
||||
" '2 onions, peeled',\n",
|
||||
" '9 -10 large eggs (or 7-8 extra-large eggs)',\n",
|
||||
" '1 12 tablespoons salt',\n",
|
||||
" '14 cup oil'],\n",
|
||||
" ['1 (10 ounce) package frozen chopped spinach, thawed and squeezed dry',\n",
|
||||
" '1 cup dry breadcrumbs',\n",
|
||||
" '1 small onion, finely chopped',\n",
|
||||
" '2 eggs, lightly beaten',\n",
|
||||
" '14 cup romano cheese, grated',\n",
|
||||
" '2 teaspoons dried oregano',\n",
|
||||
" '1 12 teaspoons garlic powder',\n",
|
||||
" '12 teaspoon salt',\n",
|
||||
" '1 teaspoon all purpose Greek seasoning (I found mine at Walmart)',\n",
|
||||
" '2 lbs ground lamb or 2 lbs ground beef',\n",
|
||||
" 'tzatziki, sauce (for a really good one, use Tzatziki Cucumber Dipping Sauce '\n",
|
||||
" ')'],\n",
|
||||
" ['2 12 lbs ground beef, your choice of cut',\n",
|
||||
" '1 lb ground pork, I use Jones Sausage Roll*',\n",
|
||||
" '1 cup large dice celery',\n",
|
||||
" '1 cup large dice onion',\n",
|
||||
" '6 -12 ounces pepperidge farm onion and garlic croutons',\n",
|
||||
" '1 lb butter, you may not need it all',\n",
|
||||
" 'poultry seasoning',\n",
|
||||
" 'salt',\n",
|
||||
" 'pepper'],\n",
|
||||
" ['3 pounds Chicken Wings Or Drummettes',\n",
|
||||
" '1 teaspoon Salt, Or To Taste',\n",
|
||||
" '1/2 teaspoons Pepper Or To Taste',\n",
|
||||
" '1 Tablespoon Oil',\n",
|
||||
" '3 Tablespoons Butter',\n",
|
||||
" '1/4 cups Sriracha Hot Sauce',\n",
|
||||
" '2 Tablespoons Honey',\n",
|
||||
" '1 Tablespoon Rice Wine Or Sherry',\n",
|
||||
" '1 teaspoon Soy Sauce',\n",
|
||||
" '1 teaspoon Hoisin Sauce',\n",
|
||||
" '1/2 teaspoons Salt',\n",
|
||||
" '2 Tablespoons Chopped Cilantro'],\n",
|
||||
" ['1 c. Slivered almonds, toasted',\n",
|
||||
" '2 Tbsp. Light brown sugar',\n",
|
||||
" '2 Tbsp. Butter, room temperature',\n",
|
||||
" '3/4 stk butter',\n",
|
||||
" '3 ounce White chocolate, minced, into small pcs',\n",
|
||||
" '2 lrg Large eggs, room temperature',\n",
|
||||
" '1/2 c. Light brown sugar, packed',\n",
|
||||
" '1/2 c. Granulated sugar',\n",
|
||||
" '1/2 tsp Baking pwdr',\n",
|
||||
" '2 x Tesa freshly grated lemon peel',\n",
|
||||
" '1/2 tsp Vanilla',\n",
|
||||
" '1/4 tsp Almond extract',\n",
|
||||
" '1 1/4 c. Flour',\n",
|
||||
" '1/4 c. Slivered almonds'],\n",
|
||||
" ['2 eggs', 'pinch salt', 'pinch black pepper', '2 slices any cheese'],\n",
|
||||
" ['2 can Pillsbury Grands Homestyle Refrigerated Buttermilk Biscuits (16.3 oz '\n",
|
||||
" 'can)',\n",
|
||||
" '3/4 cup butter',\n",
|
||||
" '1/2 cup granulated sugar',\n",
|
||||
" '1 tsp ground cinnamon',\n",
|
||||
" '1 cup brown sugar'],\n",
|
||||
" ['Meat from 1 whole chicken Or possibly canned chicken or possibly parts',\n",
|
||||
" '1 can cream of chicken soup',\n",
|
||||
" '1/2 c. green chili salsa',\n",
|
||||
" '2 tbsp. quick cooking tapioca',\n",
|
||||
" '1 med. onion, minced',\n",
|
||||
" '1 1/2 c. grated cheese',\n",
|
||||
" '1 doz. corn tortillas',\n",
|
||||
" 'Black olives'],\n",
|
||||
" ['12 cup corn kernel, - 1/2 cup',\n",
|
||||
" '12 cup mushroom, chopped - 1/2 cup',\n",
|
||||
" '3 onions, - 3',\n",
|
||||
" '4 tomatoes, - 4',\n",
|
||||
" 'red chili pepper',\n",
|
||||
" 'coriander powder',\n",
|
||||
" '6 cloves, - 6',\n",
|
||||
" '1 bay leaf, - 1',\n",
|
||||
" '2 star anise, - 2',\n",
|
||||
" 'black pepper',\n",
|
||||
" 'cornflour',\n",
|
||||
" 'milk',\n",
|
||||
" 'fresh cream',\n",
|
||||
" 'coriander leaves',\n",
|
||||
" '1 tablespoon oil, - 1 tablespoon',\n",
|
||||
" 'salt'],\n",
|
||||
" ['2 tablespoons extra virgin olive oil',\n",
|
||||
" '1 large onion, chopped',\n",
|
||||
" '1 jalapeno, seeded and minced',\n",
|
||||
" '4 garlic cloves, minced',\n",
|
||||
" '6 large red bell peppers, roasted, peeled, and seeded',\n",
|
||||
" '1 tablespoon plus 1 teaspoon red wine vinegar',\n",
|
||||
" '1 tablespoon balsamic vinegar',\n",
|
||||
" '1 tablespoon light brown sugar',\n",
|
||||
" '1 teaspoon ground cumin',\n",
|
||||
" 'Salt to taste'],\n",
|
||||
" ['2 pounds frozen cooked shrimp without tails, peeled and deveined',\n",
|
||||
" '3/4 cup chopped green onions',\n",
|
||||
" '1 1/2 cups chopped celery',\n",
|
||||
" '3 tablespoons drained capers',\n",
|
||||
" '1 cup black olives, sliced',\n",
|
||||
" '1/2 cup oil and vinegar salad dressing',\n",
|
||||
" '3/4 cup mayonnaise',\n",
|
||||
" '1 tablespoon celery seed',\n",
|
||||
" '1 dash lemon juice'],\n",
|
||||
" ['500g lamb loin (backstrap) or fillet, thinly sliced',\n",
|
||||
" '1 medium red onion, cut into thin wedges',\n",
|
||||
" '1 large red capsicum, thickly sliced',\n",
|
||||
" '1 large zucchini, cut into thick strips',\n",
|
||||
" '150g whole button mushrooms',\n",
|
||||
" '1/3 cup KRAFT* Greek Dressing',\n",
|
||||
" '60g black olives',\n",
|
||||
" 'To Serve',\n",
|
||||
" 'chopped fresh oregano or italian parsley leaves',\n",
|
||||
" 'grilled focaccia or turkish style bread'],\n",
|
||||
" ['34 cup creamy peanut butter',\n",
|
||||
" '12 cup Crisco shortening',\n",
|
||||
" '1 14 cups firmly packed light brown sugar',\n",
|
||||
" '3 tablespoons milk',\n",
|
||||
" '1 tablespoon vanilla',\n",
|
||||
" '1 egg',\n",
|
||||
" '1 34 cups flour',\n",
|
||||
" '34 teaspoon salt',\n",
|
||||
" '34 teaspoon baking soda'],\n",
|
||||
" ['3 chicken sausage',\n",
|
||||
" '1 garlic clove, crushed',\n",
|
||||
" '1 large onion, chopped',\n",
|
||||
" '1 large green pepper, chopped',\n",
|
||||
" '2 large carrots, julienned',\n",
|
||||
" '3 tablespoons soy sauce'],\n",
|
||||
" ['1 lb bacon, cooked and crumbled',\n",
|
||||
" '5 garlic cloves, chopped (or more if you like)',\n",
|
||||
" '2 (8 ounce) packages fresh mushrooms, sliced',\n",
|
||||
" '2 tablespoons extra virgin olive oil',\n",
|
||||
" '4 tablespoons butter',\n",
|
||||
" \"2 (10 3/4 ounce) cans Campbell's Cream of Mushroom Soup (or the Cream of \"\n",
|
||||
" 'Mushroom Soup with Roasted Garlic)',\n",
|
||||
" '1 12 cups milk (or half and half)',\n",
|
||||
" '14 teaspoon black pepper',\n",
|
||||
" '2 (16 ounce) bags frozen French-cut green beans, thawed, drained and '\n",
|
||||
" 'squeezed of extra water',\n",
|
||||
" \"2 23 cups French's French fried onions\"],\n",
|
||||
" ['1 egg, beaten',\n",
|
||||
" '18 cup water',\n",
|
||||
" '1 12 cups all-purpose flour',\n",
|
||||
" '2 teaspoons fine sea salt',\n",
|
||||
" '1 teaspoon ground black pepper',\n",
|
||||
" 'vegetable oil, for frying',\n",
|
||||
" '1 small cauliflower, cut into 1-inch florets',\n",
|
||||
" '4 ounces green beans, halved',\n",
|
||||
" '1 fennel bulb, trimmed and sliced into 1-inch pieces',\n",
|
||||
" '1 cup garbanzo beans, drained and rinsed',\n",
|
||||
" '1 lemon, cut into 1/4-inch slices',\n",
|
||||
" '1 cup mayonnaise',\n",
|
||||
" '2 tablespoons fresh lemon juice (from about 1/2 lemon)'],\n",
|
||||
" ['1 -2 acorn squash',\n",
|
||||
" '15 ounces black beans, rinsed and drained',\n",
|
||||
" '15 ounces crushed tomatoes',\n",
|
||||
" '2 medium onions',\n",
|
||||
" '4 garlic cloves',\n",
|
||||
" '1 quart vegetable broth',\n",
|
||||
" '1 tablespoon olive oil',\n",
|
||||
" '1 tablespoon cumin',\n",
|
||||
" 'sea salt and pepper, to taste',\n",
|
||||
" '1 avocado'],\n",
|
||||
" ['1 (21 ounce) can cherry pie filling',\n",
|
||||
" '1 (16 ounce) canpitted dark sweet cherries, drained',\n",
|
||||
" '23 cup quick oats',\n",
|
||||
" '12 cup Bisquick baking mix',\n",
|
||||
" '12 cup packed brown sugar',\n",
|
||||
" '14 cup chopped nuts (optional)',\n",
|
||||
" '14 cup butter or 14 cup margarine',\n",
|
||||
" '1 teaspoon cinnamon']]\n"
|
||||
]
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'Preheat the oven to 350 F. Butter or oil an 8-inch baking dish. Cook the penne 2 minutes less than package directions. (It will finish cooking in the oven.) Rinse the pasta in cold water and set aside. Combine the cooked pasta and the sauce in a medium bowl and mix carefully but thoroughly. Scrape the pasta into the prepared baking dish. Sprinkle the top with the cheeses and then the chili powder. Bake, uncovered, for 20 minutes. Let the mac and cheese sit for 5 minutes before serving. Melt the butter in a heavy-bottomed saucepan over medium heat and whisk in the flour. Continue whisking and cooking for 2 minutes. Slowly add the milk, whisking constantly. Cook until the sauce thickens, about 10 minutes, stirring frequently. Remove from the heat. Add the cheeses, salt, chili powder, and garlic powder. Stir until the cheese is melted and all ingredients are incorporated, about 3 minutes. Use immediately, or refrigerate for up to 3 days. This sauce reheats nicely on the stove in a saucepan over low heat. Stir frequently so the sauce doesnt scorch. This recipe can be assembled before baking and frozen for up to 3 monthsjust be sure to use a freezer-to-oven pan and increase the baking time to 50 minutes. One-half teaspoon of chipotle chili powder makes a spicy mac, so make sure your family and friends can handle it! The proportion of pasta to cheese sauce is crucial to the success of the dish. It will look like a lot of sauce for the pasta, but some of the liquid will be absorbed. '"
|
||||
]
|
||||
},
|
||||
"execution_count": 10,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"pprint(ingredients)"
|
||||
"test"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"token = nltk.word_tokenize(test)\n",
|
||||
"pos_tags = nltk.pos_tag(token)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"['6 ounces penne',\n",
|
||||
" '2 cups Beechers Flagship Cheese Sauce (recipe follows)',\n",
|
||||
" '1 ounce Cheddar, grated (1/4 cup)',\n",
|
||||
" '1 ounce Gruyere cheese, grated (1/4 cup)',\n",
|
||||
" '1/4 to 1/2 teaspoon chipotle chili powder (see Note)',\n",
|
||||
" '1/4 cup (1/2 stick) unsalted butter',\n",
|
||||
" '1/3 cup all-purpose flour',\n",
|
||||
" '3 cups milk',\n",
|
||||
" '14 ounces semihard cheese (page 23), grated (about 3 1/2 cups)',\n",
|
||||
" '2 ounces semisoft cheese (page 23), grated (1/2 cup)',\n",
|
||||
" '1/2 teaspoon kosher salt',\n",
|
||||
" '1/4 to 1/2 teaspoon chipotle chili powder',\n",
|
||||
" '1/8 teaspoon garlic powder',\n",
|
||||
" '(makes about 4 cups)']"
|
||||
]
|
||||
},
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"ingredients[0]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 17,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"[('1/4', 'CD'),\n",
|
||||
" ('cup', 'NN'),\n",
|
||||
" ('(', '('),\n",
|
||||
" ('1/2', 'CD'),\n",
|
||||
" ('stick', 'NN'),\n",
|
||||
" (')', ')'),\n",
|
||||
" ('unsalted', 'VBD'),\n",
|
||||
" ('butter', 'NN')]"
|
||||
]
|
||||
},
|
||||
"execution_count": 17,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"nltk.pos_tag(nltk.word_tokenize(ingredients[0][5]))"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
data_root = "./data/1M_recipes/"
|
||||
one_million_recipes_file = data_root + "layer1.json"
|
||||
data_root = "./data/"
|
||||
one_million_recipes_file = data_root + "1M_recipes/layer1.json"
|
||||
yummly_train = data_root + "Yummly/train.json"
|
||||
|
163
yummly_ingredients_list.ipynb
Normal file
163
yummly_ingredients_list.ipynb
Normal file
@ -0,0 +1,163 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from json_buffered_reader import JSON_buffered_reader as JSON_br\n",
|
||||
"\n",
|
||||
"import settings"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"* load all ingredients from the yummly dataset and merge them into a huge set"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"ingredients = []\n",
|
||||
"ingredient_count = {}\n",
|
||||
"\n",
|
||||
"min_count = 100"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for recipe in JSON_br(settings.yummly_train):\n",
|
||||
" for ingredient in recipe['ingredients']:\n",
|
||||
" if ingredient in ingredient_count:\n",
|
||||
" ingredient_count[ingredient] += 1\n",
|
||||
" if ingredient_count[ingredient] == min_count:\n",
|
||||
" ingredients.append(ingredient)\n",
|
||||
" else:\n",
|
||||
" ingredient_count[ingredient] = 1\n",
|
||||
" \n",
|
||||
" "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"all_ingredients_set = set(ingredients)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"648"
|
||||
]
|
||||
},
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"len(all_ingredients_set)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"* save to python file:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"filename = 'cooking_ingredients.py'"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"file_obj = open(filename,'w')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"file_obj.write(\"#!/usr/bin/env python3\\n\")\n",
|
||||
"\n",
|
||||
"file_obj.write(\"\\ningredients = [\\n\")\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"first_item = ingredients[0]\n",
|
||||
"\n",
|
||||
"file_obj.write(' \"' + first_item + '\"')\n",
|
||||
"for ingredient in ingredients[1:]:\n",
|
||||
" file_obj.write(',\\n \"' + ingredient + '\"')\n",
|
||||
"\n",
|
||||
"file_obj.write(\"\\n]\\n\")\n",
|
||||
"\n",
|
||||
"file_obj.close()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"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.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
Loading…
Reference in New Issue
Block a user