Entity linking method and apparatus

By enhancing the relevance between the text to be processed and the candidate entity vectors through recoding and cross-fusion feature processing, the problem of insufficient semantic interaction in existing technologies is solved, achieving higher entity linking accuracy and efficiency.

CN115828853BActive Publication Date: 2026-06-09BEIJING ZITIAO NETWORK TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING ZITIAO NETWORK TECH CO LTD
Filing Date
2022-12-22
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

In existing technologies, the lack of semantic interaction information between text vectors and candidate entity vectors in entity linking methods leads to low accuracy in linking entities.

Method used

By enhancing the relevance of the text vector to be processed and the candidate entity vector through re-encoding and extracting cross-fusion features, semantic interaction is enhanced. Linked entities are determined by using an encoder trained based on contrastive learning and a cross-attention mechanism.

Benefits of technology

It improves the accuracy and efficiency of entity linking, ensuring the accuracy of linked entities that match the text to be processed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115828853B_ABST
    Figure CN115828853B_ABST
Patent Text Reader

Abstract

This disclosure provides an entity linking method and apparatus. The method includes: acquiring a first text vector of a text to be processed and a first candidate entity vector of entity semantic descriptions of candidate entities; performing re-encoding on the first text vector and the first candidate entity vector with enhanced relevance based on the relevance between the first text vector and the first candidate entity vector to obtain a second text vector and a second candidate entity vector, wherein the relevance includes related and unrelated features; determining the cross-fusion features between the second candidate entity vector and the second text vector; and determining the linking entity that matches the text to be processed based on the cross-fusion features between at least one candidate entity and the second candidate entity vector. This method achieves the determination of the linking entity corresponding to the text to be processed from the semantic interaction result between the first text vector and the first candidate entity vector, thus achieving high accuracy in obtaining the linking entity matching the text to be processed.
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 more particularly to a method and apparatus for linking entities. Background Technology

[0002] Entity linking refers to the process of unambiguously and correctly pointing identified entity objects (such as names of people, places, and organizations) in free text to target entities in a knowledge base.

[0003] Linking entities in the text with entities in the entity library establishes a relationship between text objects and knowledge objects, assisting in the understanding of content resources and user needs.

[0004] The entity linking task includes identifying entities from text and determining linked entities from candidate entities, and establishing a linking relationship between the linked entities and the text. Summary of the Invention

[0005] This disclosure provides a method and apparatus for linking entities.

[0006] In a first aspect, embodiments of this disclosure provide an entity linking method, the method comprising: obtaining a first text vector of a text to be processed and a first candidate entity vector of entity sense descriptions of candidate entities; performing re-encoding on the first text vector and the first candidate entity vector with enhanced relevance based on the correlation between the first text vector and the first candidate entity vector to obtain a second text vector and a second candidate entity vector; determining the cross-fusion features between the second candidate entity vector and the second text vector; and determining a linking entity that matches the text to be processed based on the cross-fusion features between the second candidate entity vector of at least one candidate entity and the second text vector.

[0007] Secondly, embodiments of this disclosure provide an entity linking device, the device comprising: an acquisition unit, configured to acquire a first text vector of a text to be processed and a first candidate entity vector of entity sense descriptions of candidate entities; an enhancement unit, configured to perform re-encoding on the first text vector and the first candidate entity vector based on the correlation between the first text vector and the first candidate entity vector to obtain a second text vector and a second candidate entity vector; a feature cross-fusion unit, configured to determine cross-fusion features between the second candidate entity vector and the second text vector; and a determination unit, configured to determine a linking entity matching the text to be processed based on the cross-fusion features between the second candidate entity vector of at least one candidate entity and the second text vector.

[0008] Thirdly, embodiments of this disclosure provide an electronic device, including: a processor and a memory; the memory stores computer execution instructions; the processor executes the computer execution instructions stored in the memory, causing the at least one processor to perform the first aspect and various possible entity linking methods described above.

[0009] Fourthly, embodiments of this disclosure provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the first aspect and various possible entity linking methods described above.

[0010] Fifthly, embodiments of this disclosure provide a computer program product, including a computer program that, when executed by a processor, implements the first aspect above and various possible entity linking methods of the first aspect.

[0011] The entity linking method and device provided in this embodiment obtain a first text vector of the text to be processed and a first candidate entity vector of the entity sense description of the candidate entity; based on the correlation between the first text vector and the first candidate entity vector, the first text vector and the first candidate entity vector are re-encoded with enhanced relevance to obtain a second text vector and a second candidate entity vector; the cross-fusion feature between the second candidate entity vector and the second text vector is determined; based on the cross-fusion feature between the second candidate entity vector of at least one candidate entity and the second text vector, the link entity matching the text to be processed is determined. Since the correlation between the second text vector and the second candidate entity vector is enhanced by re-encoding with enhanced relevance to the first text vector and the first candidate entity vector, and furthermore, since the cross-fusion feature between the second candidate entity vector and the second text vector is taken, and the link entity is determined based on the cross-fusion feature, the link entity corresponding to the text to be processed is determined by the semantic interaction result between the first text vector and the first candidate entity vector. Therefore, the link entity matching the text to be processed obtained by the above method has high accuracy. Attached Figure Description

[0012] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are 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 schematic diagram of an entity linking method in related technologies;

[0014] Figure 2 Flowchart of the entity linking method provided in the embodiments of this disclosure Figure 1 ;

[0015] Figure 3 Flowchart of the entity linking method provided in the embodiments of this disclosure Figure 2 ;

[0016] Figure 4 A flowchart illustrating the principle of the entity linking method provided in this disclosure;

[0017] Figure 5 A structural block diagram of a physical linking device provided in an embodiment of this disclosure;

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

[0019] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.

[0020] Please refer to Figure 1 This diagram illustrates one method for implementing entity linking in related technologies. The entity linking method utilizes an entity linking model, which includes an encoder, a vector fusion layer, and a classifier. The encoder can be any language model that encodes the input text. The text 1 of the sentence to be processed and the entity semantic description text 2 of the candidate entities are input into the encoder to obtain vector 1 corresponding to text 1 and vector 2 corresponding to text 2. Vectors 1 and 2 are then input into the vector fusion layer for fusion, resulting in vector 3. This fusion can include various methods for fusing different vectors, such as dot product and summation. Vector 3 is then input into the classifier. The classifier can output whether text 2 is related to text 1, or the probability that text 2 is related to text 1. The linked entity associated with text 1 can be determined based on the classifier's output.

[0021] In the above scheme, there is a lack of semantic interaction information between the vectors corresponding to the two texts, and the accuracy of the linked entities of the text determined by the model is low.

[0022] To address the aforementioned issues, this disclosure provides an entity linking method and apparatus. By enhancing the relevance representation of the text vector to be processed and the vectors of candidate entities, and by taking cross-fusion features of the enhanced text vector and the candidate entity vector, the semantic interaction between vectors is enhanced, thereby improving the accuracy of identifying linked entities from candidate entities in the text to be processed.

[0023] Please refer to Figure 2 , Figure 2 This is a flowchart illustrating the entity linking method provided in the embodiments of this disclosure. Figure 1 This method can be applied to terminal devices or server-side applications.

[0024] S201: Obtain the first text vector of the text to be processed and the first candidate entity vector of the entity sense description of the candidate entity.

[0025] The text to be processed here can be any text. It can be long or short. It can be a section of text extracted from an article or text entered by the user.

[0026] The candidate entities here can be entities in the entity database.

[0027] Entities in an entity database (or entity library for short) are used to represent objects or concepts in the real world, usually referring to a collection of a certain type of things or objects.

[0028] The entity database can store multiple entities and their definitions.

[0029] An entity sense description can be an explanation of the entity's sense, such as including attributes and characteristics that represent the entity. An entity sense description can include separate text and references.

[0030] The aforementioned candidate entities can be entities from a pre-established entity library.

[0031] The entities in the aforementioned entity library can be entities obtained through various means, such as multiple entities extracted in advance from a dictionary or text describing the entities.

[0032] The first text vector mentioned above can be a first text vector obtained by pre-encoding the text to be processed, or a first candidate entity vector obtained by pre-encoding the entity semantic description of the candidate entity.

[0033] The above-mentioned encoding of the text to be processed and encoding of entity meaning descriptions include using various methods for encoding text information to encode the text to be processed and entity meaning descriptions respectively.

[0034] The methods for encoding text mentioned above include, but are not limited to, the bag-of-words model and word embedding methods. The bag-of-words model includes one-hot encoding, term frequency-inverse document frequency (TF-IDF), and n-grams. Word embedding methods include word2vec (word to vector) and Bidirectional Encoder Representation from Transformers (BERT).

[0035] S202: Based on the correlation between the first text vector and the first candidate entity vector, perform correlation-enhanced recoding on the first text vector and the first candidate entity vector to obtain the second text vector and the second candidate entity vector.

[0036] The correlation here can be a qualitative description, such as related and unrelated, or it can be a quantitative description, such as characterizing the strength of the correlation by the magnitude of the value.

[0037] In some applications, the similarity between a first text vector and a first candidate entity vector can be calculated using vector similarity methods. Then, based on this similarity, it can be determined whether the first text vector and the first candidate entity vector are related or unrelated.

[0038] As an illustrative example, a similarity threshold can be set. When the similarity between the first text vector and the first candidate entity vector is greater than the preset similarity threshold, the first text vector and the first candidate entity vector can be considered related. When the similarity between the first text vector and the first candidate entity vector is less than or equal to the preset similarity threshold, the first text vector and the first candidate entity vector can be considered unrelated.

[0039] As an example, algorithms such as Euclidean distance, Manhattan distance, and Chebyshev distance can be used to determine the similarity between a first text vector and a first candidate entity vector. Taking the Euclidean distance algorithm as an example, the similarity S between two vectors can be determined according to the following formula based on the distance d between the two vectors obtained by the Euclidean distance algorithm:

[0040] S = 1 / (1+d)(1).

[0041] For example, the preset similarity threshold can be 0.5. When S is greater than 0.5, the first text vector and the first candidate entity vector can be considered to be related; when S is less than or equal to 0.5, the first text vector and the first candidate entity vector can be considered to be unrelated.

[0042] As an illustrative example, if the similarity between the first text vector W11 and the first candidate entity vector W12 is 0.6, it can be considered that the first text vector W11 and the first candidate entity vector W12 are related. The first and second text vectors can be re-encoded to enhance their relevance. For example, W11 can be re-encoded to obtain the second text vector W21, and W12 can be re-encoded to obtain the second candidate entity vector W22. The similarity between the second text vector W21 and the second candidate entity vector W22 obtained by the Euclidean distance algorithm described above can be a value greater than 0.6, for example, a similarity of 0.8.

[0043] As another illustrative example, if the similarity between the first text vector W13 and the first candidate entity vector W14 is 0.4, it can be considered that the first text vector W13 and the first candidate entity vector W14 are unrelated. A re-encoding to enhance the relevance of the first and second text vectors can be performed. For example, W13 can be re-encoded to obtain the second text vector W23, and W14 can be re-encoded to obtain the second candidate entity vector W24. The similarity between the second text vector W23 and the second candidate entity vector W24 obtained by the above Euclidean distance algorithm can be a value less than 0.4, for example, a similarity of 0.2.

[0044] Through step S202 above, the first text vector and the first entity vector are encoded with enhanced relevance. If the first text vectors are related, the similarity between the second text vector and the second entity vector obtained through the enhanced relevance encoding is greater than the similarity between the first text vector and the first entity vector. If the first text vectors are not related, the similarity between the second text vector and the second entity vector obtained through the enhanced relevance encoding is less than the similarity between the first text vector and the first entity vector.

[0045] In this step, semantic interaction between the first text vector and the first candidate entity vector can be performed by enhancing relevance.

[0046] S203: Determine the cross-fusion features between the second candidate entity vector and the second text vector.

[0047] Indicatively, the cross-fusion features of the first candidate entity vector and the second text vector can be determined based on various cross-fusion algorithms.

[0048] To illustrate, the second candidate entity vector and the second text vector can be cross-referenced, for example, using a one-hot vector method to perform feature cross-reference, resulting in cross-features between the second candidate entity vector and the second text vector. In some applications, these cross-features can be fused to obtain cross-fused features. When fusing cross-features, fusion schemes such as feature concatenation, feature summation, cross-product calculation between features, and attention mechanisms can be used.

[0049] In this step, the semantic interaction between the first text vector and the first candidate entity vector is realized again by determining the cross-fusion features between the second candidate entity vector and the second text vector.

[0050] S204: Based on the cross-fusion features between the second candidate entity vector of at least one candidate entity and the second text vector, determine the link entity that matches the text to be processed.

[0051] For each candidate entity, the cross-fusion feature between the second candidate entity vector corresponding to that candidate entity and the aforementioned second text vector can be determined.

[0052] The cross-fusion features corresponding to each candidate entity can be analyzed and processed, and the results of the analysis and processing can be used to determine whether the candidate entity is an entity that matches the text to be processed.

[0053] In some application scenarios, the aforementioned cross-fusion features corresponding to multiple candidate entities can be input into a pre-trained classifier. The classifier then outputs the probability that each candidate entity is a link entity in the text to be processed. Based on these probabilities, the link entity matching the text to be processed is determined from the multiple candidate entities.

[0054] One approach is to use the candidate entity with the highest probability as the link entity that matches the text to be processed.

[0055] As another implementation, candidate entities whose corresponding probabilities are greater than a preset probability threshold can be used as link entities that match the text to be processed.

[0056] In this embodiment, a first text vector of the text to be processed and a first candidate entity vector of entity sense descriptions of candidate entities are obtained. Based on the correlation between the first text vector and the first candidate entity vector, the first text vector and the first candidate entity vector are re-encoded to enhance relevance, resulting in a second text vector and a second candidate entity vector. The correlation includes both relevant and irrelevant features. Cross-fusion features between the second candidate entity vector and the second text vector are determined. Based on the cross-fusion features between the second candidate entity vector of at least one candidate entity and the second text vector, a link entity matching the text to be processed is determined. Because the correlation between the second text vector and the second candidate entity vector is enhanced through re-encoding to enhance relevance, and because cross-fusion features are taken between the second candidate entity vector and the second text vector, and the link entity is determined based on these cross-fusion features, the link entity corresponding to the text to be processed is determined from the semantic interaction result between the first text vector and the first candidate entity vector. Therefore, the link entity matching the text to be processed obtained by the above method has high accuracy.

[0057] Please continue to refer to this. Figure 3 , Figure 3 Flowchart of the entity linking method provided in the embodiments of this disclosure Figure 2 .like Figure 3 As shown, the entity linking method provided in this embodiment includes the following steps:

[0058] S301: Input the text to be processed and the entity sense descriptions corresponding to the candidate entities into the first encoder, and output the first text vector of the text to be processed and the first candidate entity vector of the entity sense descriptions of the candidate entities.

[0059] The first encoder here can be any encoder that can encode text, such as the Bert (Bidirectional Encoder Representation from Transformers) encoder.

[0060] One implementation method is to input the text to be processed and the candidate entities into the first encoder in sequence, and the first encoder outputs the first text image vector and the first candidate entity vector respectively.

[0061] As another implementation, the text to be processed and the entity semantic descriptions corresponding to the candidate entities can be input into two first encoders that use shared parameters, and the two first encoders can output the first text vector and the first candidate entity vector respectively.

[0062] S302: Input the first text vector and the first candidate entity vector into the second encoder trained based on contrastive learning, and the second encoder outputs the second text vector and the second candidate entity vector.

[0063] The second encoder trained based on the contrastive learning method is used to perform re-encoding of the first text vector and the first candidate entity vector to enhance their relevance, based on the relevance between the first text vector and the first candidate entity vector.

[0064] The second encoder mentioned above can be any encoder, such as the ResNet encoder. The second encoder can be trained using contrastive learning. The second encoder trained using contrastive learning can re-encode the two input vectors by increasing the similarity between two originally related vectors and decreasing the similarity between two originally unrelated vectors.

[0065] The first text vector and the first candidate entity vector are encoded using the second encoder described above to obtain a second text vector and a second candidate entity vector with enhanced relevance.

[0066] In some embodiments, the above entity linking method further includes correcting the second encoder based on the following steps:

[0067] First: Obtain multiple training sample pairs; training sample pairs include positive sample pairs and negative sample pairs.

[0068] Both positive and negative sample pairs here include training statements and entity semantic descriptions. In a positive sample pair, the training statement and the entity in the sample pair are related. For example, the training statement includes mentions of entities belonging to the same category or having a related relationship with the entity. In a negative sample pair, the training statement and the entity in the sample pair are not related. For example, any entity mentions included in the training statement do not belong to the same category or have no related relationship with the entity in the sample pair.

[0069] The positive and negative sample pairs here can be pre-selected positive and negative sample pairs. For example, the training statement and entity sense description in the sample pair might be a manually selected training statement and an entity sense description selected from an entity database. After manually selecting the training sample pairs, labels can be assigned to the positive and negative sample pairs respectively. The label of a training sample pair indicates whether it is a positive or negative training sample pair.

[0070] Secondly, obtain the statement vector of each training sample corresponding to the training statement and the entity vector of the entity's entity sense description.

[0071] In this embodiment, each training sample pair can be input into a preset text encoder, which outputs the sentence vector of the training statement in the sample pair, as well as the entity vector corresponding to the entity semantic description of the entity.

[0072] The preset text encoder here can be any text encoder, such as the Bert encoder.

[0073] Next, the training sentence vectors and entity vectors corresponding to multiple training sample pairs are input into the second encoder, and the contrastive learning loss function is used to correct the second encoder so that the corrected contrastive learning loss function meets the preset conditions.

[0074] The contrastive learning loss function here can be any supervised contrastive learning loss function.

[0075] The supervised contrastive learning loss function mentioned above can be, for example, the following loss function:

[0076] in

[0077] f(x) represents the training statement vector corresponding to the training statements in the positive and negative sample pairs. + ) represents the entity vector within the entities in a positive sample pair; Let f(x) be the entity vector corresponding to the entity in the j-th negative sample pair. T f(x + ) represents the dot product of the training statement vector and the entity vector in a positive sample pair; is the dot product of the training statement vector and the entity vector in the j-th negative sample pair; N is an integer greater than or equal to 2, and j is an integer greater than or equal to 1 and less than or equal to N-1.

[0078] This loss function encourages a sufficiently high similarity between the training statement vector and the entity vector in positive sample pairs (numerator), and a sufficiently low similarity between the training statement vector and the entity vector in negative sample pairs (denominator). Contrastive learning is a type of metric learning; the goal of metric learning is to make the distance between related vectors as close as possible, and the distance between unrelated vectors as far as possible.

[0079] By correcting the second encoder through the above steps, the corrected second encoder can more accurately enhance the encoding of the input first text vector and the first candidate entity vector. The correlation between the second text vector and the second candidate entity vector generated by the second encoder is more accurately enhanced.

[0080] S303: The second candidate entity vector and the second text vector are processed based on the cross-attention mechanism to obtain the cross-fusion feature between the second candidate entity vector and the second text vector.

[0081] In this embodiment, the dimension of the second candidate entity vector can be the same as the dimension of the second text vector.

[0082] The aforementioned cross-attention mechanisms can include various cross-attention algorithms in related technologies.

[0083] Taking the second text vector as S1: [a1, a2, a3, ...] and the second candidate text vector as S2: [b1, b2, b3, ...] as an example, through the above cross-attention mechanism, the second candidate entity vector and the second text vector are asymmetrically combined to obtain the cross-fusion feature S3: [c1, c2, c3, ...] between the second candidate entity vector and the second text vector.

[0084] S304: Input the cross-fusion features between the second candidate entity vector of at least one candidate entity and the second text vector into a pre-trained classifier.

[0085] S305: Determine the link entities that match the text to be processed based on the output of the classifier.

[0086] The classifier here can be any binary classifier or any multi-classifier.

[0087] If the classifier is a binary classifier, the input to the classifier can be the cross-fusion feature corresponding to a candidate entity. The binary classifier outputs a result indicating whether the candidate entity is a link entity that matches the text to be processed. The output result includes "1" and "0". The "1" indicates that the candidate entity is a link entity that matches the text to be processed, and the "0" indicates that the candidate entity is not a link entity that matches the text to be processed.

[0088] If the classifier is a multi-classifier, the classifier's output can be the cross-fusion feature corresponding to multiple candidate entities. The classifier includes multiple outputs, each output corresponding to the probability that a candidate entity is a link entity in the text to be processed.

[0089] Based on the probabilities of each candidate entity output by the classifier, it can be determined which one or more candidate entities are the link entities that match the text to be processed.

[0090] The classifier mentioned above can be a pre-trained classifier. When training the classifier, training samples and a preset loss function can be used to train the classifier.

[0091] The loss function mentioned above may include, for example, a joint loss function of supervised contrastive loss and cross-entroy loss.

[0092] The contrastive learning loss function here can be any contrastive learning loss function used in various related techniques. Similarly, the cross-entropy loss function mentioned above can be any cross-entropy loss function used in various related techniques.

[0093] Using the joint loss function described above, the classifier parameters are trained to better distinguish relevant sentence pairs from irrelevant sentence pairs. This allows for a more accurate assessment of sentence pair relevance.

[0094] In this embodiment, a first text vector and a first candidate entity vector are obtained by encoding the entity sense descriptions of the text to be processed and the candidate entities using a first encoder. A second encoder trained based on contrastive learning is then used to enhance the relevance of the first text vector and the second candidate entity vector, resulting in a second text vector and a second candidate entity vector. A cross-attention algorithm is then used to calculate the cross-fusion features of the first text vector and the second candidate entity vector. Finally, the link entity matching the text to be processed is determined based on the cross-fusion features corresponding to at least one candidate entity. This improves both the accuracy of the link entities matching the text to be processed obtained by the above method and the efficiency of determining the link entities for the text to be processed.

[0095] Please refer to Figure 4 This illustrates a model structure diagram of the entity linking method provided in this disclosure. For example... Figure 4 As shown, the model includes a first encoder 41, a second encoder 42, a cross-attention layer 43, and a classifier 44.

[0096] The first encoder described above can be any encoder, such as the BERT encoder. The second encoder 42 described above can be an encoder trained based on contrastive learning. The cross-attention layer can include any cross-attention algorithm. The classifier described above can be any classifier.

[0097] The text to be processed, R1, and the entity sense description K1 of the candidate entity K can be input into the first encoder to obtain the first text vector R11 of the text to be processed, and the first candidate entity vector K11 of the entity sense description K1 of the candidate entity K. The first text vector R11 and the first candidate entity vector K11 are then input into the second encoder. The second encoder performs relevance enhancement re-encoding based on the relevance of the first text vector R11 and the first entity vector K11 to obtain the second text vector R12 and the second entity vector K12. The second text vector R12 and the second entity vector K12 are input into the cross-attention layer 43, which performs cross-attention processing on the second text vector R12 and the second entity vector K12 to obtain the cross-fusion feature F1. The cross-fusion feature F1 is then input into the classifier 44. The classifier determines the probability that the candidate entity K1 is a link entity matching the text to be processed, based on the cross-fusion feature F1. The link entity corresponding to the text to be processed, R1, can be determined based on the above probabilities corresponding to multiple candidate entities. For example, the candidate entity with the highest probability can be used as the link entity that matches the text to be processed.

[0098] Compared to Figure 1 The model for implementing entity linking methods, Figure 4 The model shown enhances sentence representation and sentence pair interaction capabilities by adding a second encoder trained based on contrastive learning and a cross-attention layer, thereby improving the accuracy of the model implementing the entity linking method. Furthermore, the model provided in this embodiment determines the link entities that match the text to be processed with high accuracy.

[0099] Corresponding to the entity linking method in the above embodiments, Figure 5 This is a structural block diagram of a physical linking device provided for embodiments of this disclosure. For ease of explanation, only the parts relevant to embodiments of this disclosure are shown. (Refer to...) Figure 5 The device 50 includes: an acquisition unit 501, an enhancement unit 502, a first determination unit 503, and a second determination unit 504.

[0100] The acquisition unit 501 is used to acquire the first text vector of the text to be processed and the first candidate entity vector of the entity sense description of the candidate entity;

[0101] The enhancement unit 502 is used to perform recoding with enhanced relevance on the first text vector and the first candidate entity vector based on the relevance between the first text vector and the first candidate entity vector, so as to obtain the second text vector and the second candidate entity vector.

[0102] The first determining unit 503 is used to determine the cross-fusion features between the second candidate entity vector and the second text vector;

[0103] The second determining unit 504 is used to determine the link entity that matches the text to be processed based on the cross-fusion features between the second candidate entity vector of at least one candidate entity and the second text vector.

[0104] In one embodiment of this disclosure, the acquisition unit 501 is further configured to:

[0105] The text to be processed and the entity semantic descriptions of the candidate entities are input into the first encoder, which outputs the first text vector and the first candidate entity vector.

[0106] In one embodiment of this disclosure, the enhancement unit 502 is further configured to:

[0107] The first text vector and the first candidate entity vector are input into the second encoder trained based on the contrastive learning method, and the second encoder outputs the second text vector and the second candidate entity vector; wherein, the second encoder trained based on the contrastive learning method is used to perform re-encoding of the first text vector and the first candidate entity vector with enhanced relevance according to the relevance between the first text vector and the first candidate entity vector.

[0108] In one embodiment of this disclosure, the first determining unit 503 is further configured to:

[0109] The second candidate entity vector and the second text vector are processed based on the cross-attention mechanism to obtain the cross-fusion feature between the second candidate entity vector and the second text vector.

[0110] In one embodiment of this disclosure, the second determining unit 504 is further configured to:

[0111] The cross-fusion features between the second candidate entity vector of at least one candidate entity and the second text vector are input into a pre-trained classifier.

[0112] The link entities that match the text to be processed are determined based on the output of the classifier.

[0113] In one embodiment of this disclosure, the output of the classifier includes the link confidence between the candidate entity and the text to be processed;

[0114] The second determining unit 504 is further used for:

[0115] The candidate entity with the highest link confidence is identified as the link entity that matches the text to be processed; or

[0116] Candidate entities with a link confidence score greater than a preset confidence score threshold are identified as link entities that match the text to be processed.

[0117] In one embodiment of this disclosure, the physical linking device 50 further includes a first calibration unit (not shown in the figures), which is used to calibrate the second encoder by performing the following steps:

[0118] Multiple training sample pairs are obtained; each training sample pair includes positive and negative sample pairs; both positive and negative sample pairs include training statements and entity semantic descriptions of the entities; the training statements in a positive sample pair are related to the entities in that sample pair, while the training statements in a negative sample pair are not related to the entities in that sample pair.

[0119] Obtain the sentence vector of each training sample corresponding to the training statement and the training entity vector of the entity's entity sense description.

[0120] Multiple training sample pairs are input into the second encoder, corresponding to the training statement vectors and entity vectors respectively. The second encoder is then corrected using a contrastive learning loss function, so that the corrected contrastive learning loss function meets the preset conditions.

[0121] In one embodiment of this disclosure, the entity linking device 50 further includes a second correction unit (not shown in the figures), which is used to correct the classifier by the following steps:

[0122] The classifier is corrected using loss functions that include contrastive learning loss and cross-entropy loss.

[0123] To implement the above embodiments, this disclosure also provides an electronic device.

[0124] refer to Figure 6 This document illustrates a structural schematic of an electronic device 600 suitable for implementing embodiments of the present disclosure. The electronic device 600 can be an extended reality device, a terminal device providing services to an extended reality device, or a server. The terminal device can include, but is not limited to, mobile terminals such as mobile phones, laptops, digital radio receivers, personal digital assistants (PDAs), portable Android devices (PADs), portable media players (PMPs), and in-vehicle terminals (e.g., in-vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 6 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.

[0125] like Figure 6As shown, electronic device 600 may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 602 or a program loaded from storage device 608 into random access memory (RAM) 603. RAM 603 also stores various programs and data required for the operation of electronic device 600. The processing unit 601, ROM 602, and RAM 603 are interconnected via bus 604. Input / output (I / O) interface 605 is also connected to bus 604.

[0126] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 608 including, for example, magnetic tapes, hard disks, etc.; and communication devices 609. Communication device 609 allows electronic device 600 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 6 An electronic device 600 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.

[0127] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program (computer execution instructions) can be downloaded and installed from a network via communication device 609, or installed from storage device 608, or installed from ROM 602. When the computer program is executed by processing device 601, it performs the functions defined in the methods of embodiments of this disclosure.

[0128] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0129] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.

[0130] The aforementioned computer-readable medium carries one or more programs (computer execution instructions) that, when executed by the electronic device, cause the electronic device to perform the method shown in the above embodiments.

[0131] Computer program code for performing the operations of this disclosure can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0132] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0133] The units described in the embodiments of this disclosure can be implemented in software or in hardware. The names of the units are not necessarily limiting in certain circumstances; for example, an acquisition unit can also be described as "a unit that acquires a first text vector of the text to be processed and a first candidate entity vector of the entity sense description of the candidate entity".

[0134] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.

[0135] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0136] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.

[0137] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.

[0138] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.

Claims

1. A method for linking entities, comprising: Obtain the first text vector of the text to be processed and the first candidate entity vector of the entity sense description of the candidate entities; The first text vector and the first candidate entity vector are input into a second encoder trained based on contrastive learning, and the second encoder outputs a second text vector and a second candidate entity vector. The second encoder, trained based on contrastive learning, is used to re-encode the first text vector and the first candidate entity vector based on their relevance. The contrastive learning training process includes using positive and negative sample pairs, where the training statements in the positive sample pairs are related to entities, and the training statements in the negative sample pairs are not related to entities. The second encoder performs correction based on a contrastive learning loss function. Determine the cross-fusion features between the second candidate entity vector and the second text vector; Based on the cross-fusion features between the second candidate entity vector of at least one candidate entity and the second text vector, the link entity that matches the text to be processed is determined.

2. The method according to claim 1, characterized in that, The process of obtaining the first text vector of the text to be processed and the first candidate entity vector of the entity sense description of the candidate entity includes: The text to be processed and the entity definition description of the candidate entity are input into the first encoder, and the first encoder outputs the first text vector and the first candidate entity vector.

3. The method according to claim 1, characterized in that, The determination of the cross-fusion features between the second candidate entity vector and the second text vector includes: The second candidate entity vector and the second text vector are processed based on the cross-attention mechanism to obtain the cross-fusion feature between the second candidate entity vector and the second text vector.

4. The method according to claim 1, characterized in that, The step of determining link entities matching the text to be processed based on the cross-fusion features between the second candidate entity vector of at least one candidate entity and the second text vector includes: The cross-fusion features between the second candidate entity vector of at least one candidate entity and the second text vector are input into a pre-trained classifier. The link entities that match the text to be processed are determined based on the output of the classifier.

5. The method according to claim 4, characterized in that, The output of the classifier includes the link confidence between the candidate entity and the text to be processed; The step of determining the link entity that matches the text to be processed based on the output of the classifier includes: The candidate entity with the highest link confidence is identified as the link entity that matches the text to be processed; or Candidate entities with a link confidence score greater than a preset confidence score threshold are identified as link entities that match the text to be processed.

6. The method according to claim 1, characterized in that, The method further includes calibrating the second encoder using the following steps: Obtain multiple training sample pairs; training sample pairs include positive sample pairs and negative sample pairs; both positive and negative sample pairs include training statements and entity semantic descriptions of entities; Obtain the sentence vector of each training sample corresponding to the training statement and the training entity vector of the entity's entity sense description. Multiple training sample pairs are input into the second encoder, corresponding to the training statement vectors and entity vectors respectively, and the second encoder is corrected using the contrastive learning loss function.

7. The method according to claim 4, characterized in that, The method further includes: The classifier is corrected using a loss function that includes a contrastive learning loss function and a cross-entropy loss function.

8. A physical linking device, comprising: The acquisition unit is used to acquire the first text vector of the text to be processed and the first candidate entity vector of the entity sense description of the candidate entity; An enhancement unit is used to input the first text vector and the first candidate entity vector into a second encoder trained based on a contrastive learning approach, and the second encoder outputs a second text vector and a second candidate entity vector. The second encoder, trained based on contrastive learning, is used to perform re-encoding on the first text vector and the first candidate entity vector to enhance their relevance based on the correlation between them. The contrastive learning training process includes using positive and negative sample pairs, where the training statements in the positive sample pairs are related to entities, and the training statements in the negative sample pairs are not related to entities. The second encoder performs correction based on a contrastive learning loss function. The first determining unit is used to determine the cross-fusion features between the second candidate entity vector and the second text vector; The second determining unit is used to determine the link entity that matches the text to be processed based on the cross-fusion features between the second candidate entity vector of at least one candidate entity and the second text vector.

9. An electronic device, characterized in that, include: Processor and memory; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform the entity linking method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, implement the entity linking method as described in any one of claims 1 to 7.

11. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the entity linking method as described in any one of claims 1 to 7.