At the beginning of the confinement (March 2020), I had to cook a lot at home, and I wondered how I could help myself find new ideas, without having to spend time looking at recipes online?
The ideal goal would be an assistant that knows what food I have in my fridge and cupboards, and suggests me recipes that only needs few or no more ingredients. But that is not my project. I like the agile methodology, and I proceed by iterations – so I started small.
I looked online and rtlee9 on GitHub already created a Python scraper of three recipe websites : FoodNetwork.com, EpiCurious.com, AllRecipes.com.
I thought it wouldn’t be necessary to generate a recipe from scratch – I already know how to cook, I don’t need a step-by-step, but I do need ideas for combinations of ingredients and potential results to diversify what I eat every day.
So, I used this data set to get a list of all possible ingredients. I spent a lot of time processing it because the recipes are user based and contain many ways to refer to the same food.
Then I stored like 1 points for each unique pair of food that I saw in each recipe. The idea is to get a coefficient that measures whether one ingredient goes well with another.
In order to improve these coefficients, and create activity on the Facebook Page, I added a “Food Versus” system. People could vote for food combinations using Facebook reactions. After 48 hours, the votes are extracted and the coefficients of each food are updated.
For now, it’s still a baby project – but I like the fact that it is improving “by itself” every day.
How to improve:
- Right now, my coefficients are stored in a local file (hey, it’s MVP!) – I should put them in a database
- Given the combinations of ingredients, write down the names of potential recipes. This can help to “project” the type of recipes we could make with these ingredients.
- The system could take ingredients as input. I could ask it to suggest me recipes with tomatoes and eggplants (given I have them at home). This could work well on Twitter.
- Gather more data. hhursev on GitHub open-sourced a Python scraper for more than one hundred recipe websites, which could be really useful for me, and may even open the doors of Deep Learning for this project…