Entity relationship extraction method and apparatus based on syntactic information and attention mechanism

By combining the multi-layer self-attention mechanism of sentence position information and syntactic information, the final vector of the sentence is generated, which solves the low accuracy and noise interference problems of entity relationship extraction in the existing technology, and achieves high accuracy under few sample conditions. Entity relationship extraction.

WO2024216936A1PCT designated stage expired Publication Date: 2024-10-24SOUTH CHINA NORMAL UNIV

Patent Information

Application Number
PCT/CN2023/130666
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-04-20
Filing Date
2023-11-09
Publication Date
2024-10-24

AI Technical Summary

Technical Problem

The existing few-sample relationship extraction task lacks the use of sentence position information and syntactic information, making it difficult for the model to accurately distinguish the relationship between entities, and is affected by noise interference, resulting in low classification accuracy.

Method used

By converting each word in the sentence into a word vector, and combining the relative position and syntactic relationship of the specified entity to generate an entity association vector, perform multi-layer self-attention mechanism processing, generate the final vector of the sentence with redundant information removed, and calculate the Prototype network distance for classification.

Benefits of technology

Effective use of syntactic information and attention mechanisms improves the accuracy of entity relationship classification, reduces noise interference, and can accurately distinguish relationships between entities with a small number of annotation instances.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023130666_24102024_PF_FP_ABST
    Figure CN2023130666_24102024_PF_FP_ABST
Patent Text Reader

Abstract

The present invention relates to an entity relationship extraction method based on syntactic information and an attention mechanism. A vector conversion unit is used for converting each word in a sentence and the relative positions and syntactic relationships between each word and two specified entities into vectors; a gate encoding unit is used for performing feature extraction and nonlinear processing on the relative position vectors and the syntactic relationship vectors to obtain an entity association feature gate vector; a sentence encoding unit is used for performing gate feature extraction and pooling processing on the entity association feature gate vector and the word vector to obtain a final sentence vector; and a relationship extraction unit is used for calculating the distance between the final sentence vector and a classification prototype center in a prototype network to obtain the relationship between two specific entities in the sentence. The entity relationship extraction method of the present invention can solve the problem in existing research that confusing information cannot be effectively filtered out due to insufficient use of entity positions and syntactic information in sentences, and the method can accurately distinguish the relationships between specified entities by means of only a small number of annotation instances.
Need to check novelty before this filing date? Find Prior Art

Description

A method and device for entity relationship extraction based on syntactic information and attention mechanism Technical Field

[0001] The present invention relates to the technical field of entity relationship extraction, and in particular to a method and device for entity relationship extraction based on syntactic information and an attention mechanism. Background Art

[0002] Entities are common concepts in texts, and can be specific individuals, events, objects, or abstract concepts or connections. The goal of relationship extraction is to extract entities from sentences and determine the type of relationship between them. Relationship extraction is one of the important steps in building knowledge bases and knowledge graphs. The disadvantage of the relationship extraction task is that it relies too much on already annotated corpus. The annotation process is time-consuming and labor-intensive, resulting in very high annotation costs. Therefore, the relationship extraction task suffers from the problem of corpus scarcity. Therefore, some studies have proposed a remote supervision method to perform a heuristic annotation of entities in the text of a knowledge base. This method can solve the problem of corpus scarcity to a certain extent, but it has the disadvantage of a large amount of noise and the problem of long-tail distribution in the corpus. In order to solve the large amount of noisy corpus and long-tail problem that arises in remote supervision methods, some studies have proposed a new relationship extraction task, namely the few-shot relationship extraction task.

[0003] The few-shot relation extraction (FSRE) task is an emerging research topic in recent years, combining relation extraction with few-shot learning. The FewRel 1.0 task proposed by Han et al. addresses the problem of few-shot learning for relation extraction, specifically how to improve model performance when only a few samples are available for new relation types and datasets. For the FSRE task, many current studies use pre-training to enhance the model's ability to understand RE tasks. Soare et al. proposed the pre-training method, Matching the Blanks, which assumes that similar relation types are more likely to come from the same entity pairs. Based on this assumption, they use large amounts of unsupervised data for pre-training.

[0004] The FSRE method, based on sentence similarity calculation, is a metric-based approach in few-shot learning. It effectively reduces the features lost by the model during sentence encoding and exhibits good domain adaptability. Gao et al. released a new dataset, FewRel 2.0. The BERT-PAIR method proposed in this task uses the BERT model to calculate the similarity between sentences and selects the support set classification with the closest similarity as the predicted classification for the instance. The multi-level matching aggregation network MLMAN proposed by Ye et al. uses word-level and sentence-level attention mechanisms to perform multi-level matching aggregation on the query set and support set.

[0005] There may be different entities in a sentence, and there may be different relationships between entities. Current research lacks the use of positional information and syntactic information in the sentence, so it is difficult to accurately distinguish these relationships using only a small number of annotation examples; at the same time, text is diverse and accompanied by noise interference. The current few-shot learning model is difficult to denoise these texts, so when extracting the correct relationship between entities, it will be affected by other relationships, resulting in inaccurate relationships between the extracted entities. Summary of the Invention

[0006] Based on this, the purpose of the present invention is to provide an entity relationship extraction method based on syntactic information and attention mechanism.

[0007] A method for extracting entity relations based on syntactic information and attention mechanism, comprising the following steps:

[0008] S10 converts each word of the sentence whose entity relationship is to be extracted into a word vector; converts the relative position and syntactic relationship between each word in the sentence and the specified entity into a relative position vector and a syntactic relationship vector, and concatenates the relative position vector and the syntactic relationship vector to obtain an entity association vector for each word;

[0009] S20: performing feature extraction processing on the entity association vector of each word to obtain an entity association feature vector of each word, and performing linear and nonlinear processing on the entity association feature vector to obtain an entity association feature gating vector of each word;

[0010] S30: performing a multi-layer self-attention mechanism on the word vector and the entity-associated feature gate vector to obtain a sentence feature vector containing the gated self-attention representation, and sequentially performing concatenation, linearization, and maximum pooling on the sentence feature vector containing the gated self-attention representation to obtain a final sentence vector with redundant information removed;

[0011] S40 calculates the distance between the final vector of the sentence and the classification prototype center of the prototype network, and selects the value with the smallest distance to the prototype center as the classification of the entity relationship in the sentence to be extracted.

[0012] Furthermore, the entity association vector in step S10 is expressed as:

[0013] ;

[0014] in, Represents the relative position vector between the i-th word and the specified entity, Represents the syntactic relationship vector between the i-th word and the specified entity.

[0015] Furthermore, the nonlinear processing in step S20 is performed using a sigmoid activation function, and the expression of the entity-related feature gating vector is obtained as follows:

[0016] ;

[0017] in, represents the weight matrix of linear processing, Represents the bias vector for linear processing.

[0018] Furthermore, the gated self-attention weights of each layer of the multi-layer self-attention mechanism described in step S30 satisfy the following expression:

[0019] ;

[0020] in, Indicates the The query matrix of the layer, Indicates the The bond matrix of the layer, represents the dimension of the word vector, Represents the entity-associated feature gate vector.

[0021] Furthermore, the prototype center of the u-th category Satisfies the following relationship:

[0022] ;

[0023] in, , , is a linear layer, ⊙ is element-wise generation, is the tanh() activation function, Represents the sum of all elements of the vector, and M represents the number of instances included in the u-th category.

[0024] Compared with the existing technology, the present invention improves the problem of insufficient utilization of sentence entity position and syntactic information in existing research, which leads to the inability to effectively filter confusing information, by fusing the entity's position information and syntactic information; on the other hand, by adding an attention mechanism when calculating the prototype center, the prototype obtains more features related to the query instance, and obtains a more typical prototype representation, thereby solving the defect of low classification accuracy in existing research.

[0025] For better understanding and implementation, the present invention is described in detail below with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] FIG1 is a schematic diagram of a model of an entity relationship extraction method based on syntactic information and attention mechanism of the present invention;

[0027] Figure 2 is a workflow diagram of the entity relationship extraction model shown in Figure 1. DETAILED DESCRIPTION

[0028] The technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the embodiments of the present invention.

[0029] Please refer to Figure 1 and Figure 2 at the same time, where Figure 1 is a schematic diagram of the entity relationship extraction model based on syntactic information and attention mechanism constructed by the present invention, and Figure 2 is a workflow diagram of the entity relationship extraction model shown in Figure 1.

[0030] The entity relationship extraction model constructed by the present invention includes a vector conversion unit, a gated coding unit, a sentence coding unit, and a relationship extraction unit. The vector conversion unit is used to convert each word in a sentence into a word vector, and the relative position and syntactic relationship between each word and two specified entities are converted into a relative position vector and a syntactic relationship vector. The gated coding unit is then used to perform feature extraction and nonlinear processing on the relative position vector and the syntactic relationship vector to obtain an associated feature gated vector between each word and the two specified entities. The sentence coding unit is then used to perform gated feature extraction and pooling processing on the associated feature gated vector and the word vector to obtain a final sentence vector with redundant information removed. Finally, the relationship extraction unit is used to calculate the distance between the final sentence vector and the prototype center in the prototype network to obtain the relationship between the two specific entities in the sentence.

[0031] Specifically, the vector conversion unit is configured to execute step S10: converting each word in the sentence from which entity relationships are to be extracted into a word vector; converting the relative position and syntactic relationship between each word in the sentence and the designated entity into a relative position vector and a syntactic relationship vector; and concatenating the relative position vector and the syntactic relationship vector to obtain an entity association vector for each word. The gated encoding unit includes a first vector converter and a second vector converter.

[0032] The first vector converter is used to perform step S11: convert each word of the input sentence to be extracted entity relationship Convert it into a continuous vector and add position encoding to the continuous vector of each word to obtain a word vector with position information , the word vector of the i-th word is represented as .

[0033] The second vector converter is used to execute step S12: converting the relative position and syntactic relationship between each word in the input sentence to be extracted entity relationship and the two specified entities into a vector to obtain the relative position vector and syntactic relationship vector of a single word; and concatenating the relative position vector and syntactic relationship vector of a single word to obtain the entity association vector of each word.

[0034] Specifically, this step includes the following sub-steps.

[0035] S121 converts the relative distances between the i-th word in the sentence and the two specified entities into continuous vectors to obtain the relative position vector of the i-th word, which satisfies formula (1):

[0036] (1)

[0037] (1) In the formula Represents the relative position vector from the i-th word to the first entity, Represents the relative position vector from the i-th word to the second entity, .

[0038] In a specific embodiment, named entity recognition is performed on the input sentence of the entity relationship to be extracted using Stanford CoreNLP, and the position information of the entity in the sentence is extracted to obtain the information of two specified entities and their start and end positions, and the relative position information between each word and the entity is calculated based on the information. The information of the two specified entities and their start and end positions is represented by two pairs of integers. and express, represents the first entity, represents the second entity, Indicates the starting position information. Indicates the end position information.

[0039] S122 converts the syntactic relations between the i-th word in the sentence and the two specified entities into continuous vectors to obtain the syntactic relation vector of the i-th word, and adds position encoding to the syntactic relation vector of the i-th word to obtain a syntactic relation vector containing position information. The relation vector satisfies formula (2):

[0040] (2)

[0041] (2) In the formula Represents the syntactic relationship vector between the i-th word and the first entity with position information, Represents the syntactic relationship vector between the i-th word and the second entity containing position information, .

[0042] In a specific embodiment, Stanford CoreNLP dependency analysis is used to perform dependency analysis on the syntactic relationship between each word and the entity in the input sentence to be extracted. The specific analysis steps are as follows:

[0043] Based on the original dependency tree of the sentence, we assume that the words directly connected to the given entity are more important in expressing the true relationship. We retain the dependency relationships connecting the specified entity and other words, discard other words, and derive a pruned dependency tree.

[0044] Based on the pruned dependency tree, assign a dependency label to the i-th word in the sentence As a suggested syntactic relation, with the word tag corresponding to the first entity For example, if the word If it is part of the first entity, it is a tag Assign 'self', if the word Directly connected to the first entity in the dependency tree, then the label Assign dependency relationships 'nmod', 'nsubj', etc. is neither connected to nor part of the first entity, then it is a tag Assign 'Other';

[0045] Based on the embedding lookup operation, the two dependency tags of the i-th word Convert to a continuous vector and , get the syntactic relation vector of the i-th word .

[0046] S123 concatenates the relative position vector of the i-th word in the sentence and the syntactic relation vector containing position information into an association vector to obtain the entity association vector of the i-th word. The association vector satisfies formula (3):

[0047] (3)

[0048] The gated encoding unit is configured to execute step S20: performing feature extraction processing on the entity association vector of each word to obtain an entity association feature vector for each word, performing linear and nonlinear processing on the entity association feature vector to obtain an entity association feature gate vector for each word, and storing the entity feature gate vector in an entity guidance gate. The gated encoding unit includes a first feature extractor, an entity feature gate editor, and an entity guidance gate.

[0049] Among them, the first feature extractor is used to execute step S21: perform multi-layer self-attention mechanism processing on the entity association vector of each input word, extract the entity association feature information of each word, and obtain the entity association feature vector of each word containing self-attention representation.

[0050] In a specific embodiment, a Transformer-based bidirectional encoder is used as an entity feature extractor, and this step can be expressed as ,in, The entity association vector representing the input word i is processed by the Transformer encoder to obtain the entity association feature vector of the word containing self-attention representation.

[0051] The entity feature gate editor is used to execute step S22: the entity association feature vector containing self-attention representation of each input word is sequentially processed by linear processing of the feedforward neural network and nonlinear processing of the sigmoid activation function to obtain the entity association feature gate vector , where the entity-related feature gate vector of the i-th word is Satisfying formula (4):

[0052] (4)

[0053] (4) In the formula, represents the weight matrix of the feedforward neural network, Represents the bias vector of the feedforward neural network.

[0054] The entity guidance gate is used to store the entity association feature gate vector of each word in the input sentence.

[0055] The sentence encoding unit is configured to execute step S30: performing a multi-layer self-attention mechanism on the word vector of the sentence whose entity relationship is to be extracted and the entity-related feature gate vector to obtain a sentence feature vector containing the gated self-attention representation, and sequentially performing concatenation, linearization, and maximum pooling on the sentence feature vector containing the gated self-attention representation to obtain a final sentence vector with redundant information removed. The sentence encoding unit includes a second feature extractor, a vector concatenator, a linear layer, and a pooling layer.

[0056] Among them, the second feature extractor is used to execute step S31: perform multi-layer self-attention mechanism processing on the word vector containing position information and the entity association feature gate vector, extract the association feature information between the sentence and the entity, and obtain a sentence feature vector containing gated self-attention representation.

[0057] In a specific embodiment, the number of layers of the multi-layer self-attention mechanism is Layer, of which The layer operation steps include the following sub-steps, .

[0058] S311 outputs the sentence feature vector of the previous self-attention mechanism As the first The input of the self-attention mechanism of the layer is respectively Weight matrix of layer self-attention mechanism 、 、 Do the dot product operation and get the Layer query matrix , key matrix Sum Matrix ; Among them, the input of the first layer of self-attention mechanism is the word vector containing position information .

[0059] S312 Layer query matrix and bond matrix Perform dot product operation to get Self-attention distribution of layers , Satisfying formula (5):

[0060] (5)

[0061] (5) In the formula Represents the dimension of the word vector.

[0062] S313 will Self-attention distribution of layers Multiply by the entity-related feature gate vector , and then perform softmax operation to get the Gated self-attention weights of the layer , Satisfying formula (6):

[0063] (6)

[0064] S314 Gated self-attention weights of the layer Hedi Layer value matrix Perform dot product operation to get Sentence feature vector with gated self-attention representation , Satisfying formula (7):

[0065] (7)

[0066] Repeat steps S311 to S314, so that the second feature extractor finally outputs the Sentence feature vector with gated self-attention representation of the layer .

[0067] The vector concatenator is used to execute step S32: inputting the sentence feature vector containing the gated self-attention representation and word vectors with position information Perform splicing to obtain the spliced ​​feature vector containing gated self-attention representation .

[0068] The linear layer is used to perform step S33: input the concatenated feature vector containing the gated self-attention representation Perform linear processing to obtain a sentence vector containing gated self-attention representation, whose dimension is consistent with the word vector dimension.

[0069] The pooling layer is used to execute step S34: perform maximum pooling processing on the input sentence vector containing the gated self-attention representation to obtain the final sentence vector after removing redundant information. .

[0070] The relationship extraction unit is used to perform step S40: calculating the distance between the final sentence vector and the classification prototype center in the prototype network, and selecting the value with the smallest distance from the prototype center as the classification of the entity relationship in the sentence to be extracted. The classification unit is a relationship classifier.

[0071] In a specific embodiment, the Euclidean distance is used to calculate the final vector of the sentence and the prototype center. distance :And select the prototype center corresponding to the minimum distance as the relationship classification of the entity in the sentence to be extracted .

[0072] (8)

[0073] in,

[0074] (8) In the formula, Represents the final sentence vector, 、 、 They represent the 1st prototype center, the uth prototype center and the Nth prototype center respectively.

[0075] Furthermore, the classification labels of the prototype network include N categories, and the prototype center of each category is calculated from M instances. Specifically, the prototype center of the u-th category is obtained by:

[0076] SA1 maps the word in the vth instance of the uth category to a real-valued embedding ; Replace the i-th word in the v-th instance The relative distance between the two entities in this instance is converted into two dimensions as dimensional vector, and put the two The dimensional vector is concatenated into the position vector of the i-th word ; Concatenate the real-valued embedding and position vector of the i-th word to form the final input vector of the i-th word , then the final input vector of the vth instance is Expressed as:

[0077] ;

[0078] in, (8)

[0079] (8) In the formula, .

[0080] SA2 uses a convolutional layer to slide a convolution kernel with a window size of n to check the final input vector of the i-th word of the v-th instance of the input. Perform feature extraction processing to extract the associated feature information of the i-th word and obtain the i-th word dimensional correlation feature vector , then the associated feature vector of the vth instance is Expressed as:

[0081] ;

[0082] in, (9)

[0083] (9) In the formula, represents convolution processing, represents the previous word embedding of the i-th word, represents the back word embedding of the i-th word.

[0084] SA3 performs a pooling operation on the associated feature vector of the input v-th instance to obtain the final instance vector of the v-th instance , the final instance vector satisfies formula (10):

[0085] (10)

[0086] SA4 assigns a weight to each final instance vector of the u-th category , and then get the prototype center of the u-th category in the prototype network , the prototype center Expressed as:

[0087] (11)

[0088] in, ;

[0089] ;

[0090] (11) where is a linear layer, ⊙ is element-wise generation, yes activation function, Represents the sum of all elements of a vector.

[0091] By utilizing the relative position and syntactic relationship between each word and a specified entity pair, this invention solves the problem in existing research of insufficient utilization of sentence entity position and syntactic information, which leads to the inability to effectively filter out confusing information. This method can accurately distinguish the relationship between specified entities using only a small number of annotated instances. At the same time, introducing the prototype network into the task of extracting few-sample relationships can effectively alleviate the limitations of the relationship extraction task in a low-resource environment. By extracting features from instances, introducing attention scores to assign a certain weight to each instance, and then creating a prototype center for each classification through weighted summation, the accuracy of entity relationship classification is more accurately determined.

[0092] Based on the same inventive concept, the present application also provides an electronic device, which can be a terminal device such as a server, desktop computing device, or mobile computing device (e.g., laptop computing device, handheld computing device, tablet computer, netbook, etc.). The device includes one or more processors and a memory, wherein the processor is configured to execute a program to implement an entity relationship extraction method based on syntactic information and an attention mechanism; and the memory is configured to store a computer program executable by the processor.

[0093] Based on the same inventive concept, the present application also provides a computer-readable storage medium, corresponding to the embodiment of the aforementioned entity relationship extraction method based on syntactic information and attention mechanism, and the computer-readable storage medium stores a computer program thereon, which, when executed by the processor, implements the steps of the entity relationship extraction method recorded in any of the above embodiments.

[0094] This application may take the form of a computer program product implemented on one or more storage media (including but not limited to magnetic disk storage, CD-ROMs, optical storage, etc.) containing program code. Computer-usable storage media include both permanent and non-permanent, removable and non-removable media, and may be implemented using any method or technology for information storage. Information may be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible by a computing device.

[0095] The above-described embodiments merely represent several implementations of the present invention. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art would be able to make numerous modifications and improvements without departing from the spirit of the present invention, and the present invention is intended to encompass such modifications and variations.

Claims

1. A method for extracting entity relations based on syntactic information and attention mechanism, characterized in that: The following steps are involved: S10 converts each word of the sentence whose entity relationship is to be extracted into a word vector; converts the relative position and syntactic relationship between each word in the sentence and the specified entity into a relative position vector and a syntactic relationship vector, and concatenates the relative position vector and the syntactic relationship vector to obtain an entity association vector for each word; S20: performing feature extraction processing on the entity association vector of each word to obtain an entity association feature vector of each word, and performing linear and nonlinear processing on the entity association feature vector to obtain an entity association feature gating vector of each word; S30: performing multi-layer self-attention mechanism processing on the word vector and the entity-related feature gate vector to obtain a sentence feature vector containing gated self-attention representation, and sequentially performing concatenation, linearization and maximum pooling processing on the sentence feature vector containing gated self-attention representation to obtain a final sentence vector with redundant information removed; S40 calculates the distance between the final vector of the sentence and the classification prototype center of the prototype network, and selects the value with the smallest distance to the prototype center as the classification of the entity relationship in the sentence of the entity relationship to be extracted.

2. The entity relationship extraction method according to claim 1, characterized in that: The entity association vector in step S10 is expressed as: ; in, represents the relative position vector between the i-th word and the specified entity, Represents the syntactic relationship vector between the i-th word and the specified entity.

3. The entity relationship extraction method according to claim 1, characterized in that: The nonlinear processing described in step S20 is processed using a sigmoid activation function, and the expression of the entity-related feature gating vector is: ; in, represents the weight matrix of the linear processing, Represents the bias vector for the linear process.

4. The entity relationship extraction method according to any one of claims 1 to 3, characterized in that: The gated self-attention weights of each layer of the multi-layer self-attention mechanism described in step S30 satisfy the following expression: ; in, Indicates The query matrix of the layer, Indicates The bond matrix of the layer, represents the dimension of the word vector, Represents the entity associated feature gate vector.

5. The entity relationship extraction method according to claim 4, characterized in that: Step S40 uses the Euclidean distance to calculate the final sentence vector and the prototype center Distance , the distance Satisfies the following relationship: ; in, represents the final vector of the sentence, represents the prototype center of the first category, Represents the prototype center of the Nth category.

6. The entity relationship extraction method according to claim 4, characterized in that: The classification prototype center of the prototype network in step S40 is obtained by: SA1 maps the word in the vth instance of the uth category to a real-valued embedding ; Replace the i-th word in the v-th instance The relative distance between the two entities in this example is converted into two dimensions: dimensional vector, and put the two The dimensional vectors are concatenated into the position vector of the i-th word ; Concatenate the real-valued embedding and position vector of the i-th word to form the final input vector of the i-th word , get the final input vector of the vth instance ; SA2 uses a convolutional layer to slide a convolutional kernel with a window size of n to check the final input vector of the i-th word of the v-th instance of the input. Perform feature extraction processing to extract the associated feature information of the i-th word and obtain the i-th word dimensional correlation feature vector , and obtain the associated feature vector of the vth instance ; SA3 performs a pooling operation on the associated feature vector of the input vth instance to obtain the final instance vector of the vth instance ; SA4 assigns a weight to each final instance vector of the u-th category , get the prototype center of the u-th category in the prototype network , and then get the classification prototype center of the prototype network 。 7. The entity relationship extraction method according to claim 6, characterized in that: The prototype center of the u-th category Satisfies the following relationship: ; in, , , is a linear layer, ⊙ is element-by-element generation, is the tanh() activation function, Represents the sum of all elements of the vector, and M represents the number of instances included in the u-th category.

8. An entity relationship extraction device based on syntactic information and attention mechanism, comprising: Vector conversion unit: used to convert each word of the sentence to be extracted entity relationship into a word vector; Converting the relative position and syntactic relationship between each word in the sentence and the specified entity into a relative position vector and a syntactic relationship vector, and concatenating the relative position vector and the syntactic relationship vector to obtain an entity association vector for each word; A gated coding unit: used for performing feature extraction processing on the entity association vector of each word to obtain the entity association feature vector of each word, and performing linear and nonlinear processing on the entity association feature vector to obtain the entity association feature gated vector of each word; Sentence encoding unit: used to perform multi-layer self-attention mechanism processing on the word vector and the entity-related feature gate vector to obtain a sentence feature vector containing gated self-attention representation, and sequentially perform concatenation, linear and maximum pooling processing on the sentence feature vector containing gated self-attention representation to obtain a final sentence vector with redundant information removed; Relation extraction unit: used to calculate the distance between the final vector of the sentence and the classification prototype center of the prototype network, and select the value with the smallest distance to the prototype center as the classification of the entity relationship in the sentence to be extracted.

9. The entity relationship extraction device according to claim 8, characterized in that: The gated encoding unit includes an entity feature gated editor, which is used to perform linear processing of a feedforward neural network and nonlinear processing of a sigmoid activation function on an input entity-related feature vector containing self-attention representation in sequence to obtain an entity-related feature gated vector.

10. The entity relationship extraction device according to claim 8 or 9, characterized in that: The sentence encoding unit includes a feature extractor, which is used to perform a multi-layer self-attention mechanism on the word vector containing position information and the entity-related feature gated vector, extract the associated feature information of the sentence and the entity, and obtain a sentence feature vector containing a gated self-attention representation.

Citation Information

Patent Citations

  • Chemical information extraction model training method and device, chemical information extraction method and device, equipment and storage medium

    CN112699668A

  • Chinese entity relation extraction method based on gating mechanism and graph attention network

    CN114722820A

  • Entity relationship extraction method and device based on syntactic information and attention mechanism

    CN116432631A

  • Named entity recognition method, apparatus, and computer-readable recording medium

    EP3767516A1

Cited By

  • Bidirectional GCN-BERT scientific data classification method based on rotary coding and dynamic gating

    CN120216685A