Entity relationship extraction method and device based on massive data
By combining a generative discriminative combination model with an industry knowledge base, the relationship extraction model is optimized, solving the problem of entity relationship extraction from massive amounts of data and achieving efficient entity relationship extraction in the field of smart cities.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- POTEVIO INFORMATION TECH CO LTD
- Filing Date
- 2021-06-08
- Publication Date
- 2026-06-09
AI Technical Summary
Existing technologies struggle to effectively extract entity relationships from massive datasets, especially in Chinese texts, where the flexibility and complexity of words make entity relationship extraction difficult.
A generative discriminant combination model-based approach is adopted. This approach utilizes a pre-defined relation extraction model and a pre-defined discriminator, combined with entity types and relation aliases from an industry knowledge base. The model is generated and trained through named entity recognition, and the relation extraction model is optimized using reward and penalty and policy gradient optimization. Soft constraints are added to extract entity relations.
It improves the accuracy and efficiency of entity relationship extraction, effectively extracting useful information from massive amounts of data, and is applicable to multiple fields in smart cities such as smart government affairs, smart transportation, smart security, and smart education.
Smart Images

Figure CN115455967B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data technology, and in particular to a method and apparatus for extracting entity relationships based on massive amounts of data. Background Technology
[0002] With the development of internet technology, the amount of information on the internet is increasing dramatically. For example, in new smart cities, there is a vast amount of information covering areas such as people's livelihoods, environmental protection, public safety, urban services, and commercial activities. Therefore, it is crucial to perceive, predict, and analyze key information from the core systems of the entire city's operation to provide intelligent responses to various needs such as smart government, smart transportation, smart security, smart education, and smart healthcare. Faced with such massive amounts of information, how to extract useful information has become a problem that current internet technology development must address, and it is also an important research direction for information mining technology. Information extraction requires the identification of named entities in massive amounts of data and the extraction of relationships between entities. Furthermore, the flexibility and complexity of words in Chinese text, coupled with the lack of clear markers, makes the extraction of entity relationships even more challenging.
[0003] Therefore, solving the problem of entity relationship extraction has become an important issue that the industry urgently needs to address. Summary of the Invention
[0004] This invention provides a method and apparatus for entity relation extraction based on massive data, which solves the shortcomings of existing technologies in that they cannot effectively extract entity relations, and realizes an entity relation extraction method.
[0005] This invention provides a method and apparatus for entity relation extraction based on massive data, comprising:
[0006] Named entity recognition is performed on the target statement to obtain the named entity statement;
[0007] The named entity statements are input into the trained relation extraction model to obtain the entity category relations corresponding to each named entity statement.
[0008] The trained relation extraction model is obtained by inputting named entity statement samples carrying entity category labels into the generation and discrimination combination model for training. The generation and discrimination combination model includes a preset relation extraction model and a preset discriminator.
[0009] According to the entity relation extraction method provided by the present invention, before performing named entity recognition based on the target statement to obtain the named entity statement, the method further includes:
[0010] Obtain multiple sets of statement samples and the entity category labels corresponding to each set of statement samples;
[0011] Named entity recognition is performed on each group of the statement samples to obtain the named entity statement corresponding to each group of the statement samples;
[0012] The combination of the named entity statement and the entity category label corresponding to each group of statement samples is used as a training sample to obtain multiple training samples. The generation and discrimination combination model is trained using multiple training samples.
[0013] According to the entity relation extraction method provided by the present invention, the step of training the generative discriminative combination model using multiple training samples includes:
[0014] For any training sample, the training sample is input into the preset relation extraction model in the discriminative combination model, and the entity category relation prediction corresponding to the training sample is output.
[0015] The predicted entity category relationship is input into the preset discriminator in the discriminative combination model, and the discriminative result is output.
[0016] Based on the discrimination result and the entity category label, the reward and penalty value corresponding to the training sample is determined, and the preset relation extraction model is optimized according to the reward and penalty value.
[0017] The new training samples are then input into the discriminative combination model for training until the preset conditions are met, at which point the training ends and a well-trained relation extraction model is obtained.
[0018] According to the entity relation extraction method provided by the present invention, the step of inputting the training sample into a preset relation extraction model in the discriminative combination model and outputting the entity category relation prediction corresponding to the training sample includes:
[0019] The training samples are input into the preset relation extraction model in the discriminative combination model, and based on the industry prediction soft constraint, the output is the preset relation extraction model in the discriminative combination model.
[0020] The industry forecast soft constraint is determined based on entity types and relation aliases in the industry knowledge base.
[0021] According to the entity relationship extraction method provided by the present invention, the entity category label corresponding to each group of statement samples is specifically determined based on the industry knowledge base.
[0022] The present invention also provides an entity relation extraction device, comprising:
[0023] The first identification module is used to perform named entity identification based on the target statement to obtain the named entity statement.
[0024] The extraction module is used to input the named entity statements into the trained relation extraction model to obtain the entity category relations corresponding to each named entity statement.
[0025] The trained relation extraction model is obtained by inputting named entity statement samples carrying entity category labels into the generation and discrimination combination model for training. The generation and discrimination combination model includes a preset relation extraction model and a preset discriminator.
[0026] According to an entity relationship extraction device provided by the present invention, the device further includes an acquisition module, a second identification module, and a training module;
[0027] The acquisition module is used to acquire multiple sets of statement samples and the entity category label corresponding to each set of statement samples;
[0028] The second recognition module is used to perform named entity recognition on each group of the statement samples to obtain the named entity statement corresponding to each group of the statement samples;
[0029] The training module is used to take the combination of the named entity statement and the entity category label corresponding to each group of statement samples as a training sample, obtain multiple training samples, and use the multiple training samples to train the generation and discrimination combination model.
[0030] According to the entity relation extraction device provided by the present invention, the training module is specifically used for:
[0031] For any training sample, the training sample is input into the preset relation extraction model in the discriminative combination model, and the entity category relation prediction corresponding to the training sample is output.
[0032] The predicted entity category relationship is input into the preset discriminator in the discriminative combination model, and the discriminative result is output.
[0033] Based on the discrimination result and the entity category label, the reward and penalty value corresponding to the training sample is determined, and the preset relation extraction model is optimized according to the reward and penalty value.
[0034] The new training samples are then input into the discriminative combination model for training until the preset conditions are met, at which point the training ends and a well-trained relation extraction model is obtained.
[0035] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of any of the entity relation extraction methods described above.
[0036] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the entity relation extraction method as described above.
[0037] This invention provides a method and apparatus for entity relation extraction based on massive data. It employs a discriminative combination model comprising a preset relation extraction model and a preset discriminator, utilizing the concepts of rewards and penalties and policies to apply policy gradients to the training of remotely supervised relation extraction. Furthermore, it leverages additional supervision from a knowledge base to improve remotely supervised relation extraction in a principled manner, thereby training a relation extraction model capable of effectively extracting entity relations. Attached Figure Description
[0038] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0039] Figure 1 This is a schematic diagram of the entity relation extraction method provided by the present invention;
[0040] Figure 2 This is a schematic diagram of the relation extraction model G network structure provided in an embodiment of the present invention;
[0041] Figure 3 This is a schematic diagram of the relation extraction process based on adversarial reinforcement learning provided in an embodiment of the present invention;
[0042] Figure 4 This is a schematic diagram of the relation extraction training process provided in an embodiment of the present invention;
[0043] Figure 5 This is a schematic diagram of the entity relationship extraction device provided in an embodiment of the present invention;
[0044] Figure 6 A schematic diagram of the physical structure of an electronic device is provided. Detailed Implementation
[0045] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0046] This invention utilizes entity relation extraction technology to extract knowledge elements such as entities, relations, and attributes from semi-structured and unstructured data. Relation extraction is a crucial task in the field of information extraction, aiming to extract entity pairs from text and identify the semantic relationships between them.
[0047] Figure 1 This is a schematic diagram of the entity relation extraction method provided by the present invention, as shown below. Figure 1 As shown, including;
[0048] Step 110: Perform named entity recognition based on the target statement to obtain the named entity statement;
[0049] Specifically, the entity relationship extraction method described in this invention can be applied to the medical field, as well as other general fields, such as smart government, smart transportation, smart security, and smart education.
[0050] For each different domain, the corresponding relation extraction model needs to be trained using the method in this invention.
[0051] The target statement described in this invention is a statement that requires entity relation extraction.
[0052] The named entity recognition described in this invention specifically refers to performing named entity recognition after Chinese word segmentation of the target sentence, using existing named entity recognition algorithms. For example, when the target sentence is "Influenza is a respiratory infectious disease caused by the influenza virus.", "influenza" and "influenza virus" are already identified named entities, representing the disease and virus names, respectively.
[0053] Once the named entities are identified, the named entity statement is obtained.
[0054] Step 120: Input the named entity statements into the trained relation extraction model to obtain the entity category relations corresponding to each named entity statement;
[0055] The trained relation extraction model is obtained by inputting named entity statement samples carrying entity category labels into the generation and discrimination combination model for training. The generation and discrimination combination model includes a preset relation extraction model and a preset discriminator.
[0056] The entity category label described in this invention is a label that records the real entity category information corresponding to the named entity statement sample.
[0057] The entity category tags described in this invention are all generated from information such as entity types and relation aliases in a specific industry knowledge base.
[0058] Specifically, the relation extraction model described in this invention is regarded as a generator G for adversarial learning and an agent for reinforcement learning. The output classification result is used as an action, and the discriminator D evaluates it as a reward and feeds it back to the relation extraction model G (i.e., the agent), thereby optimizing the relation extraction model. Finally, under the premise of satisfying the preset training conditions, a relation extraction model that can effectively extract entity relations is obtained.
[0059] After inputting named entity statements into the trained relation extraction model, information such as entity types and relation aliases from the industry knowledge base is added. Soft constraints are applied when predicting relations, and finally, the entity category relations corresponding to each named entity statement are obtained.
[0060] In this embodiment of the invention, a discriminative combination model, including a preset relation extraction model and a preset discriminator, is used. The policy gradient is applied to the training of remotely supervised relation extraction using the concepts of rewards and penalties and policies. Secondly, additional supervision from a knowledge base is utilized to improve remotely supervised relation extraction in a principled manner, thereby training a relation extraction model that can effectively extract entity relations. This model enables effective entity relation extraction.
[0061] Optionally, before performing named entity recognition based on the target statement to obtain the named entity statement, the method further includes:
[0062] Obtain multiple sets of statement samples and the entity category labels corresponding to each set of statement samples;
[0063] Named entity recognition is performed on each group of the statement samples to obtain the named entity statement corresponding to each group of the statement samples;
[0064] The combination of the named entity statement and the entity category label corresponding to each group of statement samples is used as a training sample to obtain multiple training samples. The generation and discrimination combination model is trained using multiple training samples.
[0065] Specifically, the multiple sets of statement samples described in this invention can be extracted from a historical statement database of the industry.
[0066] In this invention, named entity recognition is performed on each group of sentence samples to obtain the named entity sentences corresponding to each group of sentence samples. This is also done by performing Chinese word segmentation on the target sentences and then using existing named entity recognition algorithms for named entity recognition.
[0067] In this invention, the entity category label corresponding to each group of statement samples refers to a label that can identify the real entity category in the statement sample.
[0068] The combination of the named entity statement and the entity category label corresponding to each group of statement samples is used as a training sample to obtain multiple training samples. The generation and discrimination combination model is trained using multiple training samples.
[0069] Optionally, training the generative discriminative combination model using multiple training samples includes:
[0070] For any training sample, the training sample is input into the preset relation extraction model in the discriminative combination model, and the entity category relation prediction corresponding to the training sample is output.
[0071] The predicted entity category relationship is input into the preset discriminator in the discriminative combination model, and the discriminative result is output.
[0072] Based on the discrimination result and the entity category label, the reward and penalty value corresponding to the training sample is determined, and the preset relation extraction model is optimized according to the reward and penalty value.
[0073] The new training samples are then input into the discriminative combination model for training until the preset conditions are met, at which point the training ends and a well-trained relation extraction model is obtained.
[0074] Specifically, the preset training conditions described in this invention may refer to the relationship extraction classification being close to the true classification, or the training ending when the number of training iterations reaches a preset value.
[0075] Figure 2 This is a schematic diagram of the relation extraction model G network structure provided in an embodiment of the present invention. After the training samples are input into the preset relation extraction model in the discriminative combination model, the relation extraction generator G uses... Figure 2 Relation extraction is performed on the network. Additional supervision from a knowledge base is used to improve remotely supervised relation extraction in a principled manner. Information such as entity types and relation aliases from industry knowledge bases, such as the medical encyclopedia KB, is used principledly to impose soft constraints when predicting relations. Entity types include: diseases, symptoms, viruses, drugs, etc. Relation aliases, for example, can be stated as: influenza virus—causes—influenza, influenza virus—leads to—influenza, where "leads to" is an alias for "causes".
[0076] To obtain a higher-level, more abstract sentence representation, the sentence is input, and a convolutional CNN with an attention mechanism is used to obtain new features L.
[0077]
[0078] Where h rel Indicates a relational alias. and Let represent the entity types of the subject and object, respectively. Then, the probability predicted by relation r is:
[0079] p(r|x;Φ)=softmax(W r *tanh(L)+b r )
[0080] in n r It represents the total number of relationships.
[0081] The extraction results are evaluated using a discriminator D derived from adversarial learning (GAN).
[0082] The relation extraction generator G can be viewed as a function G(·), and the generated class samples are denoted as: p g (x), in contrast, the true category is denoted as: p data (x). The discriminator D, as a classification function D(·), outputs a reward or penalty value by comparing the classification result of the generator G with the true category.
[0083] The overall optimization objective function for generative adversarial GAN models is:
[0084]
[0085] The function V(G, D) is as follows:
[0086]
[0087] This method treats the relation extraction model as a generator G in adversarial learning, and also as an agent in reinforcement learning. The output classification result is used as an action, and the discriminator D evaluates it as a reward and feeds it back to the relation extraction model G (i.e., the agent).
[0088] Figure 3 This is a schematic diagram of the relation extraction process based on adversarial reinforcement learning provided in an embodiment of the present invention, as shown below. Figure 3 As shown, it includes:
[0089] The process of classifying each sentence in the bag is recorded as an episode. Based on the classification results for each sentence, the category with the highest probability is used as the classification for the entire bag.
[0090] For example, a randomly selected sentence:
[0091] S1: Influenza is a respiratory infectious disease caused by the influenza virus.
[0092] S2: For influenza patients, timely treatment is necessary once the influenza virus is detected in their body.
[0093] S2: There is no need to worry if you get the flu virus, because the flu is a very easy disease to cure.
[0094] Relation extraction is performed on these sentences: the relation category r extracted from the two entities of influenza and influenza virus is (influenza virus, causes, influenza), where it is "causes".
[0095] This paper employs reinforcement learning, utilizing the concepts of punishment (or reward) and policy, and applies the policy gradient to the training of relation extraction under remote supervision. The process of the relation extraction classifier classifying each sentence within a bag is treated as an episode. The classification result is compared with the true result, and this comparison serves as the reward or punishment to train the relation extractor for each sentence. This method can remove erroneous data (noisy sentences) and reduce errors caused by remote supervision.
[0096] The model utilizes the reward mechanism to reflect the usefulness of the selected sentences. The authors assume that after all choices are made, the model will have a maximum reward, thus receiving a delayed reward in the final state, while rewards in other states are zero.
[0097]
[0098] Where B is the set of sentences, r is the relation label of the current sentence group, and p(r|x) j ) is a relation classifier.
[0099] The above training steps are repeated in turn until the relation extraction classification is close to the true classification, or the training times reach the preset value.
[0100] In this embodiment of the invention, a discriminative combination model, including a preset relation extraction model and a preset discriminator, is used. The policy gradient is applied to the training of remotely supervised relation extraction using the concepts of rewards and penalties and policies. Secondly, additional supervision from a knowledge base is utilized to improve remotely supervised relation extraction in a principled manner, thereby training a relation extraction model that can effectively extract entity relations. This model enables effective entity relation extraction.
[0101] Optionally, the step of inputting the training samples into the preset relation extraction model in the discriminative combination model and outputting the entity category relation prediction corresponding to the training samples includes:
[0102] The training samples are input into the preset relation extraction model in the discriminative combination model, and based on the industry prediction soft constraint, the output is the preset relation extraction model in the discriminative combination model.
[0103] The industry forecast soft constraint is determined based on entity types and relation aliases in the industry knowledge base.
[0104] Specifically, the industry forecast soft constraint in this invention refers to extracting only entity relationships that conform to the constraint during the entity relationship extraction process using a preset relationship extraction model.
[0105] For example, each relation imposes certain restrictions on the type of entity; an entity can be its subject and object. For instance, the person / birthplace relation can only occur between a person and a place. Information extraction using industry-specific text data requires prior understanding and analysis of the medical text data, pre-determining the entity types and relation aliases in the industry knowledge base, thereby obtaining soft constraints for industry prediction.
[0106] In this embodiment of the invention, during the relation extraction process, industry prediction soft constraints are added to the extraction process in a principle-based manner, which can effectively ensure the accuracy of the final prediction.
[0107] Figure 4 This is a schematic diagram of the relation extraction training process provided in an embodiment of the present invention, such as... Figure 4 As shown, the process includes: first, inputting a sentence and performing named entity recognition to obtain named entity statements; using an initialization relation extraction generator G to extract relations; using a discriminator D to evaluate the extraction results; generating reward and punishment feedback based on the evaluation results; and optimizing the relation extractor based on the reward and punishment feedback.
[0108] The entity relation extraction apparatus provided by the present invention is described below. The entity relation extraction apparatus described below and the entity relation extraction method described above can be referred to in correspondence.
[0109] Figure 5 This is a schematic diagram of the entity relationship extraction device provided in an embodiment of the present invention, as shown below. Figure 5 As shown, it includes: a first identification module 510 and an extraction module 520; wherein, the first identification module 510 is used to perform named entity identification based on the target statement to obtain named entity statements; wherein, the extraction module 520 is used to input the named entity statements into a trained relation extraction model to obtain entity category relations corresponding to each named entity statement; wherein, the trained relation extraction model is obtained by inputting named entity statement samples carrying entity category labels into a generation discriminant combination model for training, and the generation discriminant combination model includes a preset relation extraction model and a preset discriminator.
[0110] Optionally, the device further includes an acquisition module, a second identification module, and a training module;
[0111] The acquisition module is used to acquire multiple sets of statement samples and the entity category label corresponding to each set of statement samples;
[0112] The second recognition module is used to perform named entity recognition on each group of the statement samples to obtain the named entity statement corresponding to each group of the statement samples;
[0113] The training module is used to take the combination of the named entity statement and the entity category label corresponding to each group of statement samples as a training sample, obtain multiple training samples, and use the multiple training samples to train the generation and discrimination combination model.
[0114] Optionally, the training module is specifically used for:
[0115] For any training sample, the training sample is input into the preset relation extraction model in the discriminative combination model, and the entity category relation prediction corresponding to the training sample is output.
[0116] The predicted entity category relationship is input into the preset discriminator in the discriminative combination model, and the discriminative result is output.
[0117] Based on the discrimination result and the entity category label, the reward and penalty value corresponding to the training sample is determined, and the preset relation extraction model is optimized according to the reward and penalty value.
[0118] The new training samples are then input into the discriminative combination model for training until the preset conditions are met, at which point the training ends and a well-trained relation extraction model is obtained.
[0119] In this embodiment of the invention, a discriminative combination model, including a preset relation extraction model and a preset discriminator, is used. The policy gradient is applied to the training of remotely supervised relation extraction using the concepts of rewards and penalties and policies. Secondly, additional supervision from a knowledge base is utilized to improve remotely supervised relation extraction in a principled manner, thereby training a relation extraction model that can effectively extract entity relations. This model enables effective entity relation extraction.
[0120] Figure 6 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 6As shown, the electronic device may include a processor 610, a communication interface 620, a memory 630, and a communication bus 640, wherein the processor 610, the communication interface 620, and the memory 630 communicate with each other through the communication bus 640. The processor 610 can call logical instructions in the memory 630 to execute an entity relation extraction method, which includes: performing named entity recognition based on the target statement to obtain named entity statements; inputting the named entity statements into a trained relation extraction model to obtain entity category relations corresponding to each named entity statement; wherein the trained relation extraction model is obtained by inputting named entity statement samples carrying entity category labels into a generation discriminant combination model for training, and the generation discriminant combination model includes a preset relation extraction model and a preset discriminator.
[0121] Furthermore, the logical instructions in the aforementioned memory 630 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0122] On the other hand, the present invention also provides a computer program product, the computer program product including a computer program stored on a non-transitory computer-readable storage medium, the computer program including program instructions, when the program instructions are executed by a computer, the computer is able to execute the entity relation extraction method provided by the above methods, the method including: performing named entity recognition based on the target statement to obtain named entity statements; inputting the named entity statements into a trained relation extraction model to obtain entity category relations corresponding to each named entity statement; wherein, the trained relation extraction model is obtained by inputting named entity statement samples carrying entity category labels into a generation discriminant combination model for training, the generation discriminant combination model including a preset relation extraction model and a preset discriminator.
[0123] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the entity relation extraction methods provided above. The method includes: performing named entity recognition based on the target statement to obtain named entity statements; inputting the named entity statements into a trained relation extraction model to obtain entity category relations corresponding to each named entity statement; wherein the trained relation extraction model is obtained by inputting named entity statement samples carrying entity category labels into a generation-discrimination-combination model for training, and the generation-discrimination-combination model includes a preset relation extraction model and a preset discriminator.
[0124] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0125] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0126] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for extracting entity relations, characterized in that, include: Named entity recognition is performed on the target statement to obtain the named entity statement; The named entity statements are input into the trained relation extraction model to obtain the entity category relations corresponding to each named entity statement. The trained relation extraction model is obtained by inputting named entity statement samples carrying entity category labels into the generation and discrimination combination model for training. The generation and discrimination combination model includes a preset relation extraction model and a preset discriminator. Prior to performing named entity recognition based on the target statement to obtain the named entity statement, the process further includes: Obtain multiple sets of statement samples and the entity category label corresponding to each set of statement samples; Named entity recognition is performed on each group of the statement samples to obtain the named entity statement corresponding to each group of the statement samples; The combination of the named entity statement and the entity category label corresponding to each group of statement samples is used as a training sample to obtain multiple training samples. The generation and discrimination combination model is trained using multiple training samples. The step of training the generative discriminative combination model using multiple training samples includes: For any training sample, the training sample is input into the preset relation extraction model in the discriminative combination model, and the entity category relation prediction corresponding to the training sample is output. The predicted entity category relationship is input into the preset discriminator in the discriminative combination model, and the discriminative result is output. Based on the discrimination result and the entity category label, the reward and penalty value corresponding to the training sample is determined, and the preset relation extraction model is optimized according to the reward and penalty value. The new training samples are then input into the discriminative combination model for training until the preset conditions are met, at which point the training ends and a well-trained relation extraction model is obtained.
2. The entity relation extraction method according to claim 1, characterized in that, The step of inputting the training samples into the preset relation extraction model in the discriminative combination model and outputting the entity category relation prediction corresponding to the training samples includes: The training samples are input into the preset relation extraction model in the discriminative combination model, and based on the industry prediction soft constraint, the output is the preset relation extraction model in the discriminative combination model. The industry forecast soft constraint is determined based on entity types and relation aliases in the industry knowledge base.
3. The entity relation extraction method according to claim 1, characterized in that, The entity category label corresponding to each group of statement samples is specifically determined based on the industry knowledge base.
4. An entity relationship extraction device, characterized in that, include: The first identification module is used to perform named entity identification based on the target statement to obtain the named entity statement. The extraction module is used to input the named entity statements into the trained relation extraction model to obtain the entity category relations corresponding to each named entity statement. The trained relation extraction model is obtained by inputting named entity statement samples carrying entity category labels into the generation and discrimination combination model for training. The generation and discrimination combination model includes a preset relation extraction model and a preset discriminator. The device further includes an acquisition module, a second identification module, and a training module; The acquisition module is used to acquire multiple sets of statement samples and the entity category label corresponding to each set of statement samples; The second recognition module is used to perform named entity recognition on each group of the statement samples to obtain the named entity statement corresponding to each group of the statement samples; The training module is used to take the combination of the named entity statement and the entity category label corresponding to each group of statement samples as a training sample, obtain multiple training samples, and use the multiple training samples to train the generation discrimination combination model; Specifically, the training module is used for: For any training sample, the training sample is input into the preset relation extraction model in the discriminative combination model, and the entity category relation prediction corresponding to the training sample is output. The predicted entity category relationship is input into the preset discriminator in the discriminative combination model, and the discriminative result is output. Based on the discrimination result and the entity category label, the reward and penalty value corresponding to the training sample is determined, and the preset relation extraction model is optimized according to the reward and penalty value. The new training samples are then input into the discriminative combination model for training until the preset conditions are met, at which point the training ends and a well-trained relation extraction model is obtained.
5. 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 steps of the entity relation extraction method as described in any one of claims 1 to 3.
6. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the entity relation extraction method as described in any one of claims 1 to 3.