Knowledge graph entity linking method, device and electronic device based on neural network
By using graph convolutional neural networks and recurrent neural networks in knowledge graph entity linking, combined with the joint attention mechanism, the problem of ignoring the semantic gap in entity linking methods in the existing technology is solved, and the accuracy and recall rate of entity linking are improved.
Patent Information
- Application Number
- CN202111336125.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-11
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2041-11-11
AI Technical Summary
The existing knowledge graph entity linking method based on neural network ignores the semantic gap between the sequential entity referent context and the graph structured entity context, and does not consider the importance of the content in the entity referent context and the entity context, which affects the entities. Link accuracy.
Use graph convolutional neural network to model entities, combine it with recurrent neural network and joint attention mechanism, use the context and relationship of entities and the graph structure relationship of neighboring entities, consider the importance of entity referents and entity contexts, and establish entity references. The correlation model between items and entity contexts solves the problem of data redundancy.
Through the combination of graph convolutional neural network, recurrent neural network and joint attention mechanism, the accuracy and recall rate of knowledge graph entity links are improved, and the semantic gap between graph structured entities and sequential entity referent contexts is bridged.
Smart Images

Figure CN114297398B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data mining and natural language processing, and in particular to a knowledge graph entity linking method, device and electronic device based on a neural network. Background Art
[0002] Existing knowledge graph-oriented entity linking work often relies on manually designed features for entity linking, which has the problem of sparse features and difficulty in adjustment. Some literature proposes an entity linking method for knowledge graphs that uses neural networks to automatically learn data features.
[0003] However, existing neural network-based knowledge graph entity linking methods ignore the semantic gap between the sequential entity referent context and the graph-structured entity context, and do not consider the importance of the content in the entity referent context and the entity context, which affects the accuracy of entity linking. Summary of the invention
[0004] In view of this, the purpose of this application is to propose a knowledge graph entity linking method, device and electronic device based on neural network to solve or partially solve the above-mentioned technical problems.
[0005] Based on the above objectives, the first aspect of the present application provides a knowledge graph entity linking method based on a neural network, comprising:
[0006] Collect the text where the entity refers to, and obtain the relationship-entity pair set of the knowledge graph;
[0007] Inputting the text and the relationship-entity pair set into a knowledge graph entity linking model, wherein the knowledge graph entity linking model is a trained comprehensive neural network model;
[0008] The knowledge graph entity linking model processes the text and the relationship-entity pair set to obtain knowledge graph entity links.
[0009] The second aspect of the present application provides a knowledge graph entity linking device based on a neural network, comprising:
[0010] The data collection module is used to collect the text where the entity refers to and obtain the relationship-entity pair set of the knowledge graph;
[0011] A data input module, used for inputting the text and the relationship-entity pair set into a knowledge graph entity linking model, wherein the knowledge graph entity linking model is a trained comprehensive neural network model;
[0012] A data processing module is used for the knowledge graph entity linking model to process the text and the relationship-entity pair set to obtain knowledge graph entity links.
[0013] A third aspect of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the first aspect when executing the program.
[0014] As can be seen from the above, the neural network-based knowledge graph entity linking method, device and electronic device provided by the present application use a graph convolutional neural network to model entities by utilizing the context and relationship of entities in the knowledge graph and the graph structure relationship of neighboring entities. In this way, the semantic gap between graph-structured entities and sequential entity referent contexts is bridged. Relationship-entity pairs with importance marks of the target entity are introduced, and a recurrent neural network is used to encode the entity referent and entity context, and a correlation model between the entity referent context and the entity context is established using a common attention mechanism. In this way, the difference in importance within the entity referent context and the entity context is taken into account in the generation process of knowledge graph entity links, and the advantages of recurrent neural networks in processing sequence data are utilized to solve the data redundancy problem in the construction of relationship-entity pair sets in the knowledge graph. In this way, the accuracy and recall rate of the knowledge graph linking method are improved by combining graph convolutional neural networks, recurrent neural networks and common attention mechanisms. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions in the present application or related technologies, the drawings required for use in the embodiments or related technical descriptions are briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0016] Figure 1 This is a flow chart of the knowledge graph entity linking method based on neural network according to an embodiment of the present application;
[0017] Figure 2 This is a flow chart of the knowledge graph entity linking model training in an embodiment of the present application;
[0018] Figure 3 This is an initial flow chart of the knowledge graph entity linking model of an embodiment of the present application;
[0019] Figure 4 A flowchart for generating a context vector according to an embodiment of the present application;
[0020] Figure 5A flowchart for generating a relationship-entity pair vector according to an embodiment of the present application;
[0021] Figure 6 A flow chart for generating a correlation matrix for an embodiment of the present application;
[0022] Figure 7 A weight vector and a vector generation flow chart for an embodiment of the present application;
[0023] Figure 8 A flow chart for generating weights and vectors of relationship-entity pairs according to an embodiment of the present application;
[0024] Fig. 9 This is a structural block diagram of a knowledge graph entity linking device based on a neural network according to an embodiment of the present application;
[0025] Fig.10 A structural diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0026] In order to make the objectives, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.
[0027] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present application should be understood by people with ordinary skills in the field to which the present application belongs. The "first", "second" and similar words used in the embodiments of the present application do not represent any order, quantity or importance, but are only used to distinguish different components. "Including" or "comprising" and similar words mean that the elements or objects appearing in front of the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect.
[0028] Knowledge graph-oriented entity linking aims to link entity references in text to target entities in a given knowledge graph. For example, given the sentence "In 2016, Michael Jordan was identified as the most influential computer scientist, based on an analysis of..." and the entity reference "Michael Jordan" in it, the purpose of knowledge graph-oriented entity linking is to link the entity reference "Michael Jordan" to the target entity Michael I. Jordan (Berkeley Professor) in the given knowledge graph, rather than the entity Michael Jordan (NBA Player).
[0029] Existing knowledge graph-oriented entity linking works often rely on manually designed features for entity linking, which has the problem of sparse features and difficulty in adjustment. Existing literature proposes knowledge graph-oriented entity linking methods that use neural networks to automatically learn data features. However, these works ignore the semantic gap between the sequential entity referent context and the graph-structured entity context, and there is a data redundancy problem in the construction of entity context, which affects the accuracy of entity linking. On the other hand, according to the following two observations: 1) The context of an entity in a knowledge graph is usually represented by the relations and neighbor entities directly connected to the entity in the form of a graph structure. Therefore, the entity context can be represented as a set of relation-entity pairs; 2) The same entity referent often focuses on different relation-entity pairs of the target entity in different contexts, that is, the importance of the relation-entity pair is different. In addition, the contribution of words in the entity referent context to the entity referent is also different. In addition, the contribution of words in the entity referent context is also different.
[0030] like Figure 1 As shown, the method of this embodiment includes:
[0031] Step 101, collect the text where the entity refers to the term, and obtain the relationship-entity pair set of the knowledge graph.
[0032] In this step, entity referents are the basic units in the text and are also important language units that carry information in the text. For example, given the text "In 2016, Michael Jordan was identified as the most influential computer scientist, based on an analysis of...", the entity referents include "Michael Jordan". The knowledge graph is a large knowledge base that provides intelligent search services, and can also be understood as a formal description framework for semantic knowledge. For example, Wikipedia ConceptNet, DeepDive, NELL, Probase, Wikidata, XLORE, CNDBpedia. The relationship-entity pair set refers to a way of representing entity context.
[0033] In the above scheme, in order to meet the needs of the subsequent knowledge graph entity linking model, the text and knowledge graph where the entity referent is located are collected to obtain the input data of the knowledge graph entity linking model. In this way, the obtained text and relationship-entity pair set provide the data basis for the subsequent generation of knowledge graph entity links.
[0034] Step 102: input the text and the relationship-entity pair set into a knowledge graph entity linking model, wherein the knowledge graph entity linking model is a trained comprehensive neural network model.
[0035] In this step, the knowledge graph entity linking model refers to a comprehensive neural network model built based on the recurrent neural network structure and the graph convolutional neural network structure.
[0036] In the above scheme, in order to process the collected text and knowledge graph, the text and knowledge graph are input into the knowledge graph entity linking model. In this way, the knowledge graph entity linking model can obtain input data that meets the requirements and provide valid data for the generation of knowledge graph entity links.
[0037] Step 103: The knowledge graph entity linking model processes the text and the relationship-entity pair set to obtain knowledge graph entity links.
[0038] In this step, knowledge graph entity linking refers to the task of linking the entity references mentioned in the text with the corresponding entities in the knowledge graph, which is to resolve the ambiguity problem between entities.
[0039] In the above scheme, in order to generate knowledge graph entity links, the knowledge graph entity link model processes the input text and knowledge graph. In this way, through the recurrent neural network, joint attention mechanism and graph convolutional neural network in the knowledge graph entity link model, the semantic gap between graph structured entities and sequential entity referent contexts is bridged, the difference in importance between entity referent contexts and entity contexts is taken into account, and the accuracy of knowledge graph entity link generation is improved.
[0040] Through the above scheme, the entities are modeled using graph convolutional neural networks by utilizing the graph structure relationship between the context and relationship of entities and neighboring entities in the knowledge graph. In this way, the semantic gap between graph-structured entities and sequential entity referent contexts is bridged. The target entity is introduced with a relationship-entity pair with importance mark, and a recurrent neural network is used to encode the entity referent and entity context, and a correlation model between the entity referent context and the entity context is established using a joint attention mechanism. In this way, the difference in importance within the entity referent context and the entity context is considered in the generation process of knowledge graph entity links, and the advantages of recurrent neural networks in processing sequential data are used to solve the data redundancy problem in the construction of relationship-entity pair sets in the knowledge graph. In this way, the accuracy and recall rate of the knowledge graph linking method are improved by combining graph convolutional neural networks, recurrent neural networks and joint attention mechanisms.
[0041] In some embodiments, Figure 2 As shown, the knowledge graph entity linking model is a trained comprehensive neural network model, specifically including:
[0042] Step 201 : collect sample texts containing sample entity reference items as a sample set.
[0043] In this step, the sample set is divided into training set, validation set and test set. For example, AIDA-CoNLL is one of the largest annotated datasets for entity linking and is divided into training set (AIDA-train), validation set (AIDA-a) and test set (AIDA-b), containing 946, 216 and 231 documents respectively.
[0044] In the above scheme, in order to train the initial neural network model, a large amount of text is collected as a sample set. In this way, it can be ensured that the trained initial neural network model meets the requirements of the knowledge graph entity linking model.
[0045] Step 202, constructing an initial neural network model of the comprehensive neural network model based on a recurrent neural network structure and a graph convolutional neural network structure.
[0046] In this step, the recurrent neural network structure refers to a type of recurrent neural network that takes sequence data as input, recursively in the direction of sequence evolution, and all nodes (recurrent units) are connected in a chain. The graph convolutional neural network structure refers to a neural network structure that applies convolution operations to a graph structure.
[0047] In the above scheme, in order to initialize the knowledge graph entity linking model, the recurrent neural network structure and the graph convolutional neural network structure are used to establish the initial neural network model. In this way, by establishing the initial neural network model, a model basis is provided for the application of the sample set.
[0048] Step 203: Use the sample set to train the initial neural network model to obtain the knowledge graph entity linking model.
[0049] In this step, the sample set is used to train the initial neural network model until the number of training times reaches a predetermined number, and the initial neural network model after training is used as the knowledge graph entity connection model. In order to effectively train the model, the following ranking type loss function is designed:
[0050] Loss=∑max(0,1-sim(m,e)+sim(m,e'))
[0051] Among them, Loss represents the ranking type loss function, m represents an entity referent, e represents the target entity, e' represents the perturbation entity randomly selected from the entity set, and sim represents the semantic similarity function. The basic principle behind the loss function is that the similarity score of the target entity should be greater than the score of the randomly selected perturbation entity, which is set to be at least 1 point greater here. The optimization algorithm uses the Adam function.
[0052] As a common practice in neural network models, the 300-dimensional case-sensitive word vectors provided by the literature are used to initialize the bidirectional long short-term memory network and the long short-term memory network in the recurrent neural network. For words that do not appear in the word vector, random initialization is used. The word vector is fixed during training, and only the neural network parameters are learned. For hyperparameters, the learning rate is selected in the range of {0.01, 0.005, 0.001}, the hidden state vector dimension k is selected in the range of {100, 200, 300}, and the batch size B is selected in the range of {10, 50, 100}. Dropout is used to prevent overfitting, and the dropout position is the previous layer of the output layer of the bidirectional long short-term memory network and the long short-term memory network in the recurrent neural network model. The model is trained on the AIDA-train dataset, the parameters are adjusted on the validation set AIDA-a dataset, and tested on the AIDA-b dataset and other datasets. In order to improve computational efficiency, candidate entities are screened and only candidate entities with semantic similarity higher than 0.05 are retained. The parameters of the knowledge graph entity linking model after training are: learning rate is 0.001, word vector dimension is 300, hidden state vector dimension is .00, batch size is 100, and dropout rate is 0.5.
[0053] In the above scheme, in order to generate the knowledge graph entity linking model, the sample set is used to train the initial neural network model. In this way, the initial neural network model is trained based on the ranking loss function to obtain the parameters of the knowledge graph entity linking model, so that the knowledge graph entity linking model can effectively process the text in the test set.
[0054] Through the above scheme, an initialized neural network model is constructed based on the recurrent neural network structure and the graph structure neural network structure, the training of the initial neural network model is completed through the training set in the sample set, and the parameters of the initial neural network model are adjusted through the verification set, so as to obtain a knowledge graph entity linking model that can effectively complete the knowledge graph entity linking process.
[0055] In some embodiments, step 202 is as follows Figure 3 As shown, specifically including:
[0056] Step 301: Using the recurrent neural network structure, a first recurrent neural network and a second recurrent neural network are configured.
[0057] In this step, the recurrent neural network structure refers to a type of recurrent neural network that takes sequence data as input, recursively in the direction of sequence evolution, and all nodes (recurrent units) are connected in a chain.
[0058] In the above scheme, in order to initialize the first recurrent neural network model and the second recurrent neural network model in the initial neural network model, the first recurrent neural network model and the second recurrent neural network model are configured using a recurrent neural network structure. In this way, the outputs of the initialized first recurrent neural network model and the second recurrent neural network model can be used as inputs for the remaining parts of the initial neural network model, which is also convenient for the subsequent training of the initial neural network model.
[0059] Step 302: Utilize the graph convolutional neural network structure to configure a graph convolutional neural network.
[0060] In this step, the graph convolutional neural network structure refers to a neural network structure that applies convolution operations to a graph structure.
[0061] In the above scheme, in order to initialize the graph convolutional neural network model in the initial neural network model, the graph convolutional neural network model is configured using a graph convolutional neural network structure. In this way, the output of the initialized graph convolutional neural network model can be used as the input of the remaining part of the initial neural network model, which is also convenient for the subsequent training of the initial neural network model.
[0062] Step 303: input the sample set and the relationship-entity pair set into the pre-built initial neural network model.
[0063] In this step, the sample set is divided into training set, validation set and test set. For example, AIDA-CoNLL (a common public dataset for entity disambiguation and entity linking, which was published in the paper Robust Disambiguation of Named Entities in Text of EMNLP2011. It contains the representations of entities assigned to named entities annotated for the original CoNLL 2003 entity recognition task.) is one of the largest annotated datasets for entity linking, which is divided into training set, validation set and test set, containing 946, 216 and 231 documents respectively.
[0064] In the above scheme, in order to train the first recurrent neural network model and the second recurrent neural network model, the sample set is input into the first recurrent neural network model, and the relationship-entity pair set is input into the second recurrent neural network model. In this way, the sample set and the relationship-entity pair set constitute the training data basis of the initial neural network model, which is convenient for the subsequent training of the initial neural network model and the generation of the knowledge graph entity linking model.
[0065] Step 304: Use the first recurrent neural network to encode the context in which the sample entity referent is located to obtain a context vector of the context.
[0066] In this step, each word in the context of the entity referent is mapped to a low-dimensional real-valued vector by querying the word vector dictionary, thereby obtaining a sequence of entity referent context word vectors, and the word vector sequence is input into the first recurrent neural network to obtain the context vector of each word. For example, usually, the context of entity referent m is the sentence in which m is located, which can be represented as ctx m ={w 1 ,w 2 ,...,w Tm}, where T m Indicates the length of the sentence where the entity referent m is located.
[0067] In the above scheme, in order to meet the needs of subsequent joint attention mechanism processing, the first recurrent neural network is used to encode the context of the entity reference. In this way, the advantage of recurrent neural networks in processing sequence data is utilized to solve the data redundancy problem in text construction.
[0068] In some embodiments, Figure 4 As shown, the first recurrent neural network is used to encode the context in which the sample entity referent is located, specifically including:
[0069] Step 401, mapping the word sequence of the context into a first word vector sequence by querying a word vector dictionary.
[0070] In this step, the query word vector dictionary maps each word in the context of the entity referent into a low-dimensional real-valued vector, thereby obtaining the first word vector sequence
[0071] In the above scheme, in order to meet the input needs of the subsequent first recurrent neural network, the first word vector sequence is generated by querying the word vector dictionary. In this way, the data basis is provided for the first recurrent neural network by generating the first word vector sequence.
[0072] Step 402: input the first word vector sequence into the first recurrent neural network.
[0073] Step 403: The first recurrent neural network encodes the word vector sequence and outputs a first hidden state vector.
[0074] In this step, the word vector sequence is input into the recurrent neural network to obtain the context vector of each word, namely:
[0075]
[0076]
[0077] Among them, different W and b represent the weight matrix and bias vector in the network respectively, and f(·) represents the nonlinear activation function of the hidden layer, such as sigmoid. The entity referent item context matrix is obtained by superimposing the word context vector, that is, in k represents the hidden state dimension.
[0078] In the above scheme, in order to meet the needs of subsequent joint attention mechanism processing, the first recurrent neural network is used to encode the context of the entity reference. In this way, the advantage of recurrent neural networks in processing sequence data is utilized to solve the data redundancy problem in text construction.
[0079] Step 404: Use the first hidden state vector as the context vector.
[0080] Through the above scheme, in order to meet the needs of subsequent joint attention mechanism processing, the entity reference item context is processed into the first word vector sequence by querying the word vector dictionary, and the first word vector sequence is encoded using the first recurrent neural network to obtain the context vector. In this way, the advantage of recurrent neural networks in processing sequence data is used to solve the data redundancy problem in the text structure where the entity reference item is located.
[0081] Step 305: Use the second recurrent neural network to encode the relationship-entity pair set to obtain a relationship-entity pair vector of the relationship-entity pair set.
[0082] In this step, the context of an entity e in the knowledge graph is often composed of a set of relation-entity pairs connected to e, that is, Where T e The total number of relation-entity pairs representing entity e. Each relation-entity pair p j Can be considered as a sequence of words where z j Indicates p j For example, (occupation, Computer Scientist) is a relation-entity pair for the entity Michael Irwin Jordan and can be represented as the word sequence {occupation Computer Scientist}.
[0083] In the above scheme, in order to meet the needs of subsequent joint attention mechanism processing, a second recurrent neural network is used to encode the relationship-entity pair set. In this way, the advantages of recurrent neural networks in processing sequence data are utilized to solve the data redundancy problem in the construction of relationship-entity pair sets in the knowledge graph.
[0084] In some embodiments, Figure 5As shown, the second recurrent neural network is used to encode the relationship-entity pair set, specifically including:
[0085] Step 501, mapping the word sequence in the relationship-entity pair set to a second word vector sequence by querying the word vector dictionary.
[0086] In this step, the word vector sequence of each word in the relation-entity pair is obtained by querying the word vector dictionary, that is,
[0087] In the above scheme, in order to meet the input needs of the subsequent second recurrent neural network, the second word vector sequence is generated by querying the word vector dictionary. In this way, the second word vector sequence is generated to provide a data basis for the second recurrent neural network.
[0088] Step 502: input the second word vector sequence into the second recurrent neural network.
[0089] Step 503: The second recurrent neural network encodes the second word vector sequence and outputs a second hidden state vector.
[0090] In this step, the second recurrent neural network is used to encode each relation-entity pair in the entity context, and the hidden state vector at the last moment is output as the relation-entity representation vector, that is:
[0091]
[0092]
[0093] Among them, σ represents the sigmoid function, and different W and b represent the weight matrix and bias vector of the network. On this basis, the entity context matrix is obtained by superimposing the relationship-entity representation vector, that is, in k represents the dimension of the hidden state vector.
[0094] In the above scheme, in order to meet the needs of subsequent joint attention mechanism processing, a second recurrent neural network is used to encode the relationship-entity pair set. In this way, the advantage of recurrent neural networks in processing sequence data is utilized to solve the data redundancy problem in text construction.
[0095] Step 504: Use the second hidden state vector as the relationship-entity pair vector.
[0096] Through the above scheme, in order to meet the needs of subsequent joint attention mechanism processing, the relationship-entity pair set is processed into a second word vector sequence by querying the word vector dictionary, and the second word vector sequence is encoded using a second recurrent neural network to obtain a relationship-entity pair vector. In this way, the advantages of recurrent neural networks in processing sequence data are used to solve the data redundancy problem in the construction of relationship-entity pair sets in the knowledge graph.
[0097] Step 306, using a common attention mechanism to establish a correlation matrix between the context vector and the relationship-entity pair vector, and processing the correlation matrix in a weighted summation manner to obtain a weight vector and a vector.
[0098] In some embodiments, Figure 6 As shown, the common attention mechanism is used to establish a correlation matrix between the context vector and the relationship-entity pair vector, specifically including:
[0099] Step 601, using a common attention mechanism to calculate the similarity between the context vector and the relationship-entity pair vector to obtain a similarity matrix.
[0100] In this step, the similarity matrix refers to the matrix composed of the similarities between the context vector and the relation-entity vector. The similarity matrix expression is Where T represents the matrix transpose symbol, is a weight matrix.
[0101] In the above scheme, by utilizing the characteristic that the similarity matrix only needs to generate a weight matrix and does not need to perform a dot product operation, a more flexible calculation of the similarity between the entity referent context and the relationship-entity pair is achieved.
[0102] Step 602, normalize the similarity matrix to obtain a correlation matrix.
[0103] In this step, the similarity matrix is normalized in the row direction and the column direction to generate the correlation matrix of the context vector and the relation-entity pair vector, namely:
[0104] A r =softmax(A);
[0105] Among them, A r is the correlation matrix of the context vector, A c is the correlation matrix of relation-entity pair vectors.
[0106] In the above scheme, in order to meet the input needs of the subsequent graph convolutional neural network, a correlation matrix is generated through a standardized operation. In this way, the data basis is provided for the graph convolutional neural network by generating a correlation matrix.
[0107] In some embodiments, Figure 7 As shown, the correlation matrix is processed by weighted summation to obtain a weight vector and a vector, specifically including:
[0108] Step 701: Calculate a first weight vector of the context vector using the correlation matrix.
[0109] In this step, the correlation matrix A of the entity referent context vector is used r The first weight vector for calculating the context vector is
[0110] Step 702: Process the first weight vector by weighted summation to obtain a weight vector and a vector.
[0111] In this step, the weight vector and vector are obtained by weighted summation.
[0112] Through the above scheme, the similarity matrix is used to flexibly calculate the similarity between the entity referent context and the relationship-entity pair set, and the correlation matrix is generated through standardization operations to facilitate the subsequent graph convolutional neural network to process the graph structure data.
[0113] Step 307: Using the correlation matrix, the graph convolutional neural network is used to process the relationship-entity pair vector to obtain the relationship-entity pair weight and vector.
[0114] In some embodiments, step 307 is as follows Figure 8 As shown, specifically including:
[0115] Step 801, calculating a second weight vector of the relationship-entity pair vector using the correlation matrix;
[0116] In this step, the correlation matrix A of the relation-entity pair vector is used c The second weight vector of the relationship-entity pair vector is calculated as
[0117] Step 802, processing the second weight vector and the relationship-entity pair vector by weighted summation to obtain a relationship-entity pair weight vector;
[0118] In this step, the relation-entity pair weight vector is obtained by weighted summation in, is the weight matrix.
[0119] Step 803: Use the graph convolutional neural network to process the relationship-entity pair weight vector to obtain the relationship-entity pair weight and vector.
[0120] In this step, a graph convolutional neural network is used to train the weight vector of the relation-entity pair Processing to obtain the relationship-entity pair weights and vectors Among them, σ represents the nonlinear activation function ReLU.
[0121] Step 308: Using cosine similarity, calculate the semantic similarity between the weight vector and the vector and the relationship-entity pair weight and vector to obtain a semantic similarity matrix.
[0122] In this step, the cosine similarity is used to calculate the semantic similarity between the two, namely:
[0123] sim(m,e)=cosine(V m ,V e )
[0124] Among them, sim is the semantic similarity function and cosine is the cosine function.
[0125] Step 309, selecting the knowledge graph entity link corresponding to the position with the largest value in the semantic similarity matrix as the output of the initial neural network model.
[0126] Through the above scheme, the knowledge graph entity linking model is initialized based on the recurrent neural network structure and the graph convolutional neural network structure, which facilitates the subsequent application of sample sets to complete the training process.
[0127] It should be noted that the method of the embodiment of the present application can be performed by a single device, such as a computer or server. The method of this embodiment can also be applied to a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only perform one or more steps in the method of the embodiment of the present application, and the multiple devices will interact with each other to complete the described method.
[0128] It should be noted that the above describes some embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the above embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0129] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a knowledge graph entity linking device based on a neural network.
[0130] refer to Fig. 9 , the neural network-based knowledge graph entity linking device comprises:
[0131] The data collection module 901 is used to collect the text where the entity referent is located and obtain the relationship-entity pair set of the knowledge graph.
[0132] The data input module 902 is used to input the text and the relationship-entity pair set into a knowledge graph entity linking model, wherein the knowledge graph entity linking model is a trained comprehensive neural network model.
[0133] The data processing module 903 is used for the knowledge graph entity linking model to process the text and the relationship-entity pair set to obtain the knowledge graph entity link.
[0134] For the convenience of description, the above device is described in terms of functions divided into various modules. Of course, when implementing the present application, the functions of each module can be implemented in the same or multiple software and / or hardware.
[0135] The device of the above embodiment is used to implement the corresponding neural network-based knowledge graph linking method in any of the above embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0136] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments and methods, the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the neural network-based knowledge graph entity linking method described in any of the above embodiments is implemented.
[0137] Fig.10 A more specific schematic diagram of the hardware structure of an electronic device provided in this embodiment is shown, and the device may include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are connected to each other through the bus 1050 in the device.
[0138] The processor 1010 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.
[0139] The memory 1020 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 may store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program codes are stored in the memory 1020 and are called and executed by the processor 1010.
[0140] The input / output interface 1030 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.
[0141] The communication interface 1040 is used to connect a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through a wired mode (such as USB, network cable, etc.) or a wireless mode (such as mobile network, WIFI, Bluetooth, etc.).
[0142] The bus 1050 includes a path that transmits information between the various components of the device (eg, the processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040).
[0143] It should be noted that, although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040 and the bus 1050, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include the components necessary for implementing the embodiments of the present specification, and does not necessarily include all the components shown in the figure.
[0144] The electronic device of the above-mentioned embodiment is used to implement the corresponding neural network-based knowledge graph entity linking method in any of the above-mentioned embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0145] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present application (including the claims) is limited to these examples. In line with the concept of the present application, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present application as described above, which are not provided in detail for the sake of simplicity.
[0146] In addition, to simplify the description and discussion, and in order not to make the embodiments of the present application difficult to understand, the known power supply / ground connection with the integrated circuit (IC) chip and other components may or may not be shown in the provided drawings. In addition, the device can be shown in the form of a block diagram to avoid making the embodiments of the present application difficult to understand, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform to be implemented in the embodiments of the present application (that is, these details should be fully within the scope of understanding of those skilled in the art). In the case of elaborating specific details (e.g., circuits) to describe exemplary embodiments of the present application, it is obvious to those skilled in the art that the embodiments of the present application can be implemented without these specific details or when these specific details are changed. Therefore, these descriptions should be considered to be illustrative rather than restrictive.
[0147] Although the present application has been described in conjunction with specific embodiments of the present application, many replacements, modifications and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed.
[0148] The embodiments of the present application are intended to cover all such substitutions, modifications and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present application should be included in the scope of protection of the present application.
Claims
1. A knowledge graph entity linking method based on neural network, characterized in that: include: Collect the text where the entity refers to, and obtain the relationship-entity pair set of the knowledge graph; Inputting the text and the relationship-entity pair set into a knowledge graph entity linking model, wherein the knowledge graph entity linking model is a trained comprehensive neural network model; The knowledge graph entity linking model processes the text and the relationship-entity pair set to obtain a knowledge graph entity link; The knowledge graph entity linking model is a trained comprehensive neural network model, including: Collect sample texts containing sample entity referents as sample sets; Using the recurrent neural network structure, a first recurrent neural network and a second recurrent neural network are configured; Using the graph convolutional neural network structure, a graph convolutional neural network is configured; Inputting the sample set and the relationship-entity pair set into a pre-built initial neural network model; Using the first recurrent neural network to encode the context in which the sample entity referent is located to obtain a context vector of the context; Using the second recurrent neural network to encode the relationship-entity pair set to obtain a relationship-entity pair vector of the relationship-entity pair set; A co-attention mechanism is used to establish a correlation matrix between the context vector and the relationship-entity pair vector, and the correlation matrix is processed by weighted summation to obtain a weight vector and a vector; Using the correlation matrix, the graph convolutional neural network is used to process the relationship-entity pair vector to obtain the relationship-entity pair weight and vector; Calculating the semantic similarity between the weight vector and the vector and the relationship-entity pair weight and vector using cosine similarity to obtain a semantic similarity matrix; Selecting the knowledge graph entity link corresponding to the position with the largest value in the semantic similarity matrix as the output of the initial neural network model; Using the sample set to train the initial neural network model to obtain the knowledge graph entity linking model; The adopting the second recurrent neural network to encode the relationship-entity pair set includes: Mapping the word sequence in the relationship-entity pair set to a second word vector sequence by querying a word vector dictionary; Inputting the second word vector sequence into the second recurrent neural network; The second recurrent neural network encodes the second word vector sequence and outputs a second hidden state vector; The second hidden state vector is used as the relationship-entity pair vector.
2. The method according to claim 1, characterized in that The using the first recurrent neural network to encode the context in which the sample entity referent is located includes: Mapping the word sequence of the context into a first word vector sequence by querying a word vector dictionary; Inputting the first word vector sequence into the first recurrent neural network; The first recurrent neural network encodes the word vector sequence and outputs a first hidden state vector; The first hidden state vector is used as the context vector.
3. The method according to claim 1, characterized in that The adopting of the common attention mechanism to establish a correlation matrix between the context vector and the relationship-entity pair vector includes: Using a common attention mechanism to calculate the similarity between the context vector and the relation-entity pair vector to obtain a similarity matrix; The similarity matrix is normalized to obtain the correlation matrix.
4. The method according to claim 1, characterized in that: The correlation matrix is processed in a weighted summation manner to obtain a weight vector and a vector, including: Calculating a first weight vector of the context vector using the correlation matrix; The first weight vector is processed in a weighted summation manner to obtain a weight vector and a vector.
5. The method according to claim 4, characterized in that The method of using the correlation matrix and the graph convolutional neural network to process the relationship-entity pair vector to obtain the relationship-entity pair weight and vector includes: Calculating a second weight vector of the relationship-entity pair vector using the correlation matrix; Processing the second weight vector and the relationship-entity pair vector in a weighted summation manner to obtain a relationship-entity pair weight vector; The graph convolutional neural network is used to process the relationship-entity pair weight vector to obtain the relationship-entity pair weight and vector.
6. A knowledge graph entity linking device based on neural network, characterized in that: include: The data collection module is used to collect the text where the entity refers to and obtain the relationship-entity pair set of the knowledge graph; A data input module, used for inputting the text and the relationship-entity pair set into a knowledge graph entity linking model, wherein the knowledge graph entity linking model is a trained comprehensive neural network model; A data processing module, used for the knowledge graph entity linking model to process the text and the relationship-entity pair set to obtain a knowledge graph entity link; The knowledge graph entity linking model is a trained comprehensive neural network model, including: Collect sample texts containing sample entity referents as sample sets; Using the recurrent neural network structure, a first recurrent neural network and a second recurrent neural network are configured; Using the graph convolutional neural network structure, a graph convolutional neural network is configured; Inputting the sample set and the relationship-entity pair set into a pre-built initial neural network model; Using the first recurrent neural network to encode the context in which the sample entity referent is located to obtain a context vector of the context; Using the second recurrent neural network to encode the relationship-entity pair set to obtain a relationship-entity pair vector of the relationship-entity pair set; A co-attention mechanism is used to establish a correlation matrix between the context vector and the relationship-entity pair vector, and the correlation matrix is processed by weighted summation to obtain a weight vector and a vector; Using the correlation matrix, the graph convolutional neural network is used to process the relationship-entity pair vector to obtain the relationship-entity pair weight and vector; Calculating the semantic similarity between the weight vector and the vector and the relationship-entity pair weight and vector using cosine similarity to obtain a semantic similarity matrix; Selecting the knowledge graph entity link corresponding to the position with the largest value in the semantic similarity matrix as the output of the initial neural network model; Using the sample set to train the initial neural network model to obtain the knowledge graph entity linking model; The adopting the second recurrent neural network to encode the relationship-entity pair set includes: Mapping the word sequence in the relationship-entity pair set to a second word vector sequence by querying a word vector dictionary; Inputting the second word vector sequence into the second recurrent neural network; The second recurrent neural network encodes the second word vector sequence and outputs a second hidden state vector; The second hidden state vector is used as the relationship-entity pair vector.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 5 is implemented.
