Entity linking method and apparatus

By incorporating relevant information from document and knowledge bases into the query statement, the task is transformed into a multiple-choice reading comprehension task. This solves the problem of low recall accuracy caused by short query statements and achieves more accurate entity linking.

CN115186105BActive Publication Date: 2026-06-02BEIJING LONGZHI DIGITAL TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING LONGZHI DIGITAL TECH CO LTD
Filing Date
2022-07-18
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

The existing technology suffers from the problem that short query statements result in low recall accuracy of candidate entities.

Method used

By obtaining the most relevant retrieval document in the document library and the most similar candidate entity in the knowledge base, and concatenating them into a long retrieval document and a set of candidate entities, the entity linking task is transformed into a multiple-choice reading comprehension task using a reading comprehension model.

Benefits of technology

This improves the recall accuracy of candidate entities and the accuracy of entity links.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115186105B_ABST
    Figure CN115186105B_ABST
Patent Text Reader

Abstract

The present disclosure relates to the technical field of computers, and provides an entity linking method and device. The method comprises: obtaining T search documents in a document library with the highest relevance score of entities of a current query statement, splicing into a search long document, wherein T is a natural number and T≥2; obtaining N candidate entities in a knowledge base with the highest similarity score of the current query statement, to form a candidate entity set, wherein N is a natural number and N≥2; and obtaining entity linking of the current query statement according to the current query statement, the search long document and the candidate entity set by using a reading comprehension model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to a method and apparatus for linking entities. Background Technology

[0002] Entity linking refers to the task of associating entity references in natural language text with corresponding entities in a knowledge graph. Entity linking is fundamental to many natural language processing tasks.

[0003] In related technologies, knowledge graph entity nodes can be selected based on the similarity between the contextual embedding representations of entities in the query statement and the contextual embedding representations of entity nodes in the knowledge graph, thereby determining the final linking results. Alternatively, a multi-task joint training model can be used to extract entity mentions of entities in the knowledge graph within text paragraphs and measure the semantic matching degree between the text paragraphs and the knowledge graph entity descriptions to determine entity links.

[0004] However, if the query text is too short, it is difficult to accurately learn the contextual embedding representation of entities in the query using the above technical solutions, thus affecting the recall accuracy of candidate entities. Summary of the Invention

[0005] In view of this, embodiments of the present disclosure provide an entity linking method, apparatus, electronic device, and computer-readable storage medium to solve the problem of low recall accuracy of candidate entities caused by short query statements in the prior art.

[0006] A first aspect of this disclosure provides an entity linking method, the method comprising: obtaining T search documents in a document library with the highest entity relevance scores to the current query statement, and concatenating them into a long search document, wherein T is a natural number and T≥2; obtaining N candidate entities in a knowledge base with the highest similarity scores to the current query statement, and forming a candidate entity set, wherein N is a natural number and N≥2; and using a reading comprehension model to obtain entity links for the current query statement based on the current query statement, the long search document, and the candidate entity set.

[0007] A second aspect of this disclosure provides an entity linking apparatus, comprising: a document retrieval module, configured to acquire T retrieval documents in a document library that have the highest entity relevance scores to the current query statement, and concatenate them into a long retrieval document, wherein T is a natural number and T≥2; a candidate entity acquisition module, configured to acquire N candidate entities in a knowledge base that have the highest similarity scores to the current query statement, and form a candidate entity set, wherein N is a natural number and N≥2; and an entity link acquisition module, configured to acquire entity links of the current query statement using a reading comprehension model based on the current query statement, the long retrieval document, and the candidate entity set.

[0008] A third aspect of this disclosure provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method described above.

[0009] A fourth aspect of this disclosure provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described method.

[0010] The beneficial effects of this disclosed embodiment compared with the prior art are as follows: by introducing retrieval documents from the document library that are highly relevant to the entity to be queried as supporting documents, and using candidate entities from the knowledge base that are highly similar to the entity to be queried as answer options, the entity linking task is transformed into a multiple-choice reading comprehension task, thereby improving the recall accuracy of candidate entities and the accuracy of entity linking.

[0011] Specifically, in the technical solution of this disclosure embodiment, for each entity mentioned in the query statement, the retrieved documents are concatenated into a long retrieval document, and candidate entities are further retrieved and combined into a candidate entity set. The entity linking task is regarded as the task of determining the linked entities in the candidate entity set based on the supporting information provided by the long retrieval document. This can transform the entity linking problem in the query statement into a multiple-choice reading comprehension problem, thereby improving the accuracy of entity linking. Attached Figure Description

[0012] To more clearly illustrate the technical solutions in the embodiments of this disclosure, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0013] Figure 1 This is a flowchart illustrating an entity linking method provided in an embodiment of this disclosure;

[0014] Figure 2 This is a flowchart illustrating the entity link acquisition method provided in the embodiments of this disclosure;

[0015] Figure 3 This is a flowchart illustrating another entity linking method provided in an embodiment of this disclosure;

[0016] Figure 4 This is a schematic diagram of the structure of a physical linking device provided in an embodiment of this disclosure;

[0017] Figure 5This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation

[0018] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, so as to provide a thorough understanding of the embodiments of this disclosure. However, those skilled in the art will understand that this disclosure may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this disclosure with unnecessary detail.

[0019] In related technologies, when query statements in question-answering scenarios are treated as paragraphs to obtain entity links, the learned contextual embedding representation of the paragraphs lacks relevant semantic information due to their short length, thus failing to match accurate entities.

[0020] To address the above issues, this disclosure proposes an entity linking scheme that combines the introduction of relevant external knowledge to enhance the local contextual information of paragraphs. By matching paragraphs with entities in the knowledge base, more accurate entities are obtained, thus achieving more accurate entity links.

[0021] Specifically, entity mentions in the query statement can be obtained. Documents retrieved from the document library based on the entity mentions in the query statement are concatenated into a long retrieval document. Candidate entities retrieved from the knowledge base based on the query statement and entity mentions are formed into a candidate entity set. The entity linking task can be viewed as determining the linked entities of the entity mentions in the question in the candidate entity set based on the supporting information provided by the long retrieval document. Thus, the entity linking task can be transformed into a multiple-choice reading comprehension task, and a reading comprehension model can be used to select candidate entities from the candidate entity set. Then, entity links can be obtained based on the selected candidate entities.

[0022] The following is a definition of terms used in the embodiments of this disclosure:

[0023] BERT (Bidirectional Encoder Representations from Transformers) is a natural language processing model that learns bidirectional representations of text, significantly improving the ability to understand unlabeled text in context across many different tasks.

[0024] Entity mention: An entity mentioned in the context, which may be referred to as an entity in the following text.

[0025] DCMN (Dual Co-Matching Network): A network model that can use large-scale pre-trained models such as BERT as front-end encoders to complete multiple-choice machine reading comprehension tasks.

[0026] The entity linking method and apparatus according to embodiments of this disclosure will now be described in detail with reference to the accompanying drawings.

[0027] Figure 1 This is a flowchart illustrating an entity linking method provided in an embodiment of this disclosure. The method provided in this embodiment can be executed by any electronic device with computer processing capabilities, such as a terminal or server. Figure 1 As shown, the entity linking method includes:

[0028] Step S101: Obtain the T search documents with the highest entity relevance scores to the current query statement from the document library, and concatenate them into a long search document, where T is a natural number and T≥2.

[0029] Specifically, before selecting the document with the highest relevance score, it is necessary to calculate the relevance score between the entities in the current query and every document in the document library. When calculating the relevance score between an entity in the current query and a specific document in the document library, it is necessary to first calculate the relevance score between each entity in the current query and that document, and then sum the relevance scores of each entity and that document to obtain the total relevance score between the entity in the current query and that document in the document library. The document library is a pre-prepared database containing a large number of documents.

[0030] Step S102: Obtain the N candidate entities with the highest similarity scores to the current query statement from the knowledge base, and form a candidate entity set, where N is a natural number and N≥2.

[0031] Specifically, before selecting the candidate entity with the highest similarity score, it is necessary to calculate the similarity score between the current query and each entity in the knowledge base. Calculating the similarity score involves first concatenating and encoding the current query with the retrieved long document, then concatenating and encoding the entity with its corresponding description text, and finally calculating the similarity score between the current query and that entity based on the encoded data. The knowledge base, or knowledge graph, contains entities and their corresponding description texts.

[0032] Step S103: Using a reading comprehension model, obtain the entity links of the current query statement based on the current query statement, the retrieved long document, and the candidate entity set.

[0033] Specifically, after obtaining the long document to be retrieved and the set of candidate entities, the entity linking task can be transformed into a reading comprehension task. This reading comprehension task involves selecting the candidate entity from the set of candidate entities that is most similar to the current query statement, and obtaining the entity link of the query statement from the knowledge base based on the candidate entity.

[0034] In the technical solution of this disclosure embodiment, for each entity mention in the query statement, the retrieved documents are concatenated into a long retrieval document d. m Furthermore, candidate entities are retrieved and combined into a candidate entity set C. m The entity linking task is viewed as retrieving long documents d m The provided supporting information confirms that the entity mentioned in the question is in the candidate entity set C. m The task of linking entities in a query can transform the entity linking problem in the query statement into a multiple-choice reading comprehension problem, thereby improving the accuracy of entity linking.

[0035] Before step S101, an entity recognition model can be used to detect the current query statement and obtain the entities. Specifically, for the query statement, the entity recognition model can be used to detect all entity mentions in the query statement, forming a set M = {m1, ..., m}. i , ..., m ∣M∣}, where |M| represents the number of elements in set M.

[0036] Named entity recognition (NID) is a fundamental task in natural language processing. Its purpose is to identify named entities such as people's names, place names, and organization names in a corpus. Entity recognition models can be used to identify named entities in a corpus. These models can be based on traditional machine learning methods or deep learning methods, and are not limited to either.

[0037] Specifically, before obtaining the T retrieved documents with the highest entity relevance scores to the current query in the document library in step S101, it is necessary to calculate the relevance scores between the entities of the current query and the documents in the document library. For example, the BM25 matching algorithm can be used to calculate the relevance scores between the entities of the current query and the documents in the document library, and it is not limited to this.

[0038] Text matching algorithms include supervised learning methods and unsupervised learning methods. BM (Best Match) is a representative unsupervised learning ranking algorithm. It can be used to calculate the relevance of a target document to a query keyword.

[0039] In this embodiment of the disclosure, the relevance scores between the entities of the current query statement and each document in the document library can be obtained sequentially according to the following steps: obtaining the sub-relevance scores between each entity of the current query statement and the current document in the document library; and obtaining the relevance scores between the entities of the current query statement and the current document based on the sum of the sub-relevance scores corresponding to each entity.

[0040] Sub-relevance is the sub-relevance score. If a query contains two entities, the first entity has a sub-relevance score of X1 to the current document, and the second entity has a sub-relevance score of X2 to the current document, then the relevance score of the query to the current document is the sum of the two relevance scores, i.e., X1 + X2.

[0041] After calculating the relevance score between the entities in the current query and the documents in the document library, the top T documents related to the entities in the current query can be selected from the document library D to form the retrieval document set D. m ={d1, ...,d ∣Dm∣}, and splice D m The retrieved documents form a new long retrieval document d m Among them, |D m | represents set D m The number of elements, i.e., D m The value here is T.

[0042] As shown in Table 1, for a given question, i.e., a given query statement "Which floor is store X located on?", the entity recognition model can detect the entity mentioning "store X". Based on this entity mention, the search documents can be retrieved from the document database D, and a search document set D can be formed. m By concatenating the searched documents in the search document set, a long search document d can be formed. m .

[0043] Table 1. Correspondence between query statements and retrieved documents

[0044]

[0045]

[0046] The long search document formed by concatenating the search documents shown in Table 1 is: "A certain restaurant is a Beijing cuisine restaurant, established in 2008, located on a certain road in a certain district. The restaurant's signature dishes include dish 1 and dish 2."

[0047] By retrieving relevant documents from external document libraries through entity references in the query statement, external knowledge can be introduced to enhance the semantic information of the query statement. This addresses the problem of lack of relevant semantic information in the contextual embedding representation when the query statement is short, thereby enabling more accurate entity matching.

[0048] In step S102, based on the retrieved long document obtained in step S101, a pre-set language model can be used to obtain the similarity score between the current query and the entities in the knowledge base. This language model can be the BERT model, but is not limited to it.

[0049] In this embodiment of the disclosure, the current query statement and the retrieved long document can be concatenated and input into a preset language model encoder to obtain first encoded data; the entities in the knowledge base and their corresponding description text can be concatenated and input into the language model encoder to obtain second encoded data; and the similarity score between the current query statement and the entities in the knowledge base can be obtained based on the first encoded data and the second encoded data.

[0050] Specifically, the current query statement q and the retrieved long document d are... m The data obtained after splicing is q⊕d m The data is input into the language model encoder to obtain the first encoded data H. qd =BERT(q⊕d m In the knowledge base, each entity corresponds to a descriptive text. (Using φ) name (e) represents the name of entity e in the knowledge base, denoted by φ. desc (e) represents the description text of entity e in the knowledge base, which will be displayed in the knowledge base entity φ. name (e) and the corresponding descriptive text φ desc (e) The data obtained after splicing is This data is input into the language model encoder to obtain the second encoded data. in This option combines two texts and adds the special character [UNUSED1] before the text being combined.

[0051] When obtaining the similarity score between the current query statement and entities in the knowledge base based on the first and second encoded data, character embedding processing can be performed on the first and second encoded data; the similarity score between the current query statement and entities in the knowledge base can be obtained by multiplying the transpose of the first and second encoded data.

[0052] Specifically, the similarity score between the current query and the entities in the knowledge base can be calculated using a similarity score formula. This similarity score formula is as follows (1):

[0053]

[0054] Where q represents the current query statement, d represents the concatenated long text, and e represents the entities in the knowledge base. Represents H qd The transpose of the embedded representation containing the [CLS] character. Represents H e An embedded representation containing the character [CLS].

[0055] [CLS] is a special character marker in the BERT model. For text classification tasks, the BERT model inserts a [CLS] symbol before the text and uses the output vector corresponding to this symbol as the semantic representation of the entire text for text classification.

[0056] The encoder of the BERT model in this embodiment can encode a string sequence of any length into a context embedding representation sequence of the same length.

[0057] In this embodiment of the disclosure, the initial language model needs to be trained before applying it for reasoning. During the reasoning phase, a similarity score formula can be used to retrieve the top N candidate entities in the knowledge base that best match the current query, forming a candidate entity set: C. m ={e1, ...,e i , ..., e ∣Cm∣}, where i is a natural number, |C m | represents set C m The number of elements, i.e., C m The value here is N.

[0058] Table 2 shows the candidate entity information retrieved from the knowledge base for the query statement.

[0059] Table 2 Candidate Entity Information

[0060]

[0061]

[0062] In step S103, a dual-matching network model can be used to obtain the probability that a candidate entity is the target entity based on the current query statement, the retrieved long document, and the candidate entity set, and output the link corresponding to the candidate entity with the highest probability as the entity link of the current query statement.

[0063] In this embodiment of the disclosure, a reading comprehension mechanism is introduced to transform the entity linking task mentioned in the question into the answer selection task in multiple-choice reading comprehension. That is, the reading comprehension model can be used to complete the answer selection task in multiple-choice reading comprehension and obtain a more accurate entity link based on the selection result.

[0064] In the embodiments disclosed herein, the DCMN reading comprehension model algorithm can be used to complete the task of selecting answers in multiple-choice reading comprehension, but it is not limited to this. For example, other reading comprehension model algorithms such as OCN (Option Comparison Network) and DUMA (Dual Multi-head Co-Attention) can also be used to complete the task of selecting answers in multiple-choice reading comprehension.

[0065] like Figure 2 As shown, in step S103, the process of obtaining entity links may include the following steps:

[0066] Step S201: Input the current query statement, the retrieved long document, and the current candidate entity into the encoder of the dual-matching network model to obtain the encoded data set.

[0067] Specifically, the encoder of the dual-matching network model can be a BERT encoder, which encodes the current query, the retrieved long document, and the current candidate entities separately to obtain encoded data. The encoded data forms an encoded data set.

[0068] Step S202: Using a pairwise matching representation and gate mechanism, feature fusion is performed on the current query statement, the retrieved long document, and the current candidate entity based on the encoded data group to obtain feature fusion data.

[0069] Specifically, the encoded data set is processed according to pairwise matching representation and gating mechanism to obtain the attention weight matrix between the retrieved long document and the current candidate entity, the retrieved long document representation related to the current candidate entity, and the current candidate entity representation of the retrieved long document. The attention weight matrix between the retrieved long document and the current candidate entity, the retrieved long document representation related to the current candidate entity, and the current candidate entity representation of the retrieved long document constitute the aforementioned feature fusion data.

[0070] Step S203: Obtain the pairwise matching embedding representations between the current query statement, the retrieved long document, and the current candidate entity based on the feature fusion data.

[0071] Specifically, the pairwise matching embedding representation includes the matching embedding representation between the current query statement and the retrieved long document, the matching embedding representation between the current query statement and the current candidate entity, and the matching embedding representation between the retrieved long document and the current candidate entity.

[0072] Step S204: Obtain the probability that the current candidate entity is the target entity based on the matching embedding representation.

[0073] Specifically, by concatenating the matching embedding representations between the current query and the retrieved long document, the current query and the current candidate entity, and the retrieved long document and the current candidate entity, we can obtain the final output embedding representation of the current candidate entity. Based on this final output embedding representation of the current candidate entity, we can obtain the probability that the current candidate entity is the correct candidate entity, i.e., the target entity.

[0074] In one embodiment of this disclosure, special marking symbols may be introduced. <mention> and< / mention> Mark entity references in the query statement. For example, if the query statement is "Which floor is store X located on?", and the entity reference is "store X", the marked query statement would be: <mention> [Store Name]< / mention> "On which floor?", denoted as Q. Supporting document d m Let P = {p1, ..., p2} i ,…,p |P|}, the candidate entity set C m Let A = {A1, ..., A} i ,…,A |A| For identifying the linked entities in the candidate entity set that are mentioned in the question, it can be viewed as determining the unique answer to question Q in answer option A, given question Q and paragraph P.

[0075] In this embodiment of the disclosure, solving the above-mentioned multiple-choice reading comprehension problem using the DCMN reading comprehension model algorithm may include the following steps:

[0076] First, for P, Q, and any answer option A... i Encode according to the following formulas (2), (3), and (4) to obtain H q H p and H a Three encoded data, H q H p and H a To form a coded data group.

[0077] H q =BERT(Q) (2)

[0078] H p =BERT(P) (3)

[0079] H a =BERT(A i (4)

[0080] Among them, H q ∈R |Q|×d H p ∈R |P|×d Ha ∈R |A|×d d represents the dimension of the embedding representation.

[0081] After obtaining the encoded data set, the features of P, Q, and A can be fused using the pairwise matching representation and gating mechanism according to the following formulas (5), (6), (7), and (8):

[0082]

[0083] E p =G pa H a ,

[0084] S p =ReLU(E p W1) (7)

[0085] S a =ReLU(E a W2) (8)

[0086] Here, W, W1, and W2 are three learnable parameters. The softmax() function converts the output values ​​of multi-class classification into a probability distribution ranging from [0, 1] to 1, thus assigning a probability value to each output classification result, representing the likelihood of belonging to each category. G pa ∈R |P| × |A| E is the attention weight matrix between paragraphs and answers. p ∈R |P|×d The paragraph representing the answer indicates that E a ∈R |A|×d This represents the answer related to the paragraph. The ReLU(x) function is a gate mechanism function; if the input x is less than 0, the output ReLU(x) is set to 0; if the input x is greater than 0, the output ReLU(x) is set to equal the input x. p S represents the paragraphs related to the answer after it has been processed using a gating mechanism. a This represents the answer related to the paragraph after processing using a gating mechanism.

[0087] After acquiring the feature fusion data, we compute bidirectional matching embedding representations between paragraph-answer, paragraph-question, and question-answer.

[0088] Specifically, the bidirectional matching embedding representation M between paragraphs and answers can be calculated according to the following formulas (9), (10), (11), and (12). p_a :

[0089] M p =MaxPooling(Sp (9)

[0090] M a =MaxPooling(S a (10)

[0091] g=σ(M p W3+M a W4+b) (11)

[0092] M p_a =g*M p +(1-g)*M a (12)

[0093] Where W3, W4, b∈R d These are trainable parameters, MaxPooling() is the pooling operation function, and M... p ∈R d M represents the paragraph embedding representation related to the answer after max pooling. a ∈R d Let σ be the paragraph-related answer embedding after max pooling, and g∈R be a set constant. d Represents the reset door, M p_a ∈R d This represents a bidirectional matching embedding between paragraph and answer sequence pairs. The reset gate controls how much information from the previous state is written into the current state; the smaller the reset gate, the less information from the previous state is written.

[0094] The same method can be used to obtain the bidirectional matching embedding representation M between paragraphs and questions. p_q ∈R d The bidirectional matching embedding representation M between questions and answers q_a ∈R d .

[0095] Based on the bidirectional matching embedding representation above and the following formula (13), candidate answer A can be obtained. i The final output embedding representation O i :

[0096] O i =[M p_q M p_q M q_a (13)

[0097] Here, [x; y; z] represents the vector concatenation operation of x, y, and z.

[0098] Based on candidate answer A i The final output embedding represents, given question Q and paragraph P, the answer option A. rThe probability that ∈A is the correct answer is calculated using the following formula (14):

[0099]

[0100] Where W0 are trainable parameters.

[0101] In this embodiment of the disclosure, the objective function for optimizing the training phase of the reading comprehension model algorithm DCMN can be the following formula (15):

[0102] L(A r |P, Q)=-log(Pr(A r |P,Q)) (15)

[0103] All of the above-mentioned optional technical solutions can be combined in any way to form the optional embodiments of this application, and will not be described in detail here.

[0104] like Figure 3 As shown, an entity linking method in this embodiment includes the following steps:

[0105] Step S321: Entity recognition is performed on query statement 311 to obtain entity 312.

[0106] Step S322: Mark the query statement 311 to obtain the marked query statement 313.

[0107] Step S323: Search the document library for the retrieval document related to entity 312 of the query statement to obtain the long retrieval document 314.

[0108] Step S324: Match candidate entities similar to query statement 311 in the knowledge base to obtain candidate entity set 315.

[0109] Step S325: Input the marked query statement 313, the retrieved long text 314 and the candidate entity set 315 into the reading comprehension model to obtain the candidate entity probability, and then perform entity linking based on the candidate entity probability.

[0110] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this disclosure.

[0111] According to the entity linking method of this disclosure, for each entity mention in the query statement, the retrieved documents are concatenated into a long retrieval document d. m Furthermore, candidate entities are retrieved and combined into a candidate entity set C. m The entity linking task is viewed as retrieving long documents dm The provided supporting information confirms that the entity mentioned in the question is in the candidate entity set C. m The task of linking entities in a query can transform the entity linking problem in the query statement into a multiple-choice reading comprehension problem, thereby improving the accuracy of entity linking.

[0112] The following are embodiments of the apparatus disclosed herein, which can be used to execute embodiments of the method disclosed herein. The entity linking apparatus described below corresponds to the entity linking method described above. For details not disclosed in the apparatus embodiments of this disclosure, please refer to the method embodiments of this disclosure.

[0113] Figure 4 This is a schematic diagram of a physical linking device provided in an embodiment of this disclosure. Figure 4 As shown, the physical linking device includes:

[0114] The document retrieval module 401 can be used to retrieve the T documents with the highest entity relevance scores to the current query statement from the document library and concatenate them into a long retrieval document, where T is a natural number and T≥2.

[0115] Specifically, before selecting the document with the highest relevance score, it is necessary to calculate the relevance score between the entities in the current query and every document in the document library. When calculating the relevance score between an entity in the current query and a specific document in the document library, it is necessary to first calculate the relevance score between each entity in the current query and that document, and then sum the relevance scores of each entity and that document to obtain the total relevance score between the entity in the current query and that document in the document library. The document library is a pre-prepared database containing a large number of documents.

[0116] The candidate entity acquisition module 402 can be used to acquire the N candidate entities with the highest similarity scores to the current query statement in the knowledge base, and form a candidate entity set, where N is a natural number and N≥2.

[0117] Specifically, before selecting the candidate entity with the highest similarity score, it is necessary to calculate the similarity score between the current query and each entity in the knowledge base. Calculating the similarity score involves first concatenating and encoding the current query with the retrieved long document, then concatenating and encoding the entity with its corresponding description text, and finally calculating the similarity score between the current query and that entity based on the encoded data. The knowledge base, or knowledge graph, contains entities and their corresponding description texts.

[0118] The entity link acquisition module 403 can be used to obtain entity links of the current query statement based on the current query statement, the retrieved long document, and the candidate entity set using a reading comprehension model.

[0119] Specifically, after obtaining the long document to be retrieved and the set of candidate entities, the entity linking task can be transformed into a reading comprehension task. This reading comprehension task involves selecting the candidate entity from the set of candidate entities that is most similar to the current query statement, and obtaining the entity link of the query statement from the knowledge base based on the candidate entity.

[0120] In the technical solution of this disclosure embodiment, for each entity mention in the query statement, the retrieved documents are concatenated into a long retrieval document d. m Furthermore, candidate entities are retrieved and combined into a candidate entity set C. m The entity linking task is viewed as retrieving long documents d m The provided supporting information confirms that the entity mentioned in the question is in the candidate entity set C. m The task of linking entities in a query can transform the entity linking problem in the query statement into a multiple-choice reading comprehension problem, thereby improving the accuracy of entity linking.

[0121] In this embodiment of the disclosure, the entity linking device may further include an entity detection module, which is used to detect the current query statement using an entity recognition model to obtain entities.

[0122] Entity recognition models can be used to identify named entities in a corpus. They can be models based on traditional machine learning methods or models based on deep learning methods, and are not limited to these.

[0123] In this embodiment of the disclosure, the document retrieval module 401 can also be used to sequentially obtain the relevance scores between the entities of the current query statement and each document in the document library according to the following steps: obtaining the sub-relevance scores between each entity of the current query statement and the current document in the document library; and obtaining the relevance scores between the entities of the current query statement and the current document based on the sum of the sub-relevance scores corresponding to each entity.

[0124] Specifically, the BM25 matching algorithm can be used to calculate the relevance score between the entities in the current query and the documents in the document library, but it is not limited to this.

[0125] The candidate entity acquisition module 402 can be used to obtain the similarity score between the current query and entities in the knowledge base using a pre-built language model. This language model can be a BERT model, but is not limited to it.

[0126] In this embodiment of the disclosure, the candidate entity acquisition module 402 can also be used to concatenate the current query statement and the retrieved long document and input them into a preset language model encoder to obtain first encoded data; concatenate the entities in the knowledge base and their corresponding description text and input them into the language model encoder to obtain second encoded data; and obtain the similarity score between the current query statement and the entities in the knowledge base based on the first encoded data and the second encoded data.

[0127] Sub-relevance is the sub-relevance score. If a query contains two entities, the first entity has a sub-relevance score of X1 to the current document, and the second entity has a sub-relevance score of X2 to the current document, then the relevance score of the query to the current document is the sum of the two relevance scores, i.e., X1 + X2.

[0128] After calculating the relevance score between the entities in the current query and the documents in the document library, the top T documents related to the entities in the current query can be selected from the document library D to form the retrieval document set D. m ={d1, ...,d ∣Dm∣}, and splice D m The retrieved documents form a new long retrieval document d m Among them, |D m | represents set D m The number of elements, i.e., D m =T.

[0129] By retrieving relevant documents from external document libraries through entity references in the query statement, external knowledge can be introduced to enhance the semantic information of the query statement. This addresses the problem of lack of relevant semantic information in the contextual embedding representation when the query statement is short, thereby enabling more accurate entity matching.

[0130] In this embodiment of the disclosure, the candidate entity acquisition module 402 can also be used to perform character embedding processing on the first encoded data and the second encoded data; and obtain the similarity score between the current query statement and the entities in the knowledge base based on the transpose of the first encoded data and the product of the second encoded data.

[0131] Specifically, the similarity score between the current query and the entities in the knowledge base can be calculated using a similarity score formula. This similarity score formula is as follows (1):

[0132]

[0133] Where q represents the current query statement, d represents the concatenated long text, and e represents the entities in the knowledge base. Represents H qd The transpose of the embedded representation containing the [CLS] character. Represents H eAn embedded representation containing the character [CLS].

[0134] The encoder of the BERT model in this embodiment can encode a string sequence of any length into a context embedding representation sequence of the same length.

[0135] In this embodiment of the disclosure, the initial language model needs to be trained before applying it for reasoning. During the reasoning phase, a similarity score formula can be used to retrieve the top N candidate entities in the knowledge base that best match the current query, forming a candidate entity set: C. m ={e1, ...,e i , ..., e ∣Cm∣}, where i is a natural number, |C m | represents set C m The number of elements.

[0136] In this embodiment of the disclosure, the entity link acquisition module 403 can also be used to use a dual-matching network model to obtain the probability that a candidate entity is the target entity based on the current query statement, the retrieved long document, and the candidate entity set; and output the link corresponding to the candidate entity with the highest probability as the entity link of the current query statement.

[0137] In the embodiments disclosed herein, the DCMN reading comprehension model algorithm can be used to complete the task of selecting answers in multiple-choice reading comprehension, but it is not limited to this. For example, other reading comprehension model algorithms such as OCN (Option Comparison Network) and DUMA (Dual Multi-head Co-Attention) can also be used to complete the task of selecting answers in multiple-choice reading comprehension.

[0138] In this embodiment of the disclosure, a reading comprehension mechanism is introduced to transform the entity linking task mentioned in the question into the answer selection task in multiple-choice reading comprehension. That is, the reading comprehension model can be used to complete the answer selection task in multiple-choice reading comprehension and obtain a more accurate entity link based on the selection result.

[0139] In this embodiment, the entity link acquisition module 403 can also be used to input the current query statement, the retrieved long document, and the current candidate entity into the encoder of the dual-matching network model to obtain an encoded data set; use a pairwise matching representation and a gate mechanism to perform feature fusion on the current query statement, the retrieved long document, and the current candidate entity based on the encoded data set to obtain feature fusion data; obtain the pairwise matching embedding representation between the current query statement, the retrieved long document, and the current candidate entity based on the feature fusion data; and obtain the probability that the current candidate entity is the target entity based on the matching embedding representation.

[0140] Specifically, the encoder of the dual-matching network model can be a BERT encoder, which encodes the current query, the retrieved long document, and the current candidate entities separately to obtain encoded data. The encoded data forms an encoded data set.

[0141] The encoded data set is processed using pairwise matching representation and gating mechanism to obtain the attention weight matrix between the retrieved long document and the current candidate entity, the retrieved long document representation related to the current candidate entity, and the current candidate entity representation of the retrieved long document.

[0142] The attention weight matrix between the retrieved long document and the current candidate entity, the retrieved long document representation related to the current candidate entity, and the current candidate entity representation of the retrieved long document constitute the aforementioned feature fusion data. The pairwise matching embedding representations include the matching embedding representations between the current query and the retrieved long document, the matching embedding representations between the current query and the current candidate entity, and the matching embedding representations between the retrieved long document and the current candidate entity.

[0143] By concatenating the matching embeddings between the current query and the retrieved long document, the current query and the current candidate entity, and the retrieved long document and the current candidate entity, we can obtain the final output embedding representation of the current candidate entity. Based on this final output embedding representation of the current candidate entity, we can obtain the probability that the current candidate entity is the correct candidate entity, i.e., the target entity.

[0144] Since the functional modules of the entity linking device in the example embodiments of this disclosure correspond to the steps of the example embodiments of the entity linking method described above, for details not disclosed in the device embodiments of this disclosure, please refer to the embodiments of the entity linking method described above.

[0145] According to the entity linking device of this disclosure, for each entity mention in the query statement, the retrieved documents are concatenated into a long retrieval document d. m Furthermore, candidate entities are retrieved and combined into a candidate entity set C. m The entity linking task is viewed as retrieving long documents d m The provided supporting information confirms that the entity mentioned in the question is in the candidate entity set C. m The task of linking entities in a query can transform the entity linking problem in the query statement into a multiple-choice reading comprehension problem, thereby improving the accuracy of entity linking.

[0146] Figure 5 This is a schematic diagram of the electronic device 5 provided in an embodiment of this disclosure. Figure 5As shown, the electronic device 5 of this embodiment includes: a processor 501, a memory 502, and a computer program 503 stored in the memory 502 and executable on the processor 501. When the processor 501 executes the computer program 503, it implements the steps in the various method embodiments described above. Alternatively, when the processor 501 executes the computer program 503, it implements the functions of each module in the various device embodiments described above.

[0147] Electronic device 5 can be a desktop computer, laptop, handheld computer, cloud server, or other electronic device. Electronic device 5 may include, but is not limited to, processor 501 and memory 502. Those skilled in the art will understand that... Figure 5 This is merely an example of electronic device 5 and does not constitute a limitation on electronic device 5. It may include more or fewer components than shown, or different components.

[0148] The processor 501 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.

[0149] The memory 502 can be an internal storage unit of the electronic device 5, such as a hard disk or RAM of the electronic device 5. The memory 502 can also be an external storage device of the electronic device 5, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, Flash Card, etc., equipped on the electronic device 5. The memory 502 can also include both internal and external storage units of the electronic device 5. The memory 502 is used to store computer programs and other programs and data required by the electronic device.

[0150] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0151] If the integrated module is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program may include computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium may include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added to or subtracted according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.

[0152] The above embodiments are only used to illustrate the technical solutions of this disclosure, and are not intended to limit it. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this disclosure, and should all be included within the protection scope of this disclosure.

Claims

1. A method for linking entities, characterized in that, The method includes: Retrieve the T documents with the highest entity relevance scores to the current query from the document library, and concatenate them into a long retrieval document, where T is a natural number and T≥2; Obtain the N candidate entities with the highest similarity scores to the current query statement from the knowledge base, and form a candidate entity set, where N is a natural number and N≥2; A reading comprehension model is used to obtain the entity links of the current query statement based on the current query statement, the retrieved long document, and the candidate entity set; The step of using a reading comprehension model to obtain entity links for the current query statement based on the current query statement, the retrieved long document, and the candidate entity set includes: A dual-matching network model is used to obtain the probability that a candidate entity is the target entity based on the current query statement, the retrieved long document, and the candidate entity set; The link corresponding to the candidate entity with the highest probability is output as the entity link of the current query statement; The step of using a dual-matching network model to obtain the probability that a candidate entity is the target entity based on the current query statement, the retrieved long document, and the candidate entity set includes: The current query statement, the retrieved long document, and the current candidate entity are respectively input into the encoder of the dual-matching network model to obtain the encoded data set; A pairwise matching representation and gating mechanism are used to perform feature fusion on the current query statement, the retrieved long document, and the current candidate entity based on the encoded data group to obtain feature fusion data; Based on the feature fusion data, obtain the pairwise matching embedding representations between the current query statement, the retrieved long document, and the current candidate entity; The probability that the current candidate entity is the target entity is obtained based on the matching embedding representation.

2. The method according to claim 1, characterized in that, Before retrieving the T documents in the document library with the highest entity relevance scores to the current query, the method further includes: The entity is obtained by detecting the current query statement using an entity recognition model.

3. The method according to claim 1, characterized in that, Before obtaining the T documents in the document library with the highest entity relevance scores to the current query, the method further includes: The relevance scores between the entities in the current query and each document in the document library are obtained sequentially using the following steps: Obtain the sub-relevance of each entity in the current query statement to the current document in the document library; The relevance score between the entities in the current query statement and the current document is obtained by summing the sub-relevance scores corresponding to each entity.

4. The method according to claim 1, characterized in that, Obtain the N candidate entities in the knowledge base that have the highest similarity score to the current query, including: The current query statement and the retrieved long document are concatenated and then input into a preset language model encoder to obtain the first encoded data. The entities in the knowledge base and their corresponding description texts are concatenated and then input into the language model encoder to obtain the second encoded data. The similarity score between the current query statement and the entities in the knowledge base is obtained based on the first encoded data and the second encoded data.

5. The method according to claim 4, characterized in that, The similarity score between the current query statement and entities in the knowledge base is obtained based on the first encoded data and the second encoded data, including: Character embedding processing is performed on the first encoded data and the second encoded data; The similarity score between the current query statement and the entities in the knowledge base is obtained by multiplying the transpose of the embedded representation of the characters contained in the first encoded data and the embedded representation of the characters contained in the second encoded data.

6. A physical linking device, characterized in that, The device includes: The document retrieval module is used to retrieve the T documents with the highest entity relevance scores to the current query from the document library and concatenate them into a long retrieval document, where T is a natural number and T≥2; The candidate entity acquisition module is used to acquire the N candidate entities with the highest similarity scores to the current query statement in the knowledge base, and form a candidate entity set, where N is a natural number and N≥2; The entity link acquisition module is used to acquire entity links of the current query statement based on the current query statement, the retrieved long document, and the candidate entity set using a reading comprehension model. The step of using a reading comprehension model to obtain entity links for the current query statement based on the current query statement, the retrieved long document, and the candidate entity set includes: A dual-matching network model is used to obtain the probability that a candidate entity is the target entity based on the current query statement, the retrieved long document, and the candidate entity set; The link corresponding to the candidate entity with the highest probability is output as the entity link of the current query statement; The step of using a dual-matching network model to obtain the probability that a candidate entity is the target entity based on the current query statement, the retrieved long document, and the candidate entity set includes: The current query statement, the retrieved long document, and the current candidate entity are respectively input into the encoder of the dual-matching network model to obtain the encoded data set; A pairwise matching representation and gating mechanism are used to perform feature fusion on the current query statement, the retrieved long document, and the current candidate entity based on the encoded data group to obtain feature fusion data; Based on the feature fusion data, obtain the pairwise matching embedding representations between the current query statement, the retrieved long document, and the current candidate entity; The probability that the current candidate entity is the target entity is obtained based on the matching embedding representation.

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 computer program, it implements the steps of the method as described in any one of claims 1 to 5.

8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 5.