Entity relationship extraction method, device, equipment and medium
By constructing a three-dimensional data structure and a triple attention mechanism, combined with deformable convolution, the problem of inaccurate entity relationship reasoning in documents is solved, and more efficient entity relationship extraction is achieved.
Patent Information
- Application Number
- CN202211717078.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-29
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2042-12-29
AI Technical Summary
Existing technologies lack sufficient accuracy in entity relationship reasoning for documents, failing to effectively capture complex interactions within and between entities in the text, resulting in inaccurate relationship extraction.
We employ a 3D data structure to expand entity pairs, and combine a triple attention mechanism and deformable convolution to capture interaction features in different semantic spaces and determine the relationship category probability of target entity pairs.
It improves the document's relational reasoning ability, achieves more accurate entity relation extraction, and enhances the ability to identify document structural features.
Smart Images

Figure CN116049398B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of natural language processing technology, and in particular to a method, apparatus, device, and medium for extracting entity relationships. Background Technology
[0002] Entity relation extraction is a crucial task in information extraction, providing structured information for downstream tasks such as knowledge graph construction, automatic abstraction, and machine question answering. Entity relation extraction extracts pairs of entities from text and identifies the relationships between them. It can be categorized into two approaches: pipeline extraction and joint extraction. Pipeline extraction involves performing entity recognition and relation extraction sequentially; joint extraction performs entity recognition and relation classification simultaneously.
[0003] Entity relation extraction involves extracting entity relation triples from unstructured text. This requires models with stronger modeling and reasoning capabilities to effectively capture the complex interactions within and between entities in the text, such as the associations of related entities in different semantic spaces, in order to determine the target entity pairs and their relation categories.
[0004] In many texts, a large number of relational facts are expressed in multiple sentences, and there are often complex relationships between multiple entities in the text. Therefore, a more accurate method for extracting entity relationships from documents is needed to improve the relational reasoning ability of all information in a document. Summary of the Invention
[0005] This invention provides an entity relation extraction method, apparatus, device, and medium to address the shortcomings of insufficient accuracy in entity relation reasoning of documents in the prior art, and to achieve a more accurate entity relation extraction method for documents, thereby improving the relation reasoning ability of all information in a document.
[0006] This invention provides a method for entity relation extraction, comprising:
[0007] Based on the target entity pairs and the relationships to be identified in the document to be identified, a three-dimensional data structure containing the mapping relationship between the target entity pairs and the relationships to be identified is determined;
[0008] Based on the aforementioned three-dimensional data structure, a triple attention mechanism is used to capture the interactive features of the three-dimensional data structure in different semantic spaces.
[0009] Based on the interaction features, determine the probability of the relationship category of the target entity pair;
[0010] The relation category probability is used to determine the semantic relation type to which the target entity pair belongs, and the convolutional layer of the triple attention mechanism adopts deformable convolution.
[0011] According to the entity relation extraction method provided by the present invention, the target entity pair includes a head entity and a tail entity;
[0012] The semantic space includes a first semantic space between the head entity and the tail entity, a second semantic space between the head entity and the relation, and a third semantic space between the tail entity and the relation;
[0013] The interaction features include a first interaction feature between the head entity and the tail entity, a second interaction feature between the head entity and the relation, and a third interaction feature between the tail entity and the relation.
[0014] According to an entity relation extraction method provided by the present invention, the target entity pair is determined based on the following steps:
[0015] Based on each sentence and each word of the document to be identified, semantically similar entity mention vectors are determined, wherein the entity words corresponding to the entity mention vectors are semantically similar;
[0016] Aggregate the entity mention vectors to determine an entity vector, wherein the entity vector corresponds to one or more entity mention vectors;
[0017] Based on the entity vector, the target entity pairs in the document to be identified are determined.
[0018] According to an entity relation extraction method provided by the present invention, based on the entity vector, target entity pairs in the document to be identified are determined, including:
[0019] Based on the entity vector, determine the context vector corresponding to the entity vector;
[0020] The entity vector and the context vector are fused to determine the fused entity vector;
[0021] Based on the fused entity vector, the target entity pairs in the document to be identified are determined.
[0022] According to an entity relation extraction method provided by the present invention, based on the fused entity vector, target entity pairs in the document to be identified are determined, including:
[0023] The fused entity vectors are divided into several groups on average to obtain entity vector groupings;
[0024] Based on the entity vector grouping and transformation matrix, the target entity pairs in the document to be identified are determined.
[0025] According to the entity relationship extraction method provided by the present invention, the relationship category probability of the target entity pair is determined based on the interaction features, including:
[0026] Based on the interaction features, the overall document relationship representation of the document to be identified is determined;
[0027] Based on the interaction features, the semantic relationship representation of the target entity pair is determined;
[0028] Based on the overall document relation representation and the semantic relation representation, the relation category probability of the target entity pair is determined.
[0029] The present invention also provides an entity relation extraction device, comprising:
[0030] A three-dimensional encoding and aggregation module is used to determine a three-dimensional data structure containing the mapping relationship between the target entity pairs and the relationships to be identified based on the target entity pairs and the relationships to be identified in the document to be identified.
[0031] The semantic interaction module is used to capture the interaction features of the three-dimensional data structure in different semantic spaces using a triple attention mechanism based on the three-dimensional data structure.
[0032] A relationship classification module is used to determine the relationship category probability of the target entity pair based on the interaction features.
[0033] The relation category probability is used to determine the semantic relation type to which the target entity pair belongs, and the convolutional layer of the triple attention mechanism adopts deformable convolution.
[0034] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the entity relation extraction method as described above.
[0035] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the entity relation extraction method as described above.
[0036] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the entity relation extraction method as described above.
[0037] The entity relation extraction method, apparatus, device, and medium provided by this invention expand the entity pairs of the "entity / entity" two-dimensional data structure to form the "entity / entity / relationship" three-dimensional data structure, and effectively distinguish the interactive representations under different semantic spaces by adopting a triple attention mechanism based on deformation convolution, thereby adaptively enhancing the recognition of document structural features, thereby improving the relational reasoning ability of all information in the document, and realizing a more accurate document entity relation extraction method. Attached Figure Description
[0038] To more clearly illustrate the technical solutions in this invention 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 invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0039] Figure 1 This is one of the flowcharts illustrating the entity relation extraction method provided by the present invention;
[0040] Figure 2 This is the second flowchart of the entity relation extraction method provided by the present invention;
[0041] Figure 3 This is the third flowchart of the entity relation extraction method provided by the present invention;
[0042] Figure 4 This is the fourth flowchart of the entity relation extraction method provided by the present invention;
[0043] Figure 5 This is the fifth flowchart of the entity relation extraction method provided by the present invention;
[0044] Figure 6 This is a schematic diagram of the entity relationship extraction device provided by the present invention;
[0045] Figure 7 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0046] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the embodiments described are only some of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.
[0047] The following combination Figure 1-Figure 5 The entity relation extraction method of the present invention is described.
[0048] Please refer to Figure 1 The entity relation extraction method proposed in this invention includes:
[0049] Step 10: Based on the target entity pairs and the relationships to be identified in the document to be identified, determine a three-dimensional data structure containing the mapping relationship between the target entity pairs and the relationships to be identified;
[0050] An entity refers to a referential entity word, which can include names of people, places, or organizations, or entity words related to the topic of interest, such as brand names, emotion words, sentiment words, and item attributes. A target entity pair consists of two entities, which may or may not have a corresponding relationship. The entity relationship extraction method proposed in this invention is used to identify the relationship between target entity pairs.
[0051] The target entity pair is a two-dimensional "entity / entity" data structure, that is, a two-dimensional data structure composed of all entities in the document. Based on the target entity pair, relationships to be identified are added to form a three-dimensional data structure, thus expanding the entity pair of the "entity / entity" two-dimensional data structure into a "entity / entity / relationship" three-dimensional data structure. This constructed three-dimensional data structure is used for entity relationship identification, improving relational reasoning for all information in the document. Specifically, the three-dimensional data structure contains the mapping relationship between the target entity pair and the relationships to be identified. The relationships to be identified are all existing relationships between entities, such as subordinate relationships, parallel relationships, attribute relationships, and association relationships.
[0052] Furthermore, entity words in the document to be identified can be identified using OCR text recognition technology, and then the identified entity words can be combined to obtain the target entity pairs of the document to be identified.
[0053] Step 20: Based on the three-dimensional data structure, use a triple attention mechanism to capture the interaction features of the three-dimensional data structure in different semantic spaces;
[0054] After obtaining the three-dimensional data structure of "entity / entity / relationship", in order to capture the directional features of the relationship, a triple attention mechanism is used to capture the interaction features of the three-dimensional data structure in different semantic spaces.
[0055] Specifically, Z-pooling is first used for dimensionality reduction and feature extraction to extract the cross-sectional features of the 3D data structure in different semantic spaces. The calculation formula is as follows:
[0056] Z-pool(χ)=[Maxpool 0d (χ), Avgpool 0d (χ)]
[0057] Where χ represents the cross-sections in different semantic spaces of the "entity / entity / relationship" 3D data structure. After obtaining the cross-section features in different spaces, an averaging operation is performed to obtain the interaction representation containing features of different semantic spaces. The calculation formula is as follows:
[0058]
[0059] Since entities in a 3D data structure are arranged according to their order of appearance in the document, they exhibit certain irregularities and implicit document structure features. Ordinary convolution cannot effectively and adaptively capture these document structure features. Therefore, to adaptively aggregate entity interaction information and capture document structure features while avoiding the influence of irrelevant entities, deformable convolution is used instead of the original ordinary convolution. Deformable convolution mainly consists of two parts: deformable convolution and deformable pooling. The formulas for deformable convolution and deformable pooling are as follows:
[0060]
[0061]
[0062] Where, Δp k and Δm k These are the learnable bias and scaling at position k, respectively.
[0063] Step 30: Based on the interaction features, determine the relationship category probability of the target entity pair;
[0064] The relation category probability is used to determine the semantic relation type to which the target entity pair belongs, and the convolutional layer of the triple attention mechanism adopts deformable convolution.
[0065] After determining the interaction features of the 3D data structure in different semantic spaces, the probability of the relation category of the target entity pair in different semantic spaces is identified based on these interaction features. Then, based on the probability of the relation category of the target entity pair in each different semantic space, the semantic relation type to which the target entity pair belongs is determined. It should be noted that, generally, the relation whose relation category probability is greater than a preset threshold is considered the semantic relation to which it belongs.
[0066] Furthermore, in order to determine an entity pair (e h e t The semantic relationship type of a target entity can be mapped to a new representation space using a fully connected neural network, and then a bilinear mapping is used to obtain the probability of the relationship category to which the target entity belongs. The calculation formula is as follows:
[0067] z h =tanh(W h e h +T h,t )
[0068] z t =tanh(W t e t +T h,t )
[0069] P(e h e t )=σ(z h W r z t +b r )
[0070] To more effectively address the issues of multi-label and imbalanced samples, an adaptive threshold loss can be used as the training objective. Specifically, an additional threshold relation category TH is introduced, and the logarithm P of positive relations above the threshold relation is increased. T And the logarithm N of the negative relationship that is reduced below the threshold. T To optimize the loss, the loss function is calculated using the following formula:
[0071]
[0072] The entity relation extraction method, apparatus, device, and medium provided by this invention expand the entity pairs of the "entity / entity" two-dimensional data structure to form the "entity / entity / relationship" three-dimensional data structure, and effectively distinguish the interactive representations under different semantic spaces by adopting a triple attention mechanism based on deformation convolution, thereby adaptively enhancing the recognition of document structural features, thereby improving the relational reasoning ability of all information in the document, and realizing a more accurate document entity relation extraction method.
[0073] In one embodiment, the target entity pair includes a head entity and a tail entity;
[0074] The semantic space includes a first semantic space between the head entity and the tail entity, a second semantic space between the head entity and the relation, and a third semantic space between the tail entity and the relation;
[0075] The interaction features include a first interaction feature between the head entity and the tail entity, a second interaction feature between the head entity and the relation, and a third interaction feature between the tail entity and the relation.
[0076] In one embodiment, the target entity pair includes a head entity and a tail entity, which may or may not have a corresponding relationship. In the constructed "entity / entity / relationship" three-dimensional data structure, the relationship between entities is to be determined, and the constructed three-dimensional data structure is used to identify the relationship between entities.
[0077] In the "entity / entity / relationship" three-dimensional data structure, the target entity pair includes a head entity and a tail entity. Therefore, a triple attention mechanism is used to capture the interaction features of the three-dimensional data structure in different semantic spaces. The three-dimensional data structure includes a first semantic space between the head entity and the tail entity, a second semantic space between the head entity and the relation, and a third semantic space between the tail entity and the relation. Furthermore, the interaction features identified based on the three-dimensional data structure include the first interaction feature between the head entity and the tail entity, the second interaction feature between the head entity and the relation, and the third interaction feature between the tail entity and the relation. By using the interaction features identified based on the three-dimensional data structure, including the first, second, and third interaction features, the recognition of document structure features is enhanced, and the relational reasoning ability of all information in the document is further improved.
[0078] In one embodiment, please refer to Figure 2 Step 10, the target entity pair is determined based on the following steps:
[0079] Step 11: Based on each sentence and each word of the document to be identified, determine semantically similar entity mention vectors, wherein the entity words corresponding to the entity mention vectors are semantically similar;
[0080] Step 12: Aggregate the entity mention vectors to determine entity vectors, wherein each entity vector corresponds to one or more entity mention vectors;
[0081] Step 13: Based on the entity vector, determine the target entity pairs in the document to be identified.
[0082] In this embodiment, each sentence and word of the document to be identified is first identified, and each entity word within each sentence and word is then identified. Based on these entity words, semantically similar entity mention vectors are determined. Entity mention vectors are descriptive words that describe the same entity word, thus exhibiting semantic similarity. Next, these semantically similar entity mention vectors are aggregated to obtain an entity vector. This process aggregates all words describing the same entity in the document into a single entity word, resulting in a corresponding entity vector. Each entity vector corresponds to one or more entity mention vectors. Finally, after aggregating semantically similar entity mention vectors, the entity vector is used to determine target entity pairs.
[0083] In this embodiment, by identifying each entity word in the document to be identified and aggregating each similar entity word, and then using the entity vector obtained by aggregating similar entity mention vectors to determine the target entity pair, the redundancy of entity words and the redundancy of target entity pairs in the document to be identified are reduced, thereby improving the accuracy of entity relation extraction.
[0084] In one embodiment, please refer to Figure 3 Step 13, based on the entity vector, determine the target entity pairs in the document to be identified, including:
[0085] Step 131: Based on the entity vector, determine the context vector corresponding to the entity vector;
[0086] Step 132: Merge the entity vector and the context vector to determine the merged entity vector;
[0087] Step 133: Based on the fused entity vector, determine the target entity pairs in the document to be identified.
[0088] One possible way to determine target entity pairs in a document based on entity vectors is to first determine the context vector corresponding to the entity vector. This can be done by inputting the entity vector into a query model, which then determines the corresponding context vector. Next, the entity vector and context vector are fused to determine a fused entity vector. The target entity pairs in the document are then determined based on this fused entity vector.
[0089] In this embodiment, when determining the target entity pair from the entity vector, the context vector of the entity vector is determined, and then the target entity pair in the document to be identified is determined based on the entity vector and the context vector. This enables the identification of entity pairs based on the context of the entity vector, thereby improving the accuracy of entity pair identification and further improving the accuracy of entity relationship extraction.
[0090] In one embodiment, please refer to Figure 4 Step 133, based on the fused entity vector, determine the target entity pairs in the document to be identified, including:
[0091] Step 1331: Divide the fused entity vector into several groups on an average basis to obtain entity vector groups;
[0092] Step 1332: Based on the entity vector grouping and transformation matrix, determine the target entity pairs in the document to be identified.
[0093] In this embodiment, the target entity pairs are obtained using a grouped bilinear mapping. Specifically, the entity vector representation is first divided into k groups on average, and then transformed using the corresponding transformation matrix g. (s,o) Obtain the target entity pair g (s,o) The formula is as follows:
[0094]
[0095]
[0096] In this embodiment, grouped bilinear mapping is used to obtain target entity pairs, thereby improving the computational efficiency and accuracy of target entity pairs.
[0097] In one embodiment, please refer to Figure 5 Step 30, based on the interaction features, determine the relationship category probability of the target entity pair, including:
[0098] Step 31: Based on the interaction features, determine the overall document relationship representation of the document to be identified;
[0099] Step 32: Based on the interaction features, determine the semantic relationship representation of the target entity pair;
[0100] Step 33: Based on the overall document relation representation and the semantic relation representation, determine the relation category probability of the target entity pair.
[0101] To alleviate the long-tail distribution problem of documents, this embodiment employs a multi-task learning approach. It embeds the data representations of two tasks—overall document relation category identification and individual entity relation category identification—into the same semantic space. Then, a task-specific layer is used for each task to extract task-specific representations, enhancing the model's perception of the global document relation representation. Therefore, after semantic enhancement of the "entity / entity / relationship" 3D table, global average pooling is used to obtain the overall semantic representation of the document. This representation serves as input to the global relation classification module, and the cross-entropy loss function is used to determine the overall relation categories. The calculation formula is as follows:
[0102] d all =GlobalAveragePooling(T)
[0103] P(d all ) = sigmoid(d all W all +b all )
[0104] in, The corresponding loss function is:
[0105]
[0106] The overall objective function for model training is:
[0107] L = L each +L global
[0108] This embodiment employs a multi-task recognition method, dividing the task of identifying the relationship category of target entity pairs into document-wide relationship category recognition and identification of the relationship category of a single entity pair. This achieves the determination of the relationship category of target entity pairs based on document-wide relationship representation and semantic relationship representation. On the one hand, it enhances the model's perception of the global relationship expression of the document; on the other hand, it avoids sacrificing the identification of the relationship category of a single entity pair to achieve the recognition effect of document-wide relationship category recognition, and avoids losing the recognition effect of document-wide relationship category recognition to achieve the identification of the relationship category of a single entity pair. This achieves a balance between document-wide relationship category recognition and the identification of the relationship category of a single entity pair.
[0109] The entity relation extraction apparatus provided by the present invention is described below. The entity relation extraction apparatus described below and the entity relation extraction method described above can be referred to in correspondence.
[0110] Please refer to Figure 6 The entity relation extraction device provided by the present invention includes:
[0111] The three-dimensional encoding and aggregation module 610 is used to determine a three-dimensional data structure containing the mapping relationship between the target entity pairs and the relationships to be identified based on the target entity pairs and the relationships to be identified in the document to be identified.
[0112] The semantic interaction module 620 is used to capture the interaction features of the three-dimensional data structure in different semantic spaces based on the three-dimensional data structure using a triple attention mechanism.
[0113] The relationship classification module 630 is used to determine the relationship category probability of the target entity pair based on the interaction features.
[0114] The relation category probability is used to determine the semantic relation type to which the target entity pair belongs, and the convolutional layer of the triple attention mechanism adopts deformable convolution.
[0115] Furthermore, the target entity pair includes a head entity and a tail entity;
[0116] The semantic space includes a first semantic space between the head entity and the tail entity, a second semantic space between the head entity and the relation, and a third semantic space between the tail entity and the relation;
[0117] The interaction features include a first interaction feature between the head entity and the tail entity, a second interaction feature between the head entity and the relation, and a third interaction feature between the tail entity and the relation.
[0118] Furthermore, the entity relationship extraction device also includes a target entity pair determination module, used for:
[0119] Based on each sentence and each word of the document to be identified, semantically similar entity mention vectors are determined, wherein the entity words corresponding to the entity mention vectors are semantically similar;
[0120] Aggregate the entity mention vectors to determine an entity vector, wherein the entity vector corresponds to one or more entity mention vectors;
[0121] Based on the entity vector, the target entity pairs in the document to be identified are determined.
[0122] Furthermore, the target entity pair determination module is also used for:
[0123] Based on the entity vector, determine the context vector corresponding to the entity vector;
[0124] The entity vector and the context vector are fused to determine the fused entity vector;
[0125] Based on the fused entity vector, the target entity pairs in the document to be identified are determined.
[0126] Furthermore, the target entity pair determination module is also used for:
[0127] The fused entity vectors are divided into several groups on average to obtain entity vector groupings;
[0128] Based on the entity vector grouping and transformation matrix, the target entity pairs in the document to be identified are determined.
[0129] Furthermore, the relationship classification module is also used for:
[0130] Based on the interaction features, the overall document relationship representation of the document to be identified is determined;
[0131] Based on the interaction features, the semantic relationship representation of the target entity pair is determined;
[0132] Based on the overall document relation representation and the semantic relation representation, the relation category probability of the target entity pair is determined.
[0133] Figure 7 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 7As shown, the electronic device may include a processor 710, a communications interface 720, a memory 730, and a communication bus 740, wherein the processor 710, communications interface 720, and memory 730 communicate with each other via the communication bus 740. The processor 710 can invoke logical instructions in the memory 730 to execute an entity relation extraction method. This method includes: determining a three-dimensional data structure containing the mapping relationship between the target entity pairs and the relations to be identified based on the target entity pairs and the relations to be identified in the document to be identified; capturing the interaction features of the three-dimensional data structure in different semantic spaces using a triple attention mechanism based on the three-dimensional data structure; and determining the relation category probability of the target entity pairs based on the interaction features. The relation category probability is used to determine the semantic relation type to which the target entity pairs belong, and the convolutional layer of the triple attention mechanism employs deformable convolution.
[0134] Furthermore, the logical instructions in the aforementioned memory 730 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0135] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer is able to execute the entity relation extraction method provided by the above methods. The method includes: determining a three-dimensional data structure containing the mapping relationship between the target entity pairs and the relationships to be identified based on the target entity pairs and the relationships to be identified in the document to be identified; capturing the interaction features of the three-dimensional data structure in different semantic spaces using a triple attention mechanism based on the three-dimensional data structure; and determining the relationship category probability of the target entity pairs based on the interaction features. The relationship category probability is used to determine the semantic relationship type to which the target entity pairs belong, and the convolutional layer of the triple attention mechanism adopts deformable convolution.
[0136] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the entity relation extraction method provided by the above methods. The method includes: determining a three-dimensional data structure containing the mapping relationship between the target entity pairs and the relationships to be identified, based on target entity pairs and relationships to be identified in a document to be identified; capturing the interaction features of the three-dimensional data structure in different semantic spaces using a triple attention mechanism based on the three-dimensional data structure; and determining the relationship category probability of the target entity pairs based on the interaction features; wherein the relationship category probability is used to determine the semantic relationship type to which the target entity pairs belong, and the convolutional layer of the triple attention mechanism employs deformable convolution.
[0137] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.
[0138] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0139] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for extracting entity relations, characterized in that, include: Based on the target entity pairs and the relationships to be identified in the document to be identified, a three-dimensional data structure containing the mapping relationship between the target entity pairs and the relationships to be identified is determined; Based on the aforementioned three-dimensional data structure, a triple attention mechanism is used to capture the interactive features of the three-dimensional data structure in different semantic spaces. Based on the interaction features, determine the probability of the relationship category of the target entity pair; The relation category probability is used to determine the semantic relation type to which the target entity pair belongs, and the convolutional layer of the triple attention mechanism adopts deformable convolution. Determining the relationship category probability of the target entity pair based on the interaction features includes: Based on the interaction features, the overall document relationship representation of the document to be identified is determined; Based on the interaction features, the semantic relationship representation of the target entity pair is determined; Based on the overall document relation representation and the semantic relation representation, the relation category probability of the target entity pair is determined.
2. The entity relation extraction method according to claim 1, characterized in that, The target entity pair includes a head entity and a tail entity; The semantic space includes a first semantic space between the head entity and the tail entity, a second semantic space between the head entity and the relation, and a third semantic space between the tail entity and the relation; The interaction features include a first interaction feature between the head entity and the tail entity, a second interaction feature between the head entity and the relation, and a third interaction feature between the tail entity and the relation.
3. The entity relation extraction method according to claim 1, characterized in that, The target entity pairs are determined based on the following steps: Based on each sentence and each word of the document to be identified, semantically similar entity mention vectors are determined, wherein the entity words corresponding to the entity mention vectors are semantically similar; Aggregate the entity mention vectors to determine an entity vector, wherein the entity vector corresponds to one or more entity mention vectors; Based on the entity vector, the target entity pairs in the document to be identified are determined.
4. The entity relation extraction method according to claim 3, characterized in that, Based on the entity vector, the target entity pairs in the document to be identified are determined, including: Based on the entity vector, determine the context vector corresponding to the entity vector; The entity vector and the context vector are fused to determine the fused entity vector; Based on the fused entity vector, the target entity pairs in the document to be identified are determined.
5. The entity relation extraction method according to claim 4, characterized in that, Based on the fused entity vector, the target entity pairs in the document to be identified are determined, including: The fused entity vectors are divided into several groups on average to obtain entity vector groupings; Based on the entity vector grouping and transformation matrix, the target entity pairs in the document to be identified are determined.
6. An entity relation extraction device, characterized in that, include: A three-dimensional encoding and aggregation module is used to determine a three-dimensional data structure containing the mapping relationship between the target entity pairs and the relationships to be identified based on the target entity pairs and the relationships to be identified in the document to be identified. The semantic interaction module is used to capture the interaction features of the three-dimensional data structure in different semantic spaces using a triple attention mechanism based on the three-dimensional data structure. A relationship classification module is used to determine the relationship category probability of the target entity pair based on the interaction features. The relation category probability is used to determine the semantic relation type to which the target entity pair belongs, and the convolutional layer of the triple attention mechanism adopts deformable convolution. The relationship classification module is specifically used to determine the overall document relationship representation of the document to be identified based on the interaction features; determine the semantic relationship representation of the target entity pair based on the interaction features; and determine the relationship category probability of the target entity pair based on the overall document relationship representation and the semantic relationship representation.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the entity relation extraction method as described in any one of claims 1 to 5.
8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the entity relation extraction method as described in any one of claims 1 to 5.
9. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the entity relation extraction method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Chapter-level relationship extraction method
CN111831783A
Cervical cell detection and identification method based on attention mechanism and detection converter
CN113920364A