Algorithmic recipes: Difference between revisions
(→==) |
No edit summary |
||
Line 61: | Line 61: | ||
See our scrapes here: [http://pantry.algorithmickitchen.org:8000/tree pantry.algorithmickitchen.org:8000/] | See our scrapes here: [http://pantry.algorithmickitchen.org:8000/tree pantry.algorithmickitchen.org:8000/] | ||
==HOT Algorithms== | |||
[[File:SichuanCucumber.png|400px]] | |||
FROM recipes | |||
WHERE | |||
Description LIKE “%spicy%” | |||
AND description LIKE “%salad%”; | |||
ID 1026 | |||
u’Chunky bacon and cucumber salad’ | |||
u’A spicy Sichuan-style salad of cucumber and fried bacon.’ | |||
Serves 6 | |||
PT30M | |||
PT10M | |||
re = store.find(Recipe, Recipe.id == 1026).any() | |||
print “name”, re.name | |||
#print “photo url”, fs.photo.url | |||
print re.ingredients.count() | |||
print re.ingredients.count() | |||
for i in re.ingredients: | |||
print i.name | |||
name Chunky bacon and cucumber salad | |||
16 | |||
16 | |||
3 tbsp groundnut oil | |||
18 long dried chillies | |||
6 tsp Sichuan peppercorns | |||
3 whole star anise (optional) | |||
300g smoked lardons, cut into 1cm/½in thick pieces | |||
3 red chilli, de-seeded, finely chopped | |||
3 tbsp Shaoxing rice wine or dry sherry | |||
6 tbsp clear rice vinegar or cider vinegar | |||
6 tbsp toasted sesame oil | |||
600g cucumber, halved lengthways, de-seeded and sliced into 1cm/½in thick wedges | |||
pinch sea salt | |||
3 pinches dried chilli flakes | |||
3 tbsp lime juice | |||
3 tbsp chilli oil | |||
3 small handful fresh coriander leaves, roughly chopped dry-roasted peanuts (optional) | |||
%%sqlite cookbook.db | |||
SELECT id, ordinal, description FROM preparations WHERE recipe_id = 1026 ORDER BY ordinal; | |||
id ordinal description | |||
8652 1 u’Heat a wok until smoking and add the groundnut oil, then add the dried chillies and | |||
Sichuan peppercorns. Stir fry for a few seconds, or until fragrant. ‘ | |||
8653 2 u’Add the star anise (if using), bacon lardons and chilli and stir fry for | |||
2-3 minutes, or until the lardons have turned golden-brown at the edges.’ | |||
8654 3 u’Add the rice wine or sherry, vinegar and sesame oil and stir-fry for a few seconds, | |||
then add the cucumber and stir-fry for a few more seconds.’ | |||
8655 4 u’Season with sea salt, dried chilli flakes and lime juice, stirring well.’ | |||
8656 5 u’Pile the stir-fry onto a serving plate, drizzle over the chilli oil, garnish | |||
with the chopped coriander, sprinkle over some peanuts, if using, and serve | |||
immediately.’ | |||
See our scrapes here: [http://pantry.algorithmickitchen.org:8000/tree pantry.algorithmickitchen.org:8000/] | |||
[[Category:HDSA2015]] | |||
[[Category:Print]] | |||
[[Category:DIY Manual]] | [[Category:DIY Manual]] | ||
[[Category: | [[Category:Ready to be published]] | ||
Revision as of 14:41, 22 November 2015
Algorithmic Chicken Soup
The Human/Machine Recipe Collaboration
import re import operator verbMap = {} adjMap = {} otherMap = {} o = store.find(Recipe, Recipe.name.like(u'%onions%')) for r in o: for i in r.ingredients: #print i.name l = i.name.split() for j in l: s = re.sub('[^A-Za-z]+', , j) if s.endswith('ly'): if s in adjMap: adjMap[s] += 1 else: adjMap[s] = 1 elif s.endswith('ed') or s.endswith('ing'): if s in verbMap: verbMap[s] += 1 else: verbMap[s] = 1 else: if s in ingMap: ingMap[s] += 1 else: ingMap[s] = 1 #for key, value in ingMap.iteritems(): # print key, value sortedAdj = sorted(adjMap.keys(), key=lambda key: adjMap[key], reverse=True) for ing in sortedAdj: print ing print "------" sortedVerbs = sorted(verbMap.keys(), key=lambda key: verbMap[key], reverse=True) for ing in sortedVerbs: print ing print "------" sortedIng = sorted(ingMap.keys(), key=lambda key: ingMap[key], reverse=True) for ing in sortedIng: print ing
The Output
- freshly chopped onions
- finely sliced olives
- thinly peeled potatos
- roughly halved chicken
- thickly grated garlic
The End...Eat! See our scrapes here: pantry.algorithmickitchen.org:8000/
HOT Algorithms
FROM recipes WHERE Description LIKE “%spicy%” AND description LIKE “%salad%”;
ID 1026 u’Chunky bacon and cucumber salad’ u’A spicy Sichuan-style salad of cucumber and fried bacon.’ Serves 6 PT30M PT10M
re = store.find(Recipe, Recipe.id == 1026).any() print “name”, re.name
- print “photo url”, fs.photo.url
print re.ingredients.count()
print re.ingredients.count()
for i in re.ingredients: print i.name
name Chunky bacon and cucumber salad 16 16 3 tbsp groundnut oil 18 long dried chillies 6 tsp Sichuan peppercorns 3 whole star anise (optional) 300g smoked lardons, cut into 1cm/½in thick pieces 3 red chilli, de-seeded, finely chopped 3 tbsp Shaoxing rice wine or dry sherry 6 tbsp clear rice vinegar or cider vinegar 6 tbsp toasted sesame oil 600g cucumber, halved lengthways, de-seeded and sliced into 1cm/½in thick wedges pinch sea salt 3 pinches dried chilli flakes 3 tbsp lime juice 3 tbsp chilli oil 3 small handful fresh coriander leaves, roughly chopped dry-roasted peanuts (optional)
%%sqlite cookbook.db SELECT id, ordinal, description FROM preparations WHERE recipe_id = 1026 ORDER BY ordinal;
id ordinal description 8652 1 u’Heat a wok until smoking and add the groundnut oil, then add the dried chillies and Sichuan peppercorns. Stir fry for a few seconds, or until fragrant. ‘ 8653 2 u’Add the star anise (if using), bacon lardons and chilli and stir fry for 2-3 minutes, or until the lardons have turned golden-brown at the edges.’ 8654 3 u’Add the rice wine or sherry, vinegar and sesame oil and stir-fry for a few seconds, then add the cucumber and stir-fry for a few more seconds.’ 8655 4 u’Season with sea salt, dried chilli flakes and lime juice, stirring well.’ 8656 5 u’Pile the stir-fry onto a serving plate, drizzle over the chilli oil, garnish with the chopped coriander, sprinkle over some peanuts, if using, and serve immediately.’
See our scrapes here: pantry.algorithmickitchen.org:8000/