Method and device for establishing knowledge graph

By performing clustering and similarity analysis of entities in the corpus, the difficulty in establishing knowledge graphs caused by insufficient corpus is solved, and the automatic expansion and accuracy of knowledge graphs in specific fields is achieved, thereby reducing labor costs.

CN112463974BActive Publication Date: 2025-01-17HUAWEI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN201910849080.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-09-09
Publication Date
2025-01-17
Estimated Expiration
2039-09-09

AI Technical Summary

Technical Problem

In specific fields with fewer corpus, the construction, expansion and verification of knowledge graphs depend on expert experience, the workload is large and labor costs are high, and the existing technology is difficult to effectively solve the problem of insufficient corpus.

Method used

By clustering entities in the corpus, determine the similarity between the newly added entity and the entity in the seed map, and add the newly added entity to the seed map based on the similarity to establish a knowledge map, using the dispersion of the clustering results and Accessibility verifies the accuracy of clustering results, expands the seed map, and improves the accuracy of connection between new entities and seed maps.

Benefits of technology

In the case of insufficient corpus, the automatic expansion of the knowledge graph is achieved, which reduces dependence on labor, improves efficiency, saves labor costs, and ensures the accuracy of the knowledge graph and the accuracy of the expansion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112463974B_ABST
    Figure CN112463974B_ABST
Patent Text Reader

Abstract

The present application provides a method for establishing a knowledge graph in the field of artificial intelligence, the method comprising: obtaining a corpus; clustering entities in the corpus to obtain a target clustering result; determining the similarity between a newly added entity in the corpus and an entity in a seed graph according to the target clustering result; and adding the newly added entity to the seed graph according to the similarity. Through the above method, the seed graph can be expanded when the corpus is insufficient, avoiding dependence on manual work. Compared with the method of relying on experts to manually comb through to establish a knowledge graph, it greatly improves efficiency and saves labor costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of natural language processing, and in particular to a method and device for establishing a knowledge graph. Background Art

[0002] 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 branch of computer science that attempts to understand the essence of intelligence and produce a new type of 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.

[0003] With the continuous development of artificial intelligence technology, natural language human-computer interaction systems that enable humans and machines to interact through natural language have become increasingly important. For humans and machines to interact through natural language, the system needs to be able to recognize the specific meaning of human natural language. Usually, the system recognizes the specific meaning of a sentence by extracting key information from natural language sentences.

[0004] The knowledge graph consists of interconnected nodes and edges, providing the ability to analyze problems from the perspective of "relationships". Knowledge graphs are increasingly being used in knowledge management. Each node of a knowledge graph can be an entity. A seed graph containing a small number of entities can be expanded to achieve the establishment of a knowledge graph. The establishment of an open domain knowledge graph generally requires a large amount of corpus, which includes a large number of entities. Through machine learning, the similarity between the newly added entities in the corpus and the entities in the seed graph is determined, and then the entities in the corpus are connected with the instances in the seed graph according to the similarity to establish a knowledge graph.

[0005] For specific fields with less corpus, such as within an enterprise or a specific field, the construction, expansion and verification of knowledge graphs rely heavily on expert experience. Therefore, establishing a knowledge graph requires a lot of work and high labor costs. Summary of the invention

[0006] The present application provides a method and device for establishing a knowledge graph, which can realize the establishment of a knowledge graph in the absence of corpus.

[0007] In a first aspect, a method for establishing a knowledge graph is provided, comprising: obtaining a corpus; clustering entities in the corpus to obtain a target clustering result; determining the similarity between new entities in the corpus and entities in a seed graph based on the target clustering result; and adding the new entities to the seed graph based on the similarity to establish a knowledge graph.

[0008] By clustering the entities in the corpus, we can determine the similarity between the newly added entities in the corpus and the entities in the seed graph when the corpus is small, and expand the seed graph to establish a knowledge graph.

[0009] In combination with the first aspect, in some possible implementations, clustering the entities in the corpus to obtain a target clustering result includes: clustering the entities in the corpus according to M initial clustering numbers to obtain M initial clustering results corresponding one-to-one to the M initial clustering numbers, where M is a positive integer; and determining the target clustering result from the M initial clustering results according to the connection relationship between the entities in the seed graph.

[0010] By selecting a target clustering result from at least one initial clustering result, the accuracy of the target clustering result is improved.

[0011] In combination with the first aspect, in some possible implementations, the seed graph includes common entities that are the same as entities in the corpus, and determining the target clustering result from the M initial clustering results based on the connection relationship of the entities in the seed graph includes: determining the dispersion and accessibility of each initial clustering result based on the connection relationship of the entities in the seed graph and each of the initial clustering results, the dispersion being used to represent the degree of discreteness of the neighbor structure of each common entity in the seed graph in the initial clustering result, the neighbor structure consisting of a common entity and all adjacent common entities of the common entity in the seed graph, and the accessibility being used to represent the shortest distance of the common entity in the seed graph in each class of the initial clustering result; determining the target clustering result from the initial clustering results based on the dispersion and the accessibility.

[0012] The clustering results are verified according to the seed map to determine the clustering results that are consistent with the seed map. The seed map is designed manually, making full use of the experience of experts to determine the target clustering results that are consistent with the expert experience. In combination with the first aspect, in some possible implementations, the absolute value of the difference between the dispersion and accessibility of the target clustering result is the smallest among the M initial clustering results.

[0013] In combination with the first aspect, in some possible implementations, the seed graph includes common entities that are identical to entities in the corpus, and the seed graph includes out-of-class entities that are outside the corpus. The method includes: when the out-of-class entity is located on the shortest path between two common entities in the first class of the target clustering result in the seed graph, adding the out-of-class entity to the first class; and / or, based on the similarity between the common entities adjacent to the out-of-class entity in the seed graph and the entities in each class of the target classification result, adding the out-of-class entity to one or more classes in the target classification result whose entity similarity meets preset conditions.

[0014] By adding out-of-class entities to the clustering results, the newly added entities in the corpus may be connected to the out-of-class entities, so that the expansion of the seed graph takes more factors into consideration and the connection between the new entities and the seed graph is more accurate.

[0015] In combination with the first aspect, in some possible implementations, determining the similarity between the newly added entities in the corpus and the entities in the seed graph based on the target clustering results includes: determining the entity vector of each entity in the target clustering results, the nth bit of the entity vector indicating whether the entity belongs to the nth category in the target classification result, where n is a positive integer; determining the distance between the vector of the newly added entity and the entity in the seed graph, the distance being used to represent the similarity between the newly added entity and the entity in the seed graph.

[0016] The similarity between the newly added entities and the entities in the seed graph is determined by the distribution of each class in the clustering results.

[0017] In combination with the first aspect, in some possible implementations, the target classification result includes multiple classes, and the jth class among the multiple classes includes a newly added entity. The method includes: determining the jth target subgraph that is most similar to the jth class based on the similarity between the entity in the jth class and multiple subgraphs in the seed graph, each subgraph in the multiple subgraphs consisting of an entity in the seed graph and all adjacent entities of the entity in the seed graph; adding the newly added entity to the seed graph based on the similarity includes: adding the newly added entity in the jth class to the jth target subgraph based on the similarity.

[0018] Improve the accuracy of adding new entities by matching classes to subgraphs.

[0019] In a second aspect, a knowledge graph establishment device is provided, comprising: an acquisition module for acquiring a corpus; a clustering module for clustering entities in the corpus to obtain a target clustering result; a determination module for determining the similarity between a newly added entity in the corpus and an entity in a seed graph based on the target clustering result; and an adding module for adding the newly added entity to the seed graph based on the similarity to establish a knowledge graph.

[0020] In combination with the second aspect, in some possible implementations, the clustering module is used to cluster the entities in the corpus according to the M initial clustering numbers to obtain M initial clustering results corresponding one-to-one to the M initial clustering numbers, where M is a positive integer; the determination module is also used to determine the target clustering result from the M initial clustering results based on the connection relationship between entities in the seed graph.

[0021] In combination with the second aspect, in some possible implementations, the seed graph includes common entities that are the same as entities in the corpus, and the determination module is also used to determine the dispersion and accessibility of each initial clustering result based on the connection relationship of the entities in the seed graph and each initial clustering result, the dispersion is used to indicate the degree of discreteness of the neighbor structure of each common entity in the seed graph in the initial clustering result, the neighbor structure consists of a common entity and all adjacent common entities of the common entity in the seed graph, and the accessibility is used to indicate the shortest distance of the common entity in the seed graph in each class of the initial clustering result; the determination module is also used to determine the target clustering result from the initial clustering result based on the dispersion and the accessibility.

[0022] In combination with the second aspect, in some possible implementations, the absolute value of the difference between the dispersion and accessibility of the target clustering result is the smallest among the M initial clustering results.

[0023] In combination with the second aspect, in some possible implementations, the seed graph includes common entities that are identical to entities in the corpus, and the seed graph includes out-of-class entities outside the corpus, and the adding module is also used to add the out-of-class entity to the first class of the target clustering result when the out-of-class entity is located on the shortest path between two common entities in the first class of the target clustering result in the seed graph; and / or, the adding module is also used to add the out-of-class entity to one or more classes in the target classification result whose entity similarity meets preset conditions based on the similarity between the common entities adjacent to the out-of-class entity in the seed graph and the entities in each class of the target classification result.

[0024] In combination with the second aspect, in some possible implementations, the determination module is also used to determine the entity vector of each entity in the target clustering result, the nth bit of the entity vector indicating whether the entity belongs to the nth category in the target classification result, and n is a positive integer; the determination module is also used to determine the distance between the vector of the newly added entity and the entity in the seed graph, and the distance is used to represent the similarity between the newly added entity and the entity in the seed graph.

[0025] In combination with the second aspect, in some possible implementations, the target classification result includes multiple classes, and the jth class among the multiple classes includes a newly added entity. The determination module is also used to determine the jth target subgraph that is most similar to the jth class based on the similarity between the entity in the jth class and the multiple subgraphs in the seed graph, each subgraph in the multiple subgraphs consisting of an entity in the seed graph and all adjacent entities of the entity in the seed graph; the adding module is used to add the newly added entity in the jth class to the jth target subgraph based on the similarity.

[0026] In a third aspect, a device for establishing a knowledge graph is provided, comprising: a communication interface and a processor; the communication interface is used to obtain a corpus; the processor is used to cluster entities in the corpus to obtain a target clustering result; the processor is also used to determine the similarity between new entities in the corpus and entities in a seed graph based on the target clustering result; the processor is also used to add the new entities to the seed graph based on the similarity to establish a knowledge graph.

[0027] In combination with the third aspect, in some possible implementations, the processor is also used to cluster the entities in the corpus according to the M initial clustering numbers to obtain M initial clustering results corresponding one-to-one to the M initial clustering numbers, where M is a positive integer; the processor is also used to determine the target clustering result from the M initial clustering results based on the connection relationship between entities in the seed graph.

[0028] In combination with the third aspect, in some possible implementations, the seed graph includes common entities that are the same as entities in the corpus, and the processor is also used to determine the dispersion and accessibility of each initial clustering result based on the connection relationship between the entities in the seed graph and each initial clustering result, the dispersion is used to indicate the degree of discreteness of the neighbor structure of each common entity in the seed graph in the initial clustering result, the neighbor structure consists of a common entity and all adjacent common entities of the common entity in the seed graph, and the accessibility is used to indicate the shortest distance of the common entity in the seed graph in each class of the initial clustering result; the processor is also used to determine the target clustering result from the initial clustering result based on the dispersion and the accessibility.

[0029] In combination with the third aspect, in some possible implementations, the absolute value of the difference between the dispersion and accessibility of the target clustering result is the smallest among the M initial clustering results.

[0030] In combination with the third aspect, in some possible implementations, the seed graph includes common entities that are identical to entities in the corpus, and the seed graph includes out-of-class entities that are outside the corpus. The processor is also used to, when the out-of-class entity is located on the shortest path between two common entities in the first class of the target clustering result in the seed graph, add the out-of-class entity to the first class; and / or, based on the similarity between the common entities adjacent to the out-of-class entity in the seed graph and the entities in each class of the target classification result, add the out-of-class entity to one or more classes in the target classification result whose entity similarity meets preset conditions.

[0031] In combination with the third aspect, in some possible implementations, the processor is also used to determine the entity vector of each entity in the target clustering result, the nth bit of the entity vector indicating whether the entity belongs to the nth category in the target classification result, and n is a positive integer; the processor is also used to determine the distance between the vector of the newly added entity and the entity in the seed graph, and the distance is used to indicate the similarity between the newly added entity and the entity in the seed graph.

[0032] In combination with the third aspect, in some possible implementations, the target classification result includes multiple classes, and the jth class among the multiple classes includes a newly added entity. The processor is also used to determine the jth target subgraph that is most similar to the jth class based on the similarity between the entity in the jth class and the multiple subgraphs in the seed graph, each subgraph in the multiple subgraphs consisting of an entity in the seed graph and all adjacent entities of the entity in the seed graph; the processor is also used to add the newly added entity in the jth class to the jth target subgraph based on the similarity.

[0033] According to a fourth aspect, a computer storage medium is provided, and when the computer instructions are executed on an electronic device, the electronic device executes the method according to the first aspect.

[0034] In a fifth aspect, a chip system is provided, the chip system comprising at least one processor, and when program instructions are executed in the at least one processor, the chip system executes the method described in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 It is a schematic diagram of an application scenario of natural language processing provided in an embodiment of the present application.

[0036] Figure 2 It is a schematic diagram of another application scenario of natural language processing provided in an embodiment of the present application.

[0037] Figure 3 It is a schematic flowchart of a method for establishing a knowledge graph proposed in an embodiment of the present application.

[0038] Figure 4 It is a schematic flowchart of a method for establishing a knowledge graph provided in an embodiment of the present application.

[0039] Figure 5 It is a schematic flowchart of a method for determining clustering results provided in an embodiment of the present application.

[0040] Figure 6 It is a schematic diagram of a seed map.

[0041] Figure 7 It is a schematic diagram of the relationship between the dispersion of clustering results and the number of clusters.

[0042] Figure 8 It is a schematic diagram of the relationship between the accessibility of clustering results and the number of clusters.

[0043] Fig. 9 It is a schematic diagram of an expanded knowledge graph.

[0044] Fig.10 The present invention is a schematic flowchart of a corpus preprocessing method.

[0045] Fig.11 It is a schematic structural diagram of a knowledge graph establishment device provided in an embodiment of the present application.

[0046] Fig.12 It is a schematic structural diagram of a knowledge graph establishment device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0047] The technical solution in this application will be described below in conjunction with the accompanying drawings.

[0048] like Figure 1 As shown, a natural language processing (NLP) system includes a user device and a data processing device.

[0049] The user device includes a user and a smart terminal such as a mobile phone, a personal computer or an information processing center. The user device is the initiator of natural language data processing, and is the initiator of language question and answer or query requests. Usually, the user initiates the request through the user device.

[0050] The data processing device may be a device or server with data processing functions such as a cloud server, a network server, an application server, and a management server. The data processing device receives query statements / voice / text and other questions from the smart terminal through the interactive interface, and then performs language data processing in the form of machine learning, deep learning, search, reasoning, decision-making, etc. through the memory for storing data and the processor for data processing. The memory may be a general term, including local storage and a database for storing historical data. The database may be on the data processing device or on other network servers.

[0051] like Figure 2 The figure shows another application scenario of the natural language processing system. In this scenario, the smart terminal directly acts as a data processing device, directly receiving input from the user and directly processing it by the hardware of the smart terminal itself. The specific process is similar to Figure 1 Similarly, please refer to the above description and will not go into details here.

[0052] To facilitate understanding, the following first introduces relevant terms and related concepts such as neural networks involved in the embodiments of the present application.

[0053] (1) Knowledge Graph

[0054] Knowledge graph (KG) describes the relationship between entities in the form of a graph or network. The knowledge graph consists of interconnected nodes and edges. Nodes represent entities, and edges represent the relationship between nodes. The knowledge graph is essentially a semantic network, a graph-based data structure. Through the knowledge graph, different types of information can be connected together to form a relationship network. The knowledge graph provides the ability to analyze problems from the perspective of "relationships". The knowledge graph can be used to optimize existing search engines. Unlike traditional search engines based on keyword search, the knowledge graph can be used to better query complex related information, understand user intent from a semantic level, and improve search quality.

[0055] (2) Corpus

[0056] Corpus refers to text in linguistics. A corpus can include a large amount of text. Usually, the corpus is organized into a certain format and tags.

[0057] (3) Entity

[0058] An entity refers to something that is distinguishable and exists independently, such as a person, a city, a plant, a commodity, etc. An entity can be represented by a word or a phrase. A corpus can include many entities.

[0059] (4) Supervised Learning

[0060] Supervised learning is a type of machine learning. It is a method of learning training samples with concept labels (classifications) in order to predict the labels (classifications) of data outside the training sample set as much as possible. Here, all labels (classifications) are known.

[0061] (5) Unsupervised Learning

[0062] Unsupervised learning is a type of machine learning. It is a method of learning training samples without concept labels (classifications) to discover structural knowledge in the training sample set. Here, all labels (classifications) are unknown.

[0063] (6) Attributes

[0064] Attributes are used to describe the characteristics or properties of an entity or concept.

[0065] With the development of mobile Internet, the interconnection of all things has become possible, and the data generated by this interconnection is also growing explosively, and this data happens to be an effective raw material for analyzing relationships. If previous intelligent analysis focused on each individual, in the era of mobile Internet, in addition to individuals, the relationship between these individuals will inevitably become an important part of our in-depth analysis. With the assistance of knowledge graphs, search engines can return more accurate and structured information based on the semantic information behind user queries.

[0066] With the development of information technology, it is becoming easier to obtain and store information. Not only Internet companies, but also traditional enterprises have accumulated a large amount of information needed for business operations, which is scattered in different IT systems. How to use this information to help business personnel complete their work efficiently is a problem faced by knowledge management in every large organization or enterprise.

[0067] Traditional knowledge management systems rely on experts to manually sort out knowledge classification systems. This method is time-consuming and slow, and the experts' experience is not necessarily comprehensive or completely error-free.

[0068] With the development of artificial intelligence (AI) technology, knowledge graphs are increasingly being used in knowledge management to enhance the understanding of natural language in question-answering or search systems. As an emerging technology, knowledge graphs have been widely used by Internet companies. In particular, the construction of open domain knowledge graphs for search engines has gradually formed a relatively mature construction method.

[0069] The construction of an open domain knowledge graph requires a large amount of corpus. However, in some specific fields, due to the limited amount of corpus, the construction technology of the open domain knowledge graph is not fully applicable, and the expansion of the knowledge graph is difficult.

[0070] At present, as a knowledge graph in a specific field, the construction process of enterprise knowledge graph generally involves experts manually generating seed graphs, which are then expanded based on the corpus to complete the establishment of the knowledge graph.

[0071] Experts summarize the knowledge in a specific field into a seed graph, which needs to be further expanded to support applications. The workload of expanding the knowledge graph completely manually is huge.

[0072] One way to expand the graph is to determine the similarity of entities based on the properties of the new entity and the properties of existing entities in the graph, and connect the new entity to the entity with the most similar properties.

[0073] Specifically, a classification model can be obtained through a supervised learning algorithm. Obtain training data. The training data includes a large amount of corpus, as well as each entity in the corpus and its corresponding tag. The tag can also be called a label, which is used to identify the attribute of the entity, that is, the class to which the entity belongs. Input the corpus into the original model to obtain the output of the original model. The output of the original model is the tag corresponding to the entity in the corpus. Adjust the parameters of the original model so that the similarity between the output of the original model and the tag corresponding to each entity in the training data is within a preset range. Use the adjusted original model as a classification model. The classification model is used to classify new entities. Classifying an entity means determining the tag corresponding to the entity.

[0074] After obtaining the classification model, the corpus is input into the classification model to obtain the label of each entity in the corpus. The graph records the attributes of each node, that is, each entity. According to the similarity of the entity's label, the new entity in the corpus can be connected to the entity in the graph that has the most similar attributes with it.

[0075] In order to improve the accuracy of the classification model, a large amount of training data is required, that is, a large amount of corpus, as well as each entity in the corpus and its corresponding tag are required.

[0076] The labels corresponding to entities in the training data are usually determined manually. Therefore, the training of classification models requires a lot of manpower.

[0077] For a specific organization or field, the training data is limited and the accuracy of the classification model cannot be guaranteed.

[0078] Another way to expand the graph is through unsupervised learning algorithms. Based on a large amount of corpus, machine learning is used to obtain the vector of the entity. The distance between two vectors represents the similarity between the two entities corresponding to these two vectors. Based on the similarity between the entities, the newly added entities in the corpus are connected to the entities in the graph with the highest similarity or the similarity greater than the preset value.

[0079] This method uses machine learning to represent entities in the corpus through vectors based on the input corpus. In order to obtain accurate vectors of entities, the machine learning process requires a large amount of corpus input. For a specific organization or field, the amount of corpus is limited and may not meet the requirements of machine learning for the amount of corpus, resulting in the inability to guarantee the accuracy of vector representation.

[0080] In order to solve the above problems, an embodiment of the present application provides a method for establishing a knowledge graph.

[0081] Figure 3 It is a schematic flowchart of a method for establishing a knowledge graph provided in an embodiment of the present application.

[0082] In step S301, corpus is obtained.

[0083] The acquired corpus can be either a corpus that has been processed with word segmentation or a raw corpus that has not been processed with word segmentation. The raw corpus can be processed with word segmentation to determine the entities in the corpus. The word segmentation method can be found in Fig.10 The corpus can also be processed in other ways to determine the entities in the corpus.

[0084] The corpus includes a large number of entities. The corpus contains all or part of the entities in the seed graph. Entities contained in both the corpus and the seed graph can be called common entities. The corpus also contains entities outside the seed graph, i.e., newly added entities.

[0085] Acquiring the corpus may include receiving the corpus sent by other devices, acquiring the corpus from a memory, or acquiring the corpus that is a processing result of other processors.

[0086] In step S302, the entities in the corpus are clustered to obtain a target clustering result.

[0087] The corpus can be clustered using any clustering method such as topic model, hierarchical model, etc.

[0088] The clustering result is related to the determined number of clusters. The number of clusters can be determined based on expert experience, that is, the number of clusters can be set manually. Alternatively, the number of clusters can be determined based on some characteristics of the data itself.

[0089] Optionally, the number of clusters and clustering results can be verified through the seed graph. The seed knowledge graph established by expert experience is used to determine the clustering results of the unsupervised clustering algorithm. At the same time, the points in the seed graph that contradict the unsupervised clustering algorithm are also re-verified. By cross-checking the consistency of the two sets of data, the parameters of the clustering algorithm are found, and the correctness of the expert experience is ensured.

[0090] According to the M initial clustering numbers, the entities in the corpus can be clustered to obtain M initial clustering results corresponding to the M initial clustering numbers, where M is a positive integer. According to the connection relationship of the entities in the seed graph, one initial clustering result is determined from the M initial clustering results as the target clustering result.

[0091] Specifically, the dispersion and accessibility of each of the initial clustering results can be determined based on the connection relationship of the entities in the seed graph and each of the initial clustering results. The neighbor structure consists of a common entity and all adjacent common entities of the common entity in the seed graph. The dispersion is used to indicate the degree of dispersion of the neighbor structure of each common entity in the seed graph in the initial clustering result. Accessibility is used to indicate the shortest distance of the common entity in the seed graph in each class of the initial clustering result. The target clustering result can be determined from the initial clustering result based on the dispersion and the accessibility.

[0092] A clustering result whose dispersion and accessibility respectively meet certain preset conditions may be selected from the M initial clustering results as the target clustering result. For example, a clustering result whose dispersion is less than or equal to a first preset value and whose accessibility is greater than or equal to a second preset value may be selected as the target clustering result.

[0093] It is also possible to draw the accessibility-cluster number relationship curve and the dispersion-cluster number relationship curve based on the M initial clustering results. The number of clusters corresponding to the intersection of the two curves can be used as the number of clusters of the target clustering result, thereby obtaining the target clustering result. In other words, the absolute value of the difference between the dispersion and accessibility of the target clustering result is the smallest among the M initial clustering results. The specific calculation and description of dispersion and accessibility can be found in Figure 5 .

[0094] In step S303, the similarity between the newly added entity in the corpus and the entity in the seed graph is determined according to the target clustering result.

[0095] The seed graph may include entities outside the corpus, which can be called out-of-class entities. Out-of-class entities can be added to the clustering results.

[0096] When the out-of-class entity is located on the shortest path between two common entities in the first class of the target clustering result in the seed graph, the out-of-class entity can be added to the first class. If there is an out-of-class entity on the shortest path between two common entities of the same class in the clustering result, the out-of-class entity can be added to the class to which the two common entities belong.

[0097] The out-of-class entity can also be added to the clustering result based on the similarity between the subgraph of the out-of-class entity and the class in the clustering result. The out-of-class entity can be added to one or more classes in the target classification result whose entity similarity meets a preset condition based on the similarity between the common entity adjacent to the out-of-class entity in the seed graph and the entity in each class of the target classification result.

[0098] The similarity between the new entity and the shared entity can be determined based on the co-occurrence of the new entity and the shared entity in the clustering results and their distribution in different clustering results. If a new entity and a shared entity always appear at the same time in different classes, or do not appear at the same time, then the similarity between the two entities is very high.

[0099] Each entity can be represented by a vector. Each bit of the vector represents a class of the clustering result. The "1" and "0" of this bit in the vector respectively represent whether the entity represented by the vector belongs to this class. In other words, the jth bit of the vector represents whether the entity belongs to the jth class in the target classification result, where j is a positive integer.

[0100] The distance between two vectors can be used to represent the similarity of the entities corresponding to the two vectors. The distance between the vectors of the newly added entity and the entity in the seed graph can be determined, so that the similarity between the newly added entity and the entity in the seed graph can be determined.

[0101] The similarity between each newly added entity and each common entity can be determined, and the similarity between a newly added entity and entities within the entire seed graph can be determined. The newly added entity can be connected to entities in the entire seed graph whose similarity meets preset conditions.

[0102] It is also possible to determine the most similar subgraph to the class to which the newly added entity belongs, and determine the similarity between a newly added entity and entities within a subgraph. The newly added entity can be connected to entities in the subgraph whose similarity meets a preset condition.

[0103] According to the similarity between the entity in the j-th class and multiple subgraphs in the seed graph, determine the j-th target subgraph that is most similar to the j-th class, each subgraph in the multiple subgraphs is composed of an entity in the seed graph and all adjacent entities of the entity in the seed graph. According to the similarity, add the newly added entity in the j-th class to the j-th target subgraph.

[0104] Determine the most similar subgraph of a class, that is, the matching of the class and the subgraph. A word may have different meanings, that is, the word is polysemous. In different meanings, the word may be classified in different classes. Each class corresponds to a topic, and each entity in the subgraph of entity 1 is related to entity 1 and can be considered to correspond to a topic. In this case, the clustering result can be matched with the subgraph, so that the newly added entity is connected to the entity in the subgraph of the topic corresponding to it, and to a certain extent, avoid the newly added entity from being connected to the entity in the subgraph corresponding to the topic that is not related to it.

[0105] By matching classes with subgraphs, the newly added entity is connected to the subgraph corresponding to the class described by the newly added entity, thereby improving the accuracy of seed graph expansion.

[0106] In step S304, the newly added entity is added to the seed graph according to the similarity.

[0107] Through steps S301-S304, a knowledge graph can be established when the corpus is insufficient, avoiding reliance on manual work. Compared with the method of relying on experts to manually comb through to establish a knowledge graph, it greatly improves efficiency and saves labor costs. It can realize the automatic expansion of the knowledge graph when the corpus is insufficient or lacks annotations.

[0108] Figure 4 It is a schematic flowchart of a method for establishing a knowledge graph provided in an embodiment of the present application.

[0109] The method provided in the embodiment of the present application utilizes an unsupervised clustering algorithm to divide the words in the corpus into different groups, defines two measurement indicators, dispersion (Dispersion) and reachability (Reachability), to measure the consistency between the seed map provided by the expert and the clustering result of the unsupervised clustering algorithm, and finds the optimal number of clusters from the balance between dispersion and reachability. According to the clustering result obtained from the optimal number of clusters, the clustered group is linked to a certain subgraph, and the newly added entities in the class are associated with the entities in the seed map through vector similarity, completing the connection between each newly added entity and the entity in the seed map. According to the importance of the definition, the connection of important newly added entities is pushed to the expert for verification to ensure efficient use of expert time and quickly add important newly added entities to the seed map. The connection between other newly added entities and entities in the seed map can be verified during the application process.

[0110] In step S401, the corpus is preprocessed. The process of corpus preprocessing can be found in Fig.10 .

[0111] Corpus preprocessing is used to decompose the original text corpus to determine the entities in the corpus.

[0112] After step S401, the entities in the corpus are clustered.

[0113] Unsupervised clustering problems generally require the number of classes to be set in advance as model parameters. The setting of this parameter is generally determined based on expert experience or some characteristics of the data itself. Determining the number of classes in the clustering results based on expert experience has high labor costs. Determining the number of classes in the clustering results based on the characteristics of the data itself cannot guarantee the accuracy of the clustering results, and usually requires manual verification.

[0114] The embodiment of the present application uses the seed knowledge graph established by expert experience to determine the parameters of the unsupervised clustering algorithm model. The seed knowledge graph provided by the expert is fully utilized to find the number of clusters consistent with the expert experience.

[0115] At the same time, the seed graph can also be verified based on the unsupervised clustering algorithm. If in a subgraph of the seed graph, other entities are in one class of the clustering result, and one or more entities in the subgraph are in another class, the position of the one or more entities in the seed graph is likely not very accurate. Experts can determine whether the connection relationship of the one or more entities is accurate.

[0116] By cross-checking the consistency of the two sets of data, the topic quantity parameter of the clustering algorithm is found, while ensuring the correctness of expert experience.

[0117] Steps S402-S404, using the initial graph built by expert experience and the unsupervised learning based on the corpus, mutually verify and determine the parameters of the unsupervised learning, and verify the correctness of the expert experience.

[0118] In step S402, entities in the corpus are clustered according to the number of clusters.

[0119] The number of clusters k may be preset, for example, k=1, or other values.

[0120] The preprocessed text corpus is input into the clustering model through the clustering algorithm to complete the clustering of words.

[0121] There are many ways to cluster corpora, such as clustering methods such as topic models and hierarchical models. A topic model can group words that describe the same content in a text into one class, and one class can represent a topic. Latent Dirichlet allocation (LDA) is a document topic generation model. The phrase-based improved topic model phrase LDA can consider the collocation of words and phrases more. The topic model is a probability distribution with all characters in the text as the support set, which indicates the frequency of the character appearing in the topic, that is, characters with high relevance to the topic have a greater probability of appearing.

[0122] In step S403, the clustering result corresponding to the number of clusters k is calculated as dispersion and accessibility.

[0123] Adjust the value of the number of clusters k. Cluster the entities in the corpus according to different numbers of clusters k.

[0124] The seed map can be manually designed and is a reflection of expert experience. The clustering results are verified with the seed map through dispersion and accessibility to obtain clustering results consistent with expert experience.

[0125] In step S404, the final number of clusters is determined according to the dispersion and accessibility indicators.

[0126] Through steps S402-S404, the final clustering result can be determined. For the specific process, please refer to Figure 5 .

[0127] In addition, the correctness of the seed graph can be judged by the clustering results. For an entity, if other entities in a subgraph are in one class, and this entity is classified in another class through the clustering algorithm, the location of this entity in the seed graph is likely not very accurate. The connection status of the entity can be pushed to experts for verification. In this way, the correctness of the seed graph can be judged. After judging the correctness of the seed graph, the seed graph can be expanded.

[0128] Through steps S402-S404, an unsupervised algorithm is used to determine the parameter of the number of clusters through purposeless trial calculations. Expert knowledge is efficiently used to significantly improve knowledge operation and maintenance efficiency and reduce operation and maintenance costs.

[0129] Steps S405-S408, vectorize entities according to the classes obtained by unsupervised clustering, determine the connection between the newly added entities and the entities in the seed graph by matching the classes with the subgraphs, and expand the seed graph.

[0130] The seed map is extended and mainly includes steps S406 to S408. Before step S406, step S405 can also be performed.

[0131] There may be entities in the seed graph that are not included in the corpus. The entity does not belong to any class and can be called an out-of-class entity. There may be an association between the out-of-class entity and the newly added entity. For example, the newly added entity may have the same meaning as the out-of-class entity, but only has a different name. In order to cover this situation when expanding the graph, step S405 can be performed.

[0132] In step S405, out-of-class entities are added to the clustering results, that is, the out-of-class entities are made to belong to one or more classes of the clustering results.

[0133] For a class in the clustering results, when the out-of-class entity is located on the shortest path between two common entities in the class on the seed graph, the out-of-class entity can be added to the class.

[0134] Alternatively, based on the neighbor structure of the out-of-class entity, a class whose similarity with the neighbor structure meets a preset condition in the clustering result is determined. The neighbor structure of the out-of-class entity includes the out-of-class entity and the common entities adjacent to the out-of-class entity in the seed map.

[0135] by Figure 6 Taking the seed graph as an example, if the classification result of the corpus is: C1 = {A, F, G}, C2 = {A, B, K, H}, C3 = {C, D, H, I}, C4 = {B, F}, E is an out-of-class entity and does not belong to any class.

[0136] If, when calculating the accessibility of a class, E is on the shortest path between two common entities in the class, then E can be added to this class. For the above clustering results, E is on the shortest path between C and D, and E should be added to C3.

[0137] If E is not on the shortest path of any class, then according to the Jaccord similarity coefficient, E is added to the class with the maximum similarity, or to the class with a Jaccord similarity greater than a certain value. Class C K The Jaccord similarity with subgraph G' can be expressed as:

[0138]

[0139] Among them, |G'∩C K | indicates class C K The number of entities included in the subgraph G', |G'∪C K | means C K and the total number of entities included in the subgraph G'.

[0140] Through step S405, expert knowledge is used to supplement the missing entities in the corpus and improve the semantic understanding of the expected clustering.

[0141] In step S406, the clustering result is matched with the subgraph.

[0142] A word may have different meanings, that is, the word is polysemous. In different meanings, the word may be classified into different classes. Each class corresponds to a topic. Each entity in the subgraph of entity 1 is related to entity 1 and can be considered to correspond to a topic. In this case, the clustering results can be matched with the subgraph, so that the newly added entity is connected to the entity in the subgraph of the topic corresponding to it, and to a certain extent, the newly added entity is prevented from being connected to the entity in the subgraph corresponding to the topic that is not related to it.

[0143] Each entity in the seed graph corresponds to a subgraph. The subgraph of an entity is the first-degree egocentric network of the entity. The subgraph of an entity in the seed graph includes the entity and the entities adjacent to the entity in the seed graph.

[0144] The clustering results are matched with the subgraphs, that is, the subgraphs corresponding to each class in the clustering results are determined, and the similarity between each class in the clustering results and the subgraphs corresponding to each common entity included in the class is calculated.

[0145] The classification results of the corpus are: C1 = {A, F, G}, C2 = {A, B, K, H}, C3 = {C, D, H, I}, C4 = {B, F}. In step S405, E is added to C3, thus forming a new class: C1 = {A, F, G}, C2 = {A, B, K, H}, C3 = {C, D, H, I, E}, C4 = {B, F}. As shown in Table 1, C1 includes a common entity A, and the similarity between C1 and the subgraph of A is calculated. C2 includes common entities A and B, and the similarity between C2 and the subgraph of A and the subgraph of B is calculated respectively. C3 includes common entities C, D, and E, and the similarity between C3 and the subgraph of C, the subgraph of D, and the subgraph of E is calculated respectively. C4 includes common entities, and the similarity between C4 and the subgraph of B is calculated.

[0146] Table 1

[0147]

[0148] According to the above calculation results, it is determined that C1 matches the subgraph of A. C2 matches the subgraph of A. C3 matches the subgraph of D. C4 matches the subgraph of B.

[0149] Through step S406, the newly added entity can be added to the subgraph corresponding to the class described by the newly added entity, thereby avoiding connection errors.

[0150] In step S407, the similarity between the newly added entity and the entities in the matching subgraph is determined.

[0151] According to the clustering results, entities can be represented by vectors, and the similarity can be represented by the distance between the vectors of the newly added entities and the entities in the matching subgraph.

[0152] Class-based vector representation, that is, entities are represented by vectors according to their distribution in the class. Each bit of the entity's vector indicates whether the entity belongs to a class in the new clustering result. In the vector representation of entities, each entity is vectorized based on whether the entity is included in each class, and the co-similarity between the newly added entity and the entity in the subgraph corresponding to the class to which the newly added entity belongs is calculated. The newly added entity is connected to the node in the corresponding subgraph with the smallest co-similarity to the rest. The greater the distance between the two vectors, the smallest the co-similarity between the entities corresponding to the two vectors. The co-similarity of two vectors can be understood as the ratio of the same digits in the two vectors.

[0153] According to the new C in Table 1 K, C1 and C2 include entity A, while C3 and C4 do not include entity A, then entity A can be represented as: A(1100). Other entities can be represented as: B(0101), C(0010), D(0010), E(0010), H(0110), K(0100), I(0010), F(1001), G(1000).

[0154] For each newly added entity, its similarity with each entity in the seed graph may be calculated. Alternatively, for each newly added entity, the similarity between the newly added entity and each entity in the subgraph corresponding to the class to which the newly added entity belongs may be calculated.

[0155] Table 2 is a similarity table between the newly added entity and each entity in the subgraph corresponding to the class to which the newly added entity belongs.

[0156] Table 2

[0157] A(1100) B(0101) C(0010) D(0010) E(0010) H(0110) 0.5 0.5 0.71 0.71 0.71 K(0100) 0.71 0.71 0 I(0010) 0 1 1 F(1001) 0.5 0.5 0 0 G(1000) 0.71 0 0

[0158] In step S408, the newly added entity is added to the seed graph according to the similarity between the newly added entity and the entities in the sub-graph.

[0159] According to the similarity in Table 2, the newly added entities are connected to the common entities with the highest similarity to build a knowledge graph. Fig. 9 , H is connected to C, D, E, K is connected to A, B, I is connected to D, E, F is connected to A, B, and G is connected to A.

[0160] Through steps S405-S408, the expansion of the seed map is achieved.

[0161] After step S408, the connection of the newly added entity may be confirmed.

[0162] The newly added entities are expanded in the seed graph. After expansion, the seed graph can be applied. Based on the feedback from the application, it can be determined whether to fix the newly added entities.

[0163] The expanded seed graph is applied to the search system. The search system provides information options to the user based on the expanded knowledge graph. The user enters a first entity and performs a search. The search system provides the user with information about the first entity and information about entities that have a relationship with the first entity based on the entity entered by the user. An entity has a relationship with another entity, that is, the two entities are connected by an edge. If the user clicks on the information of the second entity that has a relationship with the first entity, the connection relationship between the first entity and the second entity is recognized by the user. The more clicks, the more reliable the relationship between the two entities. Based on the number of clicks, the newly added entity can be fixedly added to the seed graph. If the number of clicks on the information of the second entity is very small, the connection relationship between the first entity and the second entity can be deleted.

[0164] Considering the limitation of the amount of information displayed by the user device, the search system can only provide the user with information of a limited number of entities that have a relationship with the first entity each time. That is, it may take a lot of time to determine whether there is a relationship between the first entity and other entities.

[0165] However, the perception of the application depends strongly on the size of the seed graph. If the seed graph is too small, the knowledge covered by the seed graph is not broad enough. When applied, the recommended knowledge is not rich enough, and the user experience is poor. In the construction of enterprise graphs, the seed graphs manually combed by experts are generally small, and the newly added entities in the corpus may be far more than the entities in the seed graph.

[0166] The addition of new entities is determined based on the feedback from the application. It takes some time to determine the addition of new entities. Before the new entities are added to the seed graph, the knowledge graph is not fully established, which may lead to a poor user experience. In order to obtain a better user experience, the established knowledge graph can be verified by experts, that is, experts determine the connection between the new entities and the common entities.

[0167] Since there are a large number of newly added entities, it is costly for experts to verify the connection between each newly added entity and the shared entity. Based on the importance of the newly added entities, experts can verify the connection between the newly added entities with higher importance and the shared entities.

[0168] Steps S409-S411: For the newly added nodes, an index for judging importance is proposed to determine the importance of the newly added entities. Experts verify the newly added entities with higher importance to improve efficiency.

[0169] In step S409, the importance of the newly added entity is calculated. The importance can be determined by one or more of degree centrality, closeness centrality, and betweenness centrality. For example, the importance can be the average of degree centrality, closeness centrality, and betweenness centrality.

[0170] Degree centrality is the most direct measure of node centrality in network analysis. The greater the node degree of a node, the higher the degree centrality of the node, and the more important the node is in the network.

[0171] Closeness centrality reflects the degree of closeness between a node and other nodes in the network. The reciprocal of the sum of the shortest path distances from a node to all other nodes represents the closeness centrality. That is, for a node, the closer it is to other nodes, the greater its closeness centrality.

[0172] Betweenness centrality is an indicator that describes the importance of a node by the number of shortest paths passing through a node. Betweenness centrality can reflect the number of times a node is located in the shortest path between two other nodes. The more times a node acts as a "mediator", the greater its betweenness centrality. If you want to consider the issue of standardization, you can divide the number of times a node is the shortest path bridge by the number of all paths. Standardization means adjusting the calculation result between 0 and 1.

[0173] In step S410, a newly added entity to be verified is determined according to importance.

[0174] Output the newly added entities to be verified, and verify whether the newly added entities are connected to the entities in the seed graph through human-provided methods.

[0175] When the seed graph is relatively small and there are many new entities, make efficient use of expert resources. Apply limited expert resources to the verification of important new entities.

[0176] In step S411, the verification result is obtained and the knowledge graph is determined.

[0177] Obtain the verification result of whether the important new entities are connected to the entities in the seed graph, determine the connection between the important new entities and the entities in the seed graph, and thus determine the verification result. For new entities with lower importance, they can be added to the seed graph to complete the establishment of the knowledge graph, or they can be determined whether to connect based on the feedback of the application.

[0178] Through steps S409-S411, the problem of effective verification of newly added nodes in graph expansion is solved.

[0179] Through steps S401-411, a knowledge graph is established, which enables the establishment of a knowledge graph when the amount of corpus is insufficient. There is no need to mark entities, reducing labor costs.

[0180] Figure 5This is a method for determining clustering results provided in an embodiment of the present application. By this method, a clustering result consistent with expert experience can be determined.

[0181] The corpus is input, and the initial number of clusters is input or preset. The number of clusters is the number of classes included in the clustering result. The initial number of clusters can be a small value i, for example, i can be 2. In practical applications, the corpus can be clustered into at least 2 classes.

[0182] The number of clusters can be from 1 to a preset value, and the clustering algorithm is used for multiple iterations. The preset value is less than or equal to the number of entities in the seed graph. The two indicators of dispersion and reachability determine the clustering results that are consistent with expert experience.

[0183] The entities in the corpus include the same entities as those in the seed graph, which are called common entities, and entities outside the seed graph, which are called new entities. The establishment of the knowledge graph is to add the new entities to the seed graph. The establishment of the knowledge graph is achieved by expanding the seed graph.

[0184] Cluster the entities in the corpus according to the number of clusters.

[0185] Afterwards, the dispersion and accessibility of the clustering results are calculated.

[0186] The dispersion of a common entity is used to indicate the degree of dispersion of the neighborhood structure of the common entity in the clustering results. The neighborhood structure of a common entity refers to the structure formed by the common entity and its adjacent common entities in the seed graph. The seed graph is designed by experts and represents expert experience. Each entity in the neighborhood structure of a common entity is associated with the common entity, and it can be considered that the probability of belonging to the same topic is high. Clustering is performed according to the topic model, and a class in the clustering result represents a topic. If the adjacent common entities in the seed graph are concentrated in one class in the clustering result, the clustering result is highly consistent with the neighborhood structure of the common entity, that is, the clustering result is highly consistent with the expert experience. The common entity is a point in the seed graph, and the dispersion of the common entity can also be called the dispersion of the point.

[0187] Judging from the dispersion of common entities, for a certain clustering result, the average dispersion of all common entities in the seed map can reflect the overall consistency between the clustering result and expert experience. For a clustering result, the average dispersion of all common entities in the seed map can be called the dispersion of the clustering result.

[0188] Entropy is used to measure the uncertainty of random variables. It is the expectation of the amount of information generated by all possible events. The more values ​​a random variable takes and the more states it has, the greater the entropy and the greater the degree of confusion. In addition, the more evenly the random variables are distributed in different states, the greater the entropy and the greater the degree of confusion. For clustering results, the more classes the common entities in the seed graph and their adjacent common entities belong to in the clustering results, the more dispersed the neighbor structure of the common entities is in the clustering results, and the lower the consistency with expert experience. Therefore, entropy can be used to represent dispersion.

[0189] Entropy can be expressed as The negative sign is used to ensure that the amount of information is positive or zero. The choice of the log function basis is arbitrary, for example, it can be chosen to be 2.

[0190] The dispersion of a common entity V can be expressed as:

[0191] in,

[0192] Γ(v) shares entities in the neighboring structure of entity V, C K represents the entities in the Kth class in the clustering result, and |x| represents the number of entities in x.

[0193] In the neighborhood structure of shared entities, the more shared entities there are, the higher the possibility of a large entropy value. Therefore, considering the impact of the number of entities in the neighborhood structure of shared entities on entropy, the entropy is adjusted when calculating the dispersion of shared entities V. The entropy value can be divided by a function that increases with the increase of |Γ(v)|, and the value of this function is a positive number.

[0194] For example, entropy can be normalized. The normalization coefficient increases with the number of classes in the neighbor structure of the common entity, and is guaranteed to be 1 (no penalty) when there is only one neighbor. The normalization coefficient can be set as:

[0195]

[0196] The log function basis in the normalization function may be the same as or different from the log function basis in the entropy function, for example, it may be selected as 2.

[0197] The entropy is normalized by dividing it by log(|Γ(V)|+1). Normalization balances the effect of the number of entities in the neighborhood structure of the common entity on the dispersion.

[0198] The value range of the dispersion of the shared entity V can be adjusted, for example, between 0 and 1. The value range of the dispersion can be adjusted by using an adjustment function, such as the hyperbolic tangent tanh function. The hyperbolic tangent tanh function is used to ensure that the value range of the dispersion is between [0,1], so as to facilitate comparison with accessibility. The tanh function changes significantly when the value of the independent variable is small, which can avoid the situation where the number of clusters is too small.

[0199] by Figure 6 Taking the seed graph shown in the figure as an example, the nearest neighbors of B are Γ(B) = (A, B, C, E), |Γ(B)| = 4. G represents the entity in the seed graph, C K Represents the entity in the Kth class in the clustering result, G∩C K Represents C K The clustering results are G∩C1={A,B,C},G∩C2={E},G∩C3={D}. Because the neighbors of nodes A and C are both in class 1, ζ A =ζ c = 0. Among the four neighboring nodes of node B, A, B, and C are in one class, and E is in another class. The dispersion of B is:

[0200]

[0201] The dispersion of points D and E are:

[0202]

[0203]

[0204] Comparing these five points, the neighbors of A and C are in one class, and the neighbors of B and D are in two classes, but D has only one neighbor and B has three neighbors. A =ζ c <ζ B <ζ D .

[0205] If C2 and C3 are combined, ζ A =ζ C =ζ D =0,ζ B >0,ζ E >0.

[0206] If all points are in one class, the dispersion of all points is 0, ζ A =ζ B =ζ C =ζ D =ζ E =0.

[0207] In the neighborhood structure of a common entity, the fewer classes the entity belongs to, the lower the dispersion of the entity.

[0208] Adjacent points in the seed map are clustered in the same class. The seed map manually combed by experts is consistent with the clustering algorithm. It can be seen that the dispersion of points tends to reduce the number of classes. The ultimate situation is that when there is only one class, the dispersion of all points is 0.

[0209] Therefore, the dispersion index alone is not sufficient to measure the consistency of the clustering results with the seed map.

[0210] In the seed graph, the fewer the number of classes, the more entities each class contains, and the average distance between common entities in each class increases. In order to balance the trend of reducing the number of classes caused by using dispersion to judge consistency, accessibility can be used to judge the consistency of clustering results with the seed graph while considering dispersion.

[0211] Accessibility is used to indicate the shortest distance of common entities in a class in the clustering result in the seed graph. Accessibility can also be called class accessibility. All common entities in a class in the clustering result are mapped to the seed graph, and the sum of the shortest paths between every two common entities in the class is calculated based on the connection relationship of the entities in the seed graph. The number of word pairs in this class is then standardized and averaged. The accessibility of the Kth class in the clustering result can be expressed as:

[0212]

[0213] Among them, G represents the entity in the seed graph, C K Represents the entity in the Kth class in the clustering result, G∩C K Represents C K The common entities included in G, i, j represent entities included in C K With two different common entities in G, ∑SP(i,j) represents the shortest distance between i and j in the seed graph.

[0214] The shorter the distance between words in the clustering results in the seed graph, the lower the accessibility. As the number of clusters decreases and the number of entities in each cluster increases, the accessibility increases.

[0215] According to the accessibility of each class in the clustering result, the accessibility of the entire clustering result can be determined. As the number of classes in the clustering result decreases, the accessibility of each class increases. Considering the impact of the number of each common entity in the clustering result on the accessibility of the class, the accessibility of the entire clustering result can be the sum of the accessibility of each class with weights. The weight can be determined according to the percentage of the number of words in each class to the total number. The accessibility of the entire clustering result can be expressed as:

[0216]

[0217] In a clustering result, common entities may belong to different classes at the same time. Considering this situation, the accessibility of the clustering result can be expressed as:

[0218]

[0219] The accessibility of the clustering result ρ can be used to verify the consistency of the clustering result and the seed graph structure. The smaller ρ is, the smaller the distance between the common entities of the same class in the clustering result is in the seed graph. The value of accessibility is between [0,1].

[0220] by Figure 6 Take the seed graph shown in the figure as an example. If in the clustering result, G∩C1={A,B,C},G∩C2={E},G∩C3={D}. Then The weights of each class are The accessibility of the clustering results is ρ=0.6.

[0221] If in the classification result, G∩C1={A,B,C}, G∩C2={E,D}, then ρ=1.

[0222] If in the classification result, G∩C1={A,B,C,E,D}, then ρ=3.

[0223] The most ideal situation is ρ = 1. In the clustering result, the common entities in each class are direct neighbors in the seed map, that is, they are adjacent to each other. However, the optimal number of clusters cannot be determined by ρ alone. ρ tends to increase the number of clusters.

[0224] The dispersion and accessibility of clustering results are both ways to measure the consistency between the seed map and the results of the unsupervised clustering algorithm. To meet a lower dispersion, the number of clustering result classes is reduced. To meet a higher accessibility, the number of clustering result classes is increased. In other words, dispersion tends to reduce the number of clusters, and accessibility tends to increase the number of clusters.

[0225] Therefore, we can initially set a smaller number of clusters i and gradually increase the value of i. With i as the x-axis, we plot the accessibility-number of clusters curve of the clustering results and the dispersion-number of clusters curve of the clustering results, and find the intersection of the two metrics. The number of clusters corresponding to the intersection is the number of clusters that is consistent with expert experience. The clustering result corresponding to this number of clusters is the clustering result that is consistent with expert experience.

[0226] Figure 7 It is a schematic diagram of the relationship between the dispersion of clustering results and the number of clusters.

[0227] The curve in the figure reflects how the dispersion of the clustering results changes with the number of clusters. The number of clusters can also be understood as the number of topics in the clustering results. The horizontal axis is the number of clusters, and the vertical axis is the dispersion of the clustering results, that is, the average dispersion of each common entity in the clustering results. The smaller the dispersion of the clustering results, the more consistent the clustering results are with the seed map.

[0228] Generally speaking, as the number of clusters increases, the dispersion of entities in the neighborhood structure of a common entity becomes greater.

[0229] Figure 8 It is a schematic diagram of the relationship between the accessibility of clustering results and the number of clusters.

[0230] The curve in the figure reflects the accessibility of the clustering results as the number of clusters changes. The number of clusters can also be understood as the number of topics in the clustering results. The horizontal axis is the number of clusters, and the vertical axis is the accessibility of the clustering results, which is determined by the accessibility of each class in the clustering results. The smaller the accessibility of the clustering results, the more consistent the clustering results are with the seed map.

[0231] Generally speaking, as the number of clusters decreases, the accessibility of the clustering results becomes greater.

[0232] Determine the intersection of the dispersion of the clustering results and the accessibility of the clustering results, that is, the clustering results that are consistent with the seed map.

[0233] Clustering can also be performed based on multiple preset topic quantity parameter values, and the value range of the topic quantity parameter can be further determined based on the dispersion and reachability corresponding to the clustering results, thereby determining the number of clusters and clustering results that are consistent with expert experience.

[0234] For the final clustering results, each class contains new entities and common entities, and there must be a correlation between the common entities and the new entities in the same class. Because the common entities already exist in the seed graph, the new entities can be added to the seed graph based on the correlation between the new entities and the common entities, and the seed graph can be expanded to complete the establishment of the knowledge graph.

[0235] Fig.10 The present invention is a schematic flowchart of a corpus preprocessing method.

[0236] Corpus preprocessing is used to decompose the original text corpus to obtain entities in the corpus. Entities can be represented by words or phrases. Corpus preprocessing can be performed twice.

[0237] Taking Chinese corpus as an example, before word segmentation, text cleaning can be performed to remove punctuation and convert traditional Chinese characters to simplified Chinese characters. Traditional Chinese characters in the corpus can be converted to simplified Chinese characters. Stop words can also be removed.

[0238] Stop word removal refers to the automatic filtering out of certain characters or words before or after processing natural language data (or text) in order to save storage space and improve search efficiency in information retrieval. These characters or words are called stop words. Stop words can be removed according to the stop word list.

[0239] Entities in the seed graph are represented by words, which can also be called entity words.

[0240] The first word segmentation is to complete the initial word segmentation based on the entity words in the seed graph. If the entity words in the seed graph do not appear in the text sentences of the corpus, the atomic words are decomposed according to the language rules. If the entity words in the seed graph appear in the text sentences of the corpus, the entity words in the seed graph are taken as a fixed phrase, and the corpus is segmented according to the language rules to obtain the initial word segmentation result.

[0241] After the first word segmentation, new words are formed based on the statistical regularity of the appearance of atomic words and entity words in the seed graph in the corpus text.

[0242] An atomic word or an entity word can be called an individual word. If the collocations between individual words in the initial word segmentation results appear frequently, and the individual words in the phrases formed by the collocations are closely combined, then the phrases formed by these fixed collocations are extracted to form candidate phrases. For example, for phrases formed by fixed collocations, the left and right boundary mutual information, left and right neighbor word entropy, phrase word frequency, etc. can be counted. Based on one or more of the above statistical information, the candidate phrases are determined.

[0243] The higher the mutual information value of two consecutive words X and Y, the higher the correlation between X and Y, and the greater the possibility that X and Y form a phrase; conversely, the lower the mutual information value of X and Y, the lower the correlation between X and Y, and the greater the possibility that there is a phrase boundary between X and Y. Based on the mutual information, the degree of integration within the word string is determined.

[0244] The term entropy represents a measure of the uncertainty of a random variable. Left and right entropy refers to the entropy of the left and right boundaries of a multi-word expression. The boundary outside the word string is determined based on the entropy of the left and right neighbor words.

[0245] After that, the second word segmentation is performed. The second word segmentation is completed based on the entity words and initial candidate phrases in the seed graph. During the word segmentation process, the entity words and initial candidate phrases in the seed graph are taken as a fixed phrase, and the entities in the corpus are decomposed according to the language rules. Removing common words can also be done after the second word segmentation.

[0246] After two word segmentations, we can get the processing result, that is, the processed corpus.

[0247] For ease of understanding, Fig.10 Taking two word segmentations as an example, the preprocessing method of the corpus is described. It should be noted that other processing processes can be added or some of the above processing processes can be reduced in specific applications.

[0248] Combination of the above Figures 1 to 10 The method embodiment of the present application is described below in conjunction with Figure 11 to Figure 12 , describes the device embodiment of the present application. It should be understood that the description of the method embodiment corresponds to the description of the device embodiment, so the parts not described in detail can refer to the previous method embodiment.

[0249] Fig.11 The schematic diagram of a knowledge graph establishment device provided in an embodiment of the present application is shown in FIG. 1100 , including: an acquisition module 1101 , a clustering module 1102 , a determination module 1103 , and an addition module 1104 .

[0250] The acquisition module 1101 is used to acquire corpus.

[0251] The clustering module 1102 is used to cluster the entities in the corpus to obtain a target clustering result.

[0252] The determination module 1103 is used to determine the similarity between the newly added entities in the corpus and the entities in the seed graph according to the target clustering result.

[0253] The adding module 1104 is used to add the newly added entity to the seed graph according to the similarity to establish a knowledge graph.

[0254] Optionally, the clustering module 1102 is used to cluster the entities in the corpus according to M initial cluster numbers to obtain M initial clustering results corresponding to the M initial cluster numbers, where M is a positive integer;

[0255] The determination module 1103 is further used to determine the target clustering result from the M initial clustering results according to the connection relationship between the entities in the seed graph.

[0256] Optionally, the seed graph includes common entities that are the same as entities in the corpus.

[0257] The determination module 1103 is also used to determine the dispersion and accessibility of each initial clustering result based on the connection relationship of the entities in the seed graph and each initial clustering result, the dispersion is used to represent the degree of discreteness of the neighbor structure of each common entity in the seed graph in the initial clustering result, the neighbor structure is composed of a common entity and all adjacent common entities of the common entity in the seed graph, and the accessibility is used to represent the shortest distance of the common entity in the seed graph in each class of the initial clustering result.

[0258] The determination module 1103 is further configured to determine the target clustering result from the initial clustering results according to the dispersion and the accessibility.

[0259] Optionally, the absolute value of the difference between the dispersion and accessibility of the target clustering result is the smallest among the M initial clustering results.

[0260] Optionally, the seed graph includes common entities that are the same as entities in the corpus, and the seed graph includes out-of-class entities outside the corpus.

[0261] The adding module 1104 is also used to add the out-of-class entity to the first class of the target clustering result when the out-of-class entity is located on the shortest path between two common entities in the first class of the target clustering result in the seed graph; and / or the adding module 1104 is also used to add the out-of-class entity to one or more classes in the target classification result whose entity similarity meets preset conditions based on the similarity between the common entities adjacent to the out-of-class entity in the seed graph and the entities in each class of the target classification result.

[0262] Optionally, the determination module 1103 is further used to determine an entity vector of each entity in the target clustering result, the nth bit of the entity vector indicating whether the entity belongs to the nth category in the target classification result, where n is a positive integer.

[0263] The determination module 1103 is further used to determine the distance between the vectors of the newly added entity and the entity in the seed graph, where the distance is used to represent the similarity between the newly added entity and the entity in the seed graph.

[0264] Optionally, the target classification result includes multiple classes, and the jth class among the multiple classes includes a newly added entity.

[0265] The determination module 1103 is also used to determine the jth target subgraph that is most similar to the jth class based on the similarity between the entity in the jth class and multiple subgraphs in the seed graph, each subgraph in the multiple subgraphs consisting of an entity in the seed graph and all adjacent entities of the entity in the seed graph.

[0266] The adding module 1104 is used to add the newly added entity in the j-th category to the j-th target subgraph according to the similarity.

[0267] Fig.12 12 is a schematic structural diagram of a knowledge graph establishment device provided in an embodiment of the present application. The device 1200 includes: a communication interface 1201 and a processor 1202.

[0268] The communication interface 1201 is used to obtain corpus.

[0269] The processor 1202 is used to cluster the entities in the corpus to obtain a target clustering result.

[0270] The processor 1202 is further configured to determine, based on the target clustering result, the similarity between the newly added entity in the corpus and the entity in the seed graph.

[0271] The processor 1202 is further configured to add the newly added entity to the seed graph according to the similarity to establish a knowledge graph.

[0272] Optionally, the processor 1202 is further configured to cluster the entities in the corpus according to M initial cluster numbers to obtain M initial clustering results corresponding one-to-one to the M initial cluster numbers, where M is a positive integer.

[0273] The processor 1202 is further configured to determine the target clustering result from the M initial clustering results according to the connection relationship between entities in the seed graph.

[0274] Optionally, the seed graph includes common entities that are the same as entities in the corpus,

[0275] The processor 1202 is further configured to determine the dispersion and accessibility of each of the initial clustering results according to the connection relationship of the entities in the seed graph and each of the initial clustering results, wherein the dispersion is used to represent the degree of dispersion of the neighbor structure of each common entity in the seed graph in the initial clustering result, wherein the neighbor structure is composed of a common entity and all adjacent common entities of the common entity in the seed graph, and the accessibility is used to represent the shortest distance of the common entity in the seed graph in each class of the initial clustering result;

[0276] The processor 1202 is further configured to determine the target clustering result from the initial clustering results according to the dispersion and the accessibility.

[0277] Optionally, the absolute value of the difference between the dispersion and accessibility of the target clustering result is the smallest among the M initial clustering results.

[0278] Optionally, the seed graph includes common entities that are the same as entities in the corpus, and the seed graph includes out-of-class entities outside the corpus.

[0279] Processor 1202 is also used to, when the out-of-class entity is located on the shortest path between two common entities in the first class of the target clustering result in the seed graph, add the out-of-class entity to the first class; and / or, processor 1202 is also used to, based on the similarity between the common entities adjacent to the out-of-class entity in the seed graph and the entities in each class of the target classification result, add the out-of-class entity to one or more classes in the target classification result whose entity similarity meets preset conditions.

[0280] Optionally, the processor 1202 is further configured to determine an entity vector of each entity in the target clustering result, wherein the nth bit of the entity vector indicates whether the entity belongs to the nth category in the target classification result, where n is a positive integer;

[0281] The processor 1202 is further configured to determine a distance between a vector of the newly added entity and an entity in the seed graph, wherein the distance is used to represent a similarity between the newly added entity and an entity in the seed graph.

[0282] Optionally, the target classification result includes multiple classes, and the jth class among the multiple classes includes a newly added entity.

[0283] Processor 1202 is also used to determine the jth target subgraph that is most similar to the jth class based on the similarity between the entity in the jth class and multiple subgraphs in the seed graph, each subgraph in the multiple subgraphs consisting of an entity in the seed graph and all adjacent entities of the entity in the seed graph.

[0284] The processor 1202 is further configured to, according to the similarity, add the newly added entity in the j-th category to the j-th target subgraph.

[0285] An embodiment of the present application also provides a knowledge graph establishment device, comprising: at least one processor and a communication interface, wherein the communication interface is used for the knowledge graph establishment device to exchange information with other devices, and when program instructions are executed in the at least one processor, the knowledge graph establishment device executes the above method.

[0286] An embodiment of the present application further provides a computer program storage medium, characterized in that the computer program storage medium has program instructions, and when the program instructions are directly or indirectly executed, the method in the foregoing text is implemented.

[0287] An embodiment of the present application also provides a chip system, characterized in that the chip system includes at least one processor, and when program instructions are executed in the at least one processor, the method described above is implemented.

[0288] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0289] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0290] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0291] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0292] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0293] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0294] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for establishing a knowledge graph, characterized in that: include: Get the corpus; The corpus includes new entities that are different from entities in the seed graph; Clustering entities in the corpus, and determining target clustering results according to dispersion and accessibility; Determining the similarity between the newly added entities in the corpus and the entities in the seed graph according to the target clustering result; According to the similarity, the newly added entity is added to the seed graph to establish a knowledge graph.

2. The method according to claim 1, characterized in that The clustering of entities in the corpus to obtain a target clustering result includes: According to the M initial cluster numbers, clustering the entities in the corpus to obtain M initial clustering results corresponding to the M initial cluster numbers, where M is a positive integer; The target clustering result is determined from the M initial clustering results according to the connection relationship between entities in the seed graph.

3. The method according to claim 2, characterized in that The seed graph includes common entities that are the same as entities in the corpus, Determining the target clustering result from the M initial clustering results according to the connection relationship of entities in the seed graph includes: According to the connection relationship of the entities in the seed graph and each of the initial clustering results, the dispersion and accessibility of each of the initial clustering results are determined, wherein the dispersion is used to represent the degree of dispersion of the neighbor structure of each common entity in the seed graph in the initial clustering results, wherein the neighbor structure is composed of a common entity and all adjacent common entities of the common entity in the seed graph, and the accessibility is used to represent the shortest distance of the common entity in the seed graph in each class of the initial clustering result; The target clustering result is determined from the initial clustering results according to the dispersion and the accessibility.

4. The method according to claim 3, characterized in that The absolute value of the difference between the dispersion and accessibility of the target clustering result is the smallest among the M initial clustering results.

5. The method according to any one of claims 1 to 4, characterized in that The seed graph includes common entities that are the same as entities in the corpus, the seed graph includes out-of-class entities that are outside the corpus, and the method further includes: When the out-of-class entity is located in the seed graph on the shortest path between two common entities in the first class of the target clustering result, adding the out-of-class entity to the first class; and / or, According to the similarity between the common entities adjacent to the out-of-class entity in the seed graph and the entities in each class of the target clustering result, the out-of-class entity is added to one or more classes in the target clustering result whose entity similarity meets a preset condition.

6. The method according to any one of claims 1 to 5, characterized in that Determining the similarity between the newly added entity in the corpus and the entity in the seed graph according to the target clustering result includes: Determine an entity vector of each entity in the target clustering result, wherein the nth bit of the entity vector indicates whether the entity belongs to the nth category in the target clustering result, where n is a positive integer; A distance between a vector of the newly added entity and an entity in the seed graph is determined, where the distance is used to represent a similarity between the newly added entity and the entity in the seed graph.

7. The method according to any one of claims 1 to 6, characterized in that The target clustering result includes multiple classes, and the jth class among the multiple classes includes a newly added entity. The method further includes: determining a jth target subgraph that is most similar to the jth class according to similarities between the entity in the jth class and a plurality of subgraphs in the seed graph, each of the plurality of subgraphs consisting of an entity in the seed graph and all adjacent entities of the entity in the seed graph; Adding the newly added entity to the seed graph according to the similarity includes: adding the newly added entity in the j-th category to the j-th target subgraph according to the similarity.

8. A knowledge graph building device, characterized in that: include: An acquisition module, used to acquire corpus; the corpus includes new entities that are different from entities in the seed graph; A clustering module, used to cluster entities in the corpus and determine target clustering results according to dispersion and accessibility; A determination module, used to determine the similarity between the newly added entities in the corpus and the entities in the seed graph according to the target clustering result; An adding module is used to add the newly added entity to the seed graph according to the similarity to establish a knowledge graph.

9. The device according to claim 8, characterized in that The clustering module is used to cluster the entities in the corpus according to the M initial cluster numbers to obtain M initial clustering results corresponding to the M initial cluster numbers, where M is a positive integer; The determination module is also used to determine the target clustering result from the M initial clustering results according to the connection relationship between entities in the seed graph.

10. The device according to claim 9, characterized in that The seed graph includes common entities that are the same as entities in the corpus, The determination module is further used to determine the dispersion and accessibility of each of the initial clustering results according to the connection relationship of the entities in the seed graph and each of the initial clustering results, wherein the dispersion is used to represent the degree of dispersion of the neighbor structure of each common entity in the seed graph in the initial clustering results, wherein the neighbor structure is composed of a common entity and all adjacent common entities of the common entity in the seed graph, and the accessibility is used to represent the shortest distance of the common entity in the seed graph in each class of the initial clustering result; The determination module is further configured to determine the target clustering result from the initial clustering results according to the dispersion and the accessibility.

11. The device according to claim 10, characterized in that The absolute value of the difference between the dispersion and accessibility of the target clustering result is the smallest among the M initial clustering results.

12. The device according to any one of claims 8 to 11, characterized in that The seed graph includes common entities that are the same as entities in the corpus, and the seed graph includes out-of-class entities that are outside the corpus, The adding module is further configured to, when the out-of-class entity is located in the seed graph on the shortest path between two common entities in the first class of the target clustering result, add the out-of-class entity to the first class; and / or, The adding module is also used to add the out-of-class entity to one or more classes in the target clustering result whose entity similarity meets preset conditions based on the similarity between the common entities adjacent to the out-of-class entity in the seed graph and the entities in each class of the target clustering result.

13. The device according to any one of claims 8 to 12, characterized in that The determination module is further used to determine an entity vector of each entity in the target clustering result, wherein the nth bit of the entity vector indicates whether the entity belongs to the nth category in the target clustering result, where n is a positive integer; The determination module is further used to determine a distance between a vector of the newly added entity and an entity in the seed graph, wherein the distance is used to represent a similarity between the newly added entity and an entity in the seed graph.

14. The device according to any one of claims 8 to 13, characterized in that The target clustering result includes multiple classes, and the jth class among the multiple classes includes a newly added entity. The determination module is further used to determine, based on the similarity between the entity in the j-th class and a plurality of subgraphs in the seed graph, a j-th target subgraph that is most similar to the j-th class, wherein each subgraph in the plurality of subgraphs is composed of an entity in the seed graph and all adjacent entities of the entity in the seed graph; The adding module is used to add the newly added entity in the j-th category to the j-th target subgraph according to the similarity.

15. A knowledge graph building device, characterized in that: include: At least one processor and a communication interface, wherein the communication interface is used for the knowledge graph establishment device to exchange information with other devices, and when program instructions are executed in the at least one processor, the knowledge graph establishment device executes any one of the methods of claims 1-7.

16. A computer program storage medium, characterized in that: The computer program storage medium has program instructions, and when the program instructions are directly or indirectly executed, the method of any one of claims 1 to 7 is executed.

17. A chip system, characterized in that: The system comprises at least one processor, and when the program instructions are executed in the at least one processor, the method of any one of claims 1 to 7 is executed.

Citation Information

Patent Citations

  • Method and system used for generating knowledge graphs

    CN106355627A

  • Chinese knowledge graph construction method and system

    CN108376160A