UPDATE: I updated the random dictionary, and made a stand along webpage for my Random Recipe Generator
Tonight I think you should cook:
Click on the text above, and click any button to generate a new recipe.
Most interesting and innovative recipe ideas come for non-conventional combinations of existing ingredients and ideas. So what better way to come up with unbiased combinations that a recipe title generated by a machine that has no understanding of cooking or food?
For everyone just interested in unusual and often utterly ludicrous recipe suggestions, no need to read any further. For technical details of how my first attempt at a random recipe generator works keep going!
Of course any sentence generation algorithm needs at least some understanding of the English language in order to come up with sentences that actually make sense. The problem of the typical approach, which is using an existing corpus of text (i.e. recipe titles) to train the transition matrix of a Markov chain generator, is that it inevitably introduces all the biases already present in the input data. So the probability of ‘deep-fried’ being followed by ‘salad’ will be zero, but grammatically it’s fine and also plausible in a culinary sense (and maybe delicious?).
So my first attempt involves classifying commonly used words in recipes as either: ingredient, technique, adjective, linker or product, and then manually generating a transition matrix between these different types of words (along with some increasing probability of ending the recipe if it makes sense). So the transition matrix says that an adjective can be followed by and ingredient (e.g. spicy courgette) but not by a technique (e.g. sour deep-fried).
Then once we’ve generated a string of word types e.g:
ingredient linker adjective ingredient linker ingredient
We can randomly pick a word of the right category for each entry to complete the recipe:
Seaweed topped with warm pork and mustard
And generally it seems to work fairly well, there are a few things which come out strange, and the lists of words have to be manually assigned but as a first attempt it comes up with a decent number of interesting (and ridiculous) recipe ideas.