A method and device for extracting quintuple entity relations

By performing entity relationship annotation and quintuple preprocessing on text corpus, combined with deep learning model training and data enhancement, the relationship extraction problem in scenarios with overlapping multiple entity relationships is solved, and entity relationship extraction with high recall and accuracy is achieved.

CN114297400BActive Publication Date: 2025-09-23XIAMEN MEIYA PICO INFORMATION CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202111485360.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-07
Publication Date
2025-09-23
Estimated Expiration
2041-12-07

AI Technical Summary

Technical Problem

Existing technologies have difficulty effectively handling the imbalanced relationship categories and overlapping relationships between entity pairs in scenarios with multiple entities and overlapping relationships, resulting in poor relationship extraction results.

Method used

By acquiring text corpus to annotate entity relationships, performing quintuple preprocessing, generating a training dataset, and using a deep learning model for training, combined with data enhancement, objective function and loss function optimization, high recall and accuracy extraction of entity relationships can be achieved.

Benefits of technology

The recall and accuracy of entity relationship extraction are significantly improved, the extracted data is more diversified, and the text relationship extraction effect is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114297400B_ABST
    Figure CN114297400B_ABST
Patent Text Reader

Abstract

The present invention discloses a quintuple entity relationship extraction method, which performs entity relationship annotation on text corpus to obtain annotated data, and then performs quintuple preprocessing on the annotated data to obtain a quintuple training data set containing subject, subject type, relationship, object and object type. Then, a deep learning model is trained with the training data set containing the quintuple to obtain a relationship extraction model. When it is necessary to extract information from text data, the text data can be extracted through the relationship extraction model and corresponding quintuple data can be obtained. This can greatly improve the recall rate of entity relationship extraction, while also ensuring a high accuracy rate. In addition, the extracted data is more diversified, thereby improving the effect of text relationship extraction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of information extraction, and in particular to a method and device for extracting quintuple entity relationships. Background Art

[0002] Information extraction is a key technology essential for building large-scale knowledge graphs. Information extraction consists of two main parts: named entity recognition, which identifies entities within text; and relationship extraction, which constructs relationships between identified entities. With the continuous advancement of information technology, relationship extraction technology has become a vital component of fields such as natural language processing and knowledge graphs. Simultaneously, with the advent of the deep learning era, neural network models have brought new breakthroughs to entity relationship extraction. This has evolved from a pipelined approach that first identifies entities and then classifies their relationships, to a method that jointly extracts entity relationships using feature-based and neural network models, achieving increasingly better results in relationship extraction tasks.

[0003] However, relationship extraction cannot effectively handle scenarios with multiple entities or overlapping relationships between them. The current problems primarily manifest themselves in two aspects: first, relationships do not exist within a pair of entities, resulting in an imbalance in relationship categories; second, relationships overlap between multiple entities, resulting in shared entities or even multiple relationships between two entities. Therefore, without sufficient training data, learning effective relationship extraction methods is difficult or impossible. Summary of the Invention

[0004] The technical problem to be solved by the present invention is to provide a method and device for extracting quintuple entity relationships to improve the effect of text relationship extraction.

[0005] In order to solve the above technical problems, the technical solution adopted by the present invention is:

[0006] A method for extracting quintuple entity relationships, comprising the steps of:

[0007] Get text corpus;

[0008] Performing entity relationship annotation on the text corpus to obtain annotated data;

[0009] Preprocessing the labeled data into quintuples to obtain a training data set; the quintuples include subject, subject type, relationship, object, and object type;

[0010] Training the deep learning model using the training data set to obtain a relationship extraction model;

[0011] Get the text data to be extracted;

[0012] The text data to be extracted is extracted according to the relationship extraction model to obtain the entity relationship quintuple of the text to be extracted.

[0013] In order to solve the above technical problems, another technical solution adopted by the present invention is:

[0014] A quintuple entity relationship extraction device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, each step in the above-mentioned quintuple entity relationship extraction method is implemented.

[0015] The beneficial effect of the present invention is that: by annotating the text corpus with entity relationships to obtain annotated data, and then pre-processing the annotated data into quintuples, a quintuple training data set containing subject, subject type, relationship, object and object type is obtained, and then the deep learning model is trained with the training data set containing the quintuples to obtain a relationship extraction model, so that when it is necessary to extract information from the text data, the text data can be extracted through the relationship extraction model and the corresponding quintuple data can be obtained, which can greatly improve the recall rate of entity relationship extraction, while also ensuring a high accuracy rate, and the extracted data is more diversified, thereby improving the effect of text relationship extraction. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 Flowchart of the steps of a method for extracting quintuple entity relationships in an embodiment of the present invention;

[0017] Figure 2 Schematic diagram of the structure of a quintuple entity relationship extraction device according to an embodiment of the present invention;

[0018] Figure 3 is a flowchart of the steps of a data enhancement method in an embodiment of the present invention;

[0019] Figure 4 This is a system structure diagram of a five-tuple entity relationship extraction method in an embodiment of the present invention. DETAILED DESCRIPTION

[0020] To illustrate the technical content, achieved objectives and effects of the present invention in detail, the following description is given in conjunction with the embodiments and accompanying drawings.

[0021] Please refer to Figure 1 , a five-tuple entity relationship extraction method, comprising the steps of:

[0022] Get text corpus;

[0023] Performing entity relationship annotation on the text corpus to obtain annotated data;

[0024] Preprocessing the labeled data into quintuples to obtain a training data set; the quintuples include subject, subject type, relationship, object, and object type;

[0025] Training the deep learning model using the training data set to obtain a relationship extraction model;

[0026] Get the text data to be extracted;

[0027] The text data to be extracted is extracted according to the relationship extraction model to obtain the entity relationship quintuple of the text to be extracted.

[0028] From the above description, it can be seen that the beneficial effect of the present invention is that: by annotating the text corpus with entity relationships to obtain annotated data, and then pre-processing the annotated data into quintuples, a quintuple training data set containing subject, subject type, relationship, object and object type is obtained, and then the deep learning model is trained with the training data set containing the quintuples to obtain a relationship extraction model, so that when it is necessary to extract information from the text data, the text data can be extracted through the relationship extraction model and the corresponding quintuple data can be obtained, which can greatly improve the recall rate of entity relationship extraction, while also ensuring a high accuracy rate, and the extracted data is more diversified, thereby improving the effect of text relationship extraction.

[0029] Furthermore, before the deep learning model is trained using the training data set to obtain the relationship extraction model, the following steps are further included:

[0030] Performing data enhancement on the sentences with entity relationships in the training data set to obtain new relationship sentences;

[0031] The new relational statement is added to the training dataset.

[0032] From the above description, we can see that by performing data augmentation on the sentences with entity relationships in the training dataset and adding the obtained new relationship sentences to the training dataset, not only the number of datasets is increased, but also the diversity of sentences in the training dataset is improved, so that a more accurate extraction model can be obtained in the subsequent learning process.

[0033] Furthermore, performing data enhancement on the sentences with entity relationships in the training dataset to obtain new relationship sentences includes:

[0034] Multiple groups of statements with entity relationships in the training data set are combined and merged to obtain the new relationship statement.

[0035] From the above description, it can be seen that by combining and merging multiple groups of sentences with entity relationships in the training data set, the new relational sentences still have relevant relationships and corresponding five-tuple features such as subject and object. In the subsequent learning process, it is also possible to learn the recognition of multiple combination sentences and the extraction of five-tuples, thereby improving the extraction accuracy of the extraction model.

[0036] Furthermore, the step of performing data enhancement on the sentences with entity relationships in the training data set to obtain new relationship sentences further includes:

[0037] Replacing entities of the same type in multiple groups of statements with entity relationships or multiple groups of statements with new relationships;

[0038] Synonym replacement is performed on the non-entity parts in the multiple groups of sentences with entity relationships or the multiple groups of sentences with new relationships.

[0039] From the above description, it can be seen that by replacing the entities of the same type in the original relational sentences in the training set or in the new relational sentences generated by combination, and replacing the non-entity parts in the sentences with synonyms, new relational sentences with the same or similar semantics as those in the original training data set can be generated, thereby improving the recognition of entity parts and non-entity parts in the subsequent learning process and improving the extraction accuracy of the extraction model.

[0040] Further, the adding the new relational statement to the training data set includes:

[0041] Set threshold statement length;

[0042] Determine whether the new relational statement is shorter than the threshold statement length; if so, add the new relational statement to the training data set.

[0043] From the above description, it can be seen that by setting the threshold sentence length and judging the length of the new relational sentence when adding the generated new relational sentence to the training data set, it is possible to ensure that the length of the sentence is within the recognizable length range, thereby reducing problems such as recognition failures.

[0044] Furthermore, the training of the training data set by the deep learning model comprises the steps of:

[0045] identifying the subject and subject type of each sentence in the training dataset;

[0046] The relationship corresponding to the subject and subject type and the object and object type in each of the sentences are identified based on the subject and subject type.

[0047] From the above description, it can be seen that by first identifying the subject and subject type of each sentence in the training data set, then identifying the object and object type corresponding to the subject and subject type in the sentence based on the subject and subject type, and finally identifying all possible relationships between the subject and subject type and the object and object type based on the identified subject and subject type and object and object type, the recognition ability of the quintuple of the sentence in the training data set is improved.

[0048] Furthermore, the training of the training data set by using a deep learning model includes:

[0049] The training data set is trained using an objective function, where the objective function is:

[0050]

[0051] Among them, T j represents the five-tuple of the j-th sentence in the training dataset, T j ={(s,st,r,o,ot)}; D represents the training data set, x j represents the jth sentence in the training data set; s represents the subject, st represents the subject type, r represents the relationship, o represents the object, and ot represents the object type.

[0052] From the above description, it can be seen that by training the training set through the above objective function and optimizing at the quintuple level, the entity relationship quintuple can be directly extracted, and (o, ot) can be predicted through the mapping function of (s, st) and r, instead of the traditional entity and relationship classification. At the same time, there is no need to make any assumptions about overlapping entities and relationships. The problem of overlapping entity and relationship quintuples is solved through a carefully designed cascade binary pointer annotation framework, thereby improving the extraction accuracy of the extraction model.

[0053] Furthermore, training the training data set by a deep learning model includes:

[0054] The training data set is trained using a loss function, where the loss function is:

[0055] LOSS=L(sub_heads)+L(sub_tails)+L(sub_type_heads)+L(sub_type_tails)+L(obj_heads)+L(obj_tails)+L(obj_type_heads)+L(obj_type_tails);

[0056] Where sub represents the subject, obj represents the object, heads represents the head position, obj represents the tail position, and L is the binary cross entropy loss function:

[0057]

[0058] From the above description, it can be seen that the accuracy of the extraction model is further improved by calculating the cumulative losses of the subject, subject type, object, and object type through the loss function.

[0059] Furthermore, the training of the training data set by using a deep learning model includes:

[0060] The training dataset is trained and optimized by multi-step dynamic learning rate decay.

[0061] From the above description, it can be seen that training optimization through multi-step dynamic learning rate decay can significantly improve the extraction accuracy of the extraction model.

[0062] Please refer to Figure 2 The present invention also provides a five-tuple entity relationship extraction device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the processor implements each step in the above-mentioned five-tuple entity relationship extraction method.

[0063] The above-mentioned method and device for extracting quintuple entity relationships of the present invention are suitable for extracting quintuples from text data, and are described below through specific implementation methods:

[0064] Example 1

[0065] The data model of this embodiment is in the form of an SRO quintuple, which includes a subject, a subject type, a relation, an object, and an object type.

[0066] Please refer to Figure 1 , a five-tuple entity relationship extraction method, comprising the steps of:

[0067] S1. Obtain text corpus;

[0068] S2. Annotate the text corpus with entity relationships to obtain annotated data;

[0069] Specifically, entity relationships can be annotated on an NLP (Natural Language Processing) annotation platform or through a software module with an annotation function;

[0070] S3. Preprocessing the labeled data into quintuples to obtain a training data set; that is, the generated training data set includes corresponding subject, subject type, relationship, object, and object type information;

[0071] S4. Train the deep learning model using the training data set to obtain a relationship extraction model; specifically:

[0072] S41, identifying the subject and subject type of each sentence in the training data set;

[0073] S42, identifying the relationship corresponding to the subject and subject type and the object and object type in each of the sentences according to the subject and subject type;

[0074] During step S41 and step S42, the training data set is trained using an objective function, where the objective function is:

[0075]

[0076]

[0077] Among them, T j represents the five-tuple of the j-th sentence in the training dataset, T j ={(s,st,r,o,ot)}; D represents the training data set, x j represents the jth sentence in the training data set; s represents the subject, st represents the subject type, r represents the relationship, o represents the object, and ot represents the object type;

[0078] The T in each sentence in the training set D is obtained by the objective function j The maximum likelihood estimate of (s,st,r,o,ot) is obtained from formula (3): p((s,st)|x j ) means in x j The probability of (s, st) existing in the sentence, that is, the predicted subject s and subject type st in the jth sentence; p r ((o,ot)|(s,st),x j ) means in x j The probability of (o, ot) appearing under the conditions of (s, st), that is, in the jth sentence, when the subject s and the subject type st are known, predict the object o and the object type ot; that is, first find all the subjects and subject types in the sentence, then find the corresponding objects and object types according to the model, and further obtain the relationship between the subject and subject type and the object and object type, and finally the entity relationship quintuple T in the sentence j={(s,st,r,o,ot)} is extracted; at the same time, formula (3) provides a new idea, which models the relationship as a mapping function from (s,st) to (o,ot), and can predict the relationship r through the mapping function from (s,st) to (o,ot), instead of the traditional entity and relationship classification;

[0079] In another optional embodiment, the training data set is further trained using a loss function, where the loss function is:

[0080] LOSS=L(sub_heads)+L(sub_tails)+L(sub_type_heads)+L(sub_type_tails)+L(obj_heads)+L(obj_tails)+L(obj_type_heads)+L(obj_type_tails); (4)

[0081] Where L is the binary cross entropy loss function:

[0082]

[0083] In formula (4), sub represents the subject, obj represents the object, heads represents the head position, and obj represents the tail position, that is, L(sub_heads): binary cross entropy loss of the starting position of the subject; L(sub_tails): binary cross entropy loss of the ending position of the subject; L(sub_type_heads): binary cross entropy loss of the starting position of the subject type; L(sub_type_tails): binary cross entropy loss of the ending position of the subject type; L(obj_heads): binary cross entropy loss of the starting position of the object; L(obj_tails): binary cross entropy loss of the ending position of the object; L(obj_type_heads): binary cross entropy loss of the starting position of the object type; L(obj_type_tails): binary cross entropy loss of the ending position of the object type;

[0084] In formula (5): y i is the label of the i-th sample, which takes values ​​of 0 or 1, representing negative and positive classes respectively, that is, y i ∈0,1;p i The probability that the i-th sample is predicted to be label 1 (positive class), that is, p i =P(y=1|y i );

[0085] In another optional embodiment, the training dataset is trained and optimized by using an Adam optimizer on the mini-batch after the shuffle function and by multi-step dynamic learning rate decay;

[0086] S5. Obtain the text data to be extracted;

[0087] S6. Extract the text data to be extracted according to the relationship extraction model to obtain the entity relationship quintuple of the text to be extracted.

[0088] Example 2

[0089] The difference between this embodiment and the first embodiment is that data enhancement is performed on the training data set;

[0090] Before step S4, the following steps are also included:

[0091] S7. Performing data enhancement on the sentences with entity relationships in the training dataset to obtain new relationship sentences;

[0092] Specifically, multiple groups of statements with entity relationships in the training data set are combined and merged to obtain the new relationship statement;

[0093] In an optional embodiment, the data is further enhanced by replacing entities of the same type in multiple groups of statements with entity relationships or multiple groups of new relationship statements; and replacing non-entity parts in multiple groups of statements with entity relationships or multiple groups of new relationship statements with synonyms.

[0094] S8. Adding the new relational statement to the training data set;

[0095] Specifically, a threshold sentence length is set; and it is determined whether the new relation sentence is less than the threshold sentence length. If so, the new relation sentence is added to the training data set.

[0096] This embodiment provides a specific example, please refer to Figure 3 ;

[0097] Step S71: Obtain a passage i in the training data set, and segment the passage according to relative sentences using symbols such as periods, exclamation marks, and question marks to obtain multiple relative clauses, namely relative clause 1, relative clause 2, and relative clause 3;

[0098] Step S72: Obtain the corresponding window size and step size, and obtain the window size as 2 and the step size as 1;

[0099] Step S73: Combine the sentences in different windows, that is, create a combination of the relative clause and relative clause 2, and a combination of relative clause 2 and relative clause 3;

[0100] Step S74: Merge the combined sentences to obtain new relative clause 1 and new relative clause 2. When merging the new relative clauses, ensure that the length of the merged sentences is less than or equal to a corresponding threshold, such as 510.

[0101] Step S75: randomly replace entities of the same type in the new relation clause 1 and the new relation clause 2, and replace non-entity synonyms;

[0102] S8. Add relation clause 1, relation clause 2 and relation clause 3 to the training data set, and determine whether the length of the new relation clause 1 and the new relation clause 2 is less than a threshold value such as 510. If so, add them to the training data set.

[0103] Example 3

[0104] A quintuple entity relationship extraction device includes 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 quintuple entity relationship extraction method described in Embodiment 1 or 2;

[0105] Among them, there are also provided: a coding layer module, a subject and subject type identification module, and a relationship and object and object type identification module for step S4;

[0106] Encoding layer module: used to encode words in sentences using a pre-trained language model (such as BERT) and extract text feature information;

[0107] Subject and subject type identification module: used to identify the subject in the sentence through the subject tagger and identify the entity type of the subject through the subject type classifier;

[0108] Relationship and object and object type identification module: used to find possible relationships and objects corresponding to the relationships through relationship-specific taggers, and identify the entity type of the object through object type classifiers.

[0109] In summary, the present invention provides a quintuple entity relationship extraction method and device, which obtains labeled data by annotating text corpus with entity relationships, and then preprocesses the annotated data into quintuples to obtain a quintuple training data set containing subject, subject type, relationship, object and object type, and performs data enhancement on the training data set in a variety of different ways, and then trains a deep learning model with the training data set containing quintuples to obtain a relationship extraction model. At the same time, training optimization is performed by setting an objective function, adjusting a loss function, and performing multi-step learning rate attenuation. Therefore, when information in text data needs to be extracted, the text data can be extracted through the relationship extraction model and the corresponding quintuple data can be obtained, which can greatly improve the recall rate of entity relationship extraction, while also ensuring a high accuracy rate, and the extracted data is more diversified, thereby improving the effect of text relationship extraction.

[0110] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the present invention's description and drawings, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A five-tuple entity relationship extraction method, characterized in that: Including steps: Get text corpus; Performing entity relationship annotation on the text corpus to obtain annotated data; Preprocessing the labeled data into quintuples to obtain a training data set; the quintuples include subject, subject type, relationship, object, and object type; Training the deep learning model using the training data set to obtain a relationship extraction model; Get the text data to be extracted; Extracting the text data to be extracted according to the relationship extraction model to obtain a quintuple of entity relationships of the text to be extracted; Training the deep learning model using the training data set includes: The training data set is trained using an objective function, where the objective function is: ; Among them, T j represents the five-tuple of the j-th sentence in the training dataset, T j ={(s,st,r,o,ot)}; D represents the training data set, x j represents the jth sentence in the training dataset; s represents the subject, st represents the subject type, r represents the relationship, o represents the object, and ot represents the object type; the training set is trained using the above objective function and optimized at the quintuple level, enabling direct extraction of entity-relationship quintuples, and prediction of (o, ot) through the mapping function of (s, st) and r. The problem of overlapping entity and relationship quintuples is resolved through a cascaded binary pointer annotation framework; The training data set is trained using a loss function, where the loss function is: LOSS=L(sub_heads)+L(sub_tails)+L(sub_type_heads) +L(sub_type_tails)+L(obj_heads)+L(obj_tails) +L(obj_type_heads)+L(obj_type_tails); Where sub represents the subject, obj represents the object, heads represents the head position, tails represents the tail position, and L is the binary cross entropy loss function: ; Before the deep learning model is trained using the training data set to obtain the relationship extraction model, the method further includes: Performing data enhancement on the sentences with entity relationships in the training data set to obtain new relationship sentences; Adding the new relation statement to the training data set; The step of performing data enhancement on the sentences with entity relationships in the training dataset to obtain new relationship sentences includes: Combining and merging multiple groups of statements with entity relationships in the training data set to obtain the new relationship statement; The step of performing data enhancement on the sentences with entity relationships in the training data set to obtain new relationship sentences further comprises: Replacing entities of the same type in multiple groups of statements with entity relationships or multiple groups of statements with new relationships; Performing synonym replacement on non-entity parts in the multiple groups of sentences with entity relationships or the multiple groups of sentences with new relationships; The adding the new relation statement to the training data set comprises: Set threshold statement length; Determine whether the new relational statement is shorter than the threshold statement length, and if so, add the new relational statement to the training data set; identifying the subject and subject type of each sentence in the training dataset; Identifying the relationship corresponding to the subject and subject type and the object and object type in each of the sentences based on the subject and subject type; first identifying the subject and subject type of each sentence in the training data set, then identifying the object and object type corresponding to the subject and subject type in the sentence based on the subject and subject type, and finally identifying all possible relationships between the subject and subject type and the object and object type based on the identified subject and subject type and object and object type, in a layer-by-layer progressive identification process; The training dataset is trained and optimized by multi-step dynamic learning rate decay.

2. A quintuple entity relationship extraction device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, each step of the method for extracting quintuple entity relationships as claimed in claim 1 is implemented.

Citation Information

Patent Citations

  • Method and device for training information extraction model and obtaining knowledge graph, and equipment for training information extraction model and obtaining knowledge graph

    CN111737552A

  • Deep neural network confrontation and defense method and system based on feature denoising, storage medium and equipment

    CN113222960A

  • Text information processing method and device, equipment and storage medium

    CN113553840A

  • System and method for learning sentences

    US20190013012A1