Entity edge building method, device, equipment and medium for knowledge graph
By acquiring and utilizing the target attributes in the target binary relationship, the edge building entity nodes are determined and built in the knowledge graph, which solves the problem that entity edge building cannot be completed under the situation of multiple data external sources, and improves the conductivity of the knowledge graph.
Patent Information
- Application Number
- CN202210130196.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-11
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2042-02-11
AI Technical Summary
When the data of the knowledge graph comes from multiple external sources of different data, the link relationship between the entity nodes that need to be edge-built cannot be captured, resulting in the entity edge-built cannot be completed.
By obtaining the target binary relationship of the first entity, a second entity node corresponding to the second entity is determined in the knowledge graph based on the target attributes, and the first entity node and the second entity node are edged in the knowledge graph.
Overcoming the problem of not being able to crawl jump links under the condition of multiple data external sources, and improving the conductivity of the knowledge graph.
Smart Images

Figure CN116629359B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence, and in particular to a method, device, equipment and medium for establishing entity edges in a knowledge graph. Background Art
[0002] The basic unit of a knowledge graph consists of two entity nodes and the edges between them. How to build an edge between two entity nodes is a very important step in building a knowledge graph.
[0003] In related technologies, the data of the knowledge graph comes from the same external data source. For example, the knowledge sub-graph of "Zhang San" and the knowledge sub-graph of "Li Si" in the knowledge graph both come from data provided by Baidu Encyclopedia. There is a link on the knowledge graph card of "Zhang San" in Baidu Encyclopedia to jump to the knowledge graph card of "Li Si". Therefore, the link relationship can be captured by a crawler, and the entity node of "Zhang San" can be established with the entity node of "Li Si" in the knowledge graph.
[0004] However, if the data of the knowledge graph comes from multiple external data sources, it may not be possible to capture the link relationship between the entity nodes that need to build edges, and obviously the entity edge building cannot be completed. Summary of the invention
[0005] The present application provides a method, device, equipment and medium for building entity edges in a knowledge graph, which can improve the connectivity of the knowledge graph. The technical solution is as follows:
[0006] According to one aspect of the present application, a method for building entity edges in a knowledge graph is provided, the method comprising:
[0007] Obtain a target binary relationship of the first entity, the target binary relationship includes the first entity, the target attribute, and the second entity, the second entity being an attribute value of the first entity in the target attribute;
[0008] Based on the target attribute, determining a second entity node corresponding to the second entity in the knowledge graph;
[0009] In the knowledge graph, an edge is established between a first entity node corresponding to the first entity and a second entity node.
[0010] According to another aspect of the present application, a device for building entity edges in a knowledge graph is provided, the device comprising:
[0011] An acquisition module, used for acquiring a target binary relationship of a first entity, wherein the target binary relationship includes the first entity, a target attribute, and a second entity, wherein the second entity is an attribute value of the first entity in the target attribute;
[0012] A determination module, configured to determine, in the knowledge graph, a second entity node corresponding to the second entity based on the target attribute;
[0013] The edge building module is used to build an edge between a first entity node corresponding to a first entity and a second entity node in the knowledge graph.
[0014] According to one aspect of the present application, a computer device is provided, comprising: a processor and a memory, wherein the memory stores a computer program, and the computer program is loaded and executed by the processor to implement the entity edge building method of the knowledge graph as described above.
[0015] According to another aspect of the present application, a computer-readable storage medium is provided, wherein the storage medium stores a computer program, and the computer program is loaded and executed by a processor to implement the entity edge building method of the knowledge graph as described above.
[0016] According to another aspect of the present application, a computer program product or computer program is provided, the computer program product or computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the entity edge building method of the above-mentioned knowledge graph.
[0017] The beneficial effects brought by the technical solution provided by the embodiment of the present application include at least:
[0018] The second entity node corresponding to the second entity is determined based on the target attribute, which overcomes the problem of being unable to capture jump links when the data of the knowledge graph comes from different external data sources, thereby improving the connectivity rate of the knowledge graph. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments 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 creative work.
[0020] Figure 1 It is a schematic diagram of a complete construction process of a knowledge graph provided by an exemplary embodiment of the present application;
[0021] Figure 2 is a schematic diagram of a computer system provided by an exemplary embodiment of the present application;
[0022] Figure 3It is a flow chart of an entity edge building method of a knowledge graph provided by an exemplary embodiment of the present application;
[0023] Figure 4 is a flow chart of an entity edge building method of a knowledge graph provided by another exemplary embodiment of the present application;
[0024] Figure 5 is a flow chart of an entity edge building method of a knowledge graph provided by another exemplary embodiment of the present application;
[0025] Figure 6 It is a structural block diagram of an entity edge building device of a knowledge graph provided by an exemplary embodiment of the present application;
[0026] Figure 7 It is a structural block diagram of a computer device provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0027] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0028] First, the nouns involved in the embodiments of the present application are briefly introduced:
[0029] Knowledge graph: It is a structured semantic knowledge base used to quickly describe concepts and their relationships in the physical world. The basic unit in the knowledge graph can be considered as an SPO (Subject-Predicate-Object, Entity 1-Predicate-Entity 2) triple, and an SPO is a binary relationship, for example, a triple (Zhang San-Wife-Li Si). The predicate in the SPO triple can also be called an attribute, and entity 2 can be considered as an attribute value of the attribute. It is worth noting that in all embodiments of the present application, the attribute values of the attributes are all entity types, because in the knowledge graph, only the attribute values of the entity type need to be used for entity edge building.
[0030] Entity edge building: refers to the operation of linking the extracted entity to the corresponding correct entity in the knowledge base, that is, determining the entity node 2 corresponding to the extracted entity 2 in the knowledge graph, and building an edge between entity node 1 and entity node 2. The basic idea is to first select a set of candidate entity nodes from the knowledge base based on the given entity 2, and then link entity 2 to the correct entity node 2 through entity determination.
[0031] Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.
[0032] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics and other technologies. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0033] In the related art of this application, the methods of entity edge building include the following four:
[0034] In the first entity edge building method, the data of the knowledge graph comes from the same external data source. The first entity edge building method has been introduced in detail in the above background technology and will not be discussed here.
[0035] The second way to build entity edges is to build edges through inference rules. For example, in the knowledge subgraph of "Zhang San", there is a binary relationship "Zhang San-father-Zhang Si", and in the knowledge subgraph of "Zhang Er", there is a binary relationship "Zhang Er-grandfather-Zhang Si". It can be inferred that Zhang Er is Zhang San's son or daughter, and edges are built between the "Zhang San" entity node and the "Zhang Er" entity node in the knowledge graph.
[0036] The third way to build entity edges is to build edges through graph matching. For example, in the knowledge subgraph of "Zhang San", there are binary relations "Zhang San-friend-Xiao Ming" and "Zhang San-friend-Xiao Li", and in the knowledge subgraph of "Li Si", there are binary relations "Li Si-friend-Xiao Ming" and "Li Si-friend-Xiao Li". That is, based on the similarity of the graph structure, the entity node of "Zhang San" can be established with the entity node of "Li Si" in the knowledge graph.
[0037] However, the disadvantage of the second and third entity edge building methods is that relying on inference rules and graph matching is essentially dependent on the edge relationship between entity nodes that have already built edges. The purpose of entity edge building is to increase the edge relationship of the knowledge graph. Circular dependencies can easily lead to the accumulation and amplification of errors.
[0038] The fourth entity edge building method uses a semantic matching model to build edges. For example, if you want to build an edge between the "Zhang San" entity node and the "A Brief Discussion on How to Write a Patent" (Zhang San's work) entity node in the knowledge graph, you need to combine the multi-dimensional information under the attributes of the work. For example, in the knowledge sub-graph of "A Brief Discussion on How to Write a Patent", you can obtain multi-dimensional information such as the authors of "A Brief Discussion on How to Write a Patent" are Zhang San, Zhao Liu, etc., the publication time of "A Brief Discussion on How to Write a Patent" is 2013, and the popularity of "A Brief Discussion on How to Write a Patent" is 90. In the knowledge sub-graph of "Zhang San", you can obtain multi-dimensional information such as the work "A Brief Discussion on How to Write a Patent", Zhang San's partner is Zhao Liu, and Zhang San's popularity is 95. Only through the semantic matching of the multi-dimensional information on both sides can the "A Brief Discussion on How to Write a Patent" entity node and the "Zhang San" entity node be built in the knowledge graph.
[0039] However, building edges through semantic matching models requires not only considering different attributes, but also the amount of information about the attribute values of the attributes. Under the attributes of the work of the writer "Zhang San", the work "A Brief Discussion on How to Write Patents" contains more information. However, under the attributes of the work of the architect "Zhang San" (another person), the work contains less information about an unknown bridge. At this time, multiple semantic matching models need to be trained to meet the needs of different character categories, and the calculation process is very complicated. From the above, we can know that the semantic matching model not only depends on the changes in attributes, but also is closely related to the amount of information about the attribute values. The relevant technology needs to train multiple semantic matching models to overcome the above problems. The process of training multiple semantic matching models is very cumbersome and the workload is huge.
[0040] Next, we will introduce the complete process of building a knowledge graph to facilitate understanding of entity edge building.
[0041] Combined with reference Figure 1 ,Example, ,heterogeneous data include “Zhang San; Encyclopedia: September 27, 1961, born in Province A, City B; Time Network: 1961-9-27, City B, County C”.
[0042] Step 101, structural alignment;
[0043] Through the preset data model schema, the heterogeneous data is structurally aligned to obtain homogeneous data;
[0044] For example, homogeneous data includes "Date of Birth: September 27, 1961; Place of Birth: Province A, City B; Source: Encyclopedia; Date of Birth: 1961-9-27; Place of Birth: City B, County C; Source: Time Network", that is, Schema defines the format of data attributes. Optionally, Schema also completes the classification of heterogeneous data, and classifies "Zhang San" as an entertainment figure (category).
[0045] Step 102, data cleaning;
[0046] Exemplarily, the regularized data after data cleaning includes "Date of Birth: September 27, 1961; Place of Birth: Province A, City B; Source: Encyclopedia; Date of Birth: September 27, 1961; Place of Birth: Province A, City B; Source: Time.net", that is, data cleaning is used to remove impurities (or normalization) of homogeneous data.
[0047] Step 103, entity fusion;
[0048] Exemplarily, the disambiguation data after entity fusion includes "Zhang San (writer); Encyclopedia: Zhang San; Time.com: Zhang San", "Zhang San (architect); Encyclopedia: Zhang San", that is, entity fusion completes the supplement of different entities, and based on different character categories (entertainment characters, major character categories), completes the disambiguation between different entities.
[0049] Step 104, attribute fusion;
[0050] Exemplarily, the entity data after attribute fusion includes "Zhang San (writer); Date of birth: September 27, 1961; Wife: Li Si; Place of birth: City B, Province A; Work: "A Brief Discussion on How to Draft Patents"". Attribute fusion integrates the above data from the encyclopedia and the data from Time.com, removes erroneous information and optimizes repeated information.
[0051] Step 105, relationship building;
[0052] In the knowledge graph, determine the second entity node corresponding to the second entity in the binary relationship. For example, in the binary relationship "Zhang San-wife-Li Si", determine the "Li Si" entity node corresponding to the entity "Li Si" in the knowledge graph to build an edge. Relationship construction is the entity edge building (also called entity linking) problem to be solved in this application.
[0053] Recommending related entities or similar entities in the search scenario depends on the edge relationship between entity nodes. For example, when searching for Zhang San, recommending the related entity Xiao Ming (Xiao Ming is Zhang San’s friend) depends on the edge between the “Zhang San” entity node and the “Xiao Ming” entity node.
[0054] Step 106, the entity is shipped out.
[0055] In the knowledge graph, an edge is established between the first entity node and the second entity node. For example, an edge is established between the "Zhang San" entity node and the "Li Si" entity node in the knowledge graph.
[0056] It can be explained that the above steps 101 to 106 can be completed independently by the terminal, or independently by the server, or collaboratively by the terminal and the server. Figure 2The structure block diagram of a computer system provided by an exemplary embodiment of the present application is shown. The computer system 200 includes: a terminal 220 and a server 240 .
[0057] An application supporting the construction of a knowledge graph is installed and run on the terminal 220. Illustratively, the application is used to support the steps of structural alignment, entity fusion, and attribute fusion of the heterogeneous data obtained after the terminal 220 obtains data from an external data source. Optionally, the type of the terminal includes at least one of a smart phone, a smart watch, a smart TV, a car terminal, a wearable device, a tablet computer, an e-book reader, an MP3 player, an MP4 player, and a laptop computer.
[0058] The terminal 220 is connected to the server 240 via a wireless network or a wired network.
[0059] Server 240 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. In an embodiment of the present application, server 240 is used to support the construction of a knowledge graph. Schematically, server 240 is used to support the determination of a second entity node corresponding to a second entity in a knowledge graph.
[0060] It is worth noting that the following is an example in which physical edge building (ie, the above step 105) is executed by the server.
[0061] Figure 3 A flowchart of a knowledge graph entity edge building method provided by the present application is shown. Figure 2 The server 240 shown is executed for example, and the method includes:
[0062] Step 320, obtaining a target binary relationship of the first entity, where the target binary relationship includes the first entity, a target attribute, and a second entity;
[0063] The second entity is the attribute value of the first entity in the target attribute.
[0064] Target binary relationship: that is, the target SPO triple, which refers to the basic unit of the knowledge graph for entity edge building in this application. For example, the target binary relationship is "Zhang San-Wife-Li Si", "Zhang San-Work-"A Brief Discussion on How to Draft Patents"", "Zhang San-Friend-Xiao Ming", etc.
[0065] Step 340, based on the target attribute, determining a second entity node corresponding to the second entity in the knowledge graph;
[0066] In one embodiment, when the target attribute belongs to a target attribute set in at least two attribute sets, the server determines a second entity node corresponding to the second entity in the knowledge graph by using an entity determination method corresponding to the target attribute set, wherein the entity determination methods corresponding to at least two attribute sets are different.
[0067] Illustratively, the method by which the server determines the second entity node corresponding to the second entity in the knowledge graph based on the target attribute includes at least one of the following:
[0068] The server determines, based on the target attribute belonging to the first preset attribute set, a second entity node corresponding to the second entity in the knowledge graph through a priori dictionary;
[0069] The server determines, based on the target attribute belonging to the second preset attribute set, a second entity node corresponding to the second entity in the knowledge graph through the first strategy;
[0070] The server determines, based on the target attribute belonging to the third preset attribute set, a second entity node corresponding to the second entity in the knowledge graph through a second strategy;
[0071] Among them, the computing resource consumption corresponding to the prior dictionary is less than the computing resource consumption corresponding to the first strategy, and the computing resource consumption corresponding to the first strategy is less than the computing resource consumption corresponding to the second strategy.
[0072] Step 360: In the knowledge graph, an edge is established between the first entity node corresponding to the first entity and the second entity node.
[0073] In one embodiment, after the server determines the second entity node corresponding to the second entity based on the target attribute, it creates an edge between the first entity node corresponding to the first entity and the second entity node in the knowledge graph.
[0074] In summary, determining the second entity node corresponding to the second entity based on the target attribute overcomes the problem of being unable to capture jump links when the data of the knowledge graph comes from different external data sources, thereby improving the connectivity of the knowledge graph.
[0075] Furthermore, even if the data structure schema changes, that is, the format of the attributes changes, the above-mentioned attribute-based entity edge building method can still continue to be applicable.
[0076] Furthermore, the above-mentioned entity edge building method based on attributes overcomes the disadvantages of the fourth entity edge building method in the related art (different semantic matching models need to be established as the attributes change).
[0077] Figure 4 A flowchart of an entity edge building method of a knowledge graph provided by an exemplary embodiment of the present application is shown, and the method includes:
[0078] Step 401, obtaining all binary relations of the first entity;
[0079] The server obtains all SPO triples, that is, all binary relations, after structural alignment, data cleaning, entity fusion, and attribute fusion.
[0080] Step 402, splitting all binary relations of the first entity according to the attributes in the binary relations;
[0081] The server splits all binary relations of the first entity according to the attributes in the binary relations to obtain three preset attribute sets, wherein the first preset attribute set corresponds to the use of a priori dictionary, the second preset attribute set corresponds to the use of the first strategy, and the third preset attribute set corresponds to the use of the second strategy.
[0082] It is worth mentioning that the three preset attribute sets (prior dictionary, first strategy, second strategy) are divided based on the probability that the wrong candidate entity node corresponding to the attribute is mistaken for the correct entity node, and the probabilities corresponding to the three preset attribute sets are from low to high. For example, the target binary relationship "Zhang San-Zodiac-Libra" has the attribute "Zodiac". In the prior knowledge, there are only twelve choices for the constellation. The number of constellations is small, the ambiguity is small, and the determination method is clear. At this time, it is determined that the attribute constellation belongs to the first preset attribute set, that is, the second entity node is determined by the prior dictionary method. Similarly, attributes such as zodiac sign and nationality also belong to the first preset attribute set.
[0083] For example, for the target binary relationship "Zhang San-Hometown-Province A City B", the recalled candidate entity nodes may be "Province A City B", "Province A County D", "Province A Most Beautiful Scenic Spot", "City B Specialty", etc. At this time, the number of candidate entity nodes is limited, but there are many ambiguities, and the determination method is not clear. At this time, it is determined that the attribute hometown belongs to the second preset attribute set, so the first strategy is used to determine the second entity node of the attribute hometown. Similarly, the graduation school and birthplace also belong to the second preset attribute set.
[0084] For another example, for the target binary relationship "Zhang San-Work-"A Brief Talk on How to Write a Patent"", the recalled candidate entity nodes may include the incorrect "A Brief Talk on How to Write a Patent" (a video file), the correct "A Brief Talk on How to Write a Patent" (Book A), and the incorrect "A Brief Talk on How to Write a Patent" (Book B). Moreover, the binary relationship of ""A Brief Talk on How to Write a Patent"-Author-Zhang San" is not recorded in the correct "A Brief Talk on How to Write a Patent" (Book A). At this time, the number of candidate entity nodes is limited, but there are many ambiguities, and the determination method is even more unclear. At this time, it is determined that the attribute work belongs to the third preset attribute set, so the second strategy is used to determine the second entity node of the attribute work. Similarly, the guests of the variety show also belong to the third preset attribute set.
[0085] Step 403, determining a second entity node corresponding to the second entity through a priori dictionary;
[0086] The server determines, through a priori dictionary, that a candidate entity node having the same name as the second entity is the second entity node; wherein the priori dictionary is composed of mapping relationships between a target attribute and n attribute values, where n is a positive integer.
[0087] For example, for the attribute constellation, the prior dictionary records twelve prior mappings such as "Constellation-Libra", "Constellation-Taurus", etc. For the target binary relationship "Zhang San-Constellation-Libra", you can directly query the prior dictionary of the constellation to obtain the second entity node with the same name as "Libra".
[0088] In an optional embodiment, the process of constructing the prior dictionary includes:
[0089] First, the server obtains all binary relations of the first entity, and then determines the number of attribute values under different attributes in all binary relations. The server determines that the attributes whose number of attribute values is lower than a preset threshold belong to the first preset attribute set, that is, the server uses the prior dictionary to determine the second entity node corresponding to the second entity under the attribute.
[0090] Step 404, determining a second entity node corresponding to a second entity of the target binary relationship through the first strategy;
[0091] The server determines the second entity node corresponding to the second entity through the first strategy. The steps of the first strategy can be briefly summarized as three steps: obtaining candidate entity nodes, scoring the candidate entity nodes, and determining whether the scores of the candidate entity nodes reach the score threshold. For a detailed description of the first strategy, please refer to the following embodiment.
[0092] Step 405: Determine a second entity node corresponding to a second entity of the target binary relationship through a second strategy.
[0093] The server determines the second entity node corresponding to the second entity through the second strategy. The steps of the second strategy can be briefly summarized as four steps: obtaining candidate entity nodes, scoring the candidate entity nodes, sorting the candidate entity nodes based on the scores, and determining whether the statistical data of the scores of the candidate entity nodes reaches the statistical threshold. For a detailed description of the second strategy, please refer to the following embodiment.
[0094] One point worth mentioning is that Figure 4 The optional embodiment shown is based on the attribute belonging to one of the three preset attribute sets, and then decides to determine the second entity node through the corresponding entity determination method. In fact, if the second entity node cannot be determined through the corresponding entity determination method, then another entity determination method can be used to determine the second entity node. For example, for the attribute ancestry, there is no candidate entity node whose score reaches the score threshold among the multiple candidate entity nodes obtained by the first strategy, that is, the second entity node is determined by the second strategy; for the attribute constellation, the corresponding second entity node cannot be determined by the prior dictionary, that is, the second entity node is determined by the first strategy.
[0095] In fact, the computing resource consumption corresponding to the prior dictionary is less than that corresponding to the first strategy, and the computing resource consumption corresponding to the first strategy is less than that corresponding to the second strategy. Therefore, in actual operation, the prior dictionary may be used first, then the first strategy, and then the second strategy. It has been proved through many experiments that when there is a correct second entity node in the knowledge graph, the accuracy of the second entity node finally determined by the second strategy is extremely high.
[0096] In summary, the second entity node is determined according to different attributes through the prior dictionary, the first strategy and the second strategy, and the optimal decision is made based on the consumption of computing resources, thereby avoiding excessive occupation of computing resources.
[0097] Moreover, by constructing a priori dictionary in advance, which includes the mapping relationship between the target attribute and n attribute values, the difficulty of entity edge building is greatly reduced.
[0098] Next, we will introduce the first strategy:
[0099] based on Figure 4 In the optional embodiment shown, step 404 may be replaced by steps 1 to 3 described below.
[0100] 1. In the knowledge graph, obtain k candidate entity nodes corresponding to the name of the second entity, where k is a positive integer;
[0101] Among them, corresponding to the name of the second entity means that the name is identical or similar, identical indicates that the similarity between the name of the candidate entity node and the name of the second entity falls into a first name similarity interval, similar indicates that the similarity between the name of the candidate entity node and the name of the second entity falls into a second name similarity interval, and the similarity value of the first name similarity interval is greater than that of the second name similarity interval.
[0102] For example, for the target binary relationship "Zhang San-Hometown-Province A City B", based on "Province A City B", four candidate entity nodes named "Province A City B", "Province A County D", "Province A's Most Beautiful Scenic Spot", and "City B Specialties" will be obtained.
[0103] 2. Determine the scores of k candidate entity nodes through the first scoring method;
[0104] Optionally, the first scoring method may include at least one of the following three scoring sub-methods:
[0105] First, when there is a first candidate entity node among the k candidate entity nodes, determine that the score of the first candidate entity node is a first score, and the name of the first candidate entity node is the same as that of the second entity;
[0106] In the case that there is a second candidate entity node among the k candidate entity nodes, determining the score of the second candidate entity node to be a second score, and the name of the second candidate entity node is different from that of the second entity;
[0107] Wherein, the first score is greater than the second score.
[0108] Illustratively, for the four candidate entity nodes "Province A, City B", "Province A, County D", "Province A's Most Beautiful Scenic Spot", and "Specialties of City B", based on the fact that the name of the entity node of "Province A, City B" is the same as the name of the second entity "Province A, City B", the score of the "Province A, City B" entity node is determined to be higher than the scores of the "Province A, County D" entity node, the "Province A's Most Beautiful Scenic Spot" entity node, and the "Specialties of City B" entity node.
[0109] It is worth mentioning that in the current sub-scoring method, what is considered is whether the character strings are identical, and the substantial semantic identity is not considered. That is, even if there is a candidate entity node "B City C County", the score of the "Province A City B" entity node will still be considered higher than that of the "B City C County" entity node (Zhang San's ancestral home is more precisely Province A City B County C).
[0110] Second, when there is a third candidate entity node among the k candidate entity nodes, determine that the score of the third candidate entity node is a third score, and the attribute value of the binary relationship of the third candidate entity node matches the attribute value of the binary relationship of the first entity node;
[0111] In the case that there is a fourth candidate entity node among the k candidate entity nodes, determining that the score of the fourth candidate entity node is a fourth score, and the attribute value of the binary relationship of the fourth candidate entity node does not match the attribute value of the binary relationship of the first entity node;
[0112] Among them, the third score is greater than the fourth score, the attribute value match indicates that the attribute value of the symmetric binary relationship of the candidate entity node is the same as the name of the first entity node, or the attribute value of other binary relationships of the candidate entity node is the same as the attribute value of other binary relationships of the first entity node; the symmetric binary relationship and the target binary relationship indicate the same fact, and the other binary relationship is any binary relationship except the target binary relationship and the symmetric binary relationship.
[0113] Indicatively, this sub-scoring method can be further divided into two cases:
[0114] In case 1, when the attribute value of the symmetric binary relationship of the candidate entity node is the same as the name of the first entity node, the score of the candidate entity node with the same attribute value is determined to be the third score, and the score of the candidate entity node with different attribute values is determined to be the fourth score. The symmetric binary relationship and the target binary relationship indicate the same fact.
[0115] For example, the target binary relationship is "Zhang San-wife-Li Si", if the symmetric binary relationship of the candidate entity node is "Li Si-husband-Zhang San", then the score of the candidate node is determined to be the third score, and the wife and husband essentially indicate the same facts, and the two are in a husband-and-wife relationship.
[0116] For the target binary relationship "Zhang San - Works - "A Brief Discussion on How to Draft Patents", if the symmetric binary relationship of the candidate entity node is ""A Brief Discussion on How to Draft Patents" - Author - Zhang San", the score of the candidate node is determined to be the third score. The works and authors essentially indicate the same fact, that is, Zhang San participated in the creation of "A Brief Discussion on How to Draft Patents".
[0117] Case 2: When the attribute value of the other binary relations of the candidate entity node is the same as the attribute value of the other binary relations of the first entity node, the score of the candidate entity node with the same attribute value is determined to be the third score, and the score of the candidate entity node with different attribute values is determined to be the fourth score. The other binary relations are any one of all binary relations of the candidate entity node except the symmetric binary relations, that is, the other binary relations are any one of all binary relations of the first entity node except the target binary relation.
[0118] For example, the target binary relationship is "Zhang San-wife-Li Si", the first entity node also has other binary relationships "Zhang San-friend-Xiao Ming", and the candidate entity node has other binary relationships "Li Si-friend-Xiao Ming", then the score of the candidate entity node is determined to be higher than the score of the candidate entity node with different attribute values. It should be noted that the different attribute values of other binary relationships here can be understood as non-existence or inconsistency. For example, for the candidate entity node "Li Si-friend-Sun Qi", "Sun Qi" is obviously inconsistent with "Zhang San", and the attribute value of the friend attribute of the candidate entity node does not exist "Zhang San".
[0119] Third, when there is a fifth candidate entity node among the k candidate entity nodes, determining that the score of the fifth candidate entity node is a fifth score, and the degree of association between the category of the fifth candidate entity node and the category of the first entity node reaches a first association threshold;
[0120] In the case that there is a sixth candidate entity node among the k candidate entity nodes, determining that the score of the sixth candidate entity node is a sixth score, and the degree of association between the category of the sixth candidate entity node and the category of the first entity node does not reach a first association threshold;
[0121] Among them, the fifth score is greater than the sixth score.
[0122] For example, for the target binary relationship "Zhang San-Wife-Li Si", the category of the "Zhang San" entity node is entertainment figure. If there is a candidate entity node 1 "Li Si" whose category is character and a candidate entity node 2 "Li Si" whose category is entertainment figure, then the score of candidate entity node 2 is considered to be higher than that of candidate entity node 1. At this time, the degree of association between candidate entity node 2 and the category of the first entity node "Zhang San" reaches the first association threshold, while the degree of association between candidate entity node 1 and the first entity node "Zhang San" does not reach the first association threshold.
[0123] The association threshold can also be understood as a ranking threshold between candidate entity nodes. For example, in the ranking of candidate entity nodes from high to low according to the association degree, the score of the top three candidate entity nodes is the fifth score, and the score of the candidate entity nodes after the top three is the sixth score.
[0124] 3. In the knowledge graph, the candidate entity node whose score reaches the first score threshold is determined as the second entity node.
[0125] Based on the above-mentioned completion of scoring the k candidate entity nodes by the first scoring method, the server will perform normalized weighted summation on the different scores determined by at least one sub-scoring method of the first scoring method, and determine the candidate entity node whose final score reaches the first score threshold as the second entity node.
[0126] In summary, the scoring method of the first strategy can be briefly summarized as scoring based on the same name, the same binary relationship attribute value, and the degree of association between categories. The computing resources occupied by the first strategy are relatively small.
[0127] Next, we will introduce the relevant content of the second strategy:
[0128] based on Figure 4 In the optional embodiment shown, step 405 may be replaced by the following steps 1' to 4'.
[0129] 1', in the knowledge graph, obtain k candidate entity nodes corresponding to the name of the second entity, where k is a positive integer;
[0130] Among them, the name corresponding to the second entity includes the same name or similar name, the same name indicates that the similarity between the name of the candidate entity node and the name of the second entity falls into a first name similarity interval, the similarity name indicates that the similarity between the name of the candidate entity node and the name of the second entity falls into a second name similarity interval, and the similarity value of the first name similarity interval is greater than the similarity value of the second name similarity interval.
[0131] For example, for the target binary relationship "Zhang San-Works-"A Brief Talk on How to Draft a Patent"", based on the name of the second entity ""A Brief Talk on How to Draft a Patent"", three candidate entity nodes named ""A Brief Talk on How to Draft a Patent"", ""A Brief Talk on How to Draft a Patent"" (false), and ""A Brief Talk on How to Draft a Patent"" (true) will be obtained.
[0132] 2', determine the scores of k candidate entity nodes through the second scoring method;
[0133] Optionally, the second scoring method may include at least one of the following five scoring methods:
[0134] First, when there is a seventh candidate entity node among the k candidate entity nodes, the score of the seventh candidate entity node is determined to be a seventh score, and the similarity between the attribute value of the symmetric binary relationship of the seventh candidate entity node and the name of the first entity node reaches a first similarity threshold;
[0135] In the case that there is an eighth candidate entity node among the k candidate entity nodes, determining that the score of the eighth candidate entity node is an eighth score, and the similarity between the attribute value of the symmetric binary relationship of the eighth candidate entity node and the name of the first entity node does not reach a first similarity threshold;
[0136] Among them, the seventh score is greater than the eighth score, and the symmetric binary relationship and the target binary relationship indicate the same fact.
[0137] Exemplarily, the target binary relationship is "Zhang San-wife-Li Si" and the symmetric binary relationship of the candidate entity node is "Li Si-husband-Zhang Shan", Zhang Shan is an alias of Zhang San, and the similarity between "Zhang Shan" and "Zhang San" reaches a first similarity threshold, then it is determined that the score of the candidate entity node is higher than that of the candidate entity node that does not reach the first similarity threshold.
[0138] Second, when there is a ninth candidate entity node among the k candidate entity nodes, the score of the ninth candidate entity node is determined to be a ninth score, and the similarity between the attribute values of other binary relations of the ninth candidate entity node and the attribute values of other binary relations of the first entity node reaches a second similarity threshold;
[0139] In the case that there is a tenth candidate entity node among the k candidate entity nodes, determining that the score of the tenth candidate entity node is the tenth score, and the similarity between the attribute values of other binary relations of the tenth candidate entity node and the attribute values of other binary relations of the first entity node does not reach the second similarity threshold;
[0140] Among them, the ninth score is greater than the tenth score, and the other binary relations are any binary relations except the target binary relation and the symmetric binary relation, and the symmetric binary relation and the target binary relation indicate the same fact.
[0141] Exemplarily, the target binary relationship is "Zhang San-Wife-Li Si", the other binary relationships of the first entity node are "Zhang San-Residence-Province A City B", and the other binary relationships of the candidate entity node are "Li Si-Residence-Province A City and Other Cities", Province A City and Other Cities are aliases of Province A City B (actually indicating the same city), and the similarity between "Province A City B" and "Province A City and Other Cities" reaches the second similarity threshold, then it is determined that the score of the candidate entity node is higher than the candidate entity node that does not reach the second similarity threshold.
[0142] Third, when there is an eleventh candidate entity node among the k candidate entity nodes, determining the score of the eleventh candidate entity node to be the eleventh score, and the similarity between the semantics of the relevant introduction of the eleventh candidate entity node and the semantics of the relevant introduction of the first entity node reaches a third similarity threshold;
[0143] In the case that there is a twelfth candidate entity node among the k candidate entity nodes, determining the score of the twelfth candidate entity node to be a twelfth score, and the similarity between the semantics of the relevant introduction of the twelfth candidate entity node and the semantics of the relevant introduction of the first entity node does not reach a third similarity threshold;
[0144] Among them, the eleventh score is higher than the twelfth score.
[0145] Exemplarily, the target binary relationship is "Zhang San-wife-Li Si", the relevant introduction of the first entity node "Zhang San" is "Zhang San (Zhang Shan), born on September 27, 1961 in City B, Province A, living in City B, Province A, and has published patent works", and the relevant introduction of the candidate entity node "Li Si" is "Li Si, born on April 6, 1966 in City B, Province A, and has participated in primary school science education on patents". After semantic matching of the relevant introductions, the semantic similarity is determined, and based on the semantic similarity of the relevant introductions reaching the third similarity threshold, it is determined that the candidate entity node is the correct second entity node.
[0146] Fourth, when there is a thirteenth candidate entity node among the k candidate entity nodes, determine that the score of the thirteenth candidate entity node is the thirteenth score, and the prior probability of the thirteenth candidate entity node reaches the prior threshold;
[0147] In the case that there is a fourteenth candidate entity node among the k candidate entity nodes, determining that the score of the fourteenth candidate entity node is the fourteenth score, and the prior probability of the fourteenth candidate entity node does not reach the prior threshold;
[0148] The thirteenth score is higher than the fourteenth score, and the prior probability is a pre-estimated probability that the candidate entity node is the second entity node. Optionally, the prior probability may be determined based on the number of searches for the candidate entity node and the number of clicks on the candidate entity node.
[0149] Indicatively, the first entity node is "a certain variety show", the target binary relationship is "a certain variety show-guest-Zheng Ba", and the candidate entity nodes are "Zheng Ba" (university professor), "Zheng Ba" (senior translator), and "Zheng Ba" (entertainment figure). It can be determined that "Zheng Ba" (entertainment figure) has been searched the most times, and it is determined that "Zheng Ba" (entertainment figure) is the second entity node.
[0150] Fifth, when there is a fifteenth candidate entity node among the k candidate entity nodes, determine that the score of the fifteenth candidate entity node is a fifteenth score, and the degree of association between the category of the fifteenth candidate entity node and the category of the third entity node reaches a second association threshold;
[0151] In the case that there is a sixteenth candidate entity node among the k candidate entity nodes, determining that the score of the sixteenth candidate entity node is a sixteenth score, and the degree of association between the category of the sixteenth candidate entity node and the category of the third entity node does not reach a second association threshold;
[0152] The fifteenth score is greater than the sixteenth score, and the third entity node is an entity node that has completed edge building with the first entity node.
[0153] For example, for the target binary relationship "Zhang San-wife-Li Si", the first entity node "Zhang San" and the third entity node "Xiao Ming" have completed the edge building and there is a binary relationship "Zhang San-friend-Xiao Ming". The category of the third entity node "Xiao Ming" is entertainment figure, then it is determined that the degree of association between the category "entertainment figure" of the candidate entity node "Li Si" and the category "entertainment figure" of "Xiao Ming" reaches the second association threshold, and it is determined that the score of the candidate entity node whose association reaches the second association threshold is greater than the candidate entity node whose association does not reach the second association threshold.
[0154] 3', sort the k candidate entity nodes from large to small according to their scores;
[0155] Based on the above step 2', the k candidate nodes have been scored. The server normalizes and weights the different scores determined by the sub-scoring steps of the second scoring method, and sorts the k candidate entity nodes in descending order according to the calculated scores.
[0156] Optionally, the sorting method may be directly sorting by numerical value, which is essentially a binary classification method. Optionally, the sorting method may also be a pairwise (a sorting algorithm) algorithm, which is essentially a multi-stage algorithm. It has been found in practice that the above two sorting methods have little effect on the final selection of the second entity node.
[0157] 4', based on the statistical data of k scores of the k candidate entity nodes reaching the statistical threshold, determine the candidate entity node with the largest score as the second entity node, the statistical data includes any one of variance, extreme value and standard deviation.
[0158] In one embodiment, the candidate entity node with the highest score is selected from the k candidate entity nodes after the above sorting. When the statistical data of the k scores of the k candidate entity nodes reaches the statistical threshold, the candidate entity node with the highest score is determined as the second entity node.
[0159] It is worth noting that the reason why the statistical data is designed to reach the statistical threshold is to avoid simply outputting the candidate entity node with the highest score when there is no candidate entity node that is the true second entity node. If there is a candidate entity node that is the true second entity node, the distance between its score and the scores of other candidate entity nodes will be larger, that is, the variance (or standard deviation) of the k scores will be larger, that is, the extreme value (difference between the maximum and minimum values) of the k scores will be larger.
[0160] Step 4' is based on the statistical data of k scores of the k candidate entity nodes reaching the statistical threshold, determining the candidate entity node with the largest score as the second entity node, which can be referred to as NIL decision.
[0161] Another point worth mentioning is that the NIL decision overcomes the problem of low accuracy in determining the second entity node based on the medium and long tail of the first entity node. The medium and long tail can be understood as an entity node with less information than the head entity node. For example, the information content of "Li Si" (entertainment figure) is more than that of "Li Si" (businessman) and "Li Si" (bank clerk), so "Li Si" (entertainment figure) is called the head, and "Li Si" (businessman) and "Li Si" (bank clerk) are called the medium and long tail.
[0162] In the NIL decision, based on the target binary relationship "Zhang San-Wife-Li Si", the variance between the score of "Li Si" (businessman) and the score of "Li Si" (bank clerk) will be very small, and both can be determined as incorrect second entity nodes based on the NIL decision.
[0163] Experiments show that after adopting the NIL decision, the accuracy of the second entity node determined by the second strategy is close to 98%, and when the NIL decision is not adopted, the accuracy of the second entity node determined by the second strategy is close to 35%.
[0164] In summary, the scoring method of the second strategy can be briefly summarized as calculating the similarity between the attribute value of the symmetric binary relationship of the candidate entity node and the name of the first entity node, calculating the similarity between the attribute values of other binary relationships between the candidate entity node and the first entity node, calculating the similarity between the relevant introductions of the candidate entity node and the first entity node, determining the second entity node according to the prior probability, and calculating the similarity between the categories of the candidate entity node and the third entity node.
[0165] Determining the second entity node through the second strategy is essentially to determine a more accurate second entity node by consuming more computing resources, and to determine the second entity node based on more information and more complex information utilization methods. Determining the second entity node through the second strategy greatly improves the accuracy of the determined second entity node, but the computing resources consumed by the second strategy are still less than the computing resources consumed by the fourth entity edge building method in the related technology.
[0166] Figure 5 A flowchart of an entity edge building method of a knowledge graph provided by an exemplary embodiment of the present application is shown, and the method includes:
[0167] Step 501, dividing all binary relations of the first entity according to the attributes in the binary relations;
[0168] The server obtains all SPO triples, that is, all binary relations, after structural alignment, data cleaning, entity fusion, and attribute fusion. Afterwards, the server splits all binary relations of the first entity according to the attributes in the binary relations to obtain three preset attribute sets. The first preset attribute set corresponds to the use of a priori dictionary, the second preset attribute set corresponds to the use of the first strategy, and the third preset attribute set corresponds to the use of the second strategy. The priori dictionary corresponds to the following step 502, the first strategy corresponds to the following steps 503-1 to 503-3, and the second strategy corresponds to the following steps 504-1 to 504-4.
[0169] Step 502, determining a second entity node corresponding to a second entity of a target binary relationship through a priori dictionary;
[0170] The server determines the candidate entity node with the same name as the second entity as the second entity node through the prior dictionary; wherein the prior dictionary is composed of a target attribute, n attribute values, and a mapping relationship between the target attribute and the n attribute values.
[0171] In an optional embodiment, the process of constructing the prior dictionary includes:
[0172] First, the server obtains all binary relations of the first entity, and then determines the number of attribute values under different attributes in all binary relations. The server determines that the attributes whose number of attribute values is lower than a preset threshold belong to the first preset attribute set, that is, the server uses the prior dictionary to determine the second entity node corresponding to the second entity under the attribute.
[0173] Step 503-1, based on the second entity name in the target binary relationship, obtain k candidate entity nodes;
[0174] The server obtains k candidate entity nodes whose names are identical or similar to those of the second entity.
[0175] Step 503-2, determining the scores of the k candidate entity nodes by a first scoring method;
[0176] The server determines the scores of the k candidate entity nodes by using the first scoring method. For details of step 503 - 2 , please refer to the part related to the first scoring method in the related content of the first strategy mentioned above.
[0177] Step 503-3, determining the candidate entity node whose score reaches the first score threshold in the knowledge graph as the second entity node;
[0178] Based on the above-mentioned completion of scoring the k candidate entity nodes through the first scoring method, the server normalizes and weights the different scores determined by the sub-scoring steps of the first scoring method, and determines the candidate entity node whose final score reaches the first score threshold as the second entity node.
[0179] Step 504-1, based on the second entity name in the target binary relationship, obtain k candidate entity nodes;
[0180] Similar to step 503 - 1 , details will not be repeated here.
[0181] Step 504-2, determining the scores of the k candidate entity nodes by a second scoring method;
[0182] The server determines the scores of the k candidate entity nodes by the second scoring method. For details of step 504-2, please refer to the part related to the second scoring method in the related content of the second strategy mentioned above.
[0183] Step 504-3, sort the k candidate entity nodes from large to small according to their scores;
[0184] Based on the above step 504-2, the k candidate nodes have been scored. The server normalizes and weights the different scores determined by the sub-scoring steps of the second scoring method, and sorts the k candidate entity nodes in descending order according to the calculated scores.
[0185] Step 504 - 4 : based on the statistical data of k scores of the k candidate entity nodes reaching a statistical threshold, determine the candidate entity node with the largest score as the second entity node.
[0186] In one embodiment, the candidate entity node with the highest score is selected from the k candidate entity nodes after the above sorting. When the statistical data of the k scores of the k candidate entity nodes reaches the statistical threshold, the candidate entity node with the highest score is determined as the second entity node.
[0187] Step 505, output the result.
[0188] The server outputs the second entity node determined in the knowledge graph.
[0189] It is worth noting that the method combinations of the above-mentioned a priori dictionary, first strategy, and second strategy may be "a priori dictionary", "first strategy", "second strategy", "a priori dictionary + first strategy", "first strategy + second strategy", "a priori dictionary + first strategy + second strategy", and this application does not limit this.
[0190] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data comply with the relevant laws, regulations and standards of relevant countries and regions. For example, the information on constellations and zodiac signs involved in this application are all obtained with full authorization.
[0191] Figure 6 This is a structural block diagram of an entity edge building device for a knowledge graph provided by an exemplary embodiment of the present application, and the device includes:
[0192] An acquisition module 61 is used to acquire a target binary relationship of a first entity, where the target binary relationship includes a first entity, a target attribute, and a second entity, where the second entity is an attribute value of the first entity in the target attribute;
[0193] A determination module 62, configured to determine, based on the target attribute, a second entity node corresponding to the second entity in the knowledge graph;
[0194] The edge building module 63 is used to build an edge between a first entity node corresponding to the first entity and a second entity node in the knowledge graph.
[0195] In an optional embodiment, the determination module 62 is also used to determine a second entity node corresponding to the second entity in the knowledge graph by an entity determination method corresponding to the target attribute set when the target attribute belongs to a target attribute set in at least two attribute sets.
[0196] Among them, the entity determination methods corresponding to at least two attribute sets are different.
[0197] In an optional embodiment, the determination module 62 is further used to determine a second entity node corresponding to the second entity in the knowledge graph through a priori dictionary based on the target attribute belonging to the first preset attribute set.
[0198] In an optional embodiment, the determination module 62 is further used to determine a second entity node corresponding to the second entity in the knowledge graph through the first strategy based on the target attribute belonging to a second preset attribute set.
[0199] In an optional embodiment, the determination module 62 is further used to determine a second entity node corresponding to the second entity in the knowledge graph through a second strategy based on the target attribute belonging to a third preset attribute set.
[0200] In an optional embodiment, the computing resource consumption corresponding to the priori dictionary is less than the computing resource consumption corresponding to the first strategy, and the computing resource consumption corresponding to the first strategy is less than the computing resource consumption corresponding to the second strategy.
[0201] In an optional embodiment, the determination module 62 is further configured to determine, through a priori dictionary, a candidate entity node having the same name as the second entity as the second entity node; wherein the priori dictionary includes a mapping relationship between a target attribute and n attribute values, where n is a positive integer.
[0202] In an optional embodiment, the determination module 62 is further used to obtain k candidate entity nodes corresponding to the name of the second entity in the knowledge graph, where k is a positive integer.
[0203] In an optional embodiment, the determination module 62 is further configured to determine the scores of the k candidate entity nodes by using a first scoring method.
[0204] In an optional embodiment, the determination module 62 is further configured to determine, in the knowledge graph, a candidate entity node whose score reaches a first score threshold as a second entity node.
[0205] In an optional embodiment, the determination module 62 is further configured to, when there is a first candidate entity node among the k candidate entity nodes, determine that the score of the first candidate entity node is a first score, and the name of the first candidate entity node is the same as that of the second entity.
[0206] In an optional embodiment, the determination module 62 is further configured to, when there is a second candidate entity node among the k candidate entity nodes, determine that the score of the second candidate entity node is a second score, and the second candidate entity node has a different name from the second entity.
[0207] In an optional embodiment, the first score is greater than the second score.
[0208] In an optional embodiment, the determination module 62 is further used to determine that the score of the third candidate entity node is a third score when there is a third candidate entity node among the k candidate entity nodes, and the attribute value of the binary relationship of the third candidate entity node matches the attribute value of the binary relationship of the first entity node.
[0209] In an optional embodiment, the determination module 62 is further used to determine that the score of the fourth candidate entity node is a fourth score when there is a fourth candidate entity node among the k candidate entity nodes, and the attribute value of the binary relationship of the fourth candidate entity node does not match the attribute value of the binary relationship of the first entity node.
[0210] In an optional embodiment, the third score is greater than the fourth score, and the attribute value match indicates that the attribute value of the symmetric binary relationship of the candidate entity node is the same as the name of the first entity node, or the attribute values of other binary relationships of the candidate entity node are the same as the attribute values of other binary relationships of the first entity node; the symmetric binary relationship and the target binary relationship indicate the same fact, and the other binary relationship is any binary relationship other than the target binary relationship and the symmetric binary relationship.
[0211] In an optional embodiment, the determination module 62 is further configured to, when there is a fifth candidate entity node among the k candidate entity nodes, determine that the score of the fifth candidate entity node is a fifth score, and the degree of association between the category of the fifth candidate entity node and the category of the first entity node reaches a first association threshold.
[0212] In an optional embodiment, the determination module 62 is further configured to, when there is a sixth candidate entity node among the k candidate entity nodes, determine that the score of the sixth candidate entity node is a sixth score, and the degree of association between the category of the sixth candidate entity node and the category of the first entity node does not reach a first association threshold.
[0213] In an optional embodiment, the fifth score is greater than the sixth score.
[0214] In an optional embodiment, the determination module 62 is further used to obtain k candidate entity nodes corresponding to the name of the second entity in the knowledge graph, where k is a positive integer.
[0215] In an optional embodiment, the determination module 62 is further configured to determine the scores of the k candidate entity nodes by a second scoring method.
[0216] In an optional embodiment, the determination module 62 is further configured to sort the k candidate entity nodes from large to small according to the score values.
[0217] In an optional embodiment, the determination module 62 is further used to determine that the candidate entity node with the largest score is the second entity node based on the statistical data of k scores of the k candidate entity nodes reaching a statistical threshold, and the statistical data includes at least one of variance, extreme value and standard deviation.
[0218] In an optional embodiment, the determination module 62 is also used to determine that the score of the seventh candidate entity node is a seventh score when there is a seventh candidate entity node among the k candidate entity nodes, and the similarity between the attribute value of the symmetric binary relationship of the seventh candidate entity node and the name of the first entity node reaches a first similarity threshold.
[0219] In an optional embodiment, the determination module 62 is further used to determine that the score of the eighth candidate entity node is an eighth score when there is an eighth candidate entity node among the k candidate entity nodes, and the similarity between the attribute value of the symmetric binary relationship of the eighth candidate entity node and the name of the first entity node does not reach the first similarity threshold.
[0220] In an optional embodiment, the seventh score is greater than the eighth score, and the symmetric binary relationship and the target binary relationship indicate the same fact.
[0221] In an optional embodiment, the determination module 62 is also used to determine that the score of the ninth candidate entity node is a ninth score when there is a ninth candidate entity node among the k candidate entity nodes, and the similarity between the attribute values of other binary relations of the ninth candidate entity node and the attribute values of other binary relations of the first entity node reaches a second similarity threshold.
[0222] In an optional embodiment, the determination module 62 is also used to determine that the score of the tenth candidate entity node is the tenth score when there is a tenth candidate entity node among the k candidate entity nodes, and the similarity between the attribute values of other binary relations of the tenth candidate entity node and the attribute values of other binary relations of the first entity node does not reach a second similarity threshold.
[0223] In an optional embodiment, the ninth score is greater than the tenth score, and the other binary relations are any binary relations except the target binary relation and the symmetric binary relation, and the symmetric binary relation and the target binary relation indicate the same fact.
[0224] In an optional embodiment, the determination module 62 is further used to determine that, when there is an eleventh candidate entity node among the k candidate entity nodes, the score of the eleventh candidate entity node is the eleventh score, and the similarity between the semantics of the relevant introduction of the eleventh candidate entity node and the semantics of the relevant introduction of the first entity node reaches a third similarity threshold.
[0225] In an optional embodiment, the determination module 62 is further used to determine that the score of the twelfth candidate entity node is the twelfth score when there is a twelfth candidate entity node among the k candidate entity nodes, and the similarity between the semantics of the relevant introduction of the twelfth candidate entity node and the semantics of the relevant introduction of the first entity node does not reach a third similarity threshold.
[0226] In an optional embodiment, the eleventh score is higher than the twelfth score.
[0227] In an optional embodiment, the determination module 62 is further configured to, when there is a thirteenth candidate entity node among the k candidate entity nodes, determine that the score of the thirteenth candidate entity node is the thirteenth score and the prior probability of the thirteenth candidate entity node reaches a prior threshold.
[0228] In an optional embodiment, the determination module 62 is further configured to, when there is a fourteenth candidate entity node among the k candidate entity nodes, determine that the score of the fourteenth candidate entity node is the fourteenth score, and the prior probability of the fourteenth candidate entity node does not reach the prior threshold.
[0229] In an optional embodiment, the thirteenth score is higher than the fourteenth score, and the prior probability is a pre-estimated probability that the candidate entity node is the second entity node.
[0230] In an optional embodiment, the determination module 62 is further configured to, when there is a fifteenth candidate entity node among the k candidate entity nodes, determine that the score of the fifteenth candidate entity node is the fifteenth score, and the degree of association between the category of the fifteenth candidate entity node and the category of the third entity node reaches a second association threshold.
[0231] In an optional embodiment, the determination module 62 is further configured to, when there is a sixteenth candidate entity node among the k candidate entity nodes, determine that the score of the sixteenth candidate entity node is the sixteenth score, and the degree of association between the category of the sixteenth candidate entity node and the category of the third entity node does not reach a second association threshold.
[0232] In an optional embodiment, the fifteenth score is greater than the sixteenth score, and the third entity node is an entity node that has completed edge building with the first entity node.
[0233] In summary, the above-mentioned device determines the second entity node corresponding to the second entity based on the target attribute, thereby overcoming the problem of being unable to capture jump links when the data of the knowledge graph comes from different external data sources, thereby improving the connectivity rate of the knowledge graph.
[0234] Figure 7 1 is a schematic diagram of a computer device according to an exemplary embodiment. The computer device 700 includes a central processing unit (CPU) 701, a system memory 704 including a random access memory (RAM) 702 and a read-only memory (ROM) 703, and a system bus 705 connecting the system memory 704 and the central processing unit 701. The computer device 700 also includes a basic input / output system (I / O system) 706 for helping to transmit information between various devices in the computer device, and a large-capacity storage device 707 for storing an operating system 713, an application program 714 and other program modules 715.
[0235] The basic input / output system 706 includes a display 708 for displaying information and an input device 709 such as a mouse and a keyboard for user inputting information. The display 708 and the input device 709 are connected to the central processing unit 701 through an input / output controller 710 connected to the system bus 705. The basic input / output system 706 may also include an input / output controller 710 for receiving and processing inputs from a plurality of other devices such as a keyboard, a mouse, or an electronic stylus. Similarly, the input / output controller 710 also provides output to a display screen, a printer, or other types of output devices.
[0236] The mass storage device 707 is connected to the central processing unit 701 via a mass storage controller (not shown) connected to the system bus 705. The mass storage device 707 and its associated computer device readable medium provide non-volatile storage for the computer device 700. That is, the mass storage device 707 may include a computer device readable medium (not shown) such as a hard disk or a compact disc read-only memory (CD-ROM) drive.
[0237] Without loss of generality, the computer device readable medium may include computer device storage media and communication media. Computer device storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer device readable instructions, data structures, program modules or other data. Computer device storage media include RAM, ROM, Erasable Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), CD-ROM, Digital Video Disc (DVD) or other optical storage, cassette, tape, disk storage or other magnetic storage devices. Of course, those skilled in the art will know that the computer device storage medium is not limited to the above. The above-mentioned system memory 704 and mass storage device 707 can be collectively referred to as memory.
[0238] According to various embodiments of the present disclosure, the computer device 700 can also be connected to a remote computer device on a network through a network such as the Internet. That is, the computer device 700 can be connected to the network 711 through the network interface unit 712 connected to the system bus 705, or the network interface unit 712 can be used to connect to other types of networks or remote computer device systems (not shown).
[0239] The memory also includes one or more programs, which are stored in the memory. The central processing unit 701 implements all or part of the steps of the entity edge building method of the above-mentioned knowledge graph by executing the one or more programs.
[0240] The present application also provides a computer-readable storage medium, which stores at least one instruction, at least one program, a code set or an instruction set. The at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement the entity edge building method of the knowledge graph provided by the above method embodiment.
[0241] The present application provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the entity edge building method of the knowledge graph provided by the above method embodiment.
[0242] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0243] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0244] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for building entity edges in a knowledge graph, characterized in that: The method comprises: Acquire a target binary relationship of a first entity, wherein the target binary relationship includes a first entity, a target attribute, and a second entity, wherein the second entity is an attribute value of the first entity in the target attribute; Perform at least one of the following steps: 1, 2, or 3: Step 1: Based on the target attribute belonging to a first preset attribute set, determine a second entity node corresponding to the second entity in the knowledge graph through a priori dictionary; Step 2: Based on the target attribute belonging to a second preset attribute set, determine a second entity node corresponding to the second entity in the knowledge graph by using a first strategy; Step 3: Based on the target attribute belonging to a third preset attribute set, determine a second entity node corresponding to the second entity in the knowledge graph by using a second strategy; The computing resource consumption corresponding to the priori dictionary is less than the computing resource consumption corresponding to the first strategy, and the computing resource consumption corresponding to the first strategy is less than the computing resource consumption corresponding to the second strategy; In the knowledge graph, an edge is established between a first entity node corresponding to the first entity and the second entity node; The determining, in the knowledge graph, a second entity node corresponding to the second entity by using a second strategy includes: In the knowledge graph, obtain k candidate entity nodes corresponding to the name of the second entity, where k is a positive integer; In the case that there is an eleventh candidate entity node among the k candidate entity nodes, determining that the score of the eleventh candidate entity node is the eleventh score, and the similarity between the semantics of the relevant introduction of the eleventh candidate entity node and the semantics of the relevant introduction of the first entity node reaches a preset similarity threshold; In the case that there is a twelfth candidate entity node among the k candidate entity nodes, determining that the score of the twelfth candidate entity node is a twelfth score, and the similarity between the semantics of the relevant introduction of the twelfth candidate entity node and the semantics of the relevant introduction of the first entity node does not reach a preset similarity threshold; wherein the eleventh score is higher than the twelfth score; Sort the scores of the k candidate entity nodes from large to small according to the score values; Based on the statistical data of k scores of the k candidate entity nodes reaching a statistical threshold, the candidate entity node with the largest score is determined to be the second entity node, and the statistical data includes at least one of variance, extreme value and standard deviation.
2. The method according to claim 1, characterized in that The determining, in the knowledge graph, a second entity node corresponding to the second entity by using a priori dictionary includes: Determine, by the prior dictionary, a candidate entity node having the same name as the second entity as the second entity node; The a priori dictionary includes the mapping relationship between the target attribute and n attribute values, where n is a positive integer.
3. The method according to claim 1, characterized in that The determining, in the knowledge graph, a second entity node corresponding to the second entity by using a first strategy includes: In the knowledge graph, obtain k candidate entity nodes corresponding to the name of the second entity, where k is a positive integer; Determine the scores of the k candidate entity nodes by a first scoring method; In the knowledge graph, the candidate entity node whose score reaches a first score threshold is determined as the second entity node.
4. The method according to claim 3, characterized in that The determining the scores of the k candidate entity nodes by the first scoring method includes: In a case where there is a first candidate entity node among the k candidate entity nodes, determining a score of the first candidate entity node to be a first score, and the first candidate entity node has the same name as the second entity; In a case where there is a second candidate entity node among the k candidate entity nodes, determining a score of the second candidate entity node as a second score, wherein the second candidate entity node has a different name from the second entity; Wherein, the first score is greater than the second score.
5. The method according to claim 3, characterized in that: The determining the scores of the k candidate entity nodes by the first scoring method includes: In the case that there is a third candidate entity node among the k candidate entity nodes, determining that the score of the third candidate entity node is a third score, and the attribute value of the binary relationship of the third candidate entity node matches the attribute value of the binary relationship of the first entity node; In the case that there is a fourth candidate entity node among the k candidate entity nodes, determining that the score of the fourth candidate entity node is a fourth score, and the attribute value of the binary relationship of the fourth candidate entity node does not match the attribute value of the binary relationship of the first entity node; Among them, the third score is greater than the fourth score, the attribute value match indicates that the attribute value of the symmetric binary relationship of the candidate entity node is the same as the name of the first entity node, or the attribute value of other binary relationships of the candidate entity node is the same as the attribute value of other binary relationships of the first entity node; the symmetric binary relationship and the target binary relationship indicate the same fact, and the other binary relationship is any binary relationship other than the target binary relationship and the symmetric binary relationship.
6. The method according to claim 3, characterized in that The determining the scores of the k candidate entity nodes by the first scoring method includes: In the case that there is a fifth candidate entity node among the k candidate entity nodes, determining that the score of the fifth candidate entity node is a fifth score, and the degree of association between the category of the fifth candidate entity node and the category of the first entity node reaches a first association threshold; In the case that there is a sixth candidate entity node among the k candidate entity nodes, determining that the score of the sixth candidate entity node is a sixth score, and the degree of association between the category of the sixth candidate entity node and the category of the first entity node does not reach a first association threshold; Wherein, the fifth score is greater than the sixth score.
7. The method according to claim 1, characterized in that The method further comprises: In the case that there is a seventh candidate entity node among the k candidate entity nodes, determining that the score of the seventh candidate entity node is a seventh score, and the similarity between the attribute value of the symmetric binary relationship of the seventh candidate entity node and the name of the first entity node reaches a first similarity threshold; In the case that there is an eighth candidate entity node among the k candidate entity nodes, determining that the score of the eighth candidate entity node is an eighth score, and the similarity between the attribute value of the symmetric binary relationship of the eighth candidate entity node and the name of the first entity node does not reach a first similarity threshold; Among them, the seventh score is greater than the eighth score, and the symmetric binary relationship and the target binary relationship indicate the same fact.
8. The method according to claim 1, characterized in that The method further comprises: In the case that there is a ninth candidate entity node among the k candidate entity nodes, determining that the score of the ninth candidate entity node is a ninth score, and the similarity between the attribute values of other binary relations of the ninth candidate entity node and the attribute values of the other binary relations of the first entity node reaches a second similarity threshold; In the case that there is a tenth candidate entity node among the k candidate entity nodes, determining that the score of the tenth candidate entity node is the tenth score, and the similarity between the attribute values of other binary relations of the tenth candidate entity node and the attribute values of the other binary relations of the first entity node does not reach a second similarity threshold; The ninth score is greater than the tenth score, and the other binary relationship is any binary relationship other than the target binary relationship and the symmetric binary relationship, and the symmetric binary relationship and the target binary relationship indicate the same fact.
9. The method according to claim 1, characterized in that: The method further comprises: In the case that there is a thirteenth candidate entity node among the k candidate entity nodes, determining that the score of the thirteenth candidate entity node is a thirteenth score, and the prior probability of the thirteenth candidate entity node reaches a prior threshold; In the case that there is a fourteenth candidate entity node among the k candidate entity nodes, determining that the score of the fourteenth candidate entity node is a fourteenth score, and the prior probability of the fourteenth candidate entity node does not reach the prior threshold; The thirteenth score is higher than the fourteenth score, and the prior probability is a pre-estimated probability that the candidate entity node is determined to be the second entity node.
10. The method according to claim 1, characterized in that The method further comprises: In the case that there is a fifteenth candidate entity node among the k candidate entity nodes, determining that the score of the fifteenth candidate entity node is a fifteenth score, and the degree of association between the category of the fifteenth candidate entity node and the category of the third entity node reaches a second association threshold; In the case that there is a sixteenth candidate entity node among the k candidate entity nodes, determining that the score of the sixteenth candidate entity node is a sixteenth score, and the degree of association between the category of the sixteenth candidate entity node and the category of the third entity node does not reach a second association threshold; The fifteenth score is greater than the sixteenth score, and the third entity node is an entity node that has completed edge building with the first entity node.
11. A knowledge graph entity edge building device, characterized in that: The device comprises: An acquisition module, configured to acquire a target binary relationship of a first entity, wherein the target binary relationship includes a first entity, a target attribute, and a second entity, wherein the second entity is an attribute value of the first entity in the target attribute; The determination module is used to perform at least one of the following steps 1, 2, and 3: Step 1: Based on the target attribute belonging to a first preset attribute set, determine a second entity node corresponding to the second entity in the knowledge graph through a priori dictionary; Step 2: Based on the target attribute belonging to a second preset attribute set, determine a second entity node corresponding to the second entity in the knowledge graph by using a first strategy; Step 3: Based on the target attribute belonging to a third preset attribute set, determine a second entity node corresponding to the second entity in the knowledge graph by using a second strategy; The computing resource consumption corresponding to the priori dictionary is less than the computing resource consumption corresponding to the first strategy, and the computing resource consumption corresponding to the first strategy is less than the computing resource consumption corresponding to the second strategy; An edge building module, used to build an edge between a first entity node corresponding to the first entity and the second entity node in the knowledge graph; The determination module is specifically used for: In the knowledge graph, obtain k candidate entity nodes corresponding to the name of the second entity, where k is a positive integer; In the case that there is an eleventh candidate entity node among the k candidate entity nodes, determining that the score of the eleventh candidate entity node is the eleventh score, and the similarity between the semantics of the relevant introduction of the eleventh candidate entity node and the semantics of the relevant introduction of the first entity node reaches a preset similarity threshold; In the case that there is a twelfth candidate entity node among the k candidate entity nodes, determining that the score of the twelfth candidate entity node is a twelfth score, and the similarity between the semantics of the relevant introduction of the twelfth candidate entity node and the semantics of the relevant introduction of the first entity node does not reach a preset similarity threshold; wherein the eleventh score is higher than the twelfth score; Sort the scores of the k candidate entity nodes from large to small according to the score values; Based on the statistical data of k scores of the k candidate entity nodes reaching a statistical threshold, the candidate entity node with the largest score is determined to be the second entity node, and the statistical data includes at least one of variance, extreme value and standard deviation.
12. The device according to claim 11, characterized in that The determining module is further used for: Determine, by the prior dictionary, a candidate entity node having the same name as the second entity as the second entity node; The a priori dictionary includes the mapping relationship between the target attribute and n attribute values, where n is a positive integer.
13. The device according to claim 11, characterized in that The determining module is further used for: In the knowledge graph, obtain k candidate entity nodes corresponding to the name of the second entity, where k is a positive integer; Determine the scores of the k candidate entity nodes by a first scoring method; In the knowledge graph, the candidate entity node whose score reaches a first score threshold is determined as the second entity node.
14. The device according to claim 13, characterized in that The determining module is further used for: In a case where there is a first candidate entity node among the k candidate entity nodes, determining a score of the first candidate entity node to be a first score, and the first candidate entity node has the same name as the second entity; In a case where there is a second candidate entity node among the k candidate entity nodes, determining a score of the second candidate entity node as a second score, wherein the second candidate entity node has a different name from the second entity; Wherein, the first score is greater than the second score.
15. The device according to claim 13, characterized in that The determining module is further used for: In the case that there is a third candidate entity node among the k candidate entity nodes, determining that the score of the third candidate entity node is a third score, and the attribute value of the binary relationship of the third candidate entity node matches the attribute value of the binary relationship of the first entity node; In the case that there is a fourth candidate entity node among the k candidate entity nodes, determining that the score of the fourth candidate entity node is a fourth score, and the attribute value of the binary relationship of the fourth candidate entity node does not match the attribute value of the binary relationship of the first entity node; Among them, the third score is greater than the fourth score, the attribute value match indicates that the attribute value of the symmetric binary relationship of the candidate entity node is the same as the name of the first entity node, or the attribute value of other binary relationships of the candidate entity node is the same as the attribute value of other binary relationships of the first entity node; the symmetric binary relationship and the target binary relationship indicate the same fact, and the other binary relationship is any binary relationship other than the target binary relationship and the symmetric binary relationship.
16. The device according to claim 13, characterized in that The determining module is further used for: In the case that there is a fifth candidate entity node among the k candidate entity nodes, determining that the score of the fifth candidate entity node is a fifth score, and the degree of association between the category of the fifth candidate entity node and the category of the first entity node reaches a first association threshold; In the case that there is a sixth candidate entity node among the k candidate entity nodes, determining that the score of the sixth candidate entity node is a sixth score, and the degree of association between the category of the sixth candidate entity node and the category of the first entity node does not reach a first association threshold; Wherein, the fifth score is greater than the sixth score.
17. The device according to claim 11, characterized in that The determining module is further used for: In the case that there is a seventh candidate entity node among the k candidate entity nodes, determining that the score of the seventh candidate entity node is a seventh score, and the similarity between the attribute value of the symmetric binary relationship of the seventh candidate entity node and the name of the first entity node reaches a first similarity threshold; In the case that there is an eighth candidate entity node among the k candidate entity nodes, determining that the score of the eighth candidate entity node is an eighth score, and the similarity between the attribute value of the symmetric binary relationship of the eighth candidate entity node and the name of the first entity node does not reach a first similarity threshold; Among them, the seventh score is greater than the eighth score, and the symmetric binary relationship and the target binary relationship indicate the same fact.
18. The device according to claim 11, characterized in that The determining module is further used for: In the case that there is a ninth candidate entity node among the k candidate entity nodes, determining that the score of the ninth candidate entity node is a ninth score, and the similarity between the attribute values of other binary relations of the ninth candidate entity node and the attribute values of the other binary relations of the first entity node reaches a second similarity threshold; In the case that there is a tenth candidate entity node among the k candidate entity nodes, determining that the score of the tenth candidate entity node is the tenth score, and the similarity between the attribute values of other binary relations of the tenth candidate entity node and the attribute values of the other binary relations of the first entity node does not reach a second similarity threshold; The ninth score is greater than the tenth score, and the other binary relationship is any binary relationship other than the target binary relationship and the symmetric binary relationship, and the symmetric binary relationship and the target binary relationship indicate the same fact.
19. The device according to claim 11, characterized in that The determining module is further used for: In the case that there is a thirteenth candidate entity node among the k candidate entity nodes, determining that the score of the thirteenth candidate entity node is a thirteenth score, and the prior probability of the thirteenth candidate entity node reaches a prior threshold; In the case that there is a fourteenth candidate entity node among the k candidate entity nodes, determining that the score of the fourteenth candidate entity node is a fourteenth score, and the prior probability of the fourteenth candidate entity node does not reach the prior threshold; The thirteenth score is higher than the fourteenth score, and the prior probability is a pre-estimated probability that the candidate entity node is determined to be the second entity node.
20. The device according to claim 11, characterized in that The determining module is further used for: In the case that there is a fifteenth candidate entity node among the k candidate entity nodes, determining that the score of the fifteenth candidate entity node is a fifteenth score, and the degree of association between the category of the fifteenth candidate entity node and the category of the third entity node reaches a second association threshold; In the case that there is a sixteenth candidate entity node among the k candidate entity nodes, determining that the score of the sixteenth candidate entity node is a sixteenth score, and the degree of association between the category of the sixteenth candidate entity node and the category of the third entity node does not reach a second association threshold; The fifteenth score is greater than the sixteenth score, and the third entity node is an entity node that has completed edge building with the first entity node.
21. A computer device, characterized in that: The computer device includes: a processor and a memory, the memory stores a computer program, and the computer program is loaded and executed by the processor to implement the entity edge building method of the knowledge graph as described in any one of claims 1 to 10.
22. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which is loaded and executed by a processor to implement the entity edge building method of the knowledge graph as described in any one of claims 1 to 10.
23. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium. The computer instructions are read and executed from the computer-readable storage medium by a processor of a computer device to implement the entity edge building method of the knowledge graph as described in any one of claims 1 to 10.
Citation Information
Patent Citations
Figure entity alignment method and device based on knowledge graph
CN110457486A
Knowledge graph construction method and device, computer equipment and storage medium
CN110489561A