Entity-relation triple extraction method, system, device, medium and product
By combining a pre-trained word vector model with a multi-head self-attention mechanism and dilated convolution, the accuracy and efficiency issues of entity relation extraction in complex text are solved, achieving efficient and accurate identification and extraction of entities and relations in complex text.
Patent Information
- Application Number
- CN202411743962.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-30
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2044-11-30
AI Technical Summary
Existing technologies struggle to accurately capture subtle semantic connections between entities and relationships when processing complex text. They also lack the ability to identify cross-word or cross-tag relationships and are not comprehensive enough in handling isolated entities, resulting in insufficient efficiency and accuracy in entity relationship extraction.
A pre-trained word vector model is used to generate word embedding representations. A bidirectional long short-term memory network is used to encode the temporal and semantic relationships between words. Multi-head self-attention mechanism and dilated convolution are combined to capture long-distance dependencies. Label table features are constructed, and entity-relation triples are generated through iterative optimization.
It improves the accuracy of entity recognition and overall decoding efficiency, fully covers all entities, and enhances the comprehensiveness and practicality of entity relationship extraction.
Smart Images

Figure CN119577157B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of natural language processing, and particularly relates to an entity-relation triple extraction method, system, device, medium and product. BACKGROUND
[0002] In the construction of knowledge graphs, entities play a crucial role. They usually refer to specific things or abstract concepts that have clear distinctions and exist independently. When these entities are connected by specific relationships, they form relationship triples (head entity-relation-tail entity), where the head entity serves as the starting point of the relationship, and the tail entity serves as the endpoint of the relationship, both of which jointly carry a specific piece of knowledge in the knowledge graph.
[0003] Relationships, as the cornerstone of knowledge graphs, describe various connections or interactions between entities. These relationships can be "belongs to", "located in", "contains", etc. They collectively build a rich and diverse semantic network, enabling knowledge graphs to express complex knowledge structures.
[0004] In the field of natural language processing (NLP), word representation is a technology that converts words into numerical form, enabling models to more easily learn and understand semantic relationships between words. This semantic relationship is crucial for entity recognition tasks, which aim to accurately identify entities with specific meanings, such as names, place names, organization names, etc. High-quality word representation can more accurately reflect the semantic similarity between words, thereby improving the accuracy of entity recognition.
[0005] With the development of deep learning technology, some advanced models (such as BERT and its variants) have been able to directly perform entity recognition tasks on text without explicit word representation layers. These models have learned rich contextual information and semantic knowledge through extensive pre-training, enabling them to achieve significant performance improvements in entity recognition tasks. However, these models still use some form of word representation (although it may be implicit) internally to process and represent words and entities in text.
[0006] Relationship extraction is another key task in NLP, which aims to identify semantic relationships between entities in text and convert them into structured relationship triples. Word representation plays an important role in this process, as it provides numerical information about the semantic relationships between words to the model. By analyzing the similarities and differences between word representations, the model can infer the semantic relationships that may exist between entities.
[0007] The importance of named entity recognition (NER) as a basic task of relation extraction is self-evident. The task of NER is to accurately identify entities with specific meanings from text, which usually includes names of people, places, organizations, etc. The performance of NER directly affects the effectiveness of the subsequent relation extraction task, so improving the accuracy of NER is crucial for building a high-quality knowledge graph.
[0008] However, traditional entity relation extraction methods have many challenges in dealing with complex texts. These methods often focus on learning the relationship features between words, ignoring the cross-word or cross-token relationships and the token information in the text. In addition, the processing of isolated entities is also a difficulty for traditional methods. In recent years, with the rise of deep learning technology, pre-trained models have shown strong feature extraction capabilities in NLP tasks. However, even with these advanced models, existing entity relation extraction methods still have deficiencies in dealing with complex texts. Especially when facing texts containing a large number of complex entities and relationships, existing methods often struggle to achieve high accuracy while maintaining high efficiency.
[0009] Therefore, how to realize an entity relation extraction method that can accurately identify entities and relationships in complex texts and efficiently process large-scale data has become a technical problem that NLP field technicians need to overcome. Future research needs to explore the application of deep learning technology in entity relation extraction more deeply in order to achieve greater breakthroughs in performance. SUMMARY
[0010] The purpose of the present application is to provide an entity-relation triple extraction method, system, device, medium and product to overcome the problems of existing technologies in accurately capturing the subtle semantic relationship between entities and relationships, insufficient recognition ability of cross-word or cross-token relationship, and incomplete processing of isolated entities when dealing with complex texts.
[0011] The present application solves the above technical problems by the following technical solutions:
[0012] An entity-relation triple extraction method, comprising the following steps:
[0013] S1, training the pre-trained word vector model on the sentence S to generate word embedding representation;
[0014] S2, encoding the word embedding representation to capture the timing and semantic relationship between words, generating word representation;
[0015] S31, performing named entity recognition and relation extraction on the word representation to obtain the entities and relationships of the sentence S;
[0016] S32, convert the feature information space of the word representation into a subject and object subspace to obtain a subject representation H s and an object representation H o ; set a hyperparameter to control the iteration round;
[0017] S33, start iteration: based on the subject representation H s and the object representation H o , generate a corresponding label table feature representation TF for each relationship r , wherein the label includes H-H representing the start position of the head entity and the start position of the tail entity, H-T representing the start position of the head entity and the end position of the tail entity, T-H representing the end position of the head entity and the start position of the tail entity, T-T representing the end position of the head entity and the end position of the tail entity, and N / A representing other cases; adopt conditional layer normalization to generate a word pair table feature representation M r , fuse the word pair table feature representation Mr and the label table feature representation TFr to obtain a first table feature representation Tr;
[0018] S34, combine the first table feature representations Tr of different relationships, extract features, and generate label-aware word representations, including table features related to the subject and table features related to the object , mine the relationships between the label-aware word representations and the subject representation H s and the object representation H o and the label-aware word representations through a multi-head self-attention mechanism; generate the final subject representation and object representation through a residual network, and feed back to the feature information space of the word representation for the next iteration until the iteration round equals the set hyperparameter;
[0019] S4, after the iteration ends, apply a hollow convolution to capture the long-distance dependency relationship between the word pairs in the first table feature representation Tr to obtain a second table feature representation Tr';
[0020] S5, take the second table feature representation Tr' as the first prediction factor, and take the entities and relationships of the sentence S as the second prediction factor, and obtain the final head entity and tail entity through prediction; and fill into the table TableF;
[0021] S6, extract the entity pair of each relationship in the table TableF through a bidirectional parallel decoding algorithm to obtain an entity-relation triple.
[0022] Further, before step S1, the method further comprises collecting the sentences to be processed, and pre-processing to obtain the sentences S.
[0023] Further, the pre-processing comprises word segmentation and part-of-speech tagging.
[0024] Further, step S6 further comprises a method of constructing a unified label space, and setting the isolated entity as an entity having a specific relationship with itself.
[0025] Further, the pre-trained word vector model is a BERT model.
[0026] Further, step S2 adopts a bidirectional long short-term memory network (Bi-LSTM) model for encoding.
[0027] An entity-relation triple extraction system comprises
[0028] A pre-processing module is configured to collect sentences to be processed, and pre-process to obtain the sentences S;
[0029] A word embedding generation module is configured to train the pre-trained word vector model on the sentences S to generate a word embedding representation;
[0030] A word representation generation module is configured to encode the word embedding representation to capture the timing and semantic relationship between words, and generate a word representation;
[0031] An identification and extraction module is configured to perform named entity recognition and relation extraction on the word representation to obtain entities and relations of the sentences S;
[0032] A feature conversion module is configured to convert the feature information space of the word representation into a subject and object subspace to obtain a subject representation H s and an object representation H o ; set a hyperparameter to control the iteration rounds;
[0033] An iteration and optimization module, the iteration module is configured to set a hyperparameter to control the iteration rounds, and the optimization module comprises a table label feature generation module, a label-aware word representation module, a multi-head self-attention module, and a residual network module,
[0034] The label table feature generation module is configured to generate a corresponding label table feature representation TF s based on the subject representation H o and the object representation H rwherein the label includes H-H representing a head entity start position and a tail entity start position, H-T representing a head entity start position and a tail entity end position, T-H representing a head entity end position and a tail entity start position, T-T representing a head entity end position and a tail entity end position, and N / A representing other cases; the word pair table feature representation M is generated by using conditional layer normalization r The word pair table feature representation M is fused with the label table feature representation TFr to obtain a first table feature representation Tr.
[0035] The label-aware word representation module is configured to combine the first table feature representations Tr of different relations, extract features, and generate label-aware word representations, including subject-related table features and object-related table features .
[0036] The multi-head self-attention module is configured to mine the relationships between the label-aware word representations and the subject representation H s and the object representation H o and the label-aware word representations through a multi-head self-attention mechanism.
[0037] The residual network module is configured to generate final subject and object representations through a residual network and feed back to the feature information space of the word representation.
[0038] The long-distance dependency capturing module is configured to apply a dilated convolution to the final subject and object representations after the iteration is completed, capture long-distance dependencies between the word pairs in the first table feature representation Tr, and obtain a second table feature representation Tr'.
[0039] The entity-relation triple generation module is configured to take the second table feature representation Tr' as a first prediction factor, take the entities and relations of the sentence S as a second prediction factor, obtain final head and tail entities through prediction, and fill into a table TableF; and extract the entity pairs of each relation in the table TableF through a bidirectional parallel decoding algorithm to obtain entity-relation triples.
[0040] An electronic device includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and the processor implements the above entity-relation triple extraction method when executing the program.
[0041] A computer readable storage medium has a computer program stored thereon, and the computer program is executed by a processor to implement the above entity-relation triple extraction method.
[0042] The computer program product comprises a computer program, and the computer program is executed by a processor to implement the entity-relation triple extraction method.
[0043] Compared with the prior art, the positive progress effect of the application is that:
[0044] The entity-relation triple extraction method provided by the application innovatively introduces a table feature construction method oriented to labels, marks the table through a vertex label strategy of a specific relation, and embeds the label representation into the table. This not only captures the relationship between words, but also fully considers the complex interaction between words and labels and labels. Through the parallel search route of the forward and reverse directions, the entity-relation triple can be more accurately extracted. Not only the accuracy of entity recognition is improved, but also the efficiency of the overall decoding is improved. In addition, the isolated entity is regarded as a special case of having a relationship with itself, and is included in the category of triple classification, realizing the comprehensive coverage of all entities and improving the practicability and comprehensiveness of the method. BRIEF DESCRIPTION OF DRAWINGS
[0045] The accompanying drawings are included to provide a further understanding of the application, and are incorporated in and constitute a part of this application, illustrate embodiments of the application and serve to explain the principles of the application, and do not constitute improper limitations on the application.
[0046] Figure 1 The accompanying drawings are included to provide a further understanding of the application, and are incorporated in and constitute a part of this application, illustrate embodiments of the application and serve to explain the principles of the application, and do not constitute improper limitations on the application.
[0047] Figure 2 The accompanying drawings are included to provide a further understanding of the application, and are incorporated in and constitute a part of this application, illustrate embodiments of the application and serve to explain the principles of the application, and do not constitute improper limitations on the application. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical scheme and advantages of the embodiments of the application clearer, the technical scheme in the embodiments of the application will be described clearly and completely below with reference to the drawings in the embodiments of the application. Obviously, the described embodiments are part of the embodiments of the application, rather than all the embodiments of the application. The components of the embodiments of the application described and shown in the drawings can be arranged and designed in various different configurations.
[0049] Therefore, the following detailed description of the embodiments of the application provided in the drawings is not intended to limit the scope of the claimed application, but only represents selected embodiments of the application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the application without creative labor are within the scope of protection of the application.
[0050] It should be noted that: similar reference numbers and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings.
[0051] The application will be further described in detail below with reference to the accompanying drawings, which are provided for explanation rather than limitation.
[0052] An entity-relation triple extraction method, comprising the following steps:
[0053] S1, training a pre-trained word vector model on a sentence S to generate a word embedding representation;
[0054] S2, encoding the word embedding representation to capture the timing and semantic relationship between the words, and generating a word representation;
[0055] S31, performing named entity recognition and relation extraction on the word representation to obtain the entities and relations of the sentence S;
[0056] S32, converting the feature information space of the word representation into a subject and object subspace to obtain a subject representation H s and an object representation H o ; set the hyperparameters to control the iteration rounds;
[0057] S33, iteration starts: based on the subject representation H s and the object representation H o , generate a corresponding label table feature representation TF r for each relation, wherein the labels include H-H representing the start position of the head entity and the start position of the tail entity, H-T representing the start position of the head entity and the end position of the tail entity, T-H representing the end position of the head entity and the start position of the tail entity, T-T representing the end position of the head entity and the end position of the tail entity, and N / A representing other cases; adopt conditional layer normalization to generate a word pair table feature representation M r , fuse the word pair table feature representation Mr and the label table feature representation TFr to obtain a first table feature representation Tr;
[0058] S34, combine the first table feature representations Tr of different relations to extract features and generate label-aware word representations, including subject-related table features and object-related table features , mine the relationship between the label-aware word representations and the subject representation H s and the object representation H o and the label-aware word representations through a multi-head self-attention mechanism; generate the final subject representation and object representation through a residual network, and feed back to the feature information space of the word representation for the next iteration until the iteration rounds equal the set hyperparameters;
[0059] S4, when the iteration ends, a hollow convolution is applied to capture the long-distance dependency between the word pairs in the first table feature representation Tr, and a second table feature representation Tr' is obtained;
[0060] S5, taking the second table feature representation Tr' as the first prediction factor and the entities and relations of the sentence S as the second prediction factor, the final head entity and tail entity are obtained through prediction; and filling to the table TableF;
[0061] S6, through a bidirectional parallel decoding algorithm, the entity pair of each relation in the table TableF is extracted, and an entity-relation triple is obtained.
[0062] As an optional embodiment of the present application, step S1 further includes collecting the sentences to be processed, and pre-processing to obtain the sentence S.
[0063] As an optional embodiment of the present application, the pre-processing includes word segmentation and part-of-speech tagging.
[0064] By collecting the sentences to be processed and pre-processing (including word segmentation and part-of-speech tagging), the key information in the text can be more effectively extracted, laying a solid foundation for subsequent entity recognition and relation extraction.
[0065] As an optional embodiment of the present application, step S6 further includes a unified label space method, and the isolated entity is set as an entity having a specific relation with itself. The isolated entity is set as an entity having a specific relation with itself, which solves the problem of insufficient processing of isolated entities in traditional methods, so that the model can more comprehensively cover all entities in the text, further improving the integrity of triple extraction.
[0066] As an optional embodiment of the present application, the pre-trained word vector model is a BERT model. Selecting the BERT model as the pre-trained word vector model can more accurately represent the words and entities in the text, thereby improving the performance of triple extraction.
[0067] As an optional embodiment of the present application, the encoding in step S2 adopts a bidirectional long short-term memory network Bi-LSTM model. The bidirectional long short-term memory network Bi-LSTM model can make full use of the context information in the text, improve the recognition ability of entities and relations, and thus improve the accuracy of triple extraction.
[0068] In a specific embodiment of the present application, referring to Figures 1-2 The purpose of entity-relation triple extraction is to extract all triples in the input sentence, and N is the number of triples. wherein These are the head entity "subject" and the tail entity "object", respectively. E is the predefined entity set, and m is the number of predefined entity types. , where R represents a predefined set of relations and k is the number of predefined relation types.
[0069] Given sentence ( (where i is the i-th word and n is the number of words in the sentence). In sentence S, we will maintain a relation table for each relation r. (Size is n×n). Define the tag set as follows: .if , then it means and Entities are associated, and the corresponding item in the relation table is represented as follows: The marking strategy uses five types: (1) HH (Head-to-Head), representing the start position of the head entity and the end position of the tail entity. (2) HT (Head-to-Tail), representing the start position of the head entity and the end position of the tail entity. (3) TH (Tail-to-Head), representing the end position of the head entity and the start position of the tail entity. (4) TT (Tail-to-Head), where TT represents the end position of the head entity and the end position of the tail entity. (5) N / A. All cells other than the above four cases will be marked as N / A.
[0070] In this embodiment of the invention, a pre-trained word vector model is used to train the statement S to generate a word embedding representation, denoted as . ,in It is the first The word vectors corresponding to each word; word representations are generated using pre-trained BERT and a bidirectional long short-term memory network (Bi-LSTM). It contains word-level feature information about the given statement and its relevance to the task:
[0071]
[0072] in and These are the forward LSTM and backward LSTM at the position. The hidden state at that location; Indicates a connection operation; l is the number of hidden layers in the backward LSTM.
[0073] Since the relationship between entities in a triple is directional, each word in a relation either plays a subject or object role. The subject represents the head of the triple, while the object represents the tail. The feature information space of word representations is converted into the subject and object subspaces as follows:
[0074] where, and are the subject and object representations of a sentence, , ∈ and , ∈ are trainable weights and biases, respectively, and d is the dimension of the embedding vectors.
[0075] Set hyperparameters to control the number of iterations;
[0076] Through the Tag-based Table Feature Generation Module (TTFG), the token features are embedded into the table to generate fine-grained table features containing word-word, word-token, and token-token relationships:
[0077]
[0078]
[0079] where ⊙ denotes the Hadamard product operation, and σ is the activation function, and are the feature representations of and , respectively, r ∈ and b r ∈ are trainable weights and biases, respectively, and r represents the relationship between word pairs.
[0080] Finally, the Conditional Layer Normalization (CLN) is used to generate directional word pair table feature representations M r , enhancing the directional information of the table features:
[0081]
[0082] where Wα, ∈ and , ∈ are trainable weights and biases, r represents the relation between word pairs. µ and σ are the mean and standard deviation of the elements in the relation, respectively The mean and standard deviation of the elements are denoted as:
[0083]
[0084] where, denotes h j the k-th dimension.
[0085] The word pair table feature representation Mr is fused with the token table feature representation TFr to obtain a first table feature representation Tr:
[0086]
[0087] where, denotes element-wise addition.
[0088] Tr is input into a global average pooling (GAP) and a feed-forward neural network (FFN) layer to finally generate a table feature related to the subject and a table feature related to the object .
[0089] Fine-grained relational feature extraction (FRFE) is introduced to further refine the table feature by a multi-head self-attention mechanism to mine the global connection between tokens and word pairs:
[0090]
[0091] The final subject representation and object representation are generated by a residual network and fed back to the feature information space of the word representation for the next iteration until the number of iterations is equal to the set hyperparameter;
[0092] In the embodiments of the present application, dilated convolution (Dilated Convolution) is applied to increase the receptive field of the table feature, and the size of the receptive field is controlled by adjusting the dilation rate to capture the long-distance dependency relationship between word pairs:
[0093]
[0094] where, is the output after dilated convolution, are the weights of the convolution kernel, m, n are the row and column of the matrix operation respectively, K is the size of the convolution kernel, and d is the dilation rate. Note that the indices i+dm and j+dn may need to be properly boundary handled (e.g., padded or cropped) to ensure that they are within the valid range of Tr.
[0095] In the embodiment of the application, based on the optimized table features, a relation table is maintained for each relation through a vertex marking strategy of a specific relation, and a marked matrix containing entity and relation information is filled in the table to generate a decoding algorithm containing forward search and reverse search:
[0096]
[0097] The forward search generates entity pairs in the order of starting from the head entity (subject) and the tail entity (object) to the end mark. The reverse search generates entity pairs in the reverse order of starting from the end mark of the tail entity (object) and the head entity (subject) to the start mark, which is mainly to handle nested entities. By using these labels, fine-grained entity spans can be simulated, and some error propagation in model prediction can be alleviated. For example, the head entity span "H-H" to "T-H" and "H-T" to "T-T" are searched together, and when one of them exists, the span pair corresponding to the labels between them is considered as the head entity (subject). Similarly, the tail entity span "H-H" to "H-T" and "T-H" to "T-T" are searched together, and when one of them exists, the span pair corresponding to the labels between them is considered as the tail entity (object).
[0098] According to the label types in the marked matrix, entity-relation triplets are extracted, nested entities are processed, and joint extraction of entities and relations is completed:
[0099]
[0100]
[0101] In the embodiment of the application, a unified label space method is constructed, isolated entities are regarded as having a specific relation with themselves and are included in the triplet classification category, a meaningful label is assigned by a classifier, and comprehensive entity and relation extraction is realized; the entity-relation joint extraction task is converted into a fine-grained triplet classification problem, effectively avoiding potential conflicts between entity and relation representations.
[0102] Based on the same inventive concept, the embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the entity-relation triple extraction method. The memory can include a memory, such as a high-speed random memory, and can also include a non-volatile memory, such as at least one disk memory. The processor, network interface, and memory are connected to each other through an internal bus, which can be an industry standard architecture bus, a peripheral component interconnect standard bus, an extended industry standard architecture bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. The memory is used to store programs, and specifically, the programs can include program codes, and the program codes include computer operation instructions. The memory can include a memory and a non-volatile memory, and provide instructions and data to the processor.
[0103] Based on the same inventive concept, the embodiment of the present application provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the steps of the entity-relation triple extraction method. Specifically, the computer readable storage medium includes but is not limited to, for example, a volatile memory and / or a non-volatile memory. The volatile memory can include a random access memory (RAM) and / or a cache memory, etc. The non-volatile memory can include a read-only memory (ROM), a hard disk, a flash memory, an optical disk, a magnetic disk, etc.
[0104] Based on the same inventive concept, the embodiment of the present application provides a computer program product, which comprises a computer program stored on a computer readable storage medium, and the computer program comprises program instructions, when the program instructions are executed by a computer device, the computer device executes the steps of the entity-relation triple extraction method.
[0105] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer usable program code.
[0106] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flow or blocks Figure 1 means for functionally implementing the steps in one or more flow or blocks
[0107] These computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture including instructions which implement the function specified in the flowchart block or blocks. Figure 1 one or more flow or blocks Figure 1 means for functionally implementing the steps in one or more flow or blocks
[0108] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flow or blocks Figure 1 means for functionally implementing the steps in one or more flow or blocks
[0109] Finally, it should be noted that the above-mentioned embodiments are only one or more specific forms of the technical solutions of the present application, and their purpose is to clearly illustrate the concept, principle and application mode of the present application through specific examples, and by no means intend to limit the protection scope of the present application to these specific embodiments. In fact, the true value of the present application lies in its proposed technical ideas and innovative points, not its forms or implementation means.
[0110] For those skilled in the art, after reading and understanding the technical solutions of the present application, they have the ability to make various forms of changes, modifications or equivalent replacements to the specific embodiments of the application based on their own professional knowledge and skills. These changes may include but are not limited to adjusting the value range of technical parameters, optimizing the algorithm process to improve efficiency, replacing part of the technical components to achieve better compatibility or reduce cost, etc. As long as the technical solutions after these changes still maintain the technical features required by the original invention, that is, still can realize the core function and effect of the present application, these changes should be considered as falling within the protection scope of the claims of the present application.
[0111] In addition, with the continuous progress and development of technology, new technical means and methods are emerging, which also provides a broad space for further improvement and perfection of the present application. Therefore, the protection scope of the present application should also include those reasonable foreseeable improvements and extensions based on the existing technology, as long as these improvements and extensions do not deviate from the basic principles and core ideas of the present application, they should be considered as the equivalents of the present application, and also be protected by the patent right.
Claims
1. A method for extracting entity-relation triples, characterized in that, Includes the following steps: S1. Train a pre-trained word vector model on statement S to generate word embedding representations; S2. Encode the word embedding representation to capture the temporal and semantic relationships between words and generate word representations; S31. Perform named entity recognition and relation extraction on the word representation to obtain the entities and relations of statement S; S32. Transform the feature information space of word representation into subspaces of subject and object to obtain the subject representation H. s and object represent H o Set hyperparameters to control the number of iteration rounds; S33, Iteration begins: Based on the subject representation H s and object represent H o Generate a corresponding labeled table feature representation (TF) for each relation. r The tags include HH representing the start and end positions of the head and tail entities, HT representing the start and end positions of the head and tail entities, TH representing the end and start positions of the head and tail entities, TT representing the end and end positions of the head and tail entities, and N / A representing other cases. Conditional layer normalization is used to generate the word pair table feature representation M. r The word pair table feature representation Mr and the tag table feature representation TFr are fused to obtain the first table feature representation Tr; S34. Combine the first table feature representations Tr of different relationships, extract features, and generate label-aware word representations, including table features related to the subject. and table features related to objects By employing a multi-head self-attention mechanism, we can explore the relationships between label-aware word representations and the subject representation H. s and object represent H o The relationship between the label-aware word representation and the word representation; the final subject and object representations are generated through a residual network and fed back into the feature information space of the word representation for the next iteration, until the number of iterations equals the set hyperparameters; S4. After the iteration ends, dilated convolution is applied to capture the long-distance dependencies between word pairs in the first table feature representation Tr, thus obtaining the second table feature representation Tr′; S5. Using the second table feature representation Tr′ as the first predictor, and the entities and relations of statement S as the second predictor, the final head entities and tail entities are obtained through prediction; and then filled into table TableF. S6. Using a bidirectional parallel decoding algorithm, extract the entity pairs of each relation in TableF to obtain entity-relation triples.
2. The entity-relation triple extraction method according to claim 1, characterized in that, Before step S1, the process also includes collecting statements to be processed, performing preprocessing, and obtaining statement S.
3. The entity-relation triple extraction method according to claim 2, characterized in that, The preprocessing includes word segmentation and part-of-speech tagging.
4. The entity-relation triple extraction method according to claim 1, characterized in that, Step S6 also includes constructing a unified label space method to set isolated entities as entities that have a specific relationship with themselves.
5. The entity-relation triple extraction method according to claim 1, characterized in that, The pre-trained word vector model is the BERT model.
6. The entity-relation triple extraction method according to claim 1, characterized in that, The encoding described in step S2 uses a bidirectional long short-term memory network (Bi-LSTM) model.
7. An entity-relation triple extraction system, characterized in that, include The preprocessing module is used to collect statements to be processed, perform preprocessing, and obtain statement S; The word embedding generation module is used to train a pre-trained word vector model on the statement S to generate word embedding representations; The word representation generation module is used to encode word embeddings, capture the temporal and semantic relationships between words, and generate word representations. The recognition and extraction module is used to perform named entity recognition and relation extraction on word representations to obtain the entities and relations of statement S; The feature transformation module is used to convert the feature information space of word representations into subspaces of subject and object, obtaining the subject representation H. s and object represent H o Set hyperparameters to control the number of iteration rounds; The iteration and optimization modules are as follows: the iteration module sets hyperparameters and controls the number of iterations until the number of iterations equals the set hyperparameters; the optimization module specifically includes a table label feature generation module, a label-aware word representation module, a multi-head self-attention module, and a residual network module. The tag table feature generation module is used to generate features based on the subject representation H. s and object represent H o Generate a corresponding labeled table feature representation (TF) for each relation. r The tags include HH representing the start and end positions of the head and tail entities, HT representing the start and end positions of the head and tail entities, TH representing the end and start positions of the head and tail entities, TT representing the end and end positions of the head and tail entities, and N / A representing other cases. Conditional layer normalization is used to generate the word pair table feature representation M. r The word pair table feature representation Mr and the tag table feature representation TFr are fused to obtain the first table feature representation Tr; The label-aware word representation module combines the first table feature representations Tr of different relationships, extracts features, and generates label-aware word representations, including table features related to the subject. and table features related to objects ; The multi-head self-attention module is used to mine the relationships between label-aware word representations and the subject representation H through a multi-head self-attention mechanism. s and object represent H o The relationship between label-aware word representation; The residual network module is used to generate the final subject and object representations through the residual network and feed them back to the feature information space of the word representation; The long-distance dependency capture module is used to apply dilated convolutions to the final subject and object representations after iteration to capture the long-distance dependencies between word pairs in the first table feature representation Tr, thus obtaining the second table feature representation Tr′; The entity-relation triple generation module uses the second table feature representation Tr′ as the first predictor and the entity and relation of statement S as the second predictor to obtain the final head entity and tail entity through prediction; and fills them into table TableF; through a bidirectional parallel decoding algorithm, it extracts the entity pairs of each relation in table TableF to obtain entity-relation triples.
8. 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 triple extraction method as described in any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the entity-relation triple extraction method as described in any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the entity-relation triple extraction method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
High-universality many-to-many relation triple extraction method fusing five-dimensional features
CN114091464A
Entity relationship extraction method and system based on LSTM and location-aware network
CN116384396A