Recipe generation method and device, equipment and storage medium
By obtaining and updating recipe generation parameters and dish preference data, generating the seventh dish list and finally generating the recipe, the problem that recipes in the existing technology cannot meet the preferences of dining personnel is solved, and a more personalized recipe generation is achieved.
Patent Information
- Application Number
- CN202411448145.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-16
- Publication Date
- 2025-02-25
AI Technical Summary
The existing recipe generation method does not fully consider the preferences of the dining staff, resulting in the generated recipes being unable to effectively meet the needs of the dining staff.
By obtaining recipe generation parameters and dish preference data, a list of the seventh dish is generated based on these parameters, and the dish preference data is updated, and the recipes are finally generated to meet the preferences of the dining staff.
This comprehensive consideration of the preferences of dining personnel during the recipe generation process is achieved to ensure that the generated recipes can better meet the needs of dining personnel.
Smart Images

Figure CN119515607A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a recipe generation method, apparatus, device and storage medium. Background Art
[0002] At present, when generating recipes, a certain day is usually selected first, and then the chef selects dishes from the dish library based on personal experience, and finally generates a recipe based on the dishes selected by the chef. Since the existing recipes are generated based on the chef's personal experience each time, the preferences of the diners are not taken into account, which makes the recipes unable to better meet the preferences of the diners. Therefore, how to make the generated recipes better meet the preferences of the diners is a technical problem that needs to be solved urgently by those skilled in the art. Summary of the invention
[0003] In view of this, the present disclosure proposes a recipe generation method, device, equipment and storage medium, which can enable the generated recipe to meet the preferences of diners.
[0004] According to a first aspect of the present disclosure, a method for generating a recipe is provided, comprising:
[0005] Get recipe generation parameters and dish preference data;
[0006] Generate a seventh dish list based on the recipe generation parameters and the dish list of the preset dish library;
[0007] updating the dish preference data based on the seventh dish list to obtain updated dish preference data;
[0008] A recipe is generated based on the seventh dish list and the updated dish preference data.
[0009] In one possible implementation, the recipe generation parameters include: essential dishes for a meal, types and quantities of dishes for a meal, a parameter for non-repetition of dishes, a food quantity parameter, a seasonal characteristic parameter, a parameter for excluding specific ingredients, a parameter for non-repetition of ingredients, a spiciness parameter, a conflict taboo configuration parameter, and at least one of the unit meal expense standards.
[0010] In a possible implementation, when generating the seventh dish list based on the recipe generation parameters and the dish list of the preset dish library, the method includes:
[0011] The seventh dish list is generated by adding or excluding dishes that meet the recipe generation parameters from the dish list of the dish library.
[0012] In a possible implementation, when the dish preference data is updated based on the seventh dish list to obtain updated dish preference data, the method includes:
[0013] Filtering the dishes in the seventh dish list from the dish preference data as first target favorite dishes;
[0014] The dish preference data is updated based on the first target favorite dish to obtain updated dish preference data.
[0015] In a possible implementation, when generating a recipe based on the seventh dish list and the updated dish preference data, the process includes:
[0016] Excluding the updated dish preference data from the seventh dish list to obtain an updated seventh dish list;
[0017] generating a first recipe based on the updated seventh dish list;
[0018] Filtering a set number of dishes satisfying the conflict taboo configuration parameters from the updated dish preference data as second target preference dishes;
[0019] Using the second target favorite dish, updating the first recipe to obtain a second recipe;
[0020] The second recipe is processed with conflict taboos according to the conflict taboo configuration parameters to obtain a final recipe.
[0021] In a possible implementation, after generating the recipe, the method further includes:
[0022] Obtaining spicy dishes that meet the spicy parameter and are excluded when generating the seventh dish list;
[0023] Selecting a set number of dishes that meet the conflict taboo configuration parameters from the spicy dishes as special spicy dishes;
[0024] The recipe is updated using the special spicy dishes.
[0025] In a possible implementation, after generating the recipe, the method further includes:
[0026] The recipe is processed for non-repetitive ingredients according to the non-repetitive ingredient parameter to obtain a final recipe.
[0027] According to a second aspect of the present disclosure, a device for generating a recipe is provided, comprising:
[0028] A data acquisition module is used to obtain recipe generation parameters and dish preference data;
[0029] a seventh dish list generating module, configured to generate a seventh dish list based on the recipe generating parameters and a dish list of a preset dish library;
[0030] a dish preference data updating module, configured to update the dish preference data based on the seventh dish list to obtain updated dish preference data;
[0031] A recipe generation module is used to generate a recipe based on the seventh dish list and the updated dish preference data.
[0032] According to a third aspect of the present disclosure, a recipe generating device is provided, comprising: a processor; and a memory for storing processor executable instructions; wherein the processor is configured to execute the method described in the first aspect of the present disclosure.
[0033] According to a fourth aspect of the present disclosure, a non-volatile computer-readable storage medium is provided, on which computer program instructions are stored, wherein the computer program instructions, when executed by a processor, implement the method described in the first aspect of the present disclosure.
[0034] In the present disclosure, a recipe generation method, device, equipment and storage medium are provided, the method comprising: obtaining recipe generation parameters and dish preference data; generating a seventh dish list based on the recipe generation parameters and a dish list of a preset dish library; updating the dish preference data based on the seventh dish list to obtain updated dish preference data; generating a recipe based on the seventh dish list and the updated dish preference data. The method of the present disclosure can generate a recipe based on the preferences of diners, so that the generated recipe can meet the preferences of diners.
[0035] Further features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the disclosure and, together with the description, serve to explain the principles of the disclosure.
[0037] Figure 1 A flowchart showing a recipe generation method according to an embodiment of the present disclosure is shown;
[0038] Figure 2 A schematic block diagram of a recipe generating device according to an embodiment of the present disclosure is shown;
[0039] Figure 3 A schematic block diagram of a recipe generating device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0040] Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.
[0041] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.
[0042] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present disclosure.
[0043] <Method Example>
[0044] Figure 1 A flowchart of a recipe generation method according to an embodiment of the present disclosure is shown. The method is applicable to recipe generation in scenarios such as canteens and restaurants. Figure 1 As shown, the method includes steps S1100-S1400.
[0045] S1100, obtaining recipe generation parameters and dish preference data.
[0046] In one possible implementation, the recipe generation parameters may include: essential dishes for a meal, types and quantities of dishes for a meal, parameters for non-repetition of dishes, food quantity parameters, seasonal characteristic parameters, parameters for excluding specific ingredients, parameters for non-repetition of ingredients, spiciness parameters, conflict taboo configuration parameters and at least one of the unit meal expense standards.
[0047] Among them, the essential dishes for each meal are used to specify the dishes that must be included in every meal, such as steamed buns and rice.
[0048] The types and quantities of dishes for a meal are used to specify the types of dishes included in each meal and the number of dishes generated for each dish. The dishes that are essential for a meal are not included in this parameter.
[0049] The dish non-repetition parameter is used to specify the dish non-repetition cycle in the recipe. Within the dish non-repetition cycle, the same dish can only appear once.
[0050] Seasonal characteristic parameters are used to specify that dishes that do not conform to the seasonal characteristics of the season should be excluded when generating recipes. For example, in winter, dishes that do not conform to the seasonal color of winter, such as jelly and watermelon, need to be excluded.
[0051] The Exclude Specific Ingredients parameter is used to specify specific ingredients that cannot be included in the dishes in the recipe.
[0052] The ingredient non-repetition parameter is used to limit the generation of only one dish containing the specified ingredients within a specified time.
[0053] The spiciness parameter is used to specify the spiciness of the dishes generated in the daily recipe and the number of dishes of the corresponding spiciness. It can also specify the generation of dishes of a specific spiciness.
[0054] The conflict taboo configuration is used to specify ingredients that will not conflict in the dishes generated in the daily recipes.
[0055] The food quantity parameter is used to specify the types of ingredients that must be included in the dishes generated in the daily recipe.
[0056] The unit food expense standard is used to specify the cost of ingredients corresponding to the daily menu.
[0057] The above recipe generation parameters can be pre-configured in a preset manner and stored in the system for executing the method of the present disclosure. In this way, when the method of the present disclosure is executed, the configured recipe generation parameters can be directly read from the system.
[0058] The dish preference data may include at least one of the preference selection and evaluation of the ordered dishes by all diners in the cafeteria and the sales volume of each dish in the cafeteria. The dish preference data may be collected through a human-computer interaction interface and stored in a system that executes the method of the present disclosure, so that when the method of the present disclosure is executed, the dish preference data may be directly read from the system.
[0059] After obtaining the recipe generation parameters and the food preference data, step S1200 may be executed to generate a seventh food list list7 based on the recipe generation parameters and the food list of the preset food library.
[0060] First of all, it should be noted that a dish library is pre-set in the system, which collects a large number of dishes, and corresponding dish attributes are set for each collected dish. The dish attributes may include: dish category, main nutritional information and other trace element information, food ingredient list and ingredient ratio, and at least one of other attributes. Among them, the dish category may include: meat dishes (full meat, big meat, small meat, etc.), vegetarian dishes, cold dishes, staple foods (grains, fancy staple foods, etc.), soups, fruits, beverages (dairy products, carbonated beverages, etc.), medicinal cuisine, special dishes (ethnic characteristics, case characteristics, etc.), etc. The main nutritional information may include: the content information of the main nutrients such as calories, protein, fat, carbohydrates, dietary fiber and cholesterol in the dishes. Other trace element information may include: the content information of trace elements such as vitamins, calcium, iron, sodium, etc. in the dishes. The food ingredient list may include the main ingredients, auxiliary ingredients and seasonings used to make up the dishes. The ingredient ratio includes the ratio of various ingredients. Other attributes may include: production process, production steps, color, spiciness, seasonal characteristics, production video and cuisine, etc.
[0061] Based on the obtained recipe generation parameters and in combination with the dish list in the preset dish library (the dish list includes all the dish names collected in the dish library), the seventh dish list list7 can be generated. Specifically, the seventh dish list list7 can be generated by adding or excluding dishes that meet the recipe generation parameters from the dish list in the dish library.
[0062] In a possible embodiment, the recipe generation parameters include a parameter for no repetition of dishes, a parameter for a certain amount of food, a parameter for seasonal characteristics, a parameter for excluding specific ingredients, a parameter for no repetition of ingredients, and a parameter for spiciness. In this embodiment, when generating the seventh dish list list7, the following steps may be included:
[0063] S1210, obtaining a dish non-repetition parameter, extracting a dish non-repetition period from the dish non-repetition parameter, and obtaining dishes that have been generated within the dish non-repetition period to form a first dish list list1.
[0064] S1220, excluding the first dish list list1 from the dish list in the preset dish library to obtain the second dish list list2.
[0065] S1230, determining whether the ingredients of each dish in the second dish list list2 include the type of ingredients specified in the food quantitative parameter, and excluding the dish if not. Specifically, when reading the second dish list list2, the ingredient list of each dish in the second dish list list2 is queried in association, and it is determined whether the ingredient list of each dish includes the type of ingredients specified in the food quantitative parameter, and excluding the dish if not.
[0066] S1240, according to the seasonal characteristic parameters, exclude the dishes in the second dish list list2 that do not meet the seasonal characteristics of the current season, and obtain the third dish list list3. Specifically, when generating a recipe, the current time of generating the recipe can be obtained, and the current season of generating the recipe can be determined according to the current time of generating the recipe. When reading the second dish list list2, the seasonal characteristics of each dish in the second dish list list2 can be associated and queried, that is, the season applicable to the dish, and it can be determined whether the season applicable to each dish in the second dish list list2 is the same as the current season. In different cases, it is excluded, thereby obtaining the third dish list list3.
[0067] S1250, based on the specific ingredients specified in the exclusion specific ingredients parameter, generate a list of specific ingredients iList1 that needs to be excluded, and exclude the dishes including the ingredients in the specific ingredient list iList1 from the third dish list list3, to obtain a fourth dish list list4. Specifically, when reading the third dish list list3, the ingredient list of each dish in the third dish list list3 can be associated and queried, and then it can be determined whether the ingredient list of each dish includes the specific ingredients that need to be excluded in the specific ingredient list iList1. If included, exclude it from the third dish list list3. After processing each dish in the third dish list list3, the fourth dish list list4 can be obtained.
[0068] S1260, based on the parameter of non-repetitive ingredients, obtain a list of non-repeatable ingredients rList1 within the specified time, and based on the non-repeatable ingredient list rList1 as a condition, obtain a list of ingredients iList2 that have been used within the specified time, and exclude the dishes including the ingredients in the ingredient list iList2 that have been used within the specified time from the fourth dish list list4, to obtain the sixth dish list list6.
[0069] S1270, according to the spiciness parameter, exclude dishes with a specified spiciness from the sixth dish list list6, so as to obtain the seventh dish list list7.
[0070] After obtaining the seventh dish list list7, step S1300 may be executed to update the dish preference data based on the seventh dish list list7 to obtain updated dish preference data. The specific steps may include:
[0071] S1310, select dishes existing in the seventh dish list list7 from the dish preference data as first target favorite dishes. Specifically, first select the top n dishes from the dish preference data to form a dish preference data list, and obtain the dishes existing in the seventh dish list list7 from the dish preference data list as the first target favorite dishes, that is, the first target favorite dishes are dishes existing in both the dish preference data and the dish preference data list.
[0072] S1320: Update the dish preference data based on the first target favorite dish to obtain updated dish preference data. Specifically, assign the first target favorite dish to the dish preference data list to obtain updated dish preference data.
[0073] In an embodiment in which the dish preference data includes the preference choices of all diners in the cafeteria for the ordered dishes and the sales volume of each dish in the cafeteria, when the dish preference data is updated based on the seventh dish list list7 to obtain updated dish preference data, it includes: updating the preference selection data and the sales volume data based on the seventh dish list list7 respectively to obtain updated preference selection data and updated sales volume data.
[0074] Specifically, when the preference selection data is updated based on the seventh dish list list7 to obtain the updated preference selection data, the following steps may be included: first, the top n dishes are screened out from the preference selection data to form a preference selection data list yList1, and the dishes in the dish preference data list yList1 that exist in the seventh dish list list7 are obtained as the first target preference selection dishes; secondly, the first target preference selection dishes are assigned to the preference selection data list yList1, so that the update of the preference selection data can be completed, and the final updated preference selection data is the assigned preference selection data list yList1.
[0075] Next, the sales data is updated based on the seventh dish list list7 to obtain updated sales data. Specifically, the following steps may be included: first, the top n dishes are screened out from the sales data to form a sales data list yList2, and the dishes in the seventh dish list list7 in the sales data list yList2 are obtained as the first target sales dishes; secondly, the first target sales dishes are assigned to the sales data list yList2, and the sales data can be updated. The final updated sales data is the assigned sales data list yList2.
[0076] After the update of the dish preference data is completed, step S1400 may be executed to generate a recipe based on the seventh dish list and the updated dish preference data. Specifically, the following steps may be included:
[0077] S1410, excluding the updated dish preference data from the seventh dish list to obtain an updated seventh dish list. Specifically, in an embodiment where the dish preference data includes the preferences of all diners in the cafeteria for the ordered dishes and the sales volume of each dish in the cafeteria, the dishes in the updated preference selection data yList1 and the updated sales data yList2 are excluded from the seventh dish list to obtain an updated seventh dish list, that is, the updated seventh dish list does not include the dishes in the updated preference selection data yList1 and the updated sales data yList2.
[0078] S1420, generate the first recipe based on the updated seventh dish list. Specifically, first group the dishes in the updated seventh dish list according to the dish category to obtain the structure map2, the primary key of map2 is the dish category, and the value is the dish list corresponding to the category. Then, generate the structure map3 according to the meal dish category and quantity parameters, the primary key of map3 is the dish category, and the value is the number of dishes corresponding to the category. Then, create the structure map4, the primary key of map4 is the dish category, and the value is an empty dish list. Then, traverse the structure map3, obtain the primary key (dish category key) and the corresponding value (quantity values1) in map3 in turn, obtain the dish list values2 with the same primary key and key from map2, randomly obtain the dish list values3 with the corresponding quantity values1 from the list values2, and store value3 in the list with the same primary key and key in map4. After the traversal is completed, the construction of map4 is completed, and the constructed map4 is the first recipe. At the same time, after completing the construction of map4, it is necessary to exclude the dishes that have been added to map4 from the updated seventh dish list, so as to complete the further update of the seventh dish list, that is, the seventh dish list that needs to be always updated in subsequent steps does not include dishes that have been used.
[0079] S1430, selecting a set number of dishes that meet the conflict taboo configuration parameters from the updated dish preference data as second target preference dishes, and using the second target preference dishes to update the first recipe to obtain a second recipe.
[0080] When selecting a set number of dishes that meet the conflict taboo configuration parameters from the updated dish preference data as the second target preference dishes, the following steps may be included: First, based on the conflicting ingredients specified in the conflict taboo configuration that cannot appear on the same day, a conflict taboo ingredient list ilist3 is generated, and the conflict taboo ingredient list ilist3 includes all possible conflict taboo ingredients. For example, when the conflicting ingredients are beef and pork, the generated conflict taboo ingredient list ilist3 will include beef and pork, two conflicting taboo ingredients. Next, determine whether there are dishes using conflicting taboo ingredients in the conflict taboo ingredient list ilist3 in the updated dish preference data: if so, select one ingredient from the two conflicting conflict taboo ingredients as the reserved ingredient p1, select a dish including the reserved ingredient p1 from the updated dish preference data, and select m-1 dishes that do not include the reserved ingredient p1 and do not conflict as the second target preference dishes. For example, the updated dish preference data includes both dishes with beef as an ingredient and dishes with pork as an ingredient. At this time, beef will be selected from beef and pork as the reserved ingredient p1 according to actual needs, and then a dish including beef will be selected from the updated dish preference data and m-1 dishes that do not include beef and do not conflict with beef (i.e., do not include pork) will be selected as the second target favorite dish. If it does not exist, m dishes will be directly selected from the updated dish preference data as the second target favorite dishes. Among them, the number m represents the number of favorite dishes that need to be added to the recipe, and this number can be set according to specific needs.
[0081] After obtaining the second target favorite dish, the first recipe is updated using the second target favorite dish to obtain the second recipe. The specific steps are as follows: First, the second target favorite dish is assigned to the updated dish preference data to complete the further update of the dish preference data. Then, the latest updated dish preference data is classified according to the dish type, and the number of dishes of each type is determined. Finally, according to the dish type and quantity included in the latest updated dish preference data, the dishes of the corresponding dish type and quantity in the first recipe are replaced to obtain the second recipe. For example, the latest updated dish preference data includes 1 big meat dish braised spareribs and 1 vegetarian dish assorted vegetables. Then, it is necessary to randomly select a dish from the dish list corresponding to the big meat of the first recipe to delete it and replace it with the braised spareribs in the dish preference data, and randomly select a dish from the dish list corresponding to the vegetarian dish of the first recipe to delete it and replace it with the assorted vegetables in the dish preference data. After completing the above replacement, the recipe obtained is the second recipe.
[0082] In an embodiment in which the dish preference data includes preference selection and sales volume, the updated dish preference data includes updated preference selection data yList1 and updated sales data yList2, and a set number of dishes that meet the conflict taboo configuration parameters are screened out from the updated dish preference data as second target preference dishes, and the second target preference dishes are used to update the first recipe to obtain the second recipe, including: screening out a set number of dishes that meet the conflict taboo configuration parameters from the updated preference selection data as the second target preference selection dishes; screening out a set number of dishes that meet the conflict taboo configuration parameters from the updated sales volume data as the second target sales dishes; and updating the first recipe based on the second target preference selection dishes and the second target sales dishes to obtain the second recipe.
[0083] Specifically, for the updated preference selection data yList1, a conflicting taboo ingredient list ilist3 is generated according to the conflicting ingredients specified in the conflicting taboo configuration that cannot appear on the same day. Next, determine whether there is a dish using the conflicting taboo ingredients in the conflicting taboo ingredient list ilist3 in the updated preference selection data yList1: if so, select one ingredient from the two conflicting conflicting taboo ingredients as the reserved ingredient p1, select a dish including the reserved ingredient p1 from the updated preference selection data yList1, and select m-1 dishes that do not include the reserved ingredient p1 and do not conflict as the second target preference selection dishes. If not, directly select m dishes from the updated preference selection data yList1 as the second target preference selection dishes. Assign the second target preference selection dishes to the updated preference selection data yList1 to complete the further update of the preference selection data yList1. Then, the newly updated preference selection data yList1 is classified according to the type of dishes, and the number of dishes of each type is determined. Finally, according to the types and quantities of dishes included in the latest updated preference selection data yList1, the dishes of corresponding types and quantities in the first recipe are replaced to obtain an updated first recipe. The process of updating the first recipe is described above and will not be repeated here.
[0084] Further, for the updated sales data yList2, determine whether there is a dish using the conflicting taboo ingredients in the conflicting taboo ingredients list ilist3 in the sales data yList2: if there is, select one of the two conflicting taboo ingredients as the reserved ingredient p1, select a dish including the reserved ingredient p1 from the sales data yList2, and select m-1 dishes that do not include the reserved ingredient p1 and do not conflict as the second target sales dish. If not, directly select m dishes from the sales data yList2 as the second target sales dish. Assign the second target sales dish to the updated dish sales data yList2 to complete the further update of the dish sales data yList2. Then, the latest updated dish sales data yList2 is classified according to the dish category, and the number of dishes of each category is determined. Finally, according to the dish category and quantity included in the latest updated dish sales data yList2, the dishes of the corresponding dish category and quantity other than the newly updated preference selection in the updated first recipe are replaced to obtain the final second recipe.
[0085] In this way, favorite dishes and dishes with good sales that meet the conflict taboo configuration parameters can be updated to the recipe, so that the recipe can better meet the preferences of diners.
[0086] S1440, performing conflict taboo processing on the second recipe according to the conflict taboo configuration parameters to obtain a final recipe. Specifically, the conflict taboo processing process is as follows:
[0087] Determine whether there are dishes in the second recipe that use the conflicting taboo ingredients in the conflicting taboo ingredient list ilist3. If not, directly output the second recipe as the final recipe; if so, select a conflicting taboo ingredient and assign it to p1, and execute the following conflicting taboo processing steps to output the final recipe.
[0088] In a possible implementation, the conflict taboo processing step may include:
[0089] First, create a structure map5, in which the primary key is ingredients, which is used to store ingredients in the conflicting taboo ingredient list ilist3, and the value is the dish in the second recipe that uses the ingredients in the taboo ingredient list ilist3. The specific creation process includes: 1) Create an empty table of structure map5 with the primary key as ingredients and the value as the list of dishes containing the ingredients; 2) Traverse the conflicting taboo ingredient list ilist3, and for the current ingredient name item1 traversed, determine whether the primary key in map5 contains item1, and if it does, obtain its value values1, and if it does not, create values1, and add data with the primary key item1 and the value values1 in map5; then, traverse the dish list xList3 composed of dishes in the second recipe, and for the current dish item2 traversed, determine whether the dish item2 includes the current ingredient item1, and if it does, add dish item2 to values1. After completing the traversal of all dishes in the dish list xList3, all dishes in the second recipe that include the current ingredient name item1 can be assigned to values1. After the traversal of the ingredients in the forbidden ingredient list ilist3 is completed, the dishes in the second recipe that include ingredients in the forbidden ingredient list ilist3 can be classified and stored in map5 according to the conflicting forbidden ingredients they include, completing the construction of map5.
[0090] Secondly, exclude the primary keys and corresponding values whose primary keys are not equal to p1 from map5 to obtain structure map6.
[0091] Next, based on map6, exclude the dishes in the second recipe that do not meet the conflict taboo configuration. Specifically, 1) create an excluded dish list iList4, and create an excluded ingredient list iList5; 2) traverse map6, obtain the primary key (excluded ingredient name key) and value (excluded dish list value), add all excluded ingredient name keys in map6 to iList5, and add all excluded dish list values in map6 to iList4; 3) Create a "food conflict excluded dish category and quantity" structure map7, the primary key is the dish category, the value is the number of dishes excluded under this category, and map7 is an empty table at this time; 4) traverse iList4, obtain the dish category of the traversed dish, and determine whether the dish category exists in the primary key of map7. If it exists, add 1 to its value. If it does not exist, add data with the key of the dish category and the value of 1 to map7. After the traversal is completed, the classification statistics of all excluded dishes in iList4 will be completed in map7 to obtain the excluded dish category and quantity. At the same time, obtain the second recipe (ie, map4) to find the same dish category as that in map7, and remove the corresponding excluded dishes in iList4 from the value corresponding to the dish category.
[0092] Finally, the dishes in the second recipe are supplemented to get the final recipe. Specifically, 1) filter the last updated seventh dish list list7, remove the dishes whose ingredients list exists in the excluded ingredient list iList5, and get the eighth dish list list8; 2) group the eighth dish list list8 according to the dish category, and assign the result to map2; 3) traverse map7 to obtain the primary key (dish category key) and value (dish quantity value), obtain the dish list values1 with the same primary key and key from map2, obtain the dish list values2 with the same primary key and key from map4, randomly select the dish list values3 with quantity value from values1, add values3 to values2, and remove values3 from list8, so as to get the recipe after the conflict taboo configuration is processed.
[0093] In a possible implementation, after generating a recipe, a step of adding a special spicy dish to the recipe may be included, which may specifically include the following steps:
[0094] First, the spicy dishes that meet the spicy parameters and are excluded when generating the seventh dish list are obtained. Specifically, in step S1270, the spicy dishes that meet the spicy parameters and are excluded when generating the seventh dish list are formed into a spicy dish list xList2.
[0095] Secondly, select a set number of dishes that meet the conflict taboo configuration parameters from the spicy dish list xList2 as special spicy dishes. Specifically, determine whether p1 is empty: if p1 is not empty, traverse the spicy dish list xList2, obtain the spicy dish item in the spicy dish list xList2, and remove the dishes that contain the ingredients of iList5 in the ingredient list corresponding to the dish item; then select q dishes from the spicy dish list xList2 with some dishes removed as special spicy dishes. If p1 is empty, select 1 dish from the spicy dish list xList2 that contains p1 in the ingredient list and select q-1 dishes that do not contain p1 and do not conflict with ingredient p1 as special spicy dishes. Among them, q is a pre-set number of special spicy dishes that need to be added.
[0096] Finally, the recipe is updated using the special spicy dishes. Specifically, the types of special spicy dishes and the number of dishes corresponding to each category are determined, and according to the types of special spicy dishes and the number of dishes corresponding to each category, the same number of dishes under the corresponding dish category in the generated recipe are deleted and replaced with the same type and number of special spicy dishes, thereby completing the addition of special spicy dishes. For example, when the special spicy dishes include a special spicy dish of spicy diced chicken, which is a major meat dish, a dish other than the dish corresponding to the preference data can be randomly selected from the list of dishes corresponding to the major meat dish in the recipe and deleted, and the spicy diced chicken can be added to the list of dishes corresponding to the major meat dish in the recipe.
[0097] In a possible implementation, after the recipe is generated, the process further includes: performing non-repetitive processing on the recipe ingredients according to a non-repetitive ingredient parameter to obtain a final recipe. The specific steps can be as follows: 1) All dishes that make up the recipe form a dish list xList4; 2) Create a set iList6 to store the names of non-repeatable ingredients already included in the generated dishes; 3) Create a set iList7 to store the excluded dishes corresponding to the repeated ingredient names; 4) Create a structure map8 to store the types and quantities of dishes removed due to repeated ingredients, with the primary key storing the type of dish and the value storing the quantity; 5) Traverse the dish list xList4, group them according to the ingredients, and obtain map9, where the primary key is the ingredient name and the value is the dish list; 6) Traverse map9, obtain the primary key that exists in the non-repeatable ingredient list rList1, and the value of the dish list is greater than 1 and assign it to map10; 7) Traverse map10, obtain the primary key (ingredient name key) and value (dish list value), and select a dish from value (preferentially select the dish preference that has one in the dish list yList1, then select the one that has one in the sales dish list yList2, and then randomly select one ), move other dishes into iList7 and delete them from value, record key in iList6 (need to be deduplicated) 8) traverse list8 to obtain the dishes and ingredients in the list and remove iList6 to obtain list9; 9) group list8 according to the dish category and assign the result to map2; 10) group iList7 according to the dish category and assign the result to map11, the primary key is the dish category and the value is the number of categories; 11) traverse map11, get the primary key (dish category key) and value (category number value), get values1 with the same primary key and key from map2, get the list of dishes with the quantity value from values, get values2 with the same primary key and key from map4, add values1 to values2, remove values1 from list9, and complete the non-duplicate detection of ingredients. After completion, the final map4 is the final output recipe with non-duplicate ingredients.
[0098] In order to clearly illustrate the recipe generation method of the present disclosure, the recipe generation method is further illustrated below with reference to a specific example. Specifically, the recipe generation method includes the following steps:
[0099] S1, obtain recipe generation parameters and dish preference data. The recipe generation parameters include: must-have dishes for each meal, types and quantities of dishes for each meal, dish non-repetition parameters, food quantity parameters, seasonal characteristic parameters, exclusion of specific ingredients parameters, non-repetition of ingredients parameters, spiciness parameters, and conflict taboo configuration parameters. The dish preference data includes the preferences of all diners in the cafeteria for the ordered dishes and the sales volume of each dish in the cafeteria.
[0100] S2, obtaining a dish non-repetition parameter, extracting a dish non-repetition period from the dish non-repetition parameter, and obtaining dishes that have been generated within the dish non-repetition period to form a first dish list list1.
[0101] S3, excluding the first dish list list1 from the dish list in the preset dish library to obtain the second dish list list2.
[0102] S4, judging whether the ingredients of each dish in the second dish list list2 include the ingredient type specified in the food quantitative parameter, and excluding the dish if it does not include the ingredient type.
[0103] S5, according to the seasonal characteristic parameters, exclude the dishes that do not meet the seasonal characteristics in the second dish list list2, and obtain the third dish list list3.
[0104] S6, generating a specific ingredient list iList1 to be excluded according to the specific ingredients specified in the specific ingredient exclusion parameter, and excluding dishes including the ingredients in the specific ingredient list iList1 from the third dish list list3 to obtain a fourth dish list list4.
[0105] S7, according to the parameter of non-repetitive ingredients, obtain the list rList1 of non-repetitive ingredients within the specified time, and obtain the list iList2 of ingredients that have been used within the specified time based on the list rList1 of non-repetitive ingredients, and exclude the dishes including the ingredients in the list iList2 that have been used within the specified time from the fourth list of dishes list4, to obtain the sixth list of dishes list6.
[0106] S8. According to the spiciness parameter, dishes with a specified spiciness are excluded from the sixth dish list list6, so as to obtain a seventh dish list list7.
[0107] S9, filter out the top n dishes from the preference selection data to form a preference selection data list yList1, obtain the dishes in the seventh dish list list7 in the dish preference data list yList1 as the first target preference selection dishes, and reassign the first target preference selection dishes to the preference selection data list yList1 to complete the update of the preference selection data list yList1.
[0108] S10, filter out the top n dishes from the sales data to form a sales data list yList2, obtain the dishes in the seventh dish list list7 in the sales data list yList2 as the first target sales dishes, and reassign the first target sales dishes to the sales data list yList2 to complete the update of the sales data list yList2.
[0109] S11, excluding dishes in the updated preference selection data list yList1 and the updated sales data list yList2 from the seventh dish list list7 to obtain an updated seventh dish list.
[0110] S12, grouping the dishes in the updated seventh dish list according to the dish category to obtain a structure map2, where the primary key of map2 is the dish category and the value is a list of dishes corresponding to the category.
[0111] S13, generating a structure map3 according to the type and quantity parameters of the meal dishes, wherein the primary key of map3 is the type of dishes, and the value is the number of dishes corresponding to the type.
[0112] S14, create structure map4, the primary key of map4 is the dish category, and the value is an empty dish list.
[0113] S15, traverse the structure map3, obtain the primary key (dish category key) and the corresponding value (quantity values1) in map3 in turn, obtain the dish list values2 whose primary key is equal to key from map2, randomly obtain the dish list values3 whose quantity corresponds to values1 from the list values2, and store value3 in the list whose primary key is equal to key in map4. The traversal is completed, i.e. the construction of map4 is completed, and the constructed map4 is the first recipe. At the same time, after completing the construction of map4, it is necessary to exclude the dishes that have been added to map4 from the updated seventh dish list, so as to complete the further update of the seventh dish list, i.e. the seventh dish list that needs to be kept updated at all times in subsequent steps does not include dishes that have been used.
[0114] S15, generating a conflict taboo ingredient list ilist3 according to the conflicting ingredients specified in the conflict taboo configuration that cannot appear on the same day.
[0115] S16, determine whether there are dishes using conflicting taboo ingredients in the conflicting taboo ingredient list ilist3 in the updated preference selection data yList1: if there are, select one of the two conflicting taboo ingredients as the reserved ingredient p1, select a dish including the reserved ingredient p1 from the updated preference selection data yList1, and select m-1 dishes that do not include the reserved ingredient p1 and do not conflict as the second target preference selection dishes. If not, directly select m dishes from the updated preference selection data yList1 as the second target preference selection dishes. Assign the second target preference selection dishes to the updated preference selection data yList1 to complete the further update of the preference selection data yList1. Then, classify the latest updated preference selection data yList1 according to the type of dishes, and determine the number of dishes of each type. Finally, replace the dishes of the corresponding type and quantity of dishes in the first recipe according to the type and quantity of dishes included in the latest updated preference selection data yList1 to obtain an updated first recipe.
[0116] S17, determine whether there are dishes using conflicting taboo ingredients in the conflicting taboo ingredient list ilist3 in the sales data yList2: if there are, select one ingredient from the two conflicting taboo ingredients as the reserved ingredient p1, select a dish including the reserved ingredient p1 from the sales data yList2, and select m-1 dishes that do not include the reserved ingredient p1 and do not conflict as the second target sales dishes. If not, directly select m dishes from the sales data yList2 as the second target sales dishes. Assign the second target sales dishes to the updated dish sales data yList2 to complete the further update of the dish sales data yList2. Then, the latest updated dish sales data yList2 is classified according to the dish category, and the quantity of each category of dishes is determined. Finally, according to the dish category and quantity included in the latest updated dish sales data yList2, the dishes of the corresponding dish category and quantity other than the newly updated favorite selection in the updated first recipe are replaced to obtain the final second recipe.
[0117] S18, determine whether there are dishes in the second recipe that use conflicting taboo ingredients in the conflicting taboo ingredient list ilist3. If not, execute step S27; if so, select a conflicting taboo ingredient and assign it to p1, and execute step S19.
[0118] S19, creating a structure map5, in which the primary key is ingredient, which is used to store ingredients in the conflicting forbidden ingredient list ilist3, and the value is the dish in the second recipe that uses the ingredients in the forbidden ingredient list ilist3.
[0119] S20, exclude the primary keys and corresponding values whose primary keys are not equal to p1 from map5, and obtain structure map6.
[0120] S21, based on map6, exclude dishes in the second recipe that do not meet the conflict taboo configuration. The specific steps are as mentioned above and will not be repeated here.
[0121] S22, supplement the dishes in the second recipe. The specific steps are as mentioned above and will not be repeated here.
[0122] S23, forming a spicy dish list xList2 with spicy dishes that meet the spicy parameters and are excluded when generating the seventh dish list.
[0123] S24, select a set number of dishes that meet the conflict taboo configuration parameters from the spicy dishes list xList2 as special spicy dishes. The specific steps are as described above and will not be repeated here.
[0124] S25, using the special spicy dish, the updated second recipe is updated again. The specific steps are as mentioned above and will not be repeated here.
[0125] S26, performing non-repetitive processing on the updated second recipe according to the non-repetitive parameter of ingredients to obtain a final recipe. The specific steps are as mentioned above and will not be described again here.
[0126] S27, the final recipe.
[0127] The present disclosure provides a recipe generation method, including: obtaining recipe generation parameters and dish preference data; generating a seventh dish list based on the recipe generation parameters and a dish list of a preset dish library; updating the dish preference data based on the seventh dish list to obtain updated dish preference data; generating a recipe based on the seventh dish list and the updated dish preference data. The method of the present disclosure can generate a recipe based on the preferences of diners, so that the generated recipe can meet the preferences of diners.
[0128] <Device Example>
[0129] Figure 2 FIG. 1 is a schematic block diagram of a recipe generating device according to an embodiment of the present disclosure. Figure 2 As shown, the device 100 includes:
[0130] A data acquisition module 110, for acquiring recipe generation parameters and dish preference data;
[0131] A seventh dish list generating module 120, configured to generate a seventh dish list based on the recipe generating parameters and the dish list of the preset dish library;
[0132] a dish preference data updating module 130, configured to update the dish preference data based on the seventh dish list to obtain updated dish preference data;
[0133] The recipe generating module 140 is used to generate a recipe based on the seventh dish list and the updated dish preference data.
[0134] <Equipment Embodiment>
[0135] Figure 3 FIG. 1 is a schematic block diagram of a recipe generating device according to an embodiment of the present disclosure. Figure 3 As shown, the recipe generating device 200 includes: a processor 210 and a memory 220 for storing executable instructions of the processor 210. The processor 210 is configured to implement any of the above-mentioned recipe generating methods when executing the executable instructions.
[0136] Here, it should be noted that the number of processors 210 can be one or more. At the same time, in the recipe generation device 200 of the embodiment of the present disclosure, an input device 230 and an output device 240 may also be included. The processor 210, the memory 220, the input device 230 and the output device 240 may be connected via a bus or in other ways, which are not specifically limited here.
[0137] The memory 220 is a computer-readable storage medium that can be used to store software programs, computer executable programs, and various modules, such as the program or module corresponding to the recipe generation method of the embodiment of the present disclosure. The processor 210 executes various functional applications and data processing of the recipe generation device 200 by running the software programs or modules stored in the memory 220.
[0138] The input device 230 may be used to receive input numbers or signals. The signals may be key signals related to user settings and function control of the device / terminal / server. The output device 240 may include display devices such as display screens.
[0139] <Storage Medium Embodiment>
[0140] According to a fourth aspect of the present disclosure, a non-volatile computer-readable storage medium is also provided, on which computer program instructions are stored, and when the computer program instructions are executed by the processor 210, any of the recipe generation methods described above is implemented.
[0141] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A recipe generation method, characterized in that: include: Get recipe generation parameters and dish preference data; Generate a seventh dish list based on the recipe generation parameters and the dish list of the preset dish library; updating the dish preference data based on the seventh dish list to obtain updated dish preference data; A recipe is generated based on the seventh dish list and the updated dish preference data.
2. The method according to claim 1, characterized in that The recipe generation parameters include: necessary dishes for each meal, types and quantities of dishes for each meal, parameters for non-repetition of dishes, food quantity parameters, seasonal characteristic parameters, parameters for excluding specific ingredients, parameters for non-repetition of ingredients, spiciness parameters, conflict taboo configuration parameters and at least one of the unit food expense standards.
3. The method according to claim 2, characterized in that When generating a seventh dish list based on the recipe generation parameters and the dish list of the preset dish library, the method includes: The seventh dish list is generated by adding or excluding dishes that meet the recipe generation parameters from the dish list of the dish library.
4. The method according to claim 2, characterized in that: When the dish preference data is updated based on the seventh dish list to obtain updated dish preference data, the method includes: Filtering the dishes in the seventh dish list from the dish preference data as first target favorite dishes; The dish preference data is updated based on the first target favorite dish to obtain updated dish preference data.
5. The method according to claim 2, characterized in that: When generating a recipe based on the seventh dish list and the updated dish preference data, the method includes: Excluding the updated dish preference data from the seventh dish list to obtain an updated seventh dish list; generating a first recipe based on the updated seventh dish list; Filtering a set number of dishes satisfying the conflict taboo configuration parameters from the updated dish preference data as second target preference dishes; Using the second target favorite dish, updating the first recipe to obtain a second recipe; The second recipe is processed with conflict taboos according to the conflict taboo configuration parameters to obtain a final recipe.
6. The method according to claim 3, characterized in that After generating said recipe, also include: Obtaining spicy dishes that meet the spicy parameter and are excluded when generating the seventh dish list; Selecting a set number of dishes that meet the conflict taboo configuration parameters from the spicy dishes as special spicy dishes; The recipe is updated using the special spicy dishes.
7. The method according to claim 2, characterized in that After generating said recipe, also include: The recipe is processed for non-repetitive ingredients according to the non-repetitive ingredient parameter to obtain a final recipe.
8. A recipe generating device, characterized in that: include: A data acquisition module is used to obtain recipe generation parameters and dish preference data; a seventh dish list generating module, configured to generate a seventh dish list based on the recipe generating parameters and a dish list of a preset dish library; a dish preference data updating module, configured to update the dish preference data based on the seventh dish list to obtain updated dish preference data; A recipe generation module is used to generate a recipe based on the seventh dish list and the updated dish preference data.
9. A recipe generating device, characterized in that: include: processor; a memory for storing processor-executable instructions; Wherein, the processor is configured to implement the method described in any one of claims 1 to 7 when executing the executable instructions.
10. A non-volatile computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.