Method, device, equipment and medium for determining the correlation between food nouns
By analyzing the mapping relationship between dishes and recipes and calculating the correlation between food nouns, the problem of insufficient data sources in the food field is solved, and the accuracy of correlation between food nouns is achieved and the efficiency of labeling is improved.
Patent Information
- Application Number
- CN201910453659.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-05-28
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2039-05-28
AI Technical Summary
In the prior art, due to the small number of food data sources and a single data type, it is difficult to construct a knowledge graph in the food field, and thus cannot effectively reflect the correlation between food nouns.
By analyzing the mapping relationship between dishes and recipes, the legal and illegal jump probability between food nouns is determined, and the correlation between food nouns is calculated based on these probabilities, and the legal jump probability and illegal jump probability correction factor are used to adjust Association matrix.
It realizes the accurate determination of the correlation between food nouns in the food field, solves the problem of insufficient data sources, improves the accuracy and efficiency of labeling, and is applied to machine learning model training.
Smart Images

Figure CN110335108B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of data processing technology, and in particular, to a method, device, electronic device, and readable storage medium for determining the association between food nouns. Background Art
[0002] With the development of e-commerce platforms, more and more dishes are displayed and sold through e-commerce platforms. In order to display each dish to buyers in multiple dimensions and to facilitate buyers to search for the desired dishes more accurately, e-commerce platforms usually need to build a knowledge graph in the field of food to reflect the correlation between ingredient nouns, such as synonyms, near synonyms, and superior-subordinate relationships. Labels can be set for similar ingredient nouns based on the above correlations, such as fish, chicken, eggs, mushrooms, etc.
[0003] In order to build a knowledge graph, the construction method provided by the relevant technology is: obtain professional data from different sources and different data types from multiple channels, extract information from professional data from various sources and data types, and then integrate knowledge of various professional data through entity disambiguation, information merging and other technologies to build a knowledge graph. However, the above method is highly dependent on the data source, and the professional data sources in the field of food are relatively few and the data types are single. Therefore, it is difficult to build a knowledge graph in the field of food using the above method, and it cannot reflect the correlation between food nouns. Summary of the invention
[0004] The embodiments of the present application provide a method, device, electronic device and readable storage medium for determining the association between food nouns, aiming to accurately determine the association between food nouns.
[0005] A first aspect of an embodiment of the present application provides a method for determining the association between food nouns, the method comprising:
[0006] According to the mapping relationship between dishes and recipes and between recipes and ingredient nouns, determine the legal jump probability of the first ingredient noun to the second ingredient noun under the condition that the legal path constraint is satisfied, wherein the legal path constraint refers to allowing the ingredient nouns in the recipes under the same dish to jump to each other;
[0007] According to the mapping relationship between the recipe and the ingredient noun, determining the illegal jump probability of the first ingredient noun jumping to the second ingredient noun under the condition that an illegal path constraint is satisfied, wherein the illegal path constraint indicates that mutual jumps between ingredient nouns under the same recipe are illegal;
[0008] The association between the first ingredient noun and the second ingredient noun is determined according to a legal jump probability and an illegal jump probability from the first ingredient noun to the second ingredient noun.
[0009] Optionally, according to the mapping relationship between dishes and recipes and between recipes and ingredient nouns, determining the legal jump probability of the first ingredient noun jumping to the second ingredient noun under the condition that the legal path constraint is satisfied includes:
[0010] Determine, according to the mapping relationship between dishes and recipes and between recipes and ingredient nouns, a legal path for jumping from the first ingredient noun to the second ingredient noun, wherein the legal path satisfies the legal path constraint;
[0011] Determine the probability corresponding to a legal path of the first ingredient noun jumping to the second ingredient noun according to the number of all recipes corresponding to the first ingredient noun, the number of all dishes corresponding to each first target recipe including the first ingredient noun, the number of all recipes corresponding to each first target dish including the first target recipe, and the number of all ingredients corresponding to each second target recipe under the first target dish;
[0012] The probability corresponding to the legal path is determined as the legal jump probability of the first ingredient noun jumping to the second ingredient noun.
[0013] Optionally, determining, based on a mapping relationship between recipes and ingredient nouns, an illegal jump probability between the first ingredient noun and the second ingredient noun under a condition that an illegal path constraint is satisfied, includes:
[0014] According to the mapping relationship between the recipe and the ingredient noun, determining an illegal path from the first ingredient noun to the second ingredient noun, wherein the illegal path satisfies the illegal path constraint;
[0015] Determining a probability corresponding to an illegal path from the first ingredient noun to the second ingredient noun based on the number of all recipes corresponding to the first ingredient noun and the number of all ingredients corresponding to each first target recipe including the first ingredient noun;
[0016] The probability corresponding to the illegal path is determined as the illegal jump probability of the first ingredient noun jumping to the second ingredient noun.
[0017] Optionally, determining the association between the first ingredient noun and the second ingredient noun according to a legal jump probability and an illegal jump probability of the first ingredient noun to the second ingredient noun includes:
[0018] Determine a correction factor corresponding to an illegal jump probability of the first ingredient noun jumping to the second ingredient noun;
[0019] The association between the first ingredient noun and the second ingredient noun is determined according to the legal jump probability, the illegal jump probability and the correction factor of the first ingredient noun to the second ingredient noun.
[0020] Optionally, the method further comprises:
[0021] Determine, based on the mapping relationship between dishes and recipes and between recipes and ingredient nouns, a legal jump probability of the second ingredient noun jumping to the first ingredient noun under the condition that the legal path constraint is satisfied;
[0022] Determining, according to a mapping relationship between recipes and ingredient nouns, an illegal jump probability of the second ingredient noun jumping to the first ingredient noun under a condition that the illegal path constraint is satisfied;
[0023] Determining the association between the first ingredient noun and the second ingredient noun according to the legal jump probability and the illegal jump probability of the first ingredient noun to the second ingredient noun includes:
[0024] determining a first estimated value of the degree of association between the first ingredient noun and the second ingredient noun according to a legal jump probability and an illegal jump probability from the first ingredient noun to the second ingredient noun;
[0025] determining a second estimated value of the degree of association between the first ingredient noun and the second ingredient noun according to a legal jump probability and an illegal jump probability of the second ingredient noun jumping to the first ingredient noun;
[0026] The larger one of the first estimated association degree value and the second estimated association degree value is determined as the association degree between the first ingredient noun and the second ingredient noun.
[0027] Optionally, the legal jump probabilities of mutual jumps between multiple different food nouns constitute a legal jump probability matrix, and the illegal jump probabilities of mutual jumps between multiple different food nouns constitute an illegal jump probability matrix; the multiple different food nouns include food nouns whose occurrence frequency is lower than a preset frequency; the associations between the multiple different food nouns constitute an association matrix, and the association matrix is determined according to the following formula:
[0028] sim=TP*TP T -FP
[0029] Among them, sim is the association matrix, TP is the legal jump probability matrix, and FP is the illegal jump probability matrix.
[0030] Optionally, the illegal jump probability matrix corresponds to a correction factor; the associations between the multiple different food nouns form an association matrix, and the association matrix is determined according to the following formula:
[0031] sim=TP*TP T -FP*α
[0032] Wherein, α is the correction factor.
[0033] Optionally, after determining the correlation between the first food noun and the second food noun, the method further includes:
[0034] When the correlation between the first ingredient noun and the second ingredient noun is greater than a preset threshold, the first ingredient noun and the second ingredient noun are marked with a preset ingredient label.
[0035] A second aspect of an embodiment of the present application provides a device for determining the association between food nouns, the device comprising:
[0036] A first determination module is used to determine the legal jump probability of the first ingredient noun to the second ingredient noun under the condition of satisfying the legal path constraint according to the mapping relationship between the dish and the recipe and between the recipe and the ingredient noun, wherein the legal path constraint refers to allowing the ingredient nouns in the recipes under the same dish to jump to each other;
[0037] A second determination module is used to determine, based on a mapping relationship between recipes and ingredient nouns, an illegal jump probability of the first ingredient noun jumping to the second ingredient noun under a condition that an illegal path constraint is satisfied, wherein the illegal path constraint indicates that mutual jumps between ingredient nouns under the same recipe are illegal;
[0038] The third determination module is used to determine the association between the first ingredient noun and the second ingredient noun according to the legal jump probability and the illegal jump probability of the first ingredient noun to the second ingredient noun.
[0039] Optionally, the first determining module includes:
[0040] A first sub-determination module is used to determine a legal path for jumping from the first ingredient noun to the second ingredient noun according to a mapping relationship between dishes and recipes and between recipes and ingredient nouns, wherein the legal path satisfies the legal path constraint;
[0041] A second sub-determination module is used to determine the probability corresponding to a legal path of the first ingredient noun jumping to the second ingredient noun based on the number of all recipes corresponding to the first ingredient noun, the number of all dishes corresponding to each first target recipe including the first ingredient noun, the number of all recipes corresponding to each first target dish including the first target recipe, and the number of all ingredients corresponding to each second target recipe under the first target dish;
[0042] The third sub-determination module is used to determine the probability corresponding to the legal path as the legal jump probability of the first ingredient noun jumping to the second ingredient noun.
[0043] Optionally, the second determining module includes:
[0044] a fourth sub-determination module, configured to determine, according to a mapping relationship between a recipe and an ingredient noun, an illegal path from the first ingredient noun to the second ingredient noun, wherein the illegal path satisfies the illegal path constraint;
[0045] a fifth sub-determination module, configured to determine a probability corresponding to an illegal path of the first ingredient noun jumping to the second ingredient noun based on the number of all recipes corresponding to the first ingredient noun and the number of all ingredients corresponding to each first target recipe including the first ingredient noun;
[0046] The sixth sub-determination module is used to determine the probability corresponding to the illegal path as the illegal jump probability of the first ingredient noun jumping to the second ingredient noun.
[0047] Optionally, the third determining module includes:
[0048] A seventh determination submodule, configured to determine a correction factor corresponding to an illegal jump probability of the first ingredient noun jumping to the second ingredient noun;
[0049] The eighth determination submodule is used to determine the association between the first ingredient noun and the second ingredient noun according to the legal jump probability, the illegal jump probability and the correction factor of the first ingredient noun to the second ingredient noun.
[0050] Optionally, the device further comprises:
[0051] a fourth determination module, configured to determine, based on a mapping relationship between dishes and recipes and between recipes and ingredient nouns, a legal jump probability of the second ingredient noun jumping to the first ingredient noun under a condition that the legal path constraint is satisfied;
[0052] a fifth determination module, configured to determine, based on a mapping relationship between recipes and ingredient nouns, an illegal jump probability of the second ingredient noun jumping to the first ingredient noun under a condition that the illegal path constraint is satisfied;
[0053] The third determination module comprises:
[0054] a ninth determination submodule, configured to determine a first estimated value of the degree of association between the first ingredient noun and the second ingredient noun according to a legal jump probability and an illegal jump probability of the first ingredient noun jumping to the second ingredient noun;
[0055] a tenth determining submodule, configured to determine a second estimated value of the degree of association between the first ingredient noun and the second ingredient noun according to a legal jump probability and an illegal jump probability of the second ingredient noun jumping to the first ingredient noun;
[0056] An eleventh determining submodule is configured to determine the larger one of the first estimated association degree and the second estimated association degree as the association degree between the first ingredient noun and the second ingredient noun.
[0057] Optionally, the legal jump probabilities of mutual jumps between multiple different food nouns constitute a legal jump probability matrix, and the illegal jump probabilities of mutual jumps between multiple different food nouns constitute an illegal jump probability matrix; the multiple different food nouns include food nouns whose occurrence frequency is lower than a preset frequency; the associations between the multiple different food nouns constitute an association matrix; the device further comprises:
[0058] The sixth determination module is used to determine the association matrix according to the following formula:
[0059] sim=TP*TP T -FP
[0060] Among them, sim is the association matrix, TP is the legal jump probability matrix, and FP is the illegal jump probability matrix.
[0061] Optionally, the illegal jump probability matrix corresponds to a correction factor; the associations between the multiple different food nouns form an association matrix, and the device further includes:
[0062] The seventh determination module is used to determine the association matrix according to the following formula:
[0063] sim=TP*TP T -FP*α
[0064] Wherein, α is the correction factor.
[0065] Optionally, the device further comprises:
[0066] The marking module is used to mark the first ingredient noun and the second ingredient noun with a preset ingredient label after determining the association between the first ingredient noun and the second ingredient noun, if the association between the first ingredient noun and the second ingredient noun is greater than a preset threshold.
[0067] A third aspect of an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the method described in the first aspect of the present application.
[0068] A fourth aspect of an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executed, implements the steps of the method described in the first aspect of the present application.
[0069] On the one hand, the method for determining the association between ingredient nouns provided in the embodiment of the present application is adopted. According to the characteristics that similar ingredients may appear in multiple recipes corresponding to the same dish but are unlikely to appear at the same time in the same recipe in easily accessible recipe data such as "dish-recipe-ingredient noun", the legal jump probability of the first ingredient noun jumping to the second ingredient noun is determined, and the illegal jump probability of the first ingredient noun jumping to the second ingredient noun is determined. Then, based on the legal jump probability and the illegal jump probability, the association between the first ingredient noun and the second ingredient noun is determined, which solves the problem in the prior art that it is difficult to construct a knowledge graph in the food field due to the small number of food data sources and the single data type, and thus the association between the ingredient nouns cannot be reflected.
[0070] On the other hand, the method for determining the correlation between food nouns provided in the embodiment of the present application can also be applied to model training in the field of machine learning. The method provided in the present application is used to mark multiple sample food nouns with high correlation in the training set with unified labels, thereby improving the labeling accuracy and improving the labeling efficiency compared to manual labeling. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0072] Figure 1 It is a schematic diagram of the data structure of recipe data;
[0073] Figure 2is a flow chart of a method for determining the relevance between food nouns proposed in one embodiment of the present application;
[0074] Figure 3 It is a tree diagram of the mapping relationship between "dish-recipe-ingredient noun";
[0075] Figure 4 is a flow chart of a method for determining the relevance between food nouns proposed in one embodiment of the present application;
[0076] Figure 5 It is a schematic diagram of a device for determining the association between food nouns provided in one embodiment of the present application. DETAILED DESCRIPTION
[0077] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0078] With the development of e-commerce platforms, more and more dishes are displayed and sold through e-commerce platforms. E-commerce platforms usually need to build a knowledge graph in the field of food for a variety of dishes to reflect the correlation between ingredient nouns, and can set labels for similar ingredient nouns based on the above correlation, such as fish, chicken, eggs, fungi and other labels. For example, for example, a "tomato" label can be set for ingredient nouns such as "tomato", "tomatoes", "big tomatoes", and "small tomatoes". When buyers search for dishes containing tomatoes in their ingredients, or search for dishes containing tomatoes in their ingredients, various dishes with corresponding tomato labels can be recommended to buyers, enriching user choices and achieving accurate recall of searches.
[0079] In the related technology, when constructing the knowledge graph in the field of food, the existing knowledge fusion technology is usually used. However, since the knowledge fusion technology is highly dependent on the data source, and the professional data sources in the field of food are few and the data types are single, it is difficult to construct the knowledge graph in the field of food using the knowledge fusion technology, and thus it cannot reflect the correlation between the food nouns.
[0080] The inventor of this application has obtained a wealth of recipe data from a food website. The recipe data includes multiple dishes, each dish corresponds to multiple recipes, and each recipe includes multiple ingredient names. Figure 1 , Figure 1 This is a diagram of the data structure of recipe data. Figure 1 There are two dishes in the menu, namely scrambled eggs with tomatoes and beef brisket stewed with tomatoes. Figure 1As indicated by the solid arrows, scrambled eggs with tomatoes corresponds to Recipe 1 and Recipe 2. Recipe 1 includes eggs and tomatoes, and Recipe 2 includes eggs and tomatoes. Braised beef brisket with tomatoes corresponds to Recipe 3 and Recipe 4. Recipe 3 includes beef and large tomatoes, and Recipe 4 includes beef brisket and large tomatoes.
[0081] Through analyzing the recipe data, the inventors of the present application found that the recipe data has at least the following two characteristics: First, similar ingredients may appear in multiple recipes corresponding to the same dish; Second, similar ingredients are unlikely to appear simultaneously in the same recipe. As Figure 1 indicated by the dashed arrow in the figure, the two ingredient names, "tomato" and "tomatoes", appear in Recipe 2 and Recipe 1 corresponding to scrambled eggs with tomatoes respectively, but do not appear in the same recipe.
[0082] Based on the above findings, for two ingredient names whose correlation needs to be determined, the inventors of the present application proposed a technical solution that first determines the legal jump probability of the first ingredient name jumping to the second ingredient name, and determines the illegal jump probability of the first ingredient name jumping to the second ingredient name, and then determines the correlation between the first ingredient name and the second ingredient name according to the legal jump probability and the illegal jump probability.
[0083] Refer to Figure 2 , Figure 2 which is a flowchart of a method for determining the correlation between ingredient names proposed in an embodiment of the present application. As Figure 2 shown, the method includes the following steps:
[0084] Step S11: According to the mapping relationship between the dish and the recipe and between the recipe and the ingredient name, determine the legal jump probability of the first ingredient name jumping to the second ingredient name under the condition of satisfying the legal path constraint, where the legal path constraint means that the ingredient names in each recipe allowed to appear in the same dish can jump to each other.
[0085] In this embodiment, the mapping relationship between the dish and the recipe means: for a certain dish in the recipe data, which recipes in the recipe data does this dish specifically correspond to; for a certain recipe in the recipe data, which dishes in the recipe data does this recipe specifically point to.
[0086] Exemplarily, refer to Figure 1 , for the dish of scrambled eggs with tomatoes in the recipe data, this dish corresponds to Recipe 1 and Recipe 2; from another perspective, Recipe 1 can point to the dish of scrambled eggs with tomatoes, and can also point to other dishes in the recipe data, such as tomato and egg soup; Recipe 2 can point to the dish of scrambled eggs with tomatoes, and can also point to other dishes in the recipe data, such as tomato and egg soup, tomato and egg flower soup. The above relationships represent the mapping relationship between the dish of scrambled eggs with tomatoes and Recipe 1 and Recipe 2.
[0087] In this embodiment, the mapping relationship between recipes and ingredient nouns means: for a certain recipe in the recipe data, which ingredient nouns in the recipe data the recipe specifically includes; for a certain ingredient noun in the recipe data, which recipes in the recipe data the ingredient noun specifically points to.
[0088] For example, refer to Figure 1 , for recipe 1 in the recipe data, this recipe corresponds to the two ingredient nouns "tomato" and "egg"; from another perspective, the ingredient noun "tomato" can point to recipe 1, and can also point to recipes 5 and 6 corresponding to tomato fried egg soup, etc.; the ingredient noun "egg" can point to recipe 1, and can also point to recipes 5 and 6 corresponding to tomato fried egg soup, and recipes 7 and 8 corresponding to tomato egg drop soup, etc. The above-mentioned relationship represents the mapping relationship between recipe 1 and the ingredient nouns "tomato" and "egg". In order to make Figure 1 More clear and concise, Figure 1 Dishes such as tomato fried egg soup and tomato egg drop soup are not shown, nor are recipes 5, 6, 7 and 8.
[0089] In order to explain step S11 in more detail, the inventors of the present application Figure 1 Taking the dish of scrambled eggs with tomatoes as an example, the mapping relationship between "dish-recipe-ingredient noun" is abstracted as Figure 3 The dendrogram shown. Figure 3 , Figure 3 It is a tree diagram that reflects the mapping relationship between "dish-recipe-ingredient nouns".
[0090] In this embodiment, the legal path constraint means that the ingredient nouns in the recipes under the same dish are allowed to jump to each other. The legal jump probability means the probability of jumping along the legal path between ingredient nouns. Figure 3 As shown, for example, when calculating the legal jump probability of "tomato" jumping to other food nouns, the jump paths under the legal path constraints include: CABE ("tomato" jumps to "tomato"), CABF ("tomato" jumps to "egg"), CAAD ("tomato" jumps to "egg") and CAAC ("tomato" jumps to "tomato"). Based on the above jump paths, the legal jump probability of "tomato" jumping to other food nouns is calculated.
[0091] The illegal path constraint in step S12 described below means that it is illegal to jump between the names of ingredients in the same recipe. The illegal jump probability means the probability of jumping along an illegal path between the names of ingredients. Figure 3As shown, when calculating the illegal jump probability of "tomato" jumping to other food nouns, the jump paths under the illegal path constraint include: CD ("tomato" jumps to "egg") and CC ("tomato" jumps to "tomato"). Based on the above jump paths, the illegal jump probability of "tomato" jumping to other food nouns is calculated.
[0092] Among the four jump paths listed above: CABE, CABF, CAAD, and CAAC, the last two jump paths are actually jump paths under illegal path constraints, because they both jump under recipe 1 where "tomato" is located. This shows that multiple jump paths under legal path constraints include jump paths under illegal paths.
[0093] In this embodiment, when determining the legal jump probability of the first ingredient noun to the second ingredient noun, the following steps may be specifically included:
[0094] S11-1: determining a legal path for jumping from the first ingredient noun to the second ingredient noun based on a mapping relationship between dishes and recipes and between recipes and ingredient nouns, wherein the legal path satisfies the legal path constraint;
[0095] S11-2: Determine the probability corresponding to a legal path of the first ingredient noun jumping to the second ingredient noun based on the number of all recipes corresponding to the first ingredient noun, the number of all dishes corresponding to each first target recipe including the first ingredient noun, the number of all recipes corresponding to each first target dish including the first target recipe, and the number of all ingredients corresponding to each second target recipe under the first target dish;
[0096] S11-3: Determine the probability corresponding to the legal path as the legal jump probability of the first ingredient noun jumping to the second ingredient noun.
[0097] For example, the jump probability corresponding to each legal path from the first ingredient noun to the second ingredient noun under the legal path constraint can be calculated first; then all jump probability values can be added together to determine the probability corresponding to the legal path from the first ingredient noun to the second ingredient noun, and use this as the legal jump probability.
[0098] For example, we first calculate the probability that the first ingredient noun jumps to the recipe containing the first ingredient noun. This probability is equal to Where n C represents the number of all recipes corresponding to the first ingredient noun; then calculate the probability that the first target recipe containing the first ingredient noun jumps to the dish containing the first target recipe, which is equal to Where n Frepresents the total number of dishes corresponding to the first target recipe; then calculate the probability that the first target dish containing the first target recipe jumps to the recipe below it, which is equal to Where nC represents the number of all recipes corresponding to the first target dish; then calculate the probability of the second target recipe under the first target dish jumping to the ingredient noun under it, which is equal to Where nI represents the number of all ingredients corresponding to the second target recipe; finally, the jump probability of the first ingredient noun jumping to the second ingredient noun along the above legal path is calculated, and the jump probability is
[0099] by Figure 3 Taking "tomato" as the first ingredient noun and "tomatoes" as the second ingredient noun as an example, it is determined that one of the legal paths for "tomato" to jump to "tomatoes" is CABE.
[0100] First, calculate the probability that "tomato" jumps to the recipe containing "tomato", that is, calculate the probability that "tomato" jumps to recipe 1. Assuming that in the recipe data, "tomato" corresponds to a total of 65 recipes, including recipe 1, then this probability is equal to
[0101] Then calculate the probability that the first target recipe containing "tomato" jumps to the dish containing the first target recipe, that is, calculate the probability that recipe 1 jumps to scrambled eggs with tomatoes. Assuming that in the recipe data, recipe 1 points to 4 dishes, including scrambled eggs with tomatoes, then this probability is equal to
[0102] Then calculate the probability that the first target dish containing the first target recipe jumps to the recipe below it, that is, calculate the probability that scrambled eggs with tomatoes jumps to recipe 2, assuming that scrambled eggs with tomatoes only corresponds to Figure 3 The probability of the two recipes, Recipe 1 and Recipe 2, is equal to
[0103] Next, calculate the probability that the second target recipe under the first target dish jumps to the ingredient noun under it, that is, calculate the probability that recipe 2 jumps to "tomato". Assuming that recipe 2 only includes the two ingredient nouns "tomato" and "egg", this probability is equal to
[0104] Finally, the jump probability of "tomato" jumping to "tomato" along the legal path of CABE is calculated. This jump probability is
[0105] It should be understood that Figure 3The tree diagram shown only shows a small part of the recipe data. In the remaining part of the recipe data that is not shown, there may be multiple legal jump paths from "tomato" to "tomato". For each legal path, the jump probability corresponding to the legal path is calculated according to the above method, and then all the jump probability values are added together to obtain the legal jump probability of "tomato" to "tomato".
[0106] S12: Determine, based on the mapping relationship between recipes and ingredient nouns, the illegal jump probability of the first ingredient noun to the second ingredient noun under the condition of satisfying an illegal path constraint, wherein the illegal path constraint indicates that mutual jumps between ingredient nouns under the same recipe are illegal.
[0107] In this embodiment, as described above, the mapping relationship between recipes and ingredient nouns means: for a certain recipe in the recipe data, which ingredient nouns in the recipe data are specifically included in the recipe; for a certain ingredient noun in the recipe data, which recipes in the recipe data are specifically pointed to by the ingredient noun. The illegal path constraint means: it is illegal to jump between ingredient nouns that appear in the same recipe. The illegal jump probability means: the probability of jumping along an illegal path between ingredient nouns.
[0108] In this embodiment, when determining the illegal jump probability of the first ingredient noun to the second ingredient noun, the following steps may be specifically included:
[0109] S12-1: determining an illegal path from the first ingredient noun to the second ingredient noun according to a mapping relationship between recipes and ingredient nouns, wherein the illegal path satisfies the illegal path constraint;
[0110] S12-2: determining a probability corresponding to an illegal path from the first ingredient noun to the second ingredient noun based on the number of all recipes corresponding to the first ingredient noun and the number of all ingredients corresponding to each first target recipe including the first ingredient noun;
[0111] S12-3: Determine the probability corresponding to the illegal path as the illegal jump probability of the first ingredient noun jumping to the second ingredient noun.
[0112] For example, the jump probability corresponding to each illegal path from the first ingredient noun to the second ingredient noun under the illegal path constraint can be calculated first; then all the jump probability values can be added together to determine the probability corresponding to the illegal path from the first ingredient noun to the second ingredient noun, and use this as the illegal jump probability.
[0113] For example, we first calculate the probability that the first ingredient noun jumps to the recipe containing the first ingredient noun, which is equal to where nC represents the total number of recipes corresponding to the first ingredient noun; then calculate the probability of the first target recipe containing the first ingredient noun jumping to the ingredient noun below it, which is equal to Where n I represents the number of all ingredients corresponding to the first target recipe; finally, the jump probability of the first ingredient noun jumping to the second ingredient noun along the above illegal path is calculated, and the jump probability is
[0114] by Figure 3 Taking "tomato" as the first ingredient noun and "egg" as the second ingredient noun as an example, it is determined that one of the illegal paths for "tomato" to jump to "egg" is CD.
[0115] First, calculate the probability that "tomato" jumps to the recipe containing "tomato", that is, calculate the probability that "tomato" jumps to recipe 1. Assuming that in the recipe data, "tomato" corresponds to a total of 65 recipes, including recipe 1, then this probability is equal to
[0116] Then calculate the probability that the first target recipe containing "tomato" jumps to the ingredient noun under it, that is, calculate the probability that recipe 1 jumps to "egg". Assuming that recipe 1 only contains two ingredient nouns, "tomato" and "egg", this probability is equal to
[0117] Finally, the jump probability of "tomato" jumping to "egg" along the legal path CD is calculated. This jump probability is
[0118] It should be understood that Figure 3 The tree diagram shown only shows a small part of the recipe data. In the remaining unshown part of the recipe data, there may be multiple illegal jump paths from "tomato" to "egg". For each illegal path, the jump probability corresponding to the illegal path is calculated according to the above method, and then all the jump probability values are added together to obtain the illegal jump probability of "tomato" to "egg".
[0119] S13: Determine the association between the first ingredient noun and the second ingredient noun according to the legal jump probability and the illegal jump probability of the first ingredient noun to the second ingredient noun.
[0120] In this embodiment, the degree of association refers to: the degree of similarity between the first ingredient noun and the second ingredient noun. When the first ingredient noun and the second ingredient noun have a high degree of similarity, there may be a synonym relationship, a near-synonymous relationship, or a superior-subordinate relationship between the first ingredient noun and the second ingredient noun.
[0121] In this embodiment, considering that multiple jump paths under the legal path constraint include jump paths under illegal paths, the legal jump probability can be taken as the positive probability, and the illegal jump probability can be taken as the negative probability. On the basis of the legal jump probability, the illegal jump probability can be excluded to further determine the correlation between the first ingredient noun and the second ingredient noun.
[0122] By executing steps S11 to S13, based on the characteristics of easily accessible recipe data such as "dish-recipe-ingredient noun", similar ingredients may appear in multiple recipes corresponding to the same dish, but are unlikely to appear at the same time in the same recipe. The legal jump probability of the first ingredient noun to the second ingredient noun is determined, and the illegal jump probability of the first ingredient noun to the second ingredient noun is determined. Then, based on the legal jump probability and the illegal jump probability, the correlation between the first ingredient noun and the second ingredient noun can be determined, which solves the problem in the prior art that it is difficult to construct a knowledge graph in the food field due to the small number of food data sources and the single data type, and thus the correlation between the ingredient nouns cannot be reflected.
[0123] As an example of an implementable method, when determining the correlation between the first ingredient noun and the second ingredient noun, the following steps may be specifically included:
[0124] S13-1: Determine a correction factor corresponding to an illegal jump probability of the first ingredient noun jumping to the second ingredient noun;
[0125] S13-2: Determine the association between the first ingredient noun and the second ingredient noun according to the legal jump probability, illegal jump probability and the correction factor of the first ingredient noun to the second ingredient noun.
[0126] In this embodiment, since recipe data has the characteristic that similar ingredients may appear in multiple recipes corresponding to the same dish, but are unlikely to appear at the same time in the same recipe, if the ingredients corresponding to the first ingredient noun and the second ingredient noun are similar ingredients, such as "tomato" and "tomatoes", they are unlikely to appear at the same time in the same recipe, so the illegal jump probability of "tomato" jumping to "tomatoes" is usually 0. If the ingredients corresponding to the first ingredient noun and the second ingredient noun are dissimilar ingredients, such as "tomato" and "eggs", they are likely to appear at the same time in a recipe, so the illegal jump probability of "tomato" jumping to "eggs" is usually not 0.
[0127] Based on the above situation, by setting a correction factor, the illegal jump probability between dissimilar ingredients that is not 0 can be amplified, so that after subtracting the illegal jump probability multiplied by the correction factor, the legal jump probability between dissimilar ingredients will be weakened. Since the illegal jump probability between similar ingredients is usually 0, the illegal jump probability between similar ingredients will not be amplified by multiplying the correction factor, so the legal jump probability between similar ingredients will not be weakened. The legal jump probability after subtracting the illegal jump probability multiplied by the correction factor is taken as the correlation. For dissimilar ingredients, the correlation between them is smaller, and for similar ingredients, the correlation between them is larger, which is conducive to filtering out the interference of dissimilar ingredients on the confirmation of the correlation of similar ingredients.
[0128] Taking "tomato" as the first ingredient noun as an example, the computer batch calculates the legal jump probability and illegal jump probability of "tomato" jumping to the second ingredient nouns such as "tomato", "egg", "big tomato" and "beef brisket" based on the recipe data. Assume that the legal jump probabilities of "tomato" jumping to the second ingredient nouns such as "tomato", "egg", "big tomato" and "beef brisket" are 0.09, 0.06, 0.065 and 0.03 respectively; the illegal jump probabilities of "tomato" jumping to the second ingredient nouns such as "tomato", "egg", "big tomato" and "beef brisket" are 0, 0.01, 0 and 0.008 respectively; assuming that the correction factor is preset to 100, then through the calculation method that the correlation is equal to the legal jump probability minus the illegal jump probability multiplied by the correction factor, it is determined that the correlation between "tomato" and "tomato", "egg", "big tomato" and "beef brisket" is equal to 0.09, -0.94, 0.065 and -0.77 respectively, among which the correlation between "tomato" and "tomato", and the correlation between "tomato" and "big tomato" are significantly larger.
[0129] Considering that when the food noun A is used as the first food noun and the food noun B is used as the second food noun, the correlation between the food noun A and the food noun B can be determined; conversely, if the food noun B is used as the first food noun and the food noun A is used as the second food noun, the correlation between the food noun B and the food noun A can be determined. Then, the numerical values of the above two correlations are usually not equal. Based on this consideration, another example of an implementable method is proposed. In addition to steps S11 to S13, the method can also include the following steps:
[0130] S14: determining, based on the mapping relationship between dishes and recipes and between recipes and ingredient nouns, a legal jump probability of the second ingredient noun jumping to the first ingredient noun under the condition that the legal path constraint is satisfied;
[0131] S15: Determine, based on a mapping relationship between recipes and ingredient nouns, an illegal jump probability of the second ingredient noun jumping to the first ingredient noun under a condition that the illegal path constraint is satisfied.
[0132] For example, when determining the legal jump probability of the second ingredient noun jumping to the first ingredient noun, the specific steps proposed in step S11 can be referred to. When determining the illegal jump probability of the second ingredient noun jumping to the first ingredient noun, the specific steps proposed in step S12 can be referred to.
[0133] After determining the legal jump probability and illegal jump probability of the second ingredient noun jumping to the first ingredient noun through step S14 and step S15, in step S13, when determining the association between the first ingredient noun and the second ingredient noun according to the legal jump probability and illegal jump probability of the first ingredient noun jumping to the second ingredient noun, as another example of an implementable method, the following steps may be included:
[0134] S13-3: determining a first estimated value of the degree of association between the first ingredient noun and the second ingredient noun according to a legal jump probability and an illegal jump probability from the first ingredient noun to the second ingredient noun;
[0135] S13-4: determining a second estimated value of the degree of association between the first ingredient noun and the second ingredient noun according to a legal jump probability and an illegal jump probability of the second ingredient noun jumping to the first ingredient noun;
[0136] S13-5: Determine the larger one of the first estimated association degree and the second estimated association degree as the association degree between the first ingredient noun and the second ingredient noun.
[0137] In this embodiment, when determining the first estimated value of the association between the first ingredient noun and the second ingredient noun, the legal jump probability of the first ingredient noun jumping to the second ingredient noun can be subtracted from the illegal jump probability, and the calculation result can be determined as the first estimated value of the association. Furthermore, the illegal jump probability can also be pre-multiplied by a correction factor to further weaken the first estimated value of the association between dissimilar ingredients.
[0138] In this embodiment, when determining the second estimated value of the association between the first ingredient noun and the second ingredient noun, the legal jump probability of the second ingredient noun jumping to the first ingredient noun minus the illegal jump probability can be used, and the calculation result can be determined as the second estimated value of the association. Furthermore, the illegal jump probability can also be pre-multiplied by a correction factor to further weaken the second estimated value of the association between dissimilar ingredients.
[0139] For example, taking "tomato" as the first ingredient noun and "tomatoes" as the second ingredient noun, assuming that the legal jump probability of "tomatoes" jumping to "tomatoes" is 0.09 and the illegal jump probability is 0, assuming that the legal jump probability of "tomatoes" jumping to "tomatoes" is 0.075 and the illegal jump probability is also 0. Then it is determined that the first correlation estimate between "tomatoes" and "tomatoes" is equal to 0.09, and the second correlation estimate is equal to 0.075. Finally, it is determined that the correlation between "tomatoes" and "tomatoes" is 0.09.
[0140] By selecting the larger one between the first estimated value of the correlation and the second estimated value of the correlation, it is helpful to further filter out the interference of dissimilar ingredients on the confirmation of the correlation of similar ingredients.
[0141] Considering that the recipe data includes a huge number of ingredient nouns, in order to improve the processing speed of the computer, in this embodiment, the legal jump probability of jumping between multiple different ingredient nouns constitutes a legal jump probability matrix, and the illegal jump probability of jumping between multiple different ingredient nouns constitutes an illegal jump probability matrix; the multiple different ingredient nouns include ingredient nouns whose occurrence frequency is lower than a preset frequency; the association degree between the multiple different ingredient nouns constitutes an association degree matrix, and the association degree matrix is determined according to the following formula:
[0142] sim=TP*TP T -FP
[0143] Among them, sim is the association matrix, TP is the legal jump probability matrix, and FP is the illegal jump probability matrix.
[0144] In this embodiment, when calculating the legal jump probability from the first ingredient noun to the second ingredient noun, multiple ingredient nouns can be used as the first ingredient noun, and multiple ingredient nouns can be used as the second ingredient noun at the same time, and the same ingredient noun can be used as both the first ingredient noun and the second ingredient noun for parallel calculation, and the calculation result is expressed in matrix form.
[0145] For example, when calculating the legal jump probability matrix TP, it can be calculated according to the following formula:
[0146] TP=IC*CF*FC*CI
[0147] When calculating the legal jump probability matrix FP, it can be calculated according to the following formula:
[0148] FP=IC*CI
[0149] IC refers to the probability matrix composed of the jump probability of ingredient nouns to recipes. The elements IC in IC are ijrepresents the jump probability of the i-th ingredient noun jumping to the j-th recipe, IC ij The method of determining is: where n Ci Indicates the number of all recipes corresponding to the i-th ingredient noun.
[0150] CF refers to the probability matrix composed of the jump probability from recipe to dish. The elements CF in CF are ij represents the jump probability from the i-th recipe to the j-th dish, CF ij The method of determining is: where n Fi Represents the total number of dishes corresponding to the i-th recipe.
[0151] FC refers to the probability matrix composed of the jump probability of dishes jumping to recipes. The elements FC in FC are ij represents the jump probability from the i-th dish to the j-th recipe, FC ij The method of determining is: where n Ci Indicates the total number of recipes corresponding to the i-th dish.
[0152] CI refers to the probability matrix composed of the jump probability from recipe to ingredient noun. The element CI in CI is ij represents the jump probability of the i-th recipe jumping to the j-th ingredient noun, CI ij The method of determining is: where n Ii Indicates the number of all ingredient nouns corresponding to the i-th recipe.
[0153] In this embodiment, the element sim in the association matrix sim ij With sim ji Both represent the correlation between the i-th ingredient noun and the j-th ingredient noun. ij Not equal to sim ji When taking out sim ij With sim ji The larger of the two is taken as the correlation between the i-th ingredient noun and the j-th ingredient noun.
[0154] When calculating the association matrix sim by the above method to determine the association between the i-th food noun and the j-th food noun, for the legal jump probability matrix TP, the transpose TP of the legal jump probability matrix TP is introduced T , and multiplying the two together can eliminate the interference of uncommon ingredient nouns on the calculation results. For example, when an uncommon ingredient noun only appears in a certain recipe, when the uncommon ingredient noun is used as the first ingredient noun, without introducing TP TIn the case of , the legal jump probability of the uncommon ingredient noun to other ingredient nouns is artificially high, which may be equivalent to the jump probability between similar ingredients. T TP and TP T Multiplication can take advantage of the low reverse probability value of recipes to uncommon ingredient names to reduce the falsely high probability value. T Under this condition, the present application can also achieve the expected effect, that is, the correlation between similar ingredients is generally large in the correlation matrix sim.
[0155] In addition, when determining the correlation matrix sim by the above formula, a correction factor α can also be introduced. To this end, the correlation matrix is determined according to the following formula:
[0156] sim=TP*TP T -FP*α
[0157] As described above, by setting the correction factor α, the illegal jump probability between dissimilar ingredients that is not 0 can be amplified, so that after the illegal jump probability multiplied by the correction factor is subtracted from the legal jump probability between dissimilar ingredients, the legal jump probability between dissimilar ingredients will be weakened. Since the illegal jump probability between similar ingredients is usually 0, the illegal jump probability between similar ingredients will not be amplified by multiplying by the correction factor, so the legal jump probability between similar ingredients will not be weakened. The legal jump probability after subtracting the illegal jump probability multiplied by the correction factor is taken as the correlation. For dissimilar ingredients, the correlation between them is smaller, and for similar ingredients, the correlation between them is larger, which is conducive to filtering out the interference of dissimilar ingredients on the confirmation of the correlation of similar ingredients.
[0158] For example, the correction factor α can be set to any number greater than 1, and by increasing the correction factor α, for example, setting the correction factor α to 100, the correlation between non-similar ingredients may be made negative, making similar ingredients and dissimilar ingredients more clearly distinguishable.
[0159] refer to Figure 4 , Figure 4 1 is a flow chart of a method for determining the relevance between food nouns proposed in one embodiment of the present application. Figure 4 As shown, the method further comprises the following steps:
[0160] S16: When the correlation between the first ingredient noun and the second ingredient noun is greater than a preset threshold, marking the first ingredient noun and the second ingredient noun with a preset ingredient label.
[0161] In this embodiment, the ingredient label can be a label that represents the category of the ingredient. For example, when the e-commerce platform determines the correlation between the ingredient nouns based on the recipe data, when the correlation between the two ingredient nouns "tomato" and "large tomato" is 0.065, assuming that the preset threshold is 0.03, the correlation between "tomato" and "large tomato" is greater than the preset threshold, and the label "tomato" can be marked for these two ingredient nouns.
[0162] Alternatively, the e-commerce platform can determine the correlation between a large number of food nouns through existing technologies or the method provided by this application, and set labels for food noun groups with higher correlation. For example, tomato labels have been set for "tomato", "tomato", "big tomato", and "small tomato". In order to continue to improve the label system of food nouns, the e-commerce platform uses the method provided by this application and determines that the correlation between the two food nouns "tomato" and "tomato" is 0.052 based on the latest collected recipe data, which is greater than the preset threshold of 0.03. Then, the food noun "tomato" can be marked with a tomato label, thereby enriching the food nouns under the tomato label.
[0163] By executing step S16 on the basis of steps S11 to S13, on the one hand, the label system of ingredient nouns can be made more perfect. When a buyer user searches for a dish containing a certain ingredient noun, all or part of the dishes corresponding to the label of the ingredient noun can be recommended to the buyer user, thereby enriching the user's choice and achieving accurate search recall. For example, when a user searches for a dish containing "tomato", dishes containing ingredient nouns such as "tomato", "tomato" or "tomatoes" in the recipe can be recommended to the buyer user.
[0164] On the other hand, considering that in the related art, it is sometimes necessary to conduct supervised training on a preset model to obtain a target model. Before supervised training, each sample food noun needs to be labeled so that multiple sample food nouns with high correlation carry a unified label, which represents that multiple sample food nouns belong to the same category of food. However, the labeling process is usually manual labeling, and the labeling efficiency is low. However, since the correlation between food nouns can be accurately determined after executing steps S11 to S13, the present application can accurately mark the preset food labels between food nouns with high correlation by executing step S16. If multiple food nouns with accurately marked food labels are used as a training set for training the model, the model training efficiency and accuracy can be improved.
[0165] Based on the same inventive concept, an embodiment of the present application provides a device for determining the relevance between food nouns. Figure 5 , Figure 5is a schematic diagram of a device for determining the degree of association between food nouns provided in an embodiment of the present application. Figure 5 As shown, the device comprises:
[0166] A first determination module 51 is used to determine the legal jump probability of the first ingredient noun to the second ingredient noun under the condition of satisfying the legal path constraint according to the mapping relationship between the dish and the recipe and between the recipe and the ingredient noun, wherein the legal path constraint refers to allowing the ingredient nouns in the recipes under the same dish to jump to each other;
[0167] A second determination module 52 is used to determine, based on a mapping relationship between recipes and ingredient nouns, an illegal jump probability of the first ingredient noun jumping to the second ingredient noun under a condition that an illegal path constraint is satisfied, wherein the illegal path constraint indicates that mutual jumps between ingredient nouns under the same recipe are illegal;
[0168] The third determining module 53 is used to determine the association between the first ingredient noun and the second ingredient noun according to the legal jump probability and the illegal jump probability of the first ingredient noun to the second ingredient noun.
[0169] Optionally, the first determining module includes:
[0170] A first sub-determination module is used to determine a legal path for jumping from the first ingredient noun to the second ingredient noun according to a mapping relationship between dishes and recipes and between recipes and ingredient nouns, wherein the legal path satisfies the legal path constraint;
[0171] A second sub-determination module is used to determine the probability corresponding to a legal path of the first ingredient noun jumping to the second ingredient noun based on the number of all recipes corresponding to the first ingredient noun, the number of all dishes corresponding to each first target recipe including the first ingredient noun, the number of all recipes corresponding to each first target dish including the first target recipe, and the number of all ingredients corresponding to each second target recipe under the first target dish;
[0172] The third sub-determination module is used to determine the probability corresponding to the legal path as the legal jump probability of the first ingredient noun jumping to the second ingredient noun.
[0173] Optionally, the second determining module includes:
[0174] a fourth sub-determination module, configured to determine, according to a mapping relationship between a recipe and an ingredient noun, an illegal path from the first ingredient noun to the second ingredient noun, wherein the illegal path satisfies the illegal path constraint;
[0175] a fifth sub-determination module, configured to determine a probability corresponding to an illegal path of the first ingredient noun jumping to the second ingredient noun based on the number of all recipes corresponding to the first ingredient noun and the number of all ingredients corresponding to each first target recipe including the first ingredient noun;
[0176] The sixth sub-determination module is used to determine the probability corresponding to the illegal path as the illegal jump probability of the first ingredient noun jumping to the second ingredient noun.
[0177] Optionally, the third determining module includes:
[0178] A seventh determination submodule, configured to determine a correction factor corresponding to an illegal jump probability of the first ingredient noun jumping to the second ingredient noun;
[0179] The eighth determination submodule is used to determine the association between the first ingredient noun and the second ingredient noun according to the legal jump probability, the illegal jump probability and the correction factor of the first ingredient noun to the second ingredient noun.
[0180] Optionally, the device further comprises:
[0181] a fourth determination module, configured to determine, based on a mapping relationship between dishes and recipes and between recipes and ingredient nouns, a legal jump probability of the second ingredient noun jumping to the first ingredient noun under a condition that the legal path constraint is satisfied;
[0182] a fifth determination module, configured to determine, based on a mapping relationship between recipes and ingredient nouns, an illegal jump probability of the second ingredient noun jumping to the first ingredient noun under a condition that the illegal path constraint is satisfied;
[0183] The third determination module comprises:
[0184] a ninth determination submodule, configured to determine a first estimated value of the degree of association between the first ingredient noun and the second ingredient noun according to a legal jump probability and an illegal jump probability of the first ingredient noun jumping to the second ingredient noun;
[0185] a tenth determining submodule, configured to determine a second estimated value of the degree of association between the first ingredient noun and the second ingredient noun according to a legal jump probability and an illegal jump probability of the second ingredient noun jumping to the first ingredient noun;
[0186] An eleventh determining submodule is configured to determine the larger one of the first estimated association degree and the second estimated association degree as the association degree between the first ingredient noun and the second ingredient noun.
[0187] Optionally, the legal jump probabilities of mutual jumps between multiple different food nouns constitute a legal jump probability matrix, and the illegal jump probabilities of mutual jumps between multiple different food nouns constitute an illegal jump probability matrix; the multiple different food nouns include food nouns whose occurrence frequency is lower than a preset frequency; the associations between the multiple different food nouns constitute an association matrix; the device further comprises:
[0188] The sixth determination module is used to determine the association matrix according to the following formula:
[0189] sim=TP*TP T -FP
[0190] Among them, sim is the association matrix, TP is the legal jump probability matrix, and FP is the illegal jump probability matrix.
[0191] Optionally, the illegal jump probability matrix corresponds to a correction factor; the associations between the multiple different food nouns form an association matrix, and the device further includes:
[0192] The seventh determination module is used to determine the association matrix according to the following formula:
[0193] sim=TP*TP T -FP*α
[0194] Wherein, α is the correction factor.
[0195] Optionally, the device further comprises:
[0196] The marking module is used to mark the first ingredient noun and the second ingredient noun with a preset ingredient label after determining the association between the first ingredient noun and the second ingredient noun, if the association between the first ingredient noun and the second ingredient noun is greater than a preset threshold.
[0197] Based on the same inventive concept, another embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps in the method described in any of the above embodiments of the present application are implemented.
[0198] Based on the same inventive concept, another embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executed, implements the steps of the method described in any of the above embodiments of the present application.
[0199] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0200] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0201] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, devices, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0202] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0203] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0204] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0205] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.
[0206] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0207] The above is a detailed introduction to a method, device, electronic device and readable storage medium for determining the correlation between food nouns provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for determining the relevance between food nouns, characterized in that: The method comprises: According to the mapping relationship between dishes and recipes and between recipes and ingredient nouns, determine the legal jump probability of the first ingredient noun to the second ingredient noun under the condition that the legal path constraint is satisfied, wherein the legal path constraint refers to allowing the ingredient nouns in the recipes under the same dish to jump to each other; According to the mapping relationship between the recipe and the ingredient noun, determining the illegal jump probability of the first ingredient noun jumping to the second ingredient noun under the condition that an illegal path constraint is satisfied, wherein the illegal path constraint indicates that mutual jumps between ingredient nouns under the same recipe are illegal; determining a correlation between the first ingredient noun and the second ingredient noun according to a legal jump probability and an illegal jump probability from the first ingredient noun to the second ingredient noun; The legal jump probability of the first ingredient noun to the second ingredient noun includes: Determine, according to the mapping relationship between dishes and recipes and between recipes and ingredient nouns, a legal path for jumping from the first ingredient noun to the second ingredient noun, wherein the legal path satisfies the legal path constraint; Determine the probability corresponding to a legal path of the first ingredient noun jumping to the second ingredient noun according to the number of all recipes corresponding to the first ingredient noun, the number of all dishes corresponding to each first target recipe including the first ingredient noun, the number of all recipes corresponding to each first target dish including the first target recipe, and the number of all ingredients corresponding to each second target recipe under the first target dish; Determining the probability corresponding to the legal path as the legal jump probability of the first ingredient noun jumping to the second ingredient noun; The illegal jump probability between the first ingredient noun and the second ingredient noun includes: According to the mapping relationship between the recipe and the ingredient noun, determining an illegal path from the first ingredient noun to the second ingredient noun, wherein the illegal path satisfies the illegal path constraint; Determining a probability corresponding to an illegal path from the first ingredient noun to the second ingredient noun based on the number of all recipes corresponding to the first ingredient noun and the number of all ingredients corresponding to each first target recipe including the first ingredient noun; Determine the probability corresponding to the illegal path as the illegal jump probability of the first ingredient noun jumping to the second ingredient noun; The determining the association between the first ingredient noun and the second ingredient noun according to the legal jump probability and the illegal jump probability of the first ingredient noun to the second ingredient noun includes: Determine a correction factor corresponding to an illegal jump probability of the first ingredient noun jumping to the second ingredient noun; The association between the first ingredient noun and the second ingredient noun is determined according to the legal jump probability, the illegal jump probability and the correction factor of the first ingredient noun to the second ingredient noun.
2. The method according to claim 1, characterized in that The method further comprises: Determine, based on the mapping relationship between dishes and recipes and between recipes and ingredient nouns, a legal jump probability of the second ingredient noun jumping to the first ingredient noun under the condition that the legal path constraint is satisfied; Determining, according to a mapping relationship between recipes and ingredient nouns, an illegal jump probability of the second ingredient noun jumping to the first ingredient noun under a condition that the illegal path constraint is satisfied; According to the legal jump probability and illegal jump probability of the first ingredient noun to the second ingredient noun, determine Determining the correlation between the first food noun and the second food noun includes: determining a first estimated value of the degree of association between the first ingredient noun and the second ingredient noun according to a legal jump probability and an illegal jump probability from the first ingredient noun to the second ingredient noun; determining a second estimated value of the degree of association between the first ingredient noun and the second ingredient noun according to a legal jump probability and an illegal jump probability of the second ingredient noun jumping to the first ingredient noun; The larger one of the first estimated association degree value and the second estimated association degree value is determined as the association degree between the first ingredient noun and the second ingredient noun.
3. The method according to claim 1 or 2, characterized in that: The legal jump probabilities of mutual jumps between multiple different food nouns constitute a legal jump probability matrix, and the illegal jump probabilities of mutual jumps between multiple different food nouns constitute an illegal jump probability matrix; the multiple different food nouns include food nouns whose occurrence frequency is lower than a preset frequency; the associations between the multiple different food nouns constitute an association matrix, and the association matrix is determined according to the following formula: sim=TP*TPT-FP Among them, sim is the association matrix, TP is the legal jump probability matrix, and FP is the illegal jump probability matrix.
4. The method according to claim 3, characterized in that The illegal jump probability matrix corresponds to the correction factor; the associations between the multiple different food nouns form an association matrix, and the association matrix is determined according to the following formula: sim=TP*TPT-FP*α Wherein, α is the correction factor.
5. The method according to any one of claims 1-2, characterized in that: After determining the association between the first food noun and the second food noun, the method further includes: When the correlation between the first ingredient noun and the second ingredient noun is greater than a preset threshold, the first ingredient noun and the second ingredient noun are marked with a preset ingredient label.
6. A device for determining the degree of association between food nouns, characterized in that: The device comprises: The first determining device is used to determine the legal jump probability of the first ingredient noun jumping to the second ingredient noun under the condition of satisfying the legal path constraint according to the mapping relationship between the dish and the recipe and between the recipe and the ingredient noun, wherein the legal path constraint refers to allowing the ingredient nouns in the recipes under the same dish to jump to each other, and the legal jump probability of the first ingredient noun jumping to the second ingredient noun includes: Determine, according to the mapping relationship between dishes and recipes and between recipes and ingredient nouns, a legal path for jumping from the first ingredient noun to the second ingredient noun, wherein the legal path satisfies the legal path constraint; Determine the probability corresponding to a legal path of the first ingredient noun jumping to the second ingredient noun according to the number of all recipes corresponding to the first ingredient noun, the number of all dishes corresponding to each first target recipe including the first ingredient noun, the number of all recipes corresponding to each first target dish including the first target recipe, and the number of all ingredients corresponding to each second target recipe under the first target dish; Determining the probability corresponding to the legal path as the legal jump probability of the first ingredient noun jumping to the second ingredient noun; The second determining device is used to determine, based on the mapping relationship between the recipe and the ingredient noun, the illegal jump probability of the first ingredient noun jumping to the second ingredient noun under the condition that the illegal path constraint is satisfied, wherein the illegal path constraint indicates that mutual jumps between ingredient nouns under the same recipe are illegal, and the illegal jump probability of the first ingredient noun jumping to the second ingredient noun includes: According to the mapping relationship between the recipe and the ingredient noun, determining an illegal path from the first ingredient noun to the second ingredient noun, wherein the illegal path satisfies the illegal path constraint; Determining a probability corresponding to an illegal path from the first ingredient noun to the second ingredient noun based on the number of all recipes corresponding to the first ingredient noun and the number of all ingredients corresponding to each first target recipe including the first ingredient noun; Determine the probability corresponding to the illegal path as the illegal jump probability of the first ingredient noun jumping to the second ingredient noun; The third determining means, for determining the association between the first ingredient noun and the second ingredient noun according to the legal jump probability and the illegal jump probability of the first ingredient noun to the second ingredient noun, comprises: Determine a correction factor corresponding to an illegal jump probability of the first ingredient noun jumping to the second ingredient noun; The association between the first ingredient noun and the second ingredient noun is determined according to the legal jump probability, the illegal jump probability and the correction factor of the first ingredient noun to the second ingredient noun.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps in any one of the methods according to claims 1 to 5 are implemented.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When executed, the processor implements the steps of the method according to any one of claims 1 to 5.
