Case recipe generation system and method based on large language model

Through a case recipe generation system based on a large language model, the problem of the existing technology not being able to effectively generate recipes that meet the dietary health needs of patients is solved, and the reliability and feasibility of recipe generation are improved.

CN119495402AActive Publication Date: 2025-02-21SICHUAN UNIV
View PDF 11 Cites 0 Cited by

Patent Information

Application Number
CN202411552683.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-01
Publication Date
2025-02-21
Estimated Expiration
2044-11-01

AI Technical Summary

Technical Problem

The existing recipe generation system cannot effectively generate recipes that meet the requirements for patients' dietary health needs, and is limited by the training process of generative language models, and cannot understand terms and concepts in specific fields, resulting in generation errors.

Method used

A case recipe generation system based on a large language model is used to obtain nutritional data, recipe data and case data, preprocess and screen, and use the large language model to generate recipes that meet the case requirements.

Benefits of technology

It improves the reliability and feasibility of the recipe generation system, and can generate nutritionally based recipes based on case information, ensuring the health and practicality of the recipes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119495402A_ABST
    Figure CN119495402A_ABST
Patent Text Reader

Abstract

The invention discloses a case recipe generation system and method based on a large language model, and the method comprises the following steps: 1, obtaining nutriology data, recipe data and case data, and forming a data set; 2, preprocessing data in the data set obtained in the step 1, wherein the preprocessing process comprises unified expression of case data; carrying out nutriology term identification on the nutriology data to obtain a data set with term marks; screening and filtering the recipe data according to the nutriology data; 3, acquiring nutriology text segments and recipe data meeting case requirements; 4, according to the text segments and the data obtained in the step 3, a large language model is adopted to generate a required case recipe; according to the method, the reliability, feasibility and adaptability of recipe generation can be remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a case recipe generation system and method based on a large language model. Background Art

[0002] In recent years, the number of patients with chronic diseases has been gradually increasing, and the risk factors of many diseases are related to unreasonable dietary structure. Although dietary guidelines for chronic diseases have been specified, they only cover a small number of diseases and cannot meet the needs of a large number of patients who need dietary structure adjustment. Although there are relevant websites on the Internet, the information is relatively scattered, or without nutrition and cooking knowledge, it is impossible to get recipes that meet the requirements.

[0003] The current recipe generation method generally generates a recipe that meets the requirements based on the text content of a given recipe. Generative language models are used to quickly obtain the materials required for the recipe and the steps required for cooking. Some current research results, such as a cooking recipe generation system using genetic algorithms and statistical language models, study the impact of preparation steps on the quality of generated recipes. Another part of the work focuses on generating cooking recipes under different constraints. However, existing recipe generation systems often focus on the innovation of recipes and the requirements of partial taste customization, and do not involve dietary health. And due to the limitations of the training process of generative language models, existing methods cannot generate recipes that meet the requirements for patients' dietary health needs. The generative model does not have a sufficient understanding of specific domain terms and may have generation errors. In specific fields, many concepts and terms have specific meanings and contexts. In summary, the existing processing methods cannot obtain recipes that meet the requirements. Summary of the invention

[0004] In view of the problems existing in the prior art, the present invention provides a case recipe generation system and method based on a large language model.

[0005] The technical solution adopted by the present invention is: a case recipe generation method based on a large language model, comprising the following steps:

[0006] Step 1: Obtain nutrition data, recipe data and case data to form a data set;

[0007] Step 2: Preprocess the data in the data set obtained in step 1. The preprocessing process includes uniformly expressing the case data; identifying nutrition terms in the nutrition data to obtain a data set with term tags; and filtering the recipe data according to the nutrition data;

[0008] Step 3: Obtain nutrition texts and recipe data that meet the case requirements;

[0009] Step 4: Generate the required case recipes using a large language model based on the text and data obtained in step 3.

[0010] Furthermore, the unified expression process of case data in step 2 is as follows:

[0011] Perform coarse-grained filtering based on the word frequency of case data to obtain disease names with a word frequency greater than a threshold;

[0012] The disease names obtained by screening are calibrated to obtain standard names that conform to disease coding; the standard names are merged to obtain a data set with unified expression.

[0013] Furthermore, the recognition process of nutrition terms in step 2 is as follows:

[0014] Use a large Transformer-based language model for named entity recognition.

[0015] Furthermore, the process of screening and filtering the recipe data in step 2 is as follows:

[0016] Expand the nutrition terms to obtain terms that are consistent with the ingredients in the ingredient set in the recipe dataset;

[0017] Filter recipes based on nutritional value thresholds.

[0018] Furthermore, the process of obtaining nutrition texts and recipe data that meet the case requirements in step 3 is as follows:

[0019] Segment and clean the recipe name list of the recipe;

[0020] The bag-of-words model is used to filter the word segmentation results to obtain a vocabulary;

[0021] Search the nutrition data and recipe data based on keywords to obtain content that is consistent with the ingredient list, and then perform semantic matching to obtain the similarity between the input query and the sentences in the dataset; vectorize the recipe supplementary description and calculate the similarity with the vector processed by the nutrition data;

[0022] The search results are sorted according to the similarity calculation results, and the text and data with relevance greater than the set threshold are selected.

[0023] Furthermore, the process of named entity recognition based on the Transformer-based large language model is as follows:

[0024] Preprocess the input text;

[0025] Extract features from text;

[0026] Split the text features to determine whether they are named entities;

[0027] Output the label of each word for named entity identification.

[0028] A case recipe generation system based on a large language model, comprising a data collection module, an information processing module, an information indexing module and a recipe generation module;

[0029] The data collection module is used to obtain nutrition data, recipe data and case data to form a data set;

[0030] The information processing module is used to pre-process the data in the data set;

[0031] The information indexing module is used to retrieve nutrition texts and recipe data that meet the case requirements;

[0032] The recipe generation module is used to generate case recipes based on nutrition text and recipe data based on a large language model.

[0033] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method when executing the computer program.

[0034] A computer-readable storage medium stores a computer program, which implements the steps of the method when executed by a processor.

[0035] The beneficial effects of the present invention are:

[0036] (1) The present invention integrates nutrition guidelines and a large language model, improving the reliability of the recipe generation system and the feasibility of the recipes;

[0037] (2) The present invention can generate recipe data that is more realistic and has a nutritional basis based on the information provided by the case, dish requirements and other textual content. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 It is a schematic diagram of the process of the present invention.

[0039] Figure 2 Schematic diagram of the screening and filtering process of recipe data in the present invention.

[0040] Figure 3 It is a schematic diagram of the identification process of nutrition terms in the present invention.

[0041] Figure 4 Schematic diagram of the unified expression process of case data in the present invention.

[0042] Figure 5 The figure is a schematic diagram of the named entity recognition process based on the Transformer-based large language model in the present invention.

[0043] Figure 6 Be the recipe obtained in the embodiment of the present invention. DETAILED DESCRIPTION

[0044] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments.

[0045] like Figure 1 As shown, a case recipe generation method based on a large language model includes the following steps:

[0046] Step 1: Obtain nutrition data, recipe data and case data to form a data set;

[0047] Using web crawlers, we filter out disease-related dietary guidance texts through nutrition-related information and construct preliminary nutrition guide data; we use crawlers to obtain recipe data on the website and obtain optional recipe data sets; and the patient's case data is provided through open source data sets.

[0048] Step 2: Preprocess the data in the data set obtained in step 1. The preprocessing process includes uniformly expressing the case data; identifying nutrition terms in the nutrition data to obtain a data set with term tags; and filtering the recipe data according to the nutrition data;

[0049] The case data is expressed uniformly as Figure 4 As shown in the figure, case data is filled in by different doctors, and there is a problem of inconsistent expression of the same disease. With the help of disease coding systems such as the 11th edition of the International Classification of Diseases, rule-based processing is performed to obtain a case data set with unified expression. The specific process is as follows:

[0050] Perform coarse-grained filtering based on the word frequency of case data to obtain disease names with a word frequency greater than a threshold;

[0051] The disease names obtained by screening are calibrated to obtain standard names that conform to disease coding; the standard names are merged to obtain a data set with unified expression.

[0052] The calibration process is to use a web script to query the disease names obtained in the first step one by one in the browser page of the International Classification of Diseases, 11th edition, and use the returned results as the standard name of the disease.

[0053] Since the page structures and content expression structures of various websites are different, it is necessary to use the named entity recognition model to identify nutrition terms. The recognition process of nutrition terms is as follows:

[0054] Use a large Transformer-based language model for named entity recognition.

[0055] The specific process is as follows:

[0056] Named entities are words or phrases with specific meanings, and in the context of the present invention, they are nutrition terms. For example, apple (food), vitamin C (nutrient). The task of named entity recognition is to identify these special words or phrases related to nutrition in a given sentence. Since the field of named entity recognition lacks specific models for the field of nutrition, there is a lack of corresponding training data sets. In the present invention, a large language model based on Transformer is used for named entity recognition. For a given sentence, the input text is first preprocessed, including word segmentation, removal of stop words, etc. Secondly, features in the text are extracted, such as word morphology, contextual information, etc. These features help the model understand the meaning of the entity. The model analyzes the text, classifies each word, and determines whether it is a named entity. The model outputs the label of each word, identifying those that are named entities and their categories. The output of the model of the present invention is JSON formatted data, and a nutrition guide data set with nutrition terminology tags is obtained.

[0057] The process of filtering recipe data is as follows: Figure 2 As shown:

[0058] The recipe data obtained from the Internet are uploaded by Internet users themselves, and the quality is inconsistent. It is necessary to filter out high-quality recipe data related to the labels in the nutrition guidelines to obtain the recipe data set for subsequent use.

[0059] To expand nutrition terms, each nutrition term needs to be expanded based on the definition of ingredients, that is, for each nutrition term, find the ingredients in the ingredient set in the recipe dataset that correspond to it. For example, red meat: beef, pork, lamb, venison. However, the ingredient set obtained from the recipe dataset does not include venison, so the definition of red meat is finally taken as: beef, pork, lamb. The terms that are consistent with the ingredients in the ingredient set in the recipe dataset are obtained;

[0060] Recipes are filtered based on the nutritional value threshold; assume that the nutritional value of a recipe is determined by the ingredients that make up the recipe. Since each recipe contains different types of ingredients, a nutritional guideline is given, and recipes that contain ingredients above the threshold ratio are set as recipes that meet the standard. This will filter out some recipes that only contain ingredients with low nutritional value.

[0061] Step 3: Obtain nutrition texts and recipe data that meet the case requirements;

[0062] The recipe name list of the recipe is segmented and cleaned. The user provides case information, including the patient's type of ciprofloxacin, dietary requirements, etc. Dietary dishes can be divided into cooking methods and cooking ingredients. For example, braised, steamed, fried, etc. Cooking ingredients can be understood as the user specifying that a certain ingredient needs to be included in the recipe, such as fish, shrimp, chicken, duck, beans, etc. To meet the needs of this part, first obtain the recipe name list of high-quality recipes (the above-mentioned recipe data after screening and filtering), and perform segmentation and cleaning.

[0063] The bag-of-words model is used to filter the word segmentation results to obtain a vocabulary;

[0064] The bag-of-words model is used to treat all the segmentation results as a set, collect all the unique words that appear in the text, and form a vocabulary. The information in this vocabulary is then manually screened to obtain a list of cooking methods and cooking ingredients.

[0065] Search the nutrition data and recipe data based on keywords to obtain content that is consistent with the ingredient list, and then perform semantic matching to obtain the similarity between the input query and the sentences in the dataset; vectorize the recipe supplementary description and calculate the similarity with the vector processed by the nutrition data;

[0066] To ensure that highly relevant content is retrieved in the nutrition guide dataset and recipe dataset, a keyword search is used to check whether the keyword is completely consistent with the content in the dataset. For example, whether the cooking ingredients specified by the user appear directly in the list of ingredients used in the recipe.

[0067] For semantic matching, cosine similarity is used to compare the similarity between the input query and the sentences in the dataset. Since some recipes also have description text as a supplement, this part of the text can be input into the BERT model for vectorization, and then similarity is calculated with the vectors in the nutrition guide after similar processing. The search results are sorted according to relevance, update level and user needs, and the text and recipes that do not meet the requirements are filtered out.

[0068] Step 4: Generate the required case recipes using a large language model based on the text and data obtained in step 3.

[0069] A large language model is used to integrate the retrieved text and data information to obtain recipes that meet the requirements. The details are as follows: First, relevant nutrition guidelines, case information, and recipe data are retrieved from the nutrition guideline dataset, case dataset, and recipe dataset. This information includes the user's specific condition, dietary requirements, common ingredients, and cooking methods. The retrieved information is integrated. Prompts are built based on these contents to drive the large language model for intelligent generation. The language model has powerful text generation capabilities and can automatically generate complete recipe content that meets the requirements based on the prompts. The generated content includes an overview of the key points of the relevant nutrition guidelines and provides specific recipes suitable for the case, including ingredients, methods, and nutritional analysis. Figure 6 shown.

[0070] A case recipe generation system based on a large language model, comprising a data collection module, an information processing module, an information indexing module and a recipe generation module;

[0071] The data collection module is used to obtain nutrition data, recipe data and case data to form a data set;

[0072] The information processing module is used to pre-process the data in the data set;

[0073] The information indexing module is used to retrieve nutrition texts and recipe data that meet the case requirements;

[0074] The recipe generation module is used to generate case recipes based on nutrition text and recipe data based on a large language model.

[0075] The invention is generated based on existing nutrition guidelines, and the generated recipes and nutritional recommendations are not prone to misleading content that violates professional knowledge, reducing the risk of health management for users. The recipe data based on the invention is operated and uploaded by actual users, ensuring its feasibility and practicality. The data set uploaded by network users provides a variety of choices to meet the taste requirements of different patients. The method of the invention generates personalized recipes based on the user's situation and dietary preferences, ensuring the high relevance of the recommended content. Unlike the existing recipe generation method that focuses on innovation and restrictions, it is more adaptable to real user needs.

[0076] Therefore, the method of the present invention can significantly improve the reliability, feasibility and adaptability of recipe generation.

Claims

1. A case recipe generation method based on a large language model, characterized in that: The following steps are involved: Step 1: Obtain nutrition data, recipe data and case data to form a data set; Step 2: Preprocess the data in the data set obtained in step 1, and the preprocessing process includes uniformly expressing the case data; Identify nutrition terms in nutrition data to obtain a data set with term labels; Filter recipe data based on nutritional data; Step 3: Obtain nutrition texts and recipe data that meet the case requirements; Step 4: Generate the required case recipes using a large language model based on the text and data obtained in step 3.

2. The method for generating case recipes based on a large language model according to claim 1, characterized in that: The unified expression process of case data in step 2 is as follows: Perform coarse-grained filtering based on the word frequency of case data to obtain disease names with a word frequency greater than a threshold; The disease names obtained by screening are calibrated to obtain standard names that conform to disease coding; the standard names are merged to obtain a data set with unified expression.

3. The method for generating case recipes based on a large language model according to claim 1, characterized in that: The identification process of nutrition terms in step 2 is as follows: Use a large Transformer-based language model for named entity recognition.

4. The method for generating case recipes based on a large language model according to claim 1, characterized in that: The process of filtering the recipe data in step 2 is as follows: Expand the nutrition terms to obtain terms that are consistent with the ingredients in the ingredient set in the recipe dataset; Filter recipes based on nutritional value thresholds.

5. The method for generating case recipes based on a large language model according to claim 1, characterized in that: The process of obtaining nutrition text and recipe data that meet the case requirements in step 3 is as follows: Segment and clean the recipe name list of the recipe; The bag-of-words model is used to filter the word segmentation results to obtain a vocabulary; Search the nutrition data and recipe data based on keywords to obtain content that is consistent with the ingredient list, and then perform semantic matching to obtain the similarity between the input query and the sentences in the dataset; vectorize the recipe supplementary description and calculate the similarity with the vector processed by the nutrition data; The search results are sorted according to the similarity calculation results, and the text and data with relevance greater than the set threshold are selected.

6. The method for generating case recipes based on a large language model according to claim 3, characterized in that: The process of named entity recognition based on the Transformer-based large language model is as follows: Preprocess the input text; Extract features from text; Split the text features to determine whether they are named entities; Output the label of each word for named entity identification.

7. A case recipe generation system based on a large language model according to any one of the generation methods of claims 1 to 6, characterized in that: It includes a data collection module, an information processing module, an information indexing module and a recipe generation module; The data collection module is used to obtain nutrition data, recipe data and case data to form a data set; The information processing module is used to pre-process the data in the data set; The information indexing module is used to retrieve nutrition texts and recipe data that meet the case requirements; The recipe generation module is used to generate case recipes based on nutrition text and recipe data based on a large language model.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Food recipe recommendation system

    CN110298770A

  • Recipe recommendation system suitable for diabetics

    CN115440344A

  • Dietary management method and system based on inflammatory dietary evaluation and anti-inflammatory recipe pushing

    CN116417112A

  • Digital nutrition management method for tumor rehabilitation

    CN116434916A

  • Diabetes catering scheme generation method and device, electronic equipment and storage medium

    CN117059229A