Menu recommendation method, device and system based on knowledge graph path

Through the recipe recommendation method based on the knowledge graph path, the problem of multi-dimensional recommendation in the existing technology is solved, and personalized recommendations for user health status, ingredients and nutritional ingredients are realized, which improves the intelligence and personalization of recipe recommendations.

CN119848336APending Publication Date: 2025-04-18DISCOVERY TECH SHENZHEN
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411870269.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-18
Publication Date
2025-04-18

AI Technical Summary

Technical Problem

Existing recipe recommendation methods cannot multi-dimensionally recommend users' health status, nutritional ingredients, the use of seasonal ingredients and other personal needs through the knowledge graph.

Method used

The recipe recommendation method based on the knowledge graph path is adopted, and the data is processed based on the recipe knowledge graph to be recommended, and the recipe recommendation data is generated. The method includes preprocessing the recipe text information, labeling entity data, using entity relationship joint extraction model to build a knowledge graph, and calculating the path contribution to recommend the recipe.

Benefits of technology

It realizes multi-dimensional recommendations for users' personalized needs, improves the intelligence and personalization of recipe recommendations, can better understand user needs and provide rich and profound semantic understanding.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119848336A_ABST
    Figure CN119848336A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a menu recommendation method, device and system based on a knowledge graph path. The method comprises the following steps: obtaining to-be-recommended character data; and performing entity relationship processing on the to-be-recommended character data based on a menu knowledge graph to generate corresponding menu recommendation data. According to the method, the relationship path between the entities in the menu is established through the knowledge graph, and the personalized menu of the user is recommended according to the corresponding relationship path, so that richer and profound semantic understanding is provided in the menu recommendation process, the user demand is better helped to be understood in the menu recommendation process, and the user experience is improved. Therefore, the defects of user personalization and multi-dimensional recommendation in a traditional recommendation method are effectively overcome, and intelligence and personalization of menu recommendation are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of intelligent recommendation, and in particular to a recipe recommendation method, device, system, electronic device and storage medium thereof based on a knowledge graph path. Background Art

[0002] With the rapid development of the Internet, a large amount of recipe information has been widely disseminated through various platforms and applications. Users can easily obtain various recipes through search engines. However, existing recipe recommendations usually rely on simple keyword matching, user historical behavior or rule-based recommendation algorithms, resulting in single recommendation results and lack of personalization and intelligence. These traditional recommendation methods can often only meet the basic needs of users, but cannot comprehensively consider the user's health status, the nutritional content of ingredients, the use of seasonal ingredients and other personalized needs.

[0003] Therefore, the existing recipe recommendation methods have the problem of being unable to make multi-dimensional recommendations based on the user's health status, the nutritional content of ingredients, the use of seasonal ingredients, and other personalized needs through knowledge graphs. Summary of the invention

[0004] An embodiment of the present invention provides a recipe recommendation method based on a knowledge graph path to solve the problem that the recipe recommendation method cannot make multi-dimensional recommendations on the user's health status, nutritional components of ingredients, use of seasonal ingredients and other personalized needs through the knowledge graph.

[0005] In a first aspect, an embodiment of the present invention provides a recipe recommendation method based on a knowledge graph path, the method comprising the following steps: Get the text data to be recommended; Based on the recipe knowledge graph, entity relationship processing is performed on the text data to be recommended to generate corresponding recipe recommendation data.

[0006] Optionally, obtaining the text data to be recommended includes: Get recipe text information; The recipe text information is preprocessed through a natural language processing model to obtain text data to be recommended.

[0007] Optionally, before performing entity relationship processing on the text data to be recommended based on the recipe knowledge graph to generate corresponding recipe recommendation data, the method further includes: According to preset entity data, the text data to be recommended is labeled to determine entity data corresponding to the text data to be recommended, wherein the preset entity data includes a recipe name, recipe ingredients, recipe season, diseases prevented by the recipe, and nutritional components of the recipe; The entity data corresponding to the text data to be recommended are processed by a trained entity relationship joint extraction model to obtain entity relationships between the entity data; The recipe knowledge graph is constructed based on the entity relationships between the entity data.

[0008] Optionally, constructing the recipe knowledge graph based on the entity relationship between the entity data includes: Determine an entity relationship between at least two entity data; The corresponding recipe knowledge graph is constructed with the entity data as nodes and the entity relationships as paths.

[0009] Optionally, before the entity data corresponding to the text data to be recommended are processed by the trained entity relationship joint extraction model to obtain the entity relationship between the entity data, the method further includes: Obtain the entity relationship joint extraction model to be trained; By presetting the relationship type, performing relationship annotation processing on the entity data corresponding to the text data to be recommended, and determining the entity relationship between the entity data; Based on the entity relationships between the entity data, construct an entity relationship joint extraction dataset, wherein the entity relationship joint extraction dataset includes a training dataset and a test dataset; The entity relationship joint extraction model to be trained is iteratively trained using the training data set and the test data set, and after the iterative training is completed, a trained entity relationship joint extraction model is obtained.

[0010] Optionally, the performing entity relationship processing on the text data to be recommended based on the recipe knowledge graph to generate corresponding recipe recommendation data includes: Calculating a path between at least two entity data having an entity relationship, and determining a contribution degree corresponding to the path; Based on the contribution, a score value between two entity data connected by the path is calculated; The recipe recommendation data is determined based on a comparison between the score value and a preset recommendation threshold, and the recipe recommendation data includes a recipe name, a preparation method, and preparation ingredients corresponding to the entity data.

[0011] In a second aspect, an embodiment of the present invention further provides a recipe recommendation device based on a knowledge graph path, wherein the recipe recommendation device based on a knowledge graph path comprises: A first acquisition module is used to acquire text data to be recommended; The first generating module is used to process the text data to be recommended based on the recipe knowledge graph to generate corresponding recipe recommendation data.

[0012] In a third aspect, an embodiment of the present invention further provides a recipe recommendation system based on a knowledge graph path, wherein the recipe recommendation system based on a knowledge graph path comprises: a recipe recommendation device based on a knowledge graph path, a server, and a smart terminal.

[0013] In a fourth aspect, an embodiment of the present invention provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps in the recipe recommendation method based on the knowledge graph path provided in an embodiment of the present invention are implemented.

[0014] In a fifth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the recipe recommendation method based on the knowledge graph path provided in the embodiment of the invention are implemented.

[0015] In the embodiment of the present invention, text data to be recommended is obtained; entity relationship processing is performed on the text data to be recommended based on the recipe knowledge graph to generate corresponding recipe recommendation data. The relationship path between entities in the recipe is established through the knowledge graph, and the personalized recipe of the user is recommended according to the path in the corresponding relationship path, thereby providing richer and deeper semantic understanding in the recipe recommendation process, and better helping to understand user needs in the recipe recommendation process, thereby effectively making up for the deficiencies of traditional recommendation methods in user personalization and multi-dimensional recommendation, and improving the intelligence and personalization of recipe recommendation. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0017] Figure 1 It is an architecture diagram of a recipe recommendation system based on a knowledge graph path provided by an embodiment of the present invention; Figure 2 is a schematic diagram of a recipe recommendation process provided by an embodiment of the present invention; Figure 3 is a flow chart of a recipe recommendation method based on a knowledge graph path provided by an embodiment of the present invention; Figure 4 is a schematic diagram of an entity data recognition model provided by an embodiment of the present invention; Figure 5is a schematic diagram of an entity relationship joint extraction model provided by an embodiment of the present invention; Figure 6 is a schematic diagram of a recommendation model provided by an embodiment of the present invention; Figure 7 is a structural schematic diagram of a recipe recommendation device based on a knowledge graph path provided in an embodiment of the present invention; Figure 8 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0018] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0019] like Figure 1 As shown, Figure 1 It is an architecture diagram of a recipe recommendation system 100 based on a knowledge graph path provided by an embodiment of the present invention, and the recipe recommendation system based on a knowledge graph path includes: a recipe recommendation device 700 based on a knowledge graph path, a server 101, and a smart terminal 102. Among them, the recipe recommendation device 700 based on a knowledge graph path also includes a first acquisition module, which can be used to acquire text data to be recommended; and a first generation module, which can be used to process the text data to be recommended based on the recipe knowledge graph to generate corresponding recipe recommendation data.

[0020] Specifically, the above-mentioned text data to be recommended may be text data that has been preprocessed, and can be directly used to construct a recipe knowledge graph and recommend recipes to users. Specifically, the above-mentioned text data to be recommended may include but is not limited to entity data such as recipes, ingredients, seasons, diseases, and nutrients. For example, when a user inputs "chicken recipe with light flavor", the corresponding text data such as "chicken" and "light" are obtained through preprocessing such as word segmentation, denoising, and standardization.

[0021] The above entity data is used to describe the corresponding meaning of the above text data, which can be explained as shown in Table 1, wherein the entity data recipe corresponding meaning is the name of the dish, and the entity data disease corresponding meaning is the disease that the entity data corresponding food can treat / prevent / is applicable to.

[0022]

[0023] Table 1 In a possible embodiment, the recipe recommendation system based on the knowledge graph path can crawl relevant recipe information through a crawler and perform further preprocessing, which may include but is not limited to ① deleting useless data, such as advertising text, comments and other invalid information; ② deleting punctuation marks, automatic replies and other irrelevant texts to reduce noise and reduce data sparsity. After that, the corresponding text data to be recommended is obtained.

[0024] The above recipe knowledge graph can be understood as a structured image data model, which is used to represent and organize various types of knowledge about recipes. By using the above entity data as nodes of the recipe knowledge graph and connecting the entity relationships between the entity data as paths, an abstract representation of various information in the recipe (such as ingredients, dishes, cooking steps, taste, nutritional components, etc.) and the relationships between them is formed, thus forming an interconnected knowledge system.

[0025] The above entity relationship can be illustrated by Table 2, wherein the corresponding entity data, including ingredients, diseases, etc., are obtained by extracting the above text data, and the meanings of the entity data are then linked. For example, in Table 2, ingredient-ingredient means that the two ingredients have a symbiotic relationship. For example, the two ingredients, red dates and wolfberries, have a symbiotic relationship of replenishing blood. It can be understood that in the process of building entity relationships, two entity data are often required to be linked. Therefore, there may be multiple paths between the corresponding nodes in the above recipe knowledge graph.

[0026]

[0027] Table 2 The above processing process may be a process in which the recipe recommendation system based on the knowledge graph path infers the user's preferences through the connectivity of the recipe knowledge graph and makes targeted recipe recommendations. Figure 2 For example, (stewed beef brisket with tomatoes, RepIng, tomatoes)->(tomatoes, IngDis, digestive tract cancer)->(digestive tract cancer, IngDis, white radish)->(white radish, IngRep, braised beef and radish soup)). In this way, it can be inferred that the user may be suitable for the dish of braised beef and radish soup.

[0028] More specifically, the paths between the corresponding entity data can be determined by embedding the above entity data and entity relationships into vectors and concatenating the embedded vectors. The scores between the final entity data can be obtained by encoding the entity data and entity relationships and then calculating the paths corresponding to the corresponding embedded vectors according to the following formula: ; Among them, Pm is the concatenated path embedding vector, which is used to represent the path. represents the weight coefficient of the fully connected layer, Represents bias. Represents the score of a path. Represents the final score between two recipes. The scores of all paths of the two recipes are calculated based on this formula to get the final score. is a hyperparameter used to control the weight. This parameter is introduced because different paths contribute differently to the recommendation. The function normalizes the scores to obtain the final result. In another possible embodiment, the recommendation threshold can also be set. ,if , then recommend this recipe to the user, if , then this recipe will not be recommended to the user.

[0029] like Figure 3 As shown, Figure 3 : is a flowchart of a recipe recommendation method based on a knowledge graph path provided by an embodiment of the present invention, and the recipe recommendation method based on a knowledge graph path comprises the following steps: 301. Obtain text data to be recommended.

[0030] In an embodiment of the present invention, the above-mentioned recipe recommendation method based on knowledge graph path can be applied to the above-mentioned recipe recommendation system based on knowledge graph path. The above-mentioned recipe recommendation system based on knowledge graph path has functions such as recipe data processing, recipe data transmission and reception, and recipe data memory storage, and can be constructed based on a server or a server cluster. The above-mentioned server or server cluster can be an electronic device with recipe data processing capabilities.

[0031] The above-mentioned text data to be recommended may be text data that has been preprocessed and can be directly used to construct a recipe knowledge graph and recommend recipes to users. Specifically, the above-mentioned text data to be recommended may include but is not limited to entity data such as recipes, ingredients, seasons, diseases, and nutrients. For example, when a user inputs "chicken recipe with light flavor", the corresponding text data such as "chicken" and "light" are obtained through preprocessing such as word segmentation, denoising, and standardization.

[0032] 302. Perform entity relationship processing on the recommended text data based on the recipe knowledge graph to generate corresponding recipe recommendation data.

[0033] The above recipe knowledge graph can be understood as a structured image data model, which is used to represent and organize various types of knowledge about recipes. By using the above entity data as nodes of the recipe knowledge graph and connecting the entity relationships between the entity data as paths, an abstract representation of various information in the recipe (such as ingredients, dishes, cooking steps, taste, nutritional components, etc.) and the relationships between them is formed, thus forming an interconnected knowledge system.

[0034] In the embodiment of the present invention, text data to be recommended is obtained; entity relationship processing is performed on the text data to be recommended based on the recipe knowledge graph to generate corresponding recipe recommendation data. The relationship path between entities in the recipe is established through the knowledge graph, and the personalized recipe of the user is recommended according to the corresponding relationship path, thereby providing richer and deeper semantic understanding in the recipe recommendation process, and better helping to understand user needs in the recipe recommendation process, thereby effectively making up for the deficiencies of traditional recommendation methods in user personalization and multi-dimensional recommendation, and improving the intelligence and personalization of recipe recommendation.

[0035] Optionally, the step of obtaining the text data to be recommended also includes obtaining recipe text information; and preprocessing the recipe text information through a natural language processing model to obtain the text data to be recommended.

[0036] In an embodiment of the present invention, the above-mentioned recipe text information may be text information that can describe the content of the recipe. Generally speaking, the relevant recipe information may be crawled by a crawler, including but not limited to the name of the dish, the list of ingredients, the cooking steps, the characteristics of the dish, the taste description, the nutritional ingredients, etc. The purpose of the recipe text information is to accurately convey all the information required to make a dish through text, and to help users understand how to prepare and make the dish. In this embodiment, by parsing the recipe text information, the text data in the text information may be parsed into words or phrases with practical meanings, and these words or phrases may be used as the above-mentioned text data to be recommended.

[0037] The above-mentioned natural language processing model can be any model that can parse the above-mentioned recipe text information and, through preprocessing, parse the text data in the text information into corresponding words or phrases with actual meanings.

[0038] The above preprocessing may include but is not limited to ① deleting useless data, such as advertising text, comments and other invalid information; ② deleting punctuation marks, automatic replies and other irrelevant text to reduce noise and reduce the sparsity of data.

[0039] In a possible embodiment, the recipe knowledge graph-based recommendation system preprocesses the acquired recipe text information through a natural language processing model to obtain corresponding text data to be recommended.

[0040] Optionally, in the steps before performing entity relationship processing on the recommended text data based on the recipe knowledge graph to generate corresponding recipe recommendation data, the steps also include labeling the recommended text data according to preset entity data to determine the entity data corresponding to the text data to be recommended; processing the entity data corresponding to the recommended text data through the trained entity relationship joint extraction model to obtain the entity relationship between the entity data; and constructing a recipe knowledge graph based on the entity relationship between the entity data.

[0041] In an embodiment of the present invention, the preset entity data may include but is not limited to the recipe name, recipe ingredients, recipe season, the disease that the recipe prevents, and the nutritional components of the recipe. The entity data may be obtained by processing the text data to be recommended by an entity recognition model. Specifically, the entity data may be obtained by processing the text data to be recommended by an entity recognition model. Figure 4 To explain, Figure 4 It is an entity data recognition model. Any deep learning model that can scan and process text data can be used, such as the Bi-LSTM-CRF model. The model can annotate the above-mentioned text data to be recommended, and process the annotated data into BIO format. Finally, the data set in BIO format is divided into a test set and a training set for training or optimizing the above-mentioned entity data recognition model.

[0042] In this embodiment, before labeling the entities, the above-mentioned entity data recognition model can also manually label a part of the data in BIO format, and then divide the data set in BIO format into a training set and a test set for training the above-mentioned entity data recognition model. Through the trained entity data recognition model, the above-mentioned text data to be recommended is predicted and the corresponding entity data is extracted.

[0043] More specifically, Figure 4 As shown in the figure, the entity data recognition model is divided into the word2Vec layer, which is used to encode text data into word vectors; the Bi-LSTM layer: used to filter the information in the neuron state through the gate mechanism to transmit useful information, and the state of the hidden layer is output at each moment. For the named entity recognition task, the prediction of the current value of the text sequence is not only related to the past sequence, but also to the future value. By combining the forward LSTM and the reverse LSTM, the hidden layers in the two directions are connected together to obtain the final context-related representation; CRF layer: used in the named entity recognition task to constrain the labels and improve the accuracy of entity recognition.

[0044] In a possible embodiment, the above-mentioned recipe knowledge graph-based recommendation system performs entity data recognition processing on the above-mentioned text data to be recommended through an entity data recognition model to obtain corresponding entity data including recipe name, recipe ingredients, recipe season, diseases prevented by the recipe, and nutritional components of the recipe.

[0045] The trained entity relationship joint extraction model can be any deep learning model that can determine the entity relationship between entity data by parsing the meaning between entity data. Figure 5 In this paper, a joint entity-relation extraction model is described, where the model can be divided into an input encoding part and a recipe triple extraction part; In the input encoding part, the above entity data is first constructed according to the input format of the MacBERT model to construct the input word vector, position vector and segment vector. These three vectors are added together as the final input vector. The specific final input vector can be obtained through the following steps: 1) For example, the original text is: "Today, I will make a dish of beef brisket stewed with tomatoes. Beef brisket is rich in protein, amino acids, riboflavin, etc." The reconstructed sequence is: "[CLS] Today, I will make a dish of beef brisket stewed with tomatoes. [SEP] Beef brisket is rich in protein, amino acids, riboflavin, etc." 2) Word vector representation: Map the original text into IDs through the preset database vocabulary, and then construct the corresponding one-hot representation through the ID , and the word vector matrix Initialize and obtain the currently initialized word vector by multiplying the one-hot encoding with the word vector matrix , the specific calculation can be obtained by the following formula: ; 3) Position vector representation: The calculation method of the position vector is similar to that of the word vector, and the matrix of the position vector is also initialized , for each input character position, one-hot encoding is used to obtain , and the position vector It is obtained by multiplying the position matrix with the one-hot encoding of the character, as shown in Formula 2: ; 4) Segment vector representation: In order to distinguish the input sentences, firstly, the segment vector matrix Initialize, and there are only two ways to represent the one-hot encoding of sentence pairs, sentence one is represented by 0, sentence two is represented by 1, recorded as , so the final segment vector is shown in formula 3: ; 5) The input of the MacBERT model is the accumulation of word vectors, position vectors and segment vectors, as shown in the formula: ; Figure 5 The CLN module shown in the figure can make the data distributed in the linear area as much as possible, avoid falling into the saturation area, and thus avoid the problem of gradient disappearance. The CLN module is used to fuse the input coding sequence and the head entity coding to improve the extraction results of the tail entity and relationship. Based on CLN, the conditional information is further fused to improve the prediction accuracy.

[0046] In the recipe triple extraction part, the Sigmoid function is first used to identify the head of the entity data, and the result is divided into 1 or 0 according to the recognition result. It can be performed according to the following formula: ; ; in, and They represent the starting and ending positions of the i-th character in the input sequence that is recognized as the head entity. represents the trainable weights, Represents the first The encoding of characters, Represents a trainable bias.

[0047] After the header of the entity data is identified, the CLN module is used to normalize the input coding sequence and the header coding sequence of the entity data, and the tail of the entity data is identified according to the meaning relationship in Table 1. The specific tail identification can be obtained by the following formula: ; ; ; in, and Represents the input sequence characters are recognized as the start and end positions of the tail entity, represents the trainable weights, Represents the fusion code The encoding of characters, Represents the sampled header entity code, Represents a trainable bias.

[0048] By determining the input encoding part and the recipe triplet extraction part, the corresponding vector can be constructed for model processing. After the above-mentioned entity relationship joint extraction model processes the corresponding vector, when the output result is within the training threshold interval, it means that the entity relationship joint extraction model can perform entity relationship processing on the entity data, that is, the above-mentioned recipe knowledge graph-based recommendation system can process the entity data corresponding to the above-mentioned text data to be recommended through the trained entity relationship joint extraction model to obtain the entity relationship between the entity data.

[0049] In another possible embodiment, the recipe knowledge graph-based recommendation system processes the entity data corresponding to the text data to be recommended through a trained entity relationship joint extraction model to obtain the entity relationship between the entity data, and establishes a path spectrum graph based on the obtained entity relationship and the connection between the entity data, thereby constructing a knowledge graph of the corresponding recipe.

[0050] Optionally, in the step of constructing a recipe knowledge graph based on the entity relationship between entity data, it also includes determining the entity relationship between at least two entity data; and constructing the corresponding recipe knowledge graph with the entity data as nodes and the entity relationship as paths.

[0051] In an embodiment of the present invention, the above-mentioned nodes may be ingredients (chicken, onion, carrot), dishes (Kung Pao Chicken, Braised Pork), cooking methods (frying, boiling, stewing), etc. in entity data, and the above-mentioned paths may be the relationship between ingredients and dishes in entity relationships ("Chicken" → "Kung Pao Chicken" (chicken is the main ingredient of Kung Pao Chicken), "Onion" → "Braised Pork" (onion is a supplementary ingredient for braised pork)), and the relationship between dishes and cooking methods ("Kung Pao Chicken" → "Fry" (the cooking method of Kung Pao Chicken is stir-frying), "Braised Pork" → "Braise" (the cooking method of braised pork is braising)), and the nodes are connected according to the analyzed nodes and the relationship between the corresponding nodes, and finally a recipe knowledge graph is constructed.

[0052] Optionally, before the entity data corresponding to the recommended text data is processed by the trained entity relationship joint extraction model to obtain the entity relationship between the entity data, the step also includes obtaining the entity relationship joint extraction model to be trained; performing relationship annotation processing on the entity data corresponding to the recommended text data by preset relationship types to determine the entity relationship between the entity data; constructing an entity relationship joint extraction data set based on the entity relationship between the entity data; iteratively training the entity relationship joint extraction model to be trained by using the training data set and the test data set, and obtaining the trained entity relationship joint extraction model after the iterative training is completed.

[0053] In an embodiment of the present invention, the above-mentioned entity relationship joint extraction data set includes a training data set and a test data set. It should be noted that the training data set and the test data set can be obtained by constructing vectors in the above-mentioned input encoding part and the recipe triple extraction part. Specifically, when constructing the vector, when the word vector, the position vector, and the segment vector are determined, the corresponding constructed input vector is also determined. Therefore, it can be used as a data in the corresponding test data set to test whether the above-mentioned trained entity relationship joint extraction model can parse the entity relationship between entity data.

[0054] When constructing a vector, when one of the word vector, position vector, or segment vector is uncertain, the corresponding constructed input vector is also uncertain. Therefore, it can be used as a training data in the corresponding training data set to be processed by the entity relationship joint extraction model to be trained and output a value for comparison with a preset entity relationship threshold. The parameters of the entity relationship joint extraction model to be trained are adjusted based on the comparison results, so that the entity relationship joint extraction model to be trained can parse the entity relationship between the entity data according to the adjusted parameters and output the correct entity relationship.

[0055] Optionally, in the step of performing entity relationship processing on the recommended text data based on the recipe knowledge graph to generate corresponding recipe recommendation data, it also includes calculating the path between at least two entity data with entity relationship to determine the contribution corresponding to the path; based on the contribution, calculating the score value between the two entity data connected by the path; and determining the recipe recommendation data based on the comparison of the score value with a preset recommendation threshold.

[0056] In the embodiment of the present invention, the above contribution can be used to measure the importance or correlation of the path between two entity data. Generally speaking, the closer or more important the entity relationship between the two entity data is, the greater the contribution of the path. For example, when the entity data is chicken, pork, and pork belly, the path contribution between chicken and pork belly should be smaller than the path contribution between pork and pork belly, because the only connection between chicken and pork belly is that they are both meat, and pork belly is a type of pork, and the connection between the two is closer. Therefore, the node and path contribution corresponding to the two entity data of pork and pork belly is greater than the contribution of chicken and pork belly. Specifically, the contribution can be obtained by the following formula: ; in, is the weight coefficient of the path type, for example, the relationship between ingredients and dishes may have a higher weight; It is the path relevance, which is usually determined by factors such as the strength and frequency of the path.

[0057] The above scores can be obtained by Figure 6 The recommended model structure shown is processed to obtain: Among them, the recommendation model uses three embedding layers, which are used to represent entity data, entity type and entity relationship respectively. The embedding vectors corresponding to the three embedding layers are concatenated to represent the embedding vector, and then a path is given by the model , encode the entity data and the corresponding entity type into two representation vectors and , and then encode the relationship between entity data as , then about the path The embedding representation of , in the input of LSTM, , concatenate the vectors. For the last entity data, you can use an empty relationship vector , the last layer output of LSTM That means the entire path .

[0058] Then given a recipe rep_1 liked by user u and a target recipe rep_2, the path between the two recipes is embedded as a set , by calculating to predict the scores of these two recipes, we can get it by the following formula: ; Among them, P m is the concatenated path embedding vector, used to represent the path, represents the weight coefficient of the fully connected layer, Represents bias. Represents the score of a path. Represents the final score between two recipes. The scores of all paths of the two recipes are calculated based on this formula to get the final score. is a hyperparameter used to control the weight. This parameter is introduced because different paths contribute differently to the recommendation. The function normalizes the scores to obtain the final result. In another possible embodiment, the recommendation threshold can also be set. ,if , then recommend this recipe to the user, if , then this recipe will not be recommended to the user.

[0059] The above-mentioned recipe recommendation data may include but is not limited to the recipe name, preparation method and preparation ingredients corresponding to the entity data.

[0060] like Figure 7As shown, the embodiment of the present invention further provides a recipe recommendation device 700 based on a knowledge graph path, and the recipe recommendation device based on a knowledge graph path includes: The first acquisition module 701 is used to acquire text data to be recommended; The first generating module 702 is used to process the text data to be recommended based on the recipe knowledge graph to generate corresponding recipe recommendation data.

[0061] Optionally, the first acquisition module 701 includes: Get recipe text information; The recipe text information is preprocessed through a natural language processing model to obtain text data to be recommended.

[0062] Optionally, the above device further comprises: a marking module, for marking the text data to be recommended according to preset entity data, and determining entity data corresponding to the text data to be recommended, wherein the preset entity data includes a recipe name, recipe ingredients, recipe season, diseases prevented by the recipe, and nutritional ingredients of the recipe; A processing module, used to process the entity data corresponding to the text data to be recommended by using a trained entity relationship joint extraction model to obtain entity relationships between the entity data; A construction module is used to construct the recipe knowledge graph based on the entity relationship between the entity data.

[0063] Optionally, the above building blocks include: A first determination submodule, used to determine an entity relationship between at least two entity data; The first construction submodule is used to construct a corresponding recipe knowledge graph using the entity data as nodes and the entity relationships as paths.

[0064] Optionally, the above device further comprises: The first acquisition submodule is used to obtain the entity relationship joint extraction model to be trained; A first processing submodule is used to perform relationship annotation processing on the entity data corresponding to the text data to be recommended by using a preset relationship type, and determine the entity relationship between the entity data; A second construction submodule is used to construct an entity relationship joint extraction data set based on the entity relationship between the entity data, and the entity relationship joint extraction data set includes a training data set and a test data set; The training submodule is used to iteratively train the entity relationship joint extraction model to be trained through the training data set and the test data set, and obtain the trained entity relationship joint extraction model after the iterative training is completed.

[0065] Optionally, the first generating module 702 includes: A second determination submodule is used to calculate a path between at least two entity data having an entity relationship, and determine a contribution corresponding to the path; A first calculation submodule, used for calculating a score value between two entity data connected by the path based on the contribution degree; The third determination submodule is used to determine the recipe recommendation data based on the comparison between the score value and a preset recommendation threshold, where the recipe recommendation data includes the recipe name, preparation method and preparation ingredients corresponding to the entity data.

[0066] like Figure 8 As shown, an embodiment of the present invention further provides an electronic device 800, including a processor, and the processor can execute any of the above-mentioned recipe recommendation methods based on knowledge graph paths.

[0067] Specifically, it includes a processor 801 and a memory 802, and a computer program stored in the memory 802 and capable of running on the processor 801 for executing a recipe recommendation method based on a knowledge graph path, wherein: The processor 801 runs the computer program of the recipe recommendation method based on the knowledge graph path stored in the memory 802, and performs the following steps: Get the text data to be recommended; Based on the recipe knowledge graph, entity relationship processing is performed on the text data to be recommended to generate corresponding recipe recommendation data.

[0068] Optionally, the processor 801 executes the step of obtaining the text data to be recommended, including: Get recipe text information; The recipe text information is preprocessed through a natural language processing model to obtain text data to be recommended.

[0069] Optionally, before the processor 801 performs entity relationship processing on the text data to be recommended based on the recipe knowledge graph to generate corresponding recipe recommendation data, the method further includes: According to preset entity data, the text data to be recommended is labeled to determine entity data corresponding to the text data to be recommended, wherein the preset entity data includes a recipe name, recipe ingredients, recipe season, diseases prevented by the recipe, and nutritional components of the recipe; The entity data corresponding to the text data to be recommended are processed by a trained entity relationship joint extraction model to obtain entity relationships between the entity data; The recipe knowledge graph is constructed based on the entity relationships between the entity data.

[0070] Optionally, the processor 801 executes the step of constructing the recipe knowledge graph based on the entity relationship between the entity data, including: Determine an entity relationship between at least two entity data; The corresponding recipe knowledge graph is constructed with the entity data as nodes and the entity relationships as paths.

[0071] Optionally, before the processor 801 executes the trained entity relationship joint extraction model to process the entity data corresponding to the text data to be recommended and obtains the entity relationship between the entity data, the method further includes: Obtain the entity relationship joint extraction model to be trained; By presetting the relationship type, performing relationship annotation processing on the entity data corresponding to the text data to be recommended, and determining the entity relationship between the entity data; Based on the entity relationships between the entity data, construct an entity relationship joint extraction dataset, wherein the entity relationship joint extraction dataset includes a training dataset and a test dataset; The entity relationship joint extraction model to be trained is iteratively trained using the training data set and the test data set, and after the iterative training is completed, a trained entity relationship joint extraction model is obtained.

[0072] Optionally, the processor 801 further performs entity relationship processing on the text data to be recommended based on the recipe knowledge graph to generate corresponding recipe recommendation data, including: Calculating a path between at least two entity data having an entity relationship, and determining a contribution degree corresponding to the path; Based on the contribution, a score value between two entity data connected by the path is calculated; The recipe recommendation data is determined based on a comparison between the score value and a preset recommendation threshold, and the recipe recommendation data includes a recipe name, a preparation method, and preparation ingredients corresponding to the entity data.

[0073] An embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the recipe recommendation method based on the knowledge graph path or the recipe recommendation method based on the knowledge graph path on the application side provided by the embodiment of the present invention are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0074] Those skilled in the art can understand that the implementation of all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM).

[0075] The above disclosure is only the preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.

Claims

1. A recipe recommendation method based on knowledge graph path, characterized in that: include: Get the text data to be recommended; Based on the recipe knowledge graph, entity relationship processing is performed on the text data to be recommended to generate corresponding recipe recommendation data.

2. The recipe recommendation method based on knowledge graph path according to claim 1, characterized in that: The step of obtaining the text data to be recommended includes: Get recipe text information; The recipe text information is preprocessed through a natural language processing model to obtain text data to be recommended.

3. The recipe recommendation method based on knowledge graph path according to claim 1, characterized in that: Before performing entity relationship processing on the text data to be recommended based on the recipe knowledge graph to generate corresponding recipe recommendation data, the method further includes: According to preset entity data, the text data to be recommended is labeled to determine entity data corresponding to the text data to be recommended, wherein the preset entity data includes a recipe name, recipe ingredients, recipe season, diseases prevented by the recipe, and nutritional components of the recipe; The entity data corresponding to the text data to be recommended are processed by a trained entity relationship joint extraction model to obtain entity relationships between the entity data; The recipe knowledge graph is constructed based on the entity relationships between the entity data.

4. The recipe recommendation method based on knowledge graph path according to claim 3, characterized in that: The step of constructing the recipe knowledge graph based on the entity relationship between the entity data includes: Determine an entity relationship between at least two entity data; The corresponding recipe knowledge graph is constructed with the entity data as nodes and the entity relationships as paths.

5. The recipe recommendation method based on knowledge graph path according to claim 3, characterized in that: Before the entity data corresponding to the text data to be recommended are processed by the trained entity relationship joint extraction model to obtain the entity relationship between the entity data, the method further includes: Obtain the entity relationship joint extraction model to be trained; By presetting the relationship type, performing relationship annotation processing on the entity data corresponding to the text data to be recommended, and determining the entity relationship between the entity data; Based on the entity relationships between the entity data, construct an entity relationship joint extraction dataset, wherein the entity relationship joint extraction dataset includes a training dataset and a test dataset; The entity relationship joint extraction model to be trained is iteratively trained using the training data set and the test data set, and after the iterative training is completed, a trained entity relationship joint extraction model is obtained.

6. The recipe recommendation method based on knowledge graph path as described in claim 4, characterized in that: The step of performing entity relationship processing on the text data to be recommended based on the recipe knowledge graph to generate corresponding recipe recommendation data includes: Calculating a path between at least two entity data having an entity relationship, and determining a contribution degree corresponding to the path; Based on the contribution, a score value between two entity data connected by the path is calculated; The recipe recommendation data is determined based on a comparison between the score value and a preset recommendation threshold, and the recipe recommendation data includes a recipe name, a preparation method, and preparation ingredients corresponding to the entity data.

7. A recipe recommendation device based on knowledge graph path, characterized in that: include: A first acquisition module, used to acquire text data to be recommended; The first generating module is used to process the text data to be recommended based on the recipe knowledge graph to generate corresponding recipe recommendation data.

8. A recipe recommendation system based on knowledge graph path, characterized in that: The recipe recommendation system based on knowledge graph path includes: a recipe recommendation device based on knowledge graph path; The recipe recommendation device based on knowledge graph path is determined by a recipe recommendation method based on knowledge graph path shown in claims 1-6.

9. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps in the recipe recommendation method based on the knowledge graph path as described in any one of claims 1 to 6 are implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps in the recipe recommendation method based on a knowledge graph path as described in any one of claims 1 to 6.

Citation Information

Cited By

  • Chinese food cooking process structuring method and system

    CN121030006A

  • A method and system for structuring a Chinese cooking process

    CN121030006B