A knowledge representation learning method and knowledge reasoning method for search engines

By constructing and combining relationship paths with preset steps, the problem of low efficiency in relationship path modeling in knowledge representation learning is solved, and the quality and computing efficiency of search engine knowledge graphs are improved.

CN113190685BActive Publication Date: 2024-10-08HUAZHONG UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110426286.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-20
Publication Date
2024-10-08
Estimated Expiration
2041-04-20

AI Technical Summary

Technical Problem

When existing knowledge representation learning methods deal with large-scale knowledge graphs, the complexity of relationship path modeling is high, resulting in low computational efficiency and affecting the quality and user experience of search engine knowledge graphs.

Method used

Use preset step sizes to construct shorter relationship paths, and obtain longer relationship paths through combination, reducing repeated calculations and improving the efficiency of relationship path modeling.

Benefits of technology

It greatly improves the computational efficiency of knowledge representation learning, reduces the number of traversals of the knowledge graph, and enhances the quality and user experience of the search engine knowledge graph.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113190685B_ABST
    Figure CN113190685B_ABST
Patent Text Reader

Abstract

The present invention discloses a knowledge representation learning method and a knowledge reasoning method for a search engine, which belongs to the field of computer data processing, and comprises: (S1) taking entities as nodes, traversing a target knowledge graph, obtaining a relationship path with each node as a starting node and a length of s, and obtaining the characteristics of each relationship path; initializing S tmp =s; s = L / n, L is the maximum length of the relationship path; (S2) If S tmp =L, then go to (S5); otherwise, go to (S3); (S3) for a length of S tmp For each relationship path p, combine it with the relationship path of length s and starting with the destination node of p to obtain a relationship path of length L. tmp =S tmp +s relationship path, and obtain its characteristics; (S4) S tmp Updated to L tmp , transfer to (S2); (S5) apply the features of entities, relations and all relation paths to representation learning to obtain vector representations of entities and relations. The present invention can improve the computational efficiency of relation path modeling, thereby efficiently improving the quality of search engine knowledge graphs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer data processing, and more specifically, relates to a knowledge representation learning method and a knowledge reasoning method oriented to a search engine. Background Art

[0002] Knowledge graph is an emerging structured knowledge base and a huge structured network. Knowledge graph provides a better ability to organize, manage and understand data information by expressing massive amounts of data information in a form closer to human cognition. In the industry, knowledge graphs have received widespread attention. In the search field, Google and Microsoft have applied knowledge graphs to search engines Google and Bing, respectively, to solve the problem that traditional search engines can only provide web page rankings based on keywords and cannot truly understand user intentions; in the field of question-answering and dialogue, Google, Microsoft and Apple have applied knowledge graphs to smart assistants Google Now, Microsoft Cortana and Apple Siri, respectively, to improve the performance of intelligent question-answering and human-computer interaction; in the e-commerce field, Alibaba and Meituan have built their own product knowledge graphs for intelligent shopping guides, personalized recommendations, etc.; in the social field, Facebook has built a social knowledge graph for personalized recommendations.

[0003] When a user searches on a search engine, the user types in something, and the search engine will display rich related information based on the constructed knowledge graph. For example, when a user types in a certain film or TV work, the system can display related information such as subject matter, actors, and release date through the constructed knowledge graph. However, there are gaps in the existing knowledge graph, which may cause the search engine to display incomplete information to users, affecting the user experience. To this end, it is necessary to complete the knowledge graph through knowledge reasoning algorithms to improve the quality of the search engine knowledge graph, and further improve the quality of search results returned to users by the search engine to meet user needs.

[0004] In order to realize knowledge reasoning, knowledge representation learning has become the most popular technology at present. Knowledge representation learning aims to map entities and relations in knowledge graphs into low-dimensional dense real-valued vectors. Through the obtained entity vectors and relationship vectors, downstream tasks such as knowledge reasoning can be easily completed. In order to improve the expressiveness of knowledge representation learning, knowledge representation learning methods based on relationship paths have become a research hotspot. Although the introduction of relationship path modeling can introduce semantic information on the relationship path into knowledge representation learning, the amount of information processed by search engines is extremely large, and the scale of related knowledge graphs is also very large. Correspondingly, the complexity of relationship modeling is extremely high, which affects the efficiency of knowledge representation learning. Therefore, how to improve the computational efficiency of relationship path modeling in knowledge representation learning is very important for improving the efficiency of knowledge representation learning, making it better applied to downstream knowledge reasoning tasks to effectively complete the missing information in the knowledge graph, improve the quality of search engine knowledge graphs, and thus improve user experience. Summary of the invention

[0005] In view of the defects of the prior art and the need for improvement, the present invention provides a knowledge representation learning method and a knowledge reasoning method for search engines, which aims to improve the computational efficiency of relational path modeling in knowledge representation learning, thereby improving the quality of the knowledge graph of the prime search engine.

[0006] To achieve the above object, according to one aspect of the present invention, a knowledge representation learning method for a search engine is provided, comprising the following steps:

[0007] (S1) Taking entities in the target knowledge graph as nodes, traverse the target knowledge graph to obtain all relationship paths with each node as the starting node and a length of s, and obtain the characteristics of each relationship path; initialize the length variable S tmp =s; the target knowledge graph is used to express the subject to be searched, and the entities therein correspond to the associated information of the subject to be searched; the characteristics of the relationship path include confidence, the starting node-destination node pair, and the relationship between the starting node and the destination node; s = L / n, L is the maximum length of the relationship path, and n is a positive integer;

[0008] (S2) If S tmp =L, then go to step (S5); otherwise, go to step (S3);

[0009] (S3) For a length of S tmp For each relationship path p, combine it with the relationship path of length s and starting from the destination node e of the relationship path p to obtain a relationship path of length L. tmp =S tmp +s's relationship paths, and obtain the characteristics of each combined relationship path;

[0010] (S4) The length variable S tmp The value of is updated to L tmp , proceed to step (S2);

[0011] (S5) The features of entities, relations and all relation paths of the target knowledge graph are applied to representation learning to obtain vector representations of entities and relations in the target knowledge graph.

[0012] In order to complete knowledge representation learning, it is necessary to extract relation paths with different lengths in the knowledge graph. Traditional knowledge representation learning methods directly construct relation paths of different lengths when constructing relation path models, which involves a large number of repeated calculations and is inefficient. When the present invention performs relation path modeling on the search engine knowledge graph, it first constructs a shorter relation path according to a preset step length, and then combines the shorter relation paths to obtain a longer relation path until a relation path with the maximum length is constructed. Compared with the modeling process of the traditional knowledge representation learning method, since the construction results of the shorter relation paths are directly used in the construction process of the longer relation paths, only one search of the knowledge graph is required, which greatly reduces the amount of repeated calculations and effectively improves the computational efficiency of relation path modeling in knowledge representation learning, providing strong support for efficiently completing the search engine knowledge graph and improving the quality of the search engine knowledge graph.

[0013] In some optional embodiments, s=1.

[0014] In some optional embodiments, s>1, and in step (S1), the target knowledge graph is traversed to obtain all relationship paths with each node as the starting node and a length of s, and the characteristics of each relationship path are obtained, including:

[0015] (S11) traverse the target knowledge graph to obtain all relationship paths with each node as the starting node and a length of 1, and obtain the characteristics of each relationship path; initialize the length variable u=1;

[0016] (S12) If u=s, proceed to step (S15); otherwise, proceed to step (S13);

[0017] (S13) For each relationship path p of length u u , and compare it with a path p of length 1 u The destination node e u Combine the relationship paths of the starting nodes respectively to obtain a relationship path with a length of t=u+1, and obtain the characteristics of each relationship path obtained by the combination;

[0018] (S14) Update the value of the length variable u to t, and go to step (S12);

[0019] (S15) Save each relationship path of length s and its characteristics.

[0020] In some optional embodiments, when traversing the target knowledge graph to obtain all relationship paths with each node as the starting node and a length of 1, a limited-length breadth-first traversal algorithm is used, thereby being able to easily obtain all relationship paths of a specified length.

[0021] Optionally, for any relationship path p'=(r i ), its confidence The calculation formula is:

[0022]

[0023] Among them, r i represents the relationship that constitutes the relationship path p', e y Represents the relationship i The destination node, E i-1 (·,e y ) represents node e y Along the relationship r i The set of predecessor nodes, e x ∈E i-1 (·,e y ) represents node e y Along the relationship r i The predecessor node, E i (e x ,·) represents the starting node e x Along i The set of successor nodes, Represents node e y From node e x The amount of resources obtained.

[0024] Optionally, for a relationship path p″ formed by combining relationship paths p1 and p2, its confidence C(p″|ht) is:

[0025] C(p”|ht)=C(p1|h1-t1)×C(p2|h2-t2);

[0026] Among them, C(p1|h1-t1) and C(p2|h2-t2) represent the confidence of the relationship path p1 and the relationship path p2 respectively.

[0027] The present invention uses the product of the confidences of the shorter relationship paths as the confidence of the combined relationship path through the above calculation formula, effectively considering the role of each sub-relationship path in the overall relationship path and ensuring the calculation accuracy of the overall relationship path confidence.

[0028] Furthermore, in step (S3), after obtaining the features of each relationship path obtained by combination, the step further includes: eliminating relationship paths with confidence less than a preset threshold among the relationship paths obtained by combination.

[0029] After combining the relationship paths, the present invention will eliminate the low-confidence (less than a preset threshold) relationship paths in the combined relationship paths. Since the low-confidence relationship paths are less important for knowledge representation learning, eliminating these relationship paths can reduce the computational overhead spent on invalid information and further improve the computational efficiency without affecting the accuracy of knowledge representation learning.

[0030] According to another aspect of the present invention, a knowledge reasoning method for a search engine is provided, comprising:

[0031] For the topic to be searched, the vector representation obtained by the search engine-oriented knowledge representation learning method provided by the present invention is used to perform knowledge reasoning, thereby completing the missing information in the knowledge graph used to express the topic to be searched.

[0032] According to another aspect of the present invention, a computer-readable storage medium is provided, comprising a stored computer program; when the computer program is executed by a processor, the device where the computer-readable storage medium is located is controlled to execute the search engine-oriented knowledge representation learning method provided by the present invention, and / or the search engine-oriented knowledge reasoning method provided by the present invention.

[0033] In general, the above technical solutions conceived by the present invention can achieve the following beneficial effects:

[0034] When the present invention performs knowledge representation learning on the search engine knowledge graph, a shorter relationship path is first constructed according to a preset step size, and then a longer relationship path is obtained by combining the shorter relationship paths until a relationship path of maximum length is constructed. In this process, only one search of the knowledge graph is required, which can greatly reduce the amount of repeated calculations, effectively improve the computational efficiency of relationship path modeling in knowledge representation learning, and provide strong support for efficiently completing the search engine knowledge graph, thereby improving the quality of the search engine knowledge graph. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 A schematic diagram of a movie knowledge graph provided by an embodiment of the present invention;

[0036] Figure 2 A flow chart of a knowledge representation learning method for search engines provided by an embodiment of the present invention;

[0037] Figure 3 A schematic diagram of a knowledge graph after entities and relationships between entities are converted into numbers, provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0038] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0039] In the present invention, the terms "first", "second", etc. (if any) in the present invention and the drawings are used to distinguish similar objects but not necessarily to describe a specific order or sequence.

[0040] For different topics, the search engine will maintain corresponding knowledge graphs. When a user searches for a certain topic through the search engine, the search engine will obtain information related to the search topic through the corresponding knowledge graph and display it to the user as search results. In the knowledge graph maintained by the search engine, the entity corresponds to the associated information of the topic. For example, for film and television works, in the knowledge graph maintained by the search engine, the entity corresponds to rich associated information such as the movie name, starring actor, language, etc.; for another example, for characters, in the knowledge graph maintained by the search engine, the entity corresponds to associated information such as name, gender, occupation, etc.; for another example, for food, in the knowledge graph maintained by the search engine, the entity corresponds to associated information such as food name, taste, ingredients, etc. Without loss of generality, unless otherwise specified, the knowledge graph involved in the following embodiments specifically refers to the knowledge graph of film and television works.

[0041] Due to the large number of movies and the complexity of the information, the knowledge graphs of many movies are missing, which inevitably leads to incomplete information displayed to users by search engines, affecting the user experience. Figure 1 The figure shows an example of a simplified movie knowledge graph, which consists of 5 entities and 5 relationships. The circles represent entities, the solid arrows represent relationships, and the dotted arrows represent missing relationships. In this knowledge graph, the movie "Forrest Gump" is missing language information. Through knowledge representation learning, vectors are obtained for entities and relationships such as the release country is the United States and the official language of the United States is English, and the director is Robert Zemeckis and the language of the director is English. The vectors are used for downstream reasoning tasks, and it can be inferred that the language of the movie is English, thereby completing the language information of the movie.

[0042] When learning knowledge representation, assuming that the longest relationship path length is 2, the information described above needs to be modeled into the following two relationship paths:

[0043]

[0044]

[0045] Then, knowledge representation learning is performed, and the knowledge graph is completed by using the results of representation learning for downstream reasoning tasks.

[0046] When completing the above-mentioned relationship path modeling, the traditional relationship path-based knowledge representation learning method PTransE first performs a single-step breadth-first traversal on all entities to calculate all single-step relationship paths and confidences, and then performs a two-step breadth-first traversal on all entities to find all two-step relationship paths and confidences. It can be seen that the previous work of traversing the knowledge graph is repeated when calculating the two-step relationship path. When the knowledge graph is large, these repeated tasks will greatly increase the time overhead of relationship path modeling and reduce the efficiency of knowledge representation learning. In recent years, the scale of knowledge graphs has continued to grow. The industry-renowned knowledge graph Google KnowledgeGraph contains millions of entities, the number of entities in the knowledge graph Wikidata exceeds 57 million, the number of entities in the knowledge graph YAGO exceeds 49 million, and the number of entities in the knowledge graph NELL exceeds 2 million. When the average out-degree of the node is K, the time required for breadth-first traversal to model a relationship path of length L for a node is K. L , the computational complexity is O(K L ). As L increases, the computational scale grows exponentially. Therefore, the computational efficiency of existing knowledge representation learning methods is extremely low when faced with large-scale knowledge graphs.

[0047] In order to solve the technical problem that the existing knowledge representation learning methods have low computational efficiency and are not conducive to effectively improving the quality of the search engine knowledge graph, the present invention provides a knowledge representation learning method and a knowledge reasoning method for search engines. The overall idea is: according to a preset step size, first construct a shorter relationship path from the search engine knowledge graph by traversal, and then use the shorter relationship paths to combine into longer relationship paths until a relationship path of maximum length is obtained, thereby reducing the number of traversals of the knowledge graph, greatly reducing the amount of repeated calculations, effectively improving the efficiency of knowledge representation learning, and providing strong support for effectively completing the search engine knowledge graph, thereby improving the quality of the search engine knowledge graph.

[0048] The following are examples.

[0049] Embodiment 1:

[0050] A knowledge representation learning method for search engines. In this embodiment, s=1, such as Figure 2As shown, this embodiment includes the following steps:

[0051] (S1) Taking entities in the target knowledge graph as nodes, traverse the target knowledge graph to obtain all relationship paths with each node as the starting node and a length of 1, and obtain the characteristics of each relationship path; initialize the length variable S tmp =s, length variable S tmp Used to record the maximum length of the relationship path currently obtained;

[0052] The target knowledge graph is used to express the subject to be searched, and the entities therein correspond to the associated information of the subject to be searched. In this embodiment, the target knowledge graph is specifically a knowledge graph used to express information related to film and television works;

[0053] In order to obtain the relationship path and the relationship between the nodes on the relationship path during the traversal process, the knowledge graph can be represented in triple form in advance; there are various representation forms of the knowledge graph, and the triple form is one of them. Other representation forms can be converted into corresponding triple forms; when represented in triple form, one of the triples can be represented as T = {(h, r, t)}, h and t represent the head entity and the tail entity respectively, and r represents the relationship between the head entity h and the tail entity t;

[0054] When the maximum length of the relationship path is set to L, this embodiment needs to sequentially obtain relationship paths of length 1, 2, ..., L and the features of each relationship path. In order to facilitate the storage of relevant information, in this embodiment, a total of L+1 sets are created, which are recorded as relationship path feature sets P and PF in turn. l , 1≤l≤L; the relationship path feature set P is used to save the features of all the relationship paths that have been obtained; the relationship path feature set PF l Features used to save the relationship path of length l;

[0055] Optionally, in step (S1) of this embodiment, when traversing the target knowledge graph to obtain all relationship paths with each node as the starting node and a length of 1, a limited-length breadth-first traversal algorithm is adopted, thereby being able to conveniently obtain all relationship paths of a specified length; it should be noted that this is only an optional implementation method and should not be understood as the only limitation of the present invention, and other traversal methods that can obtain all relationship paths of a specified length can also be used in the present invention;

[0056] The characteristics of the relationship path include confidence, the starting node-destination node pair, and the relationship between the starting node and the destination node; the confidence of the relationship path is used to measure the importance of the relationship path in knowledge representation learning. The higher the confidence, the more important the relationship path is in knowledge representation learning. As an optional implementation, in this embodiment, for any relationship path p'=(r i ), its confidence The calculation formula is:

[0057]

[0058] Among them, r i represents the relations constituting the relation path p', e y Represents the relationship r i The destination node, E i-1 (·,e y ) represents node e y Along the relationship r i The set of predecessor nodes, e x ∈E i-1 (·,e y ) represents node e y Along the relationship r i The predecessor node, E i (e x ,·) represents the starting node e x Along i The set of successor nodes, Represents node e y From node e x The amount of resources obtained;

[0059] After executing step (S1), the features of all relationship paths with a length of 1 obtained will be saved in the relationship path feature sets P and PF1;

[0060] (S2) If S tmp = L, it means that all the relationship paths of the specified length have been obtained, and the process goes to step (S5); otherwise, it means that all the relationship paths of the specified length have not been obtained, and a longer relationship path still needs to be obtained, and the process goes to step (S3);

[0061] (S3) For a length of S tmp Each relationship path p of , and combine it with the relationship path of length 1 and starting node e of the relationship path p, to obtain a relationship path of length L tmp =S tmp +1, and obtain the characteristics of each combined relationship path;

[0062] In order to accurately calculate the confidence of the combined relationship path, optionally, in step (S3) of this embodiment, for the relationship path p″ formed by combining the relationship path p1 and the relationship path p2, its confidence C(p″|ht) is:

[0063] C(p”|ht)=C(p1|h1-t1)×C(p2|h2-t2);

[0064] Among them, C(p1|h1-t1) and C(p2|h2-t2) represent the confidence of relationship path p1 and relationship path p2 respectively;

[0065] For the relationship paths p1 and p2, if their length is not 1, then the path is obtained by combining other shorter paths. Correspondingly, its confidence can also be expressed as the product of the confidences of the two relationship paths. Therefore, if the relationship path p" is expressed as p'=(r1,...,r i ,...r n ), r1~r n are the n relations that constitute the relationship path p', then through the above calculation formula, the confidence of the relationship path p" can be finally expressed as:

[0066]

[0067] in, Respectively represent the relationship between r1~r n And the confidence of the relationship path with length 1;

[0068] Therefore, the above calculation formula takes the product of the confidence of each part of the relationship path as the confidence of the combined relationship path, effectively considering the role of each part of the sub-relationship path in the overall relationship path, and ensuring the calculation accuracy of the overall relationship path confidence;

[0069] In order to further improve the computational efficiency without affecting the accuracy of knowledge representation learning, as a preferred implementation, in step (S3) of this embodiment, after obtaining the features of each relationship path obtained by combination, the method further includes: eliminating the relationship paths whose confidence is less than a preset threshold value from the relationship paths obtained by combination;

[0070] In practical applications, the threshold value can be set according to the characteristics of the associated information of the subject to be searched. Optionally, in this embodiment, the threshold value is specifically set to 0.01. Since the low-confidence relationship paths are less important for knowledge representation learning, eliminating these relationship paths can reduce the computational overhead spent on invalid information, thereby achieving the purpose of further improving the computational efficiency without affecting the accuracy of knowledge representation learning.

[0071] In the process of relationship path combination, the length is Stmp The information of the relationship path can be obtained from the relationship path feature set The information of the relationship path with a length of 1 can be obtained from the relationship path feature set PF1 accordingly, and the length of the combination is L tmp The characteristics of the relationship path will be saved accordingly to the relationship path feature set middle;

[0072] (S4) The length variable S tmp The value of is updated to L tmp , to update the length information of the longest relationship path currently obtained, and proceed to step (S2);

[0073] (S5) applying the features of entities, relations and all relation paths of the target knowledge graph to representation learning to obtain vector representations of entities and relations in the target knowledge graph;

[0074] The features of all relationship paths can be directly obtained from the relationship path feature set P.

[0075] Likewise Figure 1 Taking the knowledge spectrum graph shown in FIG. 1 as an example, when completing the above relationship path modeling, the knowledge representation learning method for search engines provided in Example 1 first uses a single-step long-breadth-first traversal for each entity to obtain a sub-relationship path, and then combines the sub-relationship paths to complete the relationship path modeling. For example, Example 1 first obtains the sub-relationship path by a single-step long-breadth-first traversal and and their confidences, and then combining them to model a relationship path of length 2 and its confidence, avoiding redundant calculations and reducing time overhead. When the average out-degree of a node is K, a single-step breadth-first traversal is used to extract the sub-relationship path for a node, and its computational complexity is only O(K). When the specified sub-relationship paths are combined in pairs, the computational complexity is also only O(K). By comparing the computational complexity of PTransE, it can be seen that when completing the modeling of a relationship path with a length of L, the computational complexity of this embodiment is greatly reduced.

[0076] Embodiment 2:

[0077] A knowledge representation learning method for search engines. In this embodiment, s=3. This embodiment is similar to the above-mentioned embodiment 1, except that in step (S1) of this embodiment, in order to obtain all relationship paths in the knowledge graph with each node as the starting node and the length of s, and obtain the characteristics of each relationship path, it is necessary to first traverse the target knowledge graph to obtain all relationship path features with each node as the starting node and the length of 1, and obtain the characteristics of each relationship path; then, the relationship path with a length of 1 is combined from head to tail to obtain a relationship path with a length of 2, and the characteristics of each combined relationship path are obtained; then, the relationship path feature with a length of 2 is combined with the relationship path with a length of 1 from head to tail to obtain a relationship path with a length of 3, and the characteristics of the combined relationship path are obtained;

[0078] After obtaining all relationship paths of length 3 and obtaining the characteristics of each relationship path, these relationship paths can be combined to obtain relationship paths of length 6, 9, ..., L, and the characteristics of each relationship path can be obtained.

[0079] Embodiment 3:

[0080] A knowledge reasoning method for search engines, comprising:

[0081] For the subject to be searched, i.e., film and television works, knowledge reasoning is performed using the vector representation obtained by the search engine-oriented knowledge representation learning method provided in the above-mentioned embodiment 1 or 2, so as to complete the missing information in the knowledge graph used to express the subject to be searched.

[0082] Embodiment 4:

[0083] A computer-readable storage medium includes a stored computer program; when the computer program is executed by a processor, the device where the computer-readable storage medium is located is controlled to execute the search engine-oriented knowledge representation learning method provided in the above-mentioned embodiment 1 or 2, and / or the search engine-oriented knowledge reasoning method provided in the above-mentioned embodiment 3.

[0084] To further explain the technical solution of the present invention, the following Figure 1Taking the knowledge graph shown as an example, the knowledge representation learning process of the above-mentioned embodiment 1 on the knowledge graph is elaborated in detail. For the convenience of description, the characteristic format of the relationship path is recorded as <(head entity, tail entity), (relationship), confidence>, where the head entity and the tail entity represent the starting node and the destination node of the relationship path respectively, (head entity, tail entity) represents the starting node-destination node pair of the relationship path, (relationship) represents the relationship between the starting node and the destination node of the relationship path, and the confidence corresponds to the confidence of the relationship path; when performing knowledge representation learning, the entities and relationships in the knowledge graph are numbered respectively, as shown in Table 1 and Table 2, respectively, and the corresponding entities or relationships are represented by corresponding numbers.

[0085] Table 1 Entity number

[0086] Entity Name Corresponding number Forest Gump 1 Tom Hanks 2 United States 3 English 4 Robert Zemeckis 5

[0087] Table 2 Relationship number

[0088] Relationship Name Corresponding number Actors 1 BornInContry 2 Official Language 3 Language 4 Director 5 Release Region 6

[0089] The initial step length s is preset to 1, and the maximum length of the relationship path is 2. The specific knowledge representation learning process is as follows:

[0090] 1. Input Figure 1 The data file of the knowledge graph shown in the file format is txt. According to the numbering method shown in Table 1 and Table 2, the entities and relationships are converted into corresponding digital numbers. The converted knowledge graph is as follows Figure 3 As shown;

[0091] 2. Extract triples from the knowledge graph, and the obtained triple set is T = {(1,1,2), (1,5,5), (1,6,3), (2,2,3), (3,3,4), (5,4,4)}; create three sets in advance, namely, the relationship path feature set P, PF1 and PF2. The relationship path feature set is used to save the features of all the relationship paths that have been obtained. The relationship path feature sets PF1 and PF2 are used to save the features of the relationship paths with lengths of 1 and 2 respectively;

[0092] 3. At this point, all sub-relationship paths have not been extracted yet, so go to the next step and start traversing to obtain a relationship path with a length of 1;

[0093] 4. Extract the relationship paths starting from node 1 and determine the characteristics of each relationship path, which are <(1,2),(1),1 / 3>, <(1,3),(6),1 / 3>, <(1,5),(5),1 / 3>, and save them to the relationship path feature sets P and PF1. At this time, the elements in the relationship path feature sets P and PF1 are:

[0094] P={<(1,2),(1),1 / 3>,<(1,3),(6),1 / 3>,<(1,5),(5),1 / 3>};

[0095] PF1={<(1,2),(1),1 / 3>,<(1,3),(6),1 / 3>,<(1,5),(5),1 / 3>};

[0096] 5. Get the neighbor node set N(1)={2,3,5} of node 1;

[0097] 6. At this point, all sub-relationship path extraction has not been completed, so go to the next step;

[0098] 7. Extract the relationship paths starting from node 2, and determine the features of each relationship path, specifically <(2,3),(2),1>, and save them in the relationship path feature sets P and PF1. At this time, the elements in the relationship path feature sets P and PF1 are:

[0099] P={<(1,2),(1),1 / 3>,<(1,3),(6),1 / 3>,<(1,5),(5),1 / 3>,<(2,3),(2),1>};

[0100] PF1={<(1, 2), (1), 1 / 3>, <(1, 3), (6), 1 / 3>, <(1, 5), (5), 1 / 3>, <(2, 3), (2),1>};

[0101] 8. Get the neighbor node set N(2)={3} of node 2;

[0102] 9. At this point, all sub-relationship path extraction has not been completed, so go to the next step;

[0103] 10. Extract the relationship paths starting from node 3, determine the features of each relationship path, specifically <(3,4),(3),1>, and save them in the relationship path feature sets P and PF1. At this time, the elements in the relationship path feature sets P and PF1 are:

[0104] P={<(1,2),(1),1 / 3>,<(1,3),(6),1 / 3>,<(1,5),(5),1 / 3>,<(2,3),(2),1>,<(3,4),(3),1>};

[0105] PF1={<(1,2),(1),1 / 3>,<(1,3),(6),1 / 3>,<(1,5),(5),1 / 3>,<(2,3),(2),1>,<(3,4),(3),1>};

[0106] 11. Get the neighbor node set N(3)={4} of node 3;

[0107] 12. At this point, all sub-relationship path extraction has not been completed, so go to the next step;

[0108] 13. For node 4, there is no relationship path starting from node 4, so go directly to the next step;

[0109] 14. Node 4 has no neighbors, so go directly to the next step;

[0110] 15. At this point, all sub-relationship path extraction has not been completed, so go to the next step;

[0111] 16. Extract the relationship paths starting from node 5, and determine the features of each relationship path, which are <(5,4),(4),1>, and save them in the relationship path feature sets P and PF1. At this time, the elements in the relationship path feature sets P and PF1 are:

[0112] P={<(1,2),(1),1 / 3>,<(1,3),(6),1 / 3>,<(1,5),(5),1 / 3>,<(2,3),(2),1>,<(3,4),(3),1>,<(5,4),(4),1>};

[0113] PF1={<(1,2),(1),1 / 3>,<(1,3),(6),1 / 3>,<(1,5),(5),1 / 3>,<(2,3),(2),1>,<(3,4),(3),1>,<(5,4),(4),1>};

[0114] 17. Get the neighbor node set N(5)={4} of node 5;

[0115] 18. At this point, all relationship paths with a length of 1 have been extracted and confidence calculated, so go to the next step;

[0116] 19. At this time, the longest relationship path is 1, which has not reached the maximum relationship path length 2, and the relationship path feature set PF2 with a length of 2 has not been obtained, indicating that all combinations have not been completed, and go to the next step;

[0117] 20. For the start node-destination node pair (1-2) of the relationship path <(1,2),(1),1 / 3> in the relationship path feature set PF1, obtain the sub-relationship path feature set PF1(1,2)={<(1,2),(1),1 / 3>};

[0118] 21. There is a sub-relationship path feature in PF1 with node 2 as the starting node, so go to the next step;

[0119] 22. Obtain the neighbor node 3 of node 2, and obtain the sub-relationship path feature set PF1(2,3)={<(2,3),(2),1>} according to the node pair (2-3);

[0120] 23. Combine the sub-relationship paths in PF1(1,2) and PF1(2,3) in pairs and calculate the confidence. The combined relationship path feature is <(1,3),(1,2),1 / 3>. Since the confidence is greater than 0.01, it is not discarded. The combined relationship path feature is added to the relationship path feature set PF2, and the relationship path is saved in the relationship path feature set P. At this time, the elements in the relationship path feature set P and PF2 are:

[0121] P={<(1,2),(1),1 / 3>,<(1,3),(6),1 / 3>,<(1,5),(5),1 / 3>,<(2,3),(2),1>,<(3,4),(3),1>,<(5,4),(4),1>,<(1,3),(1,2),1 / 3>};

[0122] PF2 = {<(1,3),(1,2),1 / 3>};

[0123] 24. At this point, all combinations have not been completed, so go to the next step;

[0124] 25. For the starting node-destination node pair (1-3) of the relationship path <(1,3),(6),1 / 3> in the relationship path feature set PF1, obtain the sub-relationship path feature set PF1(1,3)={<(1,3),(6),1 / 3>};

[0125] 26. There is a sub-relationship path feature in PF1 with node 3 as the starting node, so go to the next step;

[0126] 27. Obtain the neighbor node 4 of node 3, and obtain the sub-relationship path feature set PF1(3,4)={<(3,4),(3),1>} according to the node pair (3-4);

[0127] 28. Combine the sub-relationship paths in PF1(1,3) and PF1(3,4) in pairs and calculate the confidence. The combined relationship path feature is <(1,4),(6,3),1 / 3>. Since the confidence is greater than 0.01, it is not discarded and saved in the relationship path feature set P and PF2. At this time, the elements in the relationship path feature set P and PF2 are:

[0128] P={<(1,2),(1),1 / 3>,<(1,3),(6),1 / 3>,<(1,5),(5),1 / 3>,<(2,3),(2),1>, <(3,4),(3),1>,<(5,4),(4),1>,<(1,3),(1,2),1 / 3>,<(1,4),(6,3),1 / 3>};

[0129] PF2={<(1,3),(1,2),1 / 3>,<(1,4),(6,3),1 / 3>};

[0130] 29. At this point, all combinations have not been completed, so go to the next step;

[0131] 30. For the start node-destination node pair (1-5) of the sub-relationship path <(1,5),(5),1 / 3> in PF1, obtain the sub-relationship path feature set PF1(1,5)={<(1,5),(5),(1 / 3)>};

[0132] 31. There is a sub-relationship path feature in PF1 with node 5 as the starting node, so go to the next step;

[0133] 32. Obtain the neighbor node 4 of node 5, and obtain the sub-relationship path feature set PF1(5,4)={<(5,4),(4),1>} according to the node pair (5-4);

[0134] 33. Combine the sub-relationship paths in PF1(1,5) and PF1(5,4) in pairs and calculate the confidence. The combined relationship path feature is <(1,4),(5,4),1 / 3>. Since the confidence is greater than 0.01, it is not discarded and saved in the relationship path feature set P and PF2. At this time, the elements in the relationship path feature set P and PF2 are:

[0135] P={<(1,2),(1),1 / 3>,<(1,3),(6),1 / 3>,<(1,5),(5),1 / 3>,<(2,3),(2),1>,<(3,4),(3 ),1>,<(5,4),(4),1>,<(1,3),(1,2),1 / 3>,<(1,4),(6,3),1 / 3>,<(1,4),(5,4),1 / 3>};

[0136] PF2={<(1,3),(1,2),1 / 3>,<(1,4),(6,3),1 / 3>,<(1,4),(5,4),1 / 3>};

[0137] 34. At this point, all combinations have not been completed, so go to the next step;

[0138] 35. For the starting node-destination node pair (2-3) of the sub-relationship path <(2,3),(2),1> in PF1, obtain the sub-relationship path feature set PF1(2,3)={<(2,3),(2),1>};

[0139] 36. There is a sub-relationship path feature in PF1 with node 3 as the starting node, so go to the next step;

[0140] 37. Obtain the neighbor node 4 of node 3, and obtain the sub-relationship path feature set PF1(3,4)={<(3,4),(3),1>} according to the node pair (3-4);

[0141] 38. Combine the sub-relationship paths in PF1(2,3) and PF1(3,4) in pairs and calculate the confidence, and get the relationship path <(2,4),(2,3),1>; because the confidence is greater than 0.01, it is not discarded and saved in P and PF2. At this time, the elements in P and PF2 are:

[0142] P={<(1,2),(1),1 / 3>,<(1,3),(6),1 / 3>,<(1,5),(5),1 / 3>,<(2,3),(2),1>,<(3,4),(3),1>,<(5 ,4),(4),1>,<(1,3),(1,2),1 / 3>,<(1,4),(6,3),1 / 3>,<(1,4),(5,4),1 / 3>,<(2,4),(2,3),1>};

[0143] PF2={<(1,3),(1,2),1 / 3>,<(1,4),(6,3),1 / 3>,<(1,4),(5,4),1 / 3>,<(2,4),(2,3),1>};

[0144] 39. At this point, all combinations have not been completed, so go to the next step;

[0145] 40. For the start node-destination node pair (3-4) of the sub-relationship path <(3,4),(3),1> in PF1, obtain the sub-relationship path feature set PF1(3,4)={<(3,4),(3),1>};

[0146] 41. There is no sub-relationship path feature with node 4 as the starting node, so go directly to the next step;

[0147] 42. At this point, all combinations have not been completed, so go to the next step;

[0148] 43. For the starting node-destination node pair (5-4) of the sub-relationship path <(5,4),(4),1>, obtain the sub-relationship path feature set PF1(5,4)={<(5,4),(4),1>};

[0149] 44. There is no sub-relationship path feature with node 4 as the starting node in PF, so go directly to the next step;

[0150] 45. All sub-relationship paths in the sub-relationship path feature set PF1 have been combined to obtain a relationship path feature set PF2 with a length of 2. At this time, the length of the longest relationship path is 2, which has reached the maximum length, indicating that the relationship path modeling is completed, and go to the next step;

[0151] 46. ​​Apply all features in the relationship path feature set P and the entities and relationships of the knowledge graph to representation learning to obtain vector representations of entities and relationships.

[0152] It will be easily understood by those skilled in the art that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A knowledge representation learning method for search engines, It is characterized in that include: (S1) taking entities in the target knowledge graph as nodes, traversing the target knowledge graph to obtain all relationship paths with each node as the starting node and a length of s, and obtaining the characteristics of each relationship path; Initialize the length variable S tmp =s; the target knowledge graph is used to express the subject to be searched, and the entities therein correspond to the associated information of the subject to be searched; the characteristics of the relationship path include confidence, the starting node-destination node pair, and the relationship between the starting node and the destination node; s = L / n, L is the maximum length of the relationship path, and n is a positive integer; s=1 or s>1; when s>1, in step (S1), the knowledge graph is traversed to obtain all relationship paths with each node as the starting node and a length of s, and the characteristics of each relationship path are obtained, including: (S11) traverse the target knowledge graph to obtain all relationship paths with each node as the starting node and a length of 1, and obtain the characteristics of each relationship path; initialize the length variable u=1; (S12) If u=s, proceed to step (S15); otherwise, proceed to step (S13); (S13) For each relationship path p of length u u , which is connected to a path p of length 1 and with the relation u The destination node e u Combine the relationship paths of the starting nodes respectively to obtain a relationship path with a length of t=u+1, and obtain the characteristics of each relationship path obtained by the combination; (S14) Update the value of the length variable u to t, and go to step (S12); (S15) saving each relationship path of length s and its characteristics; (S2) If S tmp =L, then go to step (S5); otherwise, go to step (S3); (S3) For a length of S tmp Each relationship path p of , and combine it with the relationship path of length s and starting with the destination node e of the relationship path p as the starting node, to obtain a relationship path of length L tmp =S tmp +s's relationship paths, and obtain the characteristics of each combined relationship path; (S4) The length variable S tmp The value of is updated to L tmp , proceed to step (S2); (S5) Applying the features of entities, relationships and all relationship paths of the target knowledge graph to representation learning to obtain vector representations of entities and relationships in the target knowledge graph.

2. The search engine-oriented knowledge representation learning method according to claim 1, It is characterized in that When traversing the target knowledge graph to obtain all relationship paths with each node as the starting node and a length of 1, a limited-length breadth-first traversal algorithm is adopted.

3. The search engine-oriented knowledge representation learning method according to claim 1, It is characterized in that For any relation path p'=(r i ), whose confidence level C ri The calculation formula is: Among them, r i represents the relations constituting the relation path p', e y Represents the relationship r i The destination node, E i-1 (·,e y ) represents node e y Along the relationship r i The set of predecessor nodes, e x ∈E i-1 (·,e y ) represents node e y Along the relationship r i The predecessor node, E i (e x ,·) represents the starting node e x Along i The set of successor nodes, Represents node e y From node e x The amount of resources obtained.

4. The search engine-oriented knowledge representation learning method according to claim 3, It is characterized in that For the relationship path p 1 and the relationship path p 2 The confidence C(p”|ht) of the combined relationship path p” is: C(p”|h-t)=C(p 1 |h 1 -t 1 )×C(p 2 |h 2 -t 2 ); Among them, C(p 1 |h 1 -t 1 ) and C(p 2 |h 2 -t 2 ) represent the relationship path p 1 and the relationship path p 2 confidence level.

5. The search engine-oriented knowledge representation learning method according to any one of claims 1 to 4, It is characterized in that In the step (S3), after obtaining the features of each relationship path obtained by combination, the step further includes: eliminating the relationship paths whose confidence is less than a preset threshold among the relationship paths obtained by combination.

6. A knowledge reasoning method for search engines, It is characterized in that include: For the topic to be searched, knowledge reasoning is performed using the vector representation obtained by the search engine-oriented knowledge representation learning method described in any one of claims 1 to 5, so as to complete the missing information in the knowledge graph used to express the topic to be searched.

7. A computer-readable storage medium, It is characterized in that It comprises a stored computer program; when the computer program is executed by a processor, it controls the device where the computer-readable storage medium is located to execute the search engine-oriented knowledge representation learning method described in any one of claims 1 to 5, and / or the search engine-oriented knowledge reasoning method described in claim 6.