Entity relationship extraction method and device, equipment, medium and program product

By using large language models for data enhancement in entity relationship extraction, the problems of error propagation and redundant information in existing methods are solved, and the performance and extraction accuracy of the model are improved.

CN119691090APending Publication Date: 2025-03-25INST OF COMPUTING TECH CHINESE ACAD OF SCI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411849332.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-16
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

The existing entity relationship extraction methods have problems such as error propagation, entity redundancy and intrinsic interaction neglect, which has affected the model performance.

Method used

Using a data augmentation method based on a large language model, the generalization ability and robustness of the model are improved by generating unstructured text and adding it to the training set of the entity relationship joint extraction model.

Benefits of technology

Through data enhancement strategies, the accuracy of entity relationship extraction is improved, the information scarcity caused by incomplete knowledge base is alleviated, and the performance of the model is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119691090A_ABST
    Figure CN119691090A_ABST
Patent Text Reader

Abstract

The invention provides an entity relationship extraction method and device, equipment, a medium and a program product. The method comprises the following steps: generating an unstructured text through a large language model according to a given entity pair or a given relationship; adding the unstructured text to an initial training set of an entity relationship joint extraction model to obtain a target training set; using the target training set to train the entity relationship joint extraction model; encoding the obtained target text to obtain a feature vector of the target text; and based on the trained entity relationship joint extraction model, performing entity relationship extraction on the target text in combination with the feature vector to obtain a triple of the target text. According to the method, the generalization ability and robustness of the entity relation joint extraction model are improved, and the effectiveness of text entity relation extraction is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of text processing technology, and in particular to an entity relationship extraction method, device, equipment, medium and program product based on large language model data enhancement. Background Art

[0002] With the advancement of computer technology and the advent of the big data era, a large amount of text data has emerged on the Internet, of which unstructured text accounts for the majority. How to extract important information from these texts has become particularly important. Entity relationship extraction, as a core subtask of text information extraction, aims to extract entity-relationship triples from unstructured text, convert unstructured text into structured text, and automatically extract effective semantic information.

[0003] According to the different extraction methods, the current entity relationship extraction is mainly divided into two methods, pipeline method and joint extraction method. The pipeline method treats the entity relationship extraction task as two independent subtasks, first performing named entity recognition on the text, and then predicting the relationship between entities. However, since it is divided into two subtasks and there is no connection between the training processes of the tasks, there are often problems such as error propagation, entity redundancy, and ignoring the inherent interaction between the two subtasks, which has a certain impact on the model performance.

[0004] Unlike the pipeline method, the joint extraction method uses a joint model to simultaneously identify entities and relations. The current joint methods can be divided into two categories according to the process of extracting triples: a multi-module multi-step strategy and a multi-module single-step strategy. Among them, in the multi-module multi-step strategy, the model does not have a fixed order for extracting entities and relations. For example, first predict the entity pairs, and then classify the relations between each pair of entities. This method has a clear process, but is susceptible to cascading errors, that is, the errors in the early steps cannot be corrected in the subsequent steps, resulting in error accumulation problems. In the multi-module single-step strategy, the model uses different modules to achieve parallel extraction of entities and relations, and then forms triples based on the correlation between them. However, since the multi-module single-step models do not have strong enough mutual constraints in the independent recognition process, they cannot fully capture the interdependence between entities and relations. This leads to unnecessary redundant information when constructing triples, resulting in poor accuracy in entity relationship extraction. Summary of the invention

[0005] In view of the deficiencies in the prior art, the present invention proposes an entity relationship extraction method, device, equipment, medium and program product based on large language model data enhancement.

[0006] The present invention discloses a method for extracting entity relationships, comprising the following steps:

[0007] Generate unstructured text based on given entity pairs or given relations through a large language model;

[0008] Adding the unstructured text to an initial training set of an entity-relationship joint extraction model to obtain a target training set;

[0009] Using the target training set to train the entity relationship joint extraction model;

[0010] Encoding the acquired target text to obtain a feature vector of the target text;

[0011] Based on the trained entity relationship joint extraction model, entity relationship extraction is performed on the target text in combination with the feature vector to obtain triples of the target text.

[0012] In one embodiment of the present invention, generating unstructured text through a large language model according to a given entity pair includes:

[0013] Constructing a first prompt template, wherein the large language model generates first labeled data corresponding to the given entity pair through a data enhancement strategy, wherein the first labeled data includes: a plurality of first labeled sentences corresponding to the relationship expressed by the head entity and the tail entity of the given entity pair;

[0014] The unstructured text includes the given entity pair and the first tag data.

[0015] In one embodiment of the present invention, generating unstructured text by using a large language model according to a given relationship includes:

[0016] Constructing a second prompt template, generating at least one entity pair corresponding to the given relationship by the large language model;

[0017] The large language model generates second labeled data corresponding to each of the entity pairs through a data enhancement strategy, wherein the second labeled data includes: a plurality of second labeled sentences corresponding to the relationship expressed by the head entity and the tail entity of the entity pair;

[0018] The unstructured text includes each of the entity pairs and the second annotation data corresponding to the entity pairs.

[0019] In one embodiment of the present invention, the data enhancement strategy includes one or a combination of multiple of an expression diversity strategy, a length diversity strategy, a sentence diversity strategy, a domain diversity strategy and a content correctness strategy.

[0020] In one embodiment of the present invention, entity relationship extraction is performed on the target text based on the trained entity relationship joint extraction model in combination with the feature vector to obtain triples of the target text, including:

[0021] Based on the trained entity relationship joint extraction model, the feature vector is integrated into the corner marking strategy corresponding to the predefined relationship of the target text;

[0022] Based on the corner labeling strategy, calculating a label score for each word pair of the target text;

[0023] Assign a label to each word pair according to its label score to generate a label matrix;

[0024] According to the boundaries of the head entity and the tail entity of the tag matrix, the triples of the target text are decoded.

[0025] In one embodiment of the present invention, the tag includes:

[0026] The first preset mark indicates the start mark of the corresponding head entity and tail entity;

[0027] The second preset mark indicates the start mark of the corresponding head entity and the end mark of the tail entity;

[0028] The third preset mark indicates the end mark of the corresponding head entity and tail entity;

[0029] A fourth preset mark, other marks in the mark matrix except those marked as the first preset mark, the second preset mark and the third preset mark.

[0030] In one embodiment of the present invention, a pre-trained language model is used to encode the target text.

[0031] Another aspect of the present invention also discloses an entity relationship extraction device, which adopts the above-mentioned entity relationship extraction method, and the entity relationship extraction device comprises:

[0032] A text processing module, used to generate unstructured text through a large language model according to a given entity pair or a given relationship, and add the unstructured text to an initial training set of an entity-relationship joint extraction model to obtain a target training set;

[0033] A model training module, used to train the entity relationship joint extraction model using the target training set;

[0034] A feature vector acquisition module is used to encode the target text to obtain the feature vector of the target text;

[0035] The entity relationship extraction module is used to extract entity relationships from the target text based on the trained entity relationship joint extraction model in combination with the feature vector to obtain triples of the target text.

[0036] On the other hand, the present invention also discloses an electronic device, comprising: at least one processor; and a memory connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor executes the above-mentioned entity relationship extraction method.

[0037] On the other hand, the present invention also discloses a computer-readable storage medium, characterized in that computer instructions are stored thereon, and when the instructions are executed by a processor, the entity relationship extraction method as described above is implemented.

[0038] Another aspect of the present invention also discloses a computer program product, including a computer program, which implements the steps of the above-mentioned entity relationship extraction method when executed by a processor.

[0039] It can be seen from the above scheme that the advantages of the present invention are:

[0040] In the entity relationship extraction method disclosed by the present invention, both entity pair-dominated and relationship-dominated methods are used to generate labeled data for a training set based on given entity pairs or given relationships through a large language model, and a series of transformations and expansions are performed on the training data to increase the data diversity of the training set, improve the generalization ability and robustness of the entity relationship joint extraction model, alleviate the problem of information scarcity caused by incomplete knowledge base, and improve the effectiveness of entity relationship extraction of text. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 A schematic diagram of the overall process of an entity relationship extraction method disclosed in an embodiment of the present invention;

[0042] Figure 2 This is a schematic diagram of the principle of the entity relationship extraction method;

[0043] Figure 3 An example of generating unstructured text based on given entity pairs using an entity pair-based data generation method is shown;

[0044] Figure 4 , Figure 5 An example of using a relation-based data generation method to generate unstructured text based on a given relation is shown;

[0045] Figure 6 A schematic diagram of the overall structure of an entity relationship extraction device disclosed in another embodiment of the present invention.

[0046] Reference numerals:

[0047] 100: the entity relationship extraction device;

[0048] 101: text processing module;

[0049] 102: model training module;

[0050] 103: feature vector acquisition module;

[0051] 104: Entity relationship extraction module. DETAILED DESCRIPTION

[0052] It should be noted that, in this application, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.

[0053] Without more constraints, an element defined by the phrase "comprising a..." does not exclude the existence of other identical elements in the process, method, article or apparatus comprising the element.

[0054] Please refer to Figure 1 As shown in Figure 1 The figure shows a schematic diagram of the overall process of an entity relationship extraction method disclosed in an embodiment of the present invention. The entity relationship extraction method specifically includes the following steps:

[0055] Step S1: Generate unstructured text through a large language model according to a given entity pair or a given relationship, and add the unstructured text to an initial training set of an entity-relationship joint extraction model to obtain a target training set.

[0056] In one embodiment, in order to solve the problem of less labeled data and easy overfitting of neural networks, the entity-pair-driven data generation (EDDG) method and the relationship-driven data generation (RDDG) method are combined to perform data enhancement through a large language model, and unstructured text is generated through a large language model based on a given entity pair or a given relationship. The quality of the generated corpus is improved based on the data enhancement strategy, thereby improving the accuracy of triple extraction.

[0057] Specifically, in one embodiment, a data generation method dominated by entity pairs generates unstructured text through a large language model based on a given entity pair. Specifically, at least one given entity pair can be obtained from a structured knowledge base, and each entity pair includes a head entity and a tail entity; then a first prompt template is constructed, and the large language model generates first labeled data corresponding to the given entity pair through a data augmentation strategy. The first labeled data includes: several first annotation statements corresponding to the relationship expressed by the head entity and the tail entity of the given entity pair; wherein the unstructured text includes the given entity pair and the first labeled data, and then the obtained unstructured text is added to the initial training set of the entity relationship joint extraction model to obtain a target training set.

[0058] For specific reference, please Figure 2 and Figure 3 , in this embodiment, the data generation method dominated by entity pairs uses the structured knowledge base as the knowledge source, directly obtains the given entity pair from the structured knowledge base, and guides the large language model to generate the first labeled data corresponding to the given entity pair. The generated first labeled data is used to train the model and predict the manually annotated test data to evaluate the performance. After obtaining the entity pair from the structured knowledge base, it can guide the large language model to generate multiple sentences with the specified entity pair, and all of them are annotated as the relationship expressed by this entity pair in the structured knowledge base. For example Figure 3 as shown in, from the head entity "Wang**" and the tail entity "Li**" of the given entity pair, and labeling the head entity as the specified relationship "mother", several sentences are generated. The advantage of this method is that it can utilize the knowledge base in a specific domain, especially when these domains do not exist in the pre-trained corpus, thereby allowing external knowledge to be integrated into the large language model to guide its better data generation.

[0059] In one embodiment, a data generation method dominated by relationships generates unstructured text through a large language model based on a given relationship. Specifically, the given relationship can be obtained from a structured knowledge base; then a second prompt template is constructed, and the large language model generates at least one entity pair corresponding to the given relationship, and each entity pair includes a head entity and a tail entity; and the large language model generates second labeled data corresponding to each entity pair through a data augmentation strategy. The second labeled data includes: several second annotation statements corresponding to the relationship expressed by the entity pair; wherein the unstructured text includes each entity pair and its corresponding second annotation data, and then the obtained unstructured text is added to the initial training set of the entity relationship joint extraction model to obtain a target training set.

[0060] For specific reference, please Figure 2 , Figure 4 , Figure 5As shown in the figure, a relation-driven data generation method is used. A structured knowledge base is used as the knowledge source. A given relation is directly obtained from the structured knowledge base. The existing knowledge in the knowledge base is used to guide the large language model to generate second labeled data corresponding to the given relation. The generated second labeled data is used to train the model and predict manually annotated test data to evaluate performance. For example, to generate training data with a "nationality" relation, first give an example to the large language model and heuristically let it generate head-tail entity pairs with a specified "nationality" relation, such as Figure 4 Then, after having the specified relation and its head and tail entities, the large language model is prompted to generate sentences using the given relation and its entity pairs, such as Figure 5 shown.

[0061] In one embodiment, the large language model adopts ChatGPT, which can generate diverse data through prompts in the form of multiple rounds of dialogue. ChatGPT is used as a large language model for data enhancement to solve the problem of data scarcity for entity relationship extraction.

[0062] The data enhancement strategy will be explained in detail in the subsequent sections combined with effect verification.

[0063] Step S2: using the target training set to train the entity relationship joint extraction model.

[0064] In this embodiment, after obtaining the target training set in the above step S1, the target training set is further used to train the entity relationship joint extraction model.

[0065] Step S3: Encode the acquired target text to obtain a feature vector of the target text.

[0066] In one embodiment, in order to solve the error propagation and relation redundancy problems existing in the current joint extraction, a pre-trained language model is used as the underlying encoder, and the target text is encoded using the pre-trained language model to improve the encoding ability of the model. Specifically, the BERT-wwm-ext pre-trained language model is used to encode the target text. The pre-training data set of BERT-wwm-ext has been increased to 5.4B; and the number of training steps has been increased, with 1M steps in the first stage of training and 400K steps in the second stage of training.

[0067] Step S4: Based on the trained entity relationship joint extraction model, entity relationship extraction is performed on the target text in combination with the feature vector to obtain triples of the target text.

[0068] In one embodiment, firstly, based on the trained entity-relationship joint extraction model, the feature vector of the target text is integrated into the corner labeling strategy corresponding to the predefined relationship of the target text; then, based on the corner labeling strategy, the label score of each word pair of the target text is calculated, and a label is assigned to each word pair according to the label score of each word pair to generate a label matrix. Finally, according to the boundaries of the head entity and the tail entity of the label matrix, the triples of the target text are decoded.

[0069] In one embodiment, a label score is calculated by a scoring-based classifier, and a label is assigned to each word pair of the target text. The label includes: a first preset mark, indicating the start mark of the corresponding head entity and the end mark of the tail entity; a second preset mark, indicating the start mark of the corresponding head entity and the end mark of the tail entity; a third preset mark, indicating the end mark of the corresponding head entity and the end mark of the tail entity; and a fourth preset mark, other marks in the label matrix except those marked as the first preset mark, the second preset mark and the third preset mark.

[0070] For example, given a target text sentence S = {w1,w2,...,w L}, where L tags and K predefined relations R = {r1, r2, ... r k}, the goal of joint extraction is to identify all possible triples in S where N is the number of triplets, h i ,t i It is a head entity and a tail entity consisting of multiple consecutive tokens.

[0071] For a target text sentence S = {w1,w2,...,w L}, use a classifier for all possible word pairs (w i ,r k ,w j )Combined assignment label, where w i ,w j ∈S,r k∈R, the "BIE" (Begin, Inside, End) symbol is used to indicate the position information of the mark in the entity. For example, "HB" indicates the start mark of the head entity, and "TE" indicates the end mark of the tail entity. Based on the view that entities can be determined by detecting boundary marks, the marking strategy uses four types of marks: (1) The first preset mark HB-TB indicates the start mark of a pair of head entity and tail entity under specific relationship conditions. (2) The second preset mark HB-TE indicates the corresponding start mark of the head entity and the end mark of the tail entity. (3) The third preset mark HE-TE indicates that the two positions are the end marks of a pair of head entity and tail entity under specific relationship conditions. (4) The fourth preset mark "-" indicates that all cells except the above three marking cases will be marked as "-". As Figure 2 As shown, only the three corners of the rectangle need to be marked. The above method is called a relation-specific corner marking strategy. Based on this corner marking strategy, the label score of each word pair of the target text is calculated, and a label is assigned to each word pair according to the label score of each word pair to generate a label matrix M L ×K×L Furthermore, during the decoding process, the marking matrix M L×K×L The boundary markers of the paired head entity and tail entity and the relationship between them are marked. Therefore, according to the boundary of the head entity and the tail entity of the marking matrix, decoding to obtain the triples of the target text becomes simple and direct. For each relationship, the span of the head entity is spliced ​​from the second preset marker "HB-TE" to the third preset marker "HE-TE"; the span of the tail entity is spliced ​​from the first preset marker "HB-TB" to the second preset marker "HB-TE", and the two paired entities share the second preset marker "HB-TE". Figure 2 As shown in , taking the text "King Huanhui of Han, son of King Li of Han" on the left and top of the corner tag strategy as an example, "King Huanhui of Han" is identified as the head entity, "King Li of Han" is identified as the tail entity, and "son of" is used to describe the relationship between the two. The span of the head entity is spliced ​​from the second preset tag "HB-TE" to the third preset tag "HE-TE", and the span of the tail entity is spliced ​​from the first preset tag "HB-TB" to the second preset tag "HB-TE", and the two paired entities share the second preset tag "HB-TE".

[0072] In addition, in one embodiment, in step S1, when data enhancement is performed through a large language model in combination with the entity-pair-dominated data generation (EDDG) method and the relationship-dominated data generation (RDDG), the specific data enhancement strategy adopted includes: a combination of one or more of an expression diversity strategy, a length diversity strategy, a sentence diversity strategy, a domain diversity strategy, and a content correctness strategy. Among them, the expression diversity strategy makes the labeled data generated by the large language model have greater differences in text expression; the length diversity strategy is used to make the labeled data generated by the large language model have greater differences in text length; the sentence diversity strategy is used to make the labeled data generated by the large language model have greater differences in text sentences; the domain diversity strategy is used to make the labeled data generated by the large language model have greater differences in text fields; the content correctness strategy is used to make the labeled data generated by the large language model correct in content.

[0073] In one embodiment, by combining these data enhancement strategies, examples of designed prompt sentences are shown in Table 1 below.

[0074] Table 1

[0075]

[0076]

[0077] The above data enhancement strategies can be used individually or in combination. For example, sentence diversity and length diversity can be used together. Domain diversity, expression diversity, and content correctness can also be used together.

[0078] The data enhancement effects of different strategies are further compared. Table 2 shows the results of triple extraction after using different enhancement strategies. From Table 2, it can be seen that the extraction effect after using the data enhancement strategy is improved, and the strategy superposition effect is better. Through analysis, the data enhancement strategy combining "ExpDiv+LenDiv+StcDiv+DomDiv+Crt" is the optimal prompt enhancement strategy.

[0079] Table 2

[0080]

[0081] The general effectiveness of the proposed strategy is further verified by extracting entity relationships from Chinese text. In this process, the BiLSTM model, CASREL model and TPLinker model are selected, and the data sets of five optimal enhancement strategies such as silent strategy enhancement and ExpDiv in the text are used for comparison. The models that use silent strategy to enhance data are represented as "BiLSTM", "CASREL", "TPLinker", and "the present invention", and the models that use the optimal enhancement strategy data are represented as "BiLSTM*", "CASREL*", "TPLinker*", and "the present invention*". The experimental results are shown in Table 3. It is further verified that the data generation and data enhancement strategy of the large language model proposed in the present invention have good effects on the task of entity relationship extraction.

[0082] Table 3

[0083]

[0084]

[0085] In addition, further ablation experiments were conducted, and the dataset using five enhancement strategies was named ELSDC. Among them, after removing the expression diversity strategy from the combination of the five enhancement strategies, 100 data were enhanced for each relationship, and the dataset was named LSDC; the enhanced dataset after removing the length diversity strategy was named ESDC; the enhanced dataset after removing the sentence diversity strategy was named ELDC; the enhanced dataset after removing the domain diversity strategy was named ELSC; after removing the content correctness strategy, the enhanced dataset was named ELSD. Comparison Table 4 can verify the effectiveness of the ExpDiv strategy, LenDiv strategy, StcDiv strategy, DomDiv strategy, and Crt strategy, all of which have improved the model performance.

[0086] Table 4

[0087]

[0088] Therefore, in summary, in the entity relationship extraction method disclosed by the present invention, in view of the error propagation and relationship redundancy problems existing in the current joint extraction, a pre-trained language model is used as the underlying encoder to improve the encoding ability of the model. At the same time, in order to solve the problem of less labeled data and easy overfitting of neural networks, data generation is performed with the help of a large language model through two methods: entity pair dominance and relationship dominance. Five data enhancement strategies are proposed to improve the quality of generated corpus, thereby improving the accuracy of triple extraction. The triple extraction is finally completed by conducting experiments on the enhanced data set. The experimental results show that the proposed method has a good improvement in evaluation indicators compared with unenhanced data. The accuracy and F1 value of the entity relationship extraction task are improved by 7.3 and 8.5 percentage points respectively. At the same time, good results are also achieved in the silent strategy enhancement. The accuracy and F1 value are improved by 9.4 and 9.1 percentage points respectively. The effectiveness of the application of data enhancement based on the large language model in the entity relationship extraction task is verified by experiments.

[0089] Correspondingly, corresponding to the above-mentioned entity relationship extraction method, the present invention also provides an entity relationship extraction device, please refer to Figure 6 As shown, Figure 6 The schematic diagram of the structure of the entity relationship extraction device is shown. The entity relationship extraction device 100 specifically comprises:

[0090] The text processing module 101 is used to generate unstructured text through a large language model according to a given entity pair or a given relationship, and add the unstructured text to the initial training set of the entity-relationship joint extraction model to obtain a target training set.

[0091] The model training module 102 is used to train the entity relationship joint extraction model using the target training set.

[0092] The feature vector acquisition module 103 is used to encode the target text to obtain the feature vector of the target text.

[0093] The entity relationship extraction module 104 is used to extract entity relationships from the target text based on the trained entity relationship joint extraction model in combination with the feature vector to obtain triples of the target text.

[0094] In addition, those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of each module of the described device can refer to the corresponding process in the aforementioned method embodiment and will not be repeated here.

[0095] In addition, the present invention also proposes an electronic device in another embodiment, comprising: at least one processor; and a memory connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor executes the above-mentioned entity relationship extraction method based on large language model data enhancement.

[0096] The present invention also proposes a storage medium in another embodiment for storing a computer program for executing the entity relationship extraction method. It should be understood that the storage medium in the embodiment of the present invention may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct rambus RAM (DR RAM).

[0097] In addition, the present invention also provides a computer program product in one embodiment, which includes a computer program. The computer program can be stored on a readable storage medium. When the computer program is executed by a processor, the computer can execute the entity relationship extraction method provided by the above methods.

[0098] Although the embodiments of the present invention have been disclosed as above, they are not limited to the applications listed in the specification and the implementation modes, and they can be fully applied to various fields suitable for the present invention. For those familiar with the art, additional modifications can be easily implemented. Therefore, without departing from the general concept defined by the claims and the scope of equivalents, the present invention is not limited to the specific details and the illustrations shown and described herein.

Claims

1. A method for extracting entity relations, characterized in that: The steps include: Generate unstructured text based on given entity pairs or given relations through a large language model; Adding the unstructured text to an initial training set of an entity-relationship joint extraction model to obtain a target training set; Using the target training set to train the entity relationship joint extraction model; Encoding the acquired target text to obtain a feature vector of the target text; Based on the trained entity relationship joint extraction model, entity relationship extraction is performed on the target text in combination with the feature vector to obtain triples of the target text.

2. The method according to claim 1, characterized in that The unstructured text is generated through a large language model based on a given entity pair, including: Constructing a first prompt template, wherein the large language model generates first labeled data corresponding to the given entity pair through a data enhancement strategy, wherein the first labeled data includes: a plurality of first labeled sentences corresponding to the relationship expressed by the head entity and the tail entity of the given entity pair; The unstructured text includes the given entity pair and the first tag data.

3. The method according to claim 1, characterized in that The unstructured text is generated through a large language model based on a given relationship, including: Constructing a second prompt template, generating at least one entity pair corresponding to the given relationship by the large language model; The large language model generates second labeled data corresponding to each of the entity pairs through a data enhancement strategy, wherein the second labeled data includes: a plurality of second labeled sentences corresponding to the relationship expressed by the head entity and the tail entity of the entity pair; The unstructured text includes each of the entity pairs and the second annotation data corresponding to the entity pairs.

4. The method according to claim 2 or 3, characterized in that: The data enhancement strategy includes one or a combination of expression diversity strategy, length diversity strategy, sentence diversity strategy, domain diversity strategy and content correctness strategy.

5. The method according to any one of claims 1 to 3, characterized in that: The entity relationship extraction of the target text is performed based on the trained entity relationship joint extraction model and combined with the feature vector to obtain the triples of the target text, including: Based on the trained entity relationship joint extraction model, the feature vector is integrated into the corner marking strategy corresponding to the predefined relationship of the target text; Based on the corner labeling strategy, calculating a label score for each word pair of the target text; Assign a label to each word pair according to its label score to generate a label matrix; According to the boundaries of the head entity and the tail entity of the tag matrix, the triples of the target text are decoded.

6. The method according to claim 5, characterized in that in, The tags include: The first preset mark indicates the start mark of the corresponding head entity and tail entity; The second preset mark indicates the start mark of the corresponding head entity and the end mark of the tail entity; The third preset mark indicates the end mark of the corresponding head entity and tail entity; A fourth preset mark, other marks in the mark matrix except those marked as the first preset mark, the second preset mark and the third preset mark.

7. The method according to claim 1, characterized in that The target text is encoded using a pre-trained language model.

8. An entity relationship extraction device, characterized in that: include: A text processing module, used to generate unstructured text through a large language model according to a given entity pair or a given relationship, and add the unstructured text to an initial training set of an entity-relationship joint extraction model to obtain a target training set; A model training module, used to train the entity relationship joint extraction model using the target training set; A feature vector acquisition module is used to encode the target text to obtain the feature vector of the target text; The entity relationship extraction module is used to extract entity relationships from the target text based on the trained entity relationship joint extraction model in combination with the feature vector to obtain triples of the target text.

9. An electronic device, characterized in that: include: at least one processor; And a memory connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor executes the entity relationship extraction method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that: Computer instructions are stored thereon, and when the instructions are executed by a processor, an entity relationship extraction method as described in any one of claims 1-7 is implemented.

11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the entity relationship extraction method described in any one of claims 1-7 are implemented.