Sorry for bad English :(
Suppose i can preliminary organize recipes and ingredients data in any way.
How can i effectively conduct search of recipes by user-provided ingredients, preferably sorted by max match - so, first going recipes that use maximum of provided ingridients and do not contain any other ingrs, after them recipes that uses less of provided set and still not any other ingrs, after them recipes with minimum additional requirements and so on?
All i can think about is represent recipe ingridients like bitmasks, and compare required bitmask with all recipes, but it is obviously a bad way to go.
And related things like Levenstein distance i don't see how to use here.
I believe it should be quite common task...
SuperCook is one of the best ways to reduce food waste in the home. It finds recipes that use as many of your ingredients as possible, so nothing goes to waste. SuperCook makes food waste prevention fun and easy, just open the menu page on the app and choose a recipe.
: SuperCook allows you to start by selecting ingredients you already have on hand from several categories (dairy, seasoning, soup and more). When you add available ingredients, SuperCook suggests recipes, updating results for each new item you include.
A: Chefs and restaurants are used to getting recipe requests these days and will typically comply with pleasure. It will help if you can be specific, perhaps in a follow-up email, with how many servings you're interested in.
It sounds like you're talking about sets - "available ingredients" is one set, and you want to find all recipes whose ingredients form a subset of that, ordered by size. Sets are efficiently implemented as balanced trees or hashtables.
It gets a bit more complicated when you want to address different amounts of ingredients.
Edit: If your recipe data is stored in an SQL database, it should actually be possible to do the the whole thing efficiently as an SQL query (which will use hastables and trees internally). But it's going to be a pretty complex query; better ask someone who's better at SQL than me (and of course your actual table structre is necessary).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With