Chapter-level relation extraction method and device, electronic equipment and storage medium
By performing entity alignment on pronoun and noun phrase references in the text, and combining the preset pointers to generate network models and relationship extraction models, the problems of inaccurate and incomplete entity relationship extraction in the existing technology are solved, and comprehensive and accurate extraction of entity relationships in the text is achieved.
Patent Information
- Application Number
- CN202211185670.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-27
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2042-09-27
AI Technical Summary
In the existing technology, only noun phrase references in the text of the passage are used as entities to construct the text graph, which leads to the problem of inaccurate and incomplete entity relationship extraction.
By aligning the pronouns and noun phrases in the text, and using preset pointers to generate network models and relationship extraction models, a more comprehensive text graph is constructed to extract the semantic relationships between different entities in the text.
It achieves accurate and comprehensive extraction of entity relationships in paragraph texts, and improves the accuracy and reliability of paragraph-level relationship extraction.
Smart Images

Figure CN115618846B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of natural language processing, and in particular to a passage-level relation extraction method and device, electronic equipment and storage medium. BACKGROUND
[0002] Nowadays, relation extraction is one of the important tasks in the field of information extraction, and the purpose is to extract the factual relationship between entities in unstructured text. For example, relation extraction is indispensable in tasks such as question, dialogue or large-scale knowledge graph construction. Especially, how to extract semantic relationships between different entities in passage text is a current research hotspot.
[0003] In related technologies, for entity relation extraction of passage text, first, the noun phrase reference in the passage text is represented as an entity, and then the represented entity is used as a node to build a text graph. Finally, the semantic information of the nodes and edges in the text graph in the passage text is learned to extract the entity relationship.
[0004] However, when building a text graph for a passage text, only the noun phrase reference is used as an entity, so the constructed text graph cannot fully and completely cover different entities in the passage text, resulting in inaccurate and incomplete entity relationships extracted for the passage text. SUMMARY
[0005] The present application provides a passage-level relation extraction method, device, electronic equipment and storage medium to solve the problem that the existing technology only considers the noun phrase reference of the passage text for text graph construction and entity relation extraction, resulting in inaccurate and incomplete entity relationships extracted for the passage text. By considering pronouns as entities in the passage text, the purpose of accurately and completely extracting semantic relationships between different entities in the passage text is achieved.
[0006] The present application provides a passage-level relation extraction method, comprising:
[0007] Obtaining a target passage text, the target passage text being a passage text with pronouns and noun phrase references aligned with the pronouns;
[0008] Based on the target passage text and a preset relation extraction model, the semantic relationship between different entity pairs in the target passage text and the relationship category of the semantic relationship are obtained.
[0009] According to the passage-level relation extraction method provided by the present application, the target passage text is obtained, comprising:
[0010] Obtaining an initial passage text, the initial passage text having noun phrase references and containing pronouns matching the noun phrase references.
[0011] inputting the initial chapter text into a preset pointer generation network model to obtain a target chapter text output by the preset pointer generation network model;
[0012] The preset pointer generation network model is used to perform entity alignment on the pronoun and the noun phrase reference in the initial chapter text, and obtain the target chapter text.
[0013] According to the chapter-level relationship extraction method provided by the application, the preset relationship extraction model includes a preset encoder sub-model, a preset reference-level graph aggregation sub-model, a preset entity-level graph reasoning sub-model and a preset classifier sub-model, and based on the target chapter text and the preset relationship extraction model, the semantic relationship between different entity pairs in the target chapter text and the relationship category of the semantic relationship are obtained, which includes:
[0014] inputting the target chapter text into the preset encoder sub-model to obtain an initial semantic information vector corresponding to each target vocabulary in the target chapter text output by the preset encoder sub-model;
[0015] inputting the initial semantic information vector into the preset reference-level graph aggregation sub-model to obtain a target semantic information vector of different category reference nodes and a heterogeneous edge vector connecting the different category reference nodes output by the preset reference-level graph aggregation sub-model;
[0016] inputting the target semantic information vector and the heterogeneous edge vector into the preset entity-level graph reasoning sub-model to obtain an entity semantic vector information of an entity and path information between entity pairs output by the preset entity-level graph reasoning sub-model;
[0017] inputting the entity semantic vector information and the path information into the preset classifier sub-model to obtain a semantic relationship between different entity pairs and a relationship category of the semantic relationship output by the preset classifier sub-model.
[0018] According to the chapter-level relationship extraction method provided by the application, the training process of the preset pointer generation network model includes:
[0019] determining an initial sample chapter text, the initial sample chapter text being marked with at least two sample noun phrase references;
[0020] replacing a target sample noun phrase reference in the at least two sample noun phrase references with a preset sample pronoun to determine a target sample chapter text;
[0021] The initial pointer generation network model is trained using the target sample chapter text to determine a preset pointer generation network model corresponding to a training stop time.
[0022] According to the chapter-level relation extraction method provided in the application, the training process of the preset relation extraction model comprises:
[0023] The initial pointer generation network model is iteratively trained using the target sample chapter text to determine a coreference sample entity corresponding to the preset sample pronoun output by an intermediate pointer generation network model after each iteration training.
[0024] Based on the coreference sample entity, a loss function of the intermediate pointer generation network model is determined.
[0025] Based on the loss function and a preset precision condition, a preset pointer generation network model corresponding to a training stop time is determined.
[0026] According to the chapter-level relation extraction method provided in the application, the training process of the preset relation extraction model comprises:
[0027] A sample chapter text, a verification chapter text and a test chapter text are determined.
[0028] The initial relation extraction model is trained using the sample chapter text to obtain an intermediate relation extraction model after training.
[0029] The hyperparameters of the intermediate relation extraction model are adjusted using the verification chapter text to determine an intermediate relation extraction model after hyperparameter adjustment and a training stop condition.
[0030] When it is determined that the training stop condition is reached, the relation extraction model corresponding to a training end time is tested using the test chapter text to determine a preset relation extraction model corresponding to a test result satisfying a preset condition.
[0031] When it is determined that the training stop condition is not reached, the intermediate relation extraction model after hyperparameter adjustment is trained again using the sample chapter text until the training stop condition is reached and the test result satisfies the preset condition.
[0032] The application further provides a chapter-level relation extraction device, comprising:
[0033] A text acquisition module is configured to acquire a target chapter text, wherein the target chapter text is a chapter text with a pronoun and a noun phrase reference aligned with the pronoun.
[0034] a relationship extraction module configured to obtain semantic relationships between different entity pairs in the target text and relationship categories of the semantic relationships based on the target text and a preset relationship extraction model.
[0035] According to the document-level relationship extraction device provided by the application, the text acquisition module comprises a first text acquisition module and a second text acquisition module.
[0036] The first text acquisition module is configured to acquire an initial document text, wherein the initial document text is marked with a noun phrase reference, and the initial document text contains a pronoun matching the noun phrase reference.
[0037] The second text acquisition module is configured to input the initial document text into a preset pointer generation network model to obtain a target document text output by the preset pointer generation network model, wherein the preset pointer generation network model is configured to perform entity alignment on the pronoun and the noun phrase reference in the initial document text to acquire the target document text.
[0038] According to the document-level relationship extraction device provided by the application, the preset relationship extraction model comprises a preset encoder submodel, a preset reference-level graph aggregation submodel, a preset entity-level graph reasoning submodel, and a preset classifier submodel, and the relationship extraction module comprises an encoding module, an aggregation model, a reasoning module, and an extraction module.
[0039] The encoding module is configured to input the target document text into the preset encoder submodel to obtain an initial semantic information vector corresponding to each target vocabulary in the target document text output by the preset encoder submodel.
[0040] The aggregation model is configured to input the initial semantic information vector into the preset reference-level graph aggregation submodel to obtain a target semantic information vector of different category reference nodes and a heterogeneous edge vector connecting the different category reference nodes output by the preset reference-level graph aggregation submodel.
[0041] The reasoning module is configured to input the target semantic information vector and the heterogeneous edge vector into the preset entity-level graph reasoning submodel to obtain an entity semantic vector information of an entity and path information between entity pairs output by the preset entity-level graph reasoning submodel.
[0042] The extraction module is configured to input the entity semantic vector information and the path information into the preset classifier submodel to obtain semantic relationships between different entity pairs and relationship categories of the semantic relationships output by the preset classifier submodel.
[0043] The chapter-level relation extraction device provided by the application further comprises a first determining module, a second determining module and a first training module, wherein:
[0044] The first determining module is configured to determine an initial sample chapter text, and the initial sample chapter text is marked with at least two sample noun phrase designations.
[0045] The second determining module is configured to replace a target sample noun phrase designation in the at least two sample noun phrase designations with a preset sample pronoun to determine a target sample chapter text.
[0046] The first training module is configured to train an initial pointer generation network model using the target sample chapter text to determine a preset pointer generation network model corresponding to a training stop condition, wherein the initial pointer generation network model is an encoder containing a preset attention mechanism and a preset coverage mechanism.
[0047] The chapter-level relation extraction device provided by the application further comprises a first training module, a first determining module and a second determining module, wherein:
[0048] The first training submodule is configured to iteratively train the initial pointer generation network model using the target sample chapter text to determine a coreference sample entity for the preset sample pronoun output by an intermediate pointer generation network model after each iteration.
[0049] The first determining submodule is configured to determine a loss function of the intermediate pointer generation network model based on the coreference sample entity.
[0050] The second determining submodule is configured to determine a preset pointer generation network model corresponding to a training stop condition based on the loss function and a preset precision condition.
[0051] The chapter-level relation extraction device provided by the application further comprises a third determining module, a second training module, a fourth determining module and a test module, wherein:
[0052] The third determining module is configured to determine a sample chapter text, a verification chapter text and a test chapter text.
[0053] The second training module is configured to train an initial relation extraction model using the sample chapter text to obtain an intermediate relation extraction model after training.
[0054] The fourth determining module is configured to adjust hyperparameters of the intermediate relation extraction model using the verification chapter text to determine an intermediate relation extraction model after hyperparameter adjustment and a training stop condition.
[0055] The test module is configured for testing the relationship extraction model corresponding to the end of training using the test text when it is determined that the training stop condition is met, and determining the relationship extraction model corresponding to the preset condition when the test result meets the preset condition.
[0056] The second training module is further configured for retraining the intermediate relationship extraction model after the hyperparameters are adjusted using the sample text until the training stop condition is met and the test result meets the preset condition.
[0057] The present application also provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned any one of the discourse-level relationship extraction methods when executing the program.
[0058] The present application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program is executable on a processor to implement the above-mentioned any one of the discourse-level relationship extraction methods.
[0059] The present application also provides a computer program product comprising a computer program, wherein the computer program is executable on a processor to implement the above-mentioned any one of the discourse-level relationship extraction methods.
[0060] The present application provides a discourse-level relationship extraction method, device, electronic device, and storage medium, which first acquires a target text, and since the target text is a text identified with pronouns and noun phrases aligned with the pronouns, the richness and comprehensiveness of entities in the text are enriched in combination with the fact that both noun phrases and pronouns can represent entities. Further, by inputting the target text into a preset relationship extraction model, the semantic relationship between different entities in the target text is obtained, so as to effectively utilize the pronouns in the text and the model learning method to accurately and comprehensively extract the semantic relationship between different entities in the text, thereby effectively improving the accuracy and reliability of discourse-level relationship extraction. BRIEF DESCRIPTION OF DRAWINGS
[0061] In order to more clearly illustrate the technical solutions in the present application or prior art, the following will briefly introduce the drawings needed in the embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor.
[0062] Figure 1 is one of the flowcharts of the discourse-level relationship extraction method provided by the present application;
[0063] Figure 2 is a flowchart of a process of a preset relationship extraction model provided by the present application for processing a target text;
[0064] Figure 3 is a flowchart of a process of a text-level relationship extraction method provided by the present application;
[0065] Figure 4 is a structural schematic diagram of a text-level relationship extraction device provided by the present application;
[0066] Figure 5 is a structural schematic diagram of an electronic device provided by the present application. DETAILED DESCRIPTION
[0067] To make the objectives, technical solutions and advantages of the present application clearer, the technical solutions of the present application will be described below in detail with reference to the accompanying drawings of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of protection of the present application.
[0068] The text-level relationship extraction method, device, electronic device and storage medium of the present application will be described below. Figures 1-5 The execution subject of the text-level relationship extraction method can be a terminal device, and the terminal device can be a personal computer (PC), a portable device, a notebook computer, a smart phone, a tablet computer, a portable wearable device or other electronic devices. The server can use an independent server or a server cluster composed of multiple servers, such as a physical server containing an independent host, a virtual server carried by a host cluster, a cloud server, etc. The present application does not limit the specific form of the terminal device, nor the specific form of the server.
[0069] It should be noted that the following method embodiments are described by taking the terminal device as an example, and the execution subject of the following method embodiments can be part or all of the terminal device.
[0070] Figure 1 The flowchart of the text-level relationship extraction method provided by the present application is shown in FIG. 1, and the text-level relationship extraction method comprises the following steps: Figure 1
[0071] Step 110: obtaining a target text, the target text being a text identified with pronouns and noun phrases referring to the pronouns.
[0072] Specifically, the terminal device obtains the target chapter text, which can be input by a user to the terminal device, and the input method can include but is not limited to terminal device input and photograph upload input. For example, the target chapter text can be obtained by manually inputting the target chapter text on the terminal device, or the target chapter text can be obtained by uploading the photographed target chapter text. The terminal device can also obtain the target chapter text by first selecting a chapter text with a noun phrase from a pre-stored chapter text set, and then aligning the identified noun phrase with the corresponding pronoun. The method of obtaining the target chapter text is not limited here. Further, the pre-stored chapter text set can be a DocRED chapter text set.
[0073] Step 120, based on the target chapter text and the preset relationship extraction model, obtaining the semantic relationship between different entity pairs in the target chapter text and the relationship category of the semantic relationship.
[0074] Specifically, in order to improve the accuracy of entity relationship extraction, a model for entity relationship extraction of pronouns and noun phrases aligned with pronouns can be pre-established and trained, and the corresponding preset relationship extraction model is determined when the training converges. Further, the target chapter text is input into the preset relationship extraction model, and the semantic relationship between different entity pairs in the target chapter text output by the preset relationship extraction model and the relationship category of the semantic relationship can be obtained.
[0075] The chapter-level relationship extraction method provided by the application first obtains the target chapter text. Since the target chapter text is a chapter text with pronouns and noun phrases aligned with pronouns, the noun phrases and pronouns can both represent entities, which enriches the richness and comprehensiveness of entities in the chapter text. Further, by inputting the target chapter text into the preset relationship extraction model, the semantic relationship between different entities in the target chapter text is obtained. Thus, by effectively utilizing the pronouns in the chapter text and the model learning method, the purpose of accurately and comprehensively extracting the semantic relationship between different entities in the chapter text is achieved, thereby effectively improving the accuracy and reliability of chapter-level relationship extraction.
[0076] Optionally, the specific implementation process of step 110 can include:
[0077] An initial chapter text is obtained, and the initial chapter text is identified by a noun phrase and contains a pronoun matching the noun phrase. The initial chapter text is input into a preset pointer generation network model to obtain a target chapter text output by the preset pointer generation network model. The preset pointer generation network model is used to align the pronoun in the initial chapter text with the noun phrase, and obtain the target chapter text.
[0078] Specifically, the initial chapter text can be obtained in the following manner: input by a user to a terminal device or selected from a pre-stored chapter text set by the terminal device. The manner in which the terminal device obtains the initial chapter text is not specifically limited. In addition, the preset pointer generation network model can be a trained coreference resolver. In this case, the preset pointer generation network model can perform coreference resolution on pronouns that are difficult to annotate in the initial chapter text, that is, align the pronouns with the annotated noun phrase references to obtain aligned pronouns and noun phrase references. Based on this, the initial chapter text can be input into the preset pointer generation network model, and the target chapter text output by the preset pointer generation network model can be naturally obtained.
[0079] The chapter-level relation extraction method provided by the application can effectively learn the coreference relationship between entities in different references by using the preset pointer generation network model and the annotated noun phrase references in the initial chapter text, and effectively improve the accuracy and reliability of obtaining the target chapter text.
[0080] Optionally, the training process of the preset pointer generation network model can include:
[0081] An initial sample chapter text is determined, the initial sample chapter text being marked with at least two sample noun phrase references; a target sample noun phrase reference in the at least two sample noun phrase references is replaced with a preset sample pronoun to determine a target sample chapter text; the initial pointer generation network model is trained using the target sample chapter text to determine a preset pointer generation network model corresponding to a training stop; wherein the initial pointer generation network model is an encoder containing a preset attention mechanism and a preset coverage mechanism.
[0082] Specifically, the initial sample chapter text can be determined as one or more, and each initial sample chapter text contains at least two or more sample noun phrase references; for the at least two sample noun phrase references in each initial sample chapter text, one sample noun phrase reference can be randomly selected and replaced with a preset sample pronoun, such as this, other, etc. In this way, the target sample chapter text is determined; the initial pointer generation network model can also be an initial coreference resolver, and both are encoders containing a preset attention mechanism and a preset coverage mechanism. Based on this, the terminal device trains the initial pointer generation network model using the target sample chapter text, such as a preset number of training times. After the initial pointer generation network model is trained for a preset number of training times using the target sample chapter text, the model output result after the current training can be sent to the client to determine whether the accuracy of the model output result meets the actual needs through the client corresponding user.
[0083] When the terminal device receives the first feedback information fed back by the client and including the accuracy of the output result of the current trained model meeting the actual demand, the training is stopped, and the pointer generation network model corresponding to the training stopping time is determined as the preset pointer generation network model; otherwise, when the terminal device receives the second feedback information fed back by the client and including the accuracy of the output result of the current trained model not meeting the actual demand, a new target sample chapter text is determined by replacing the new preset sample pronoun with a selected sample noun phrase in the sample noun phrase, the pointer generation network model corresponding to the model output result is used as a new initial pointer generation network model, and the new target sample chapter text is used to train the new initial pointer generation network model again for a preset number of training times; until the first feedback information fed back by the client is received.
[0084] The chapter-level relation extraction method provided by the application can effectively learn the coreference relation between different designations of each entity by combining the attention and coverage mechanisms, thereby improving the accuracy and reliability of the preset pointer generation network model.
[0085] Optionally, the target sample chapter text is used to train the initial pointer generation network model to determine the preset pointer generation network model corresponding to the training stopping time, and the implementation process can include:
[0086] The target sample chapter text is used to iteratively train the initial pointer generation network model to determine the coreference sample entity for the preset sample pronoun output by the intermediate pointer generation network model after each iteration training; based on the coreference sample entity, the loss function of the intermediate pointer generation network model is determined; and based on the loss function and the preset precision condition, the preset pointer generation network model corresponding to the training stopping time is determined.
[0087] Specifically, the coreference sample entity can represent different designations of the same entity.
[0088] Specifically, since the entity appears multiple times in the target chapter text, the words in the entity also appear multiple times, which causes the words representing the same entity at different positions to be assigned a high attention value at the same time. Therefore, the coverage mechanism is set in the initial pointer generation network model, that is, the attention value of the generated words is covered in the decoding stage to avoid repeated generation of the same word. The coverage mechanism has the following forms:
[0089]
[0090] Based on the introduced coverage mechanism, the attention calculation formula is:
[0091]
[0092] Therefore, the loss function to be optimized each time of training is:
[0093]
[0094] In formulas (1)-(3), k represents the decoding time step of the target sample chapter text and the decoding ends when the decoding reaches the preset end marker word; under the coverage mechanism, when calculating the attention of each word at the kth step, the attention values a k' of each step before k need to be accumulated and summed, k' represents the time step before k, c k represents the attention value under the coverage mechanism. The initial calculation method of the attention value is as shown in formula (2), wherein h i represents the encoding hidden state vector of the ith vocabulary, W h represents the encoding state weight matrix, s k represents the decoding state vector at the kth time step, W s represents the decoding state weight matrix, b attn represents the bias when calculating the attention, tanh is a nonlinear activation function; v T represents a linear weight, wherein the superscript T represents a vector transposition operation, and after the nonlinear activation function softmax operation, the attention value of each word can be obtained. The attention value c k under the coverage mechanism is compared with the ordinary attention value a k , and the smaller one is accumulated, and the accumulated sum L k is taken as the loss function to be optimized.
[0095] Based on this, the initial pointer generation network model is iteratively trained using the target sample chapter text, which can be an optimization process for the loss function, and after a preset number of training, it is determined whether the value of the loss function of the current obtained intermediate pointer generation network model meets the preset accuracy requirement. If the value of the loss function of the current obtained intermediate pointer generation network model meets the preset accuracy requirement, the training is stopped, and the intermediate pointer generation network model corresponding to the training stop is determined as the preset pointer generation network model. Otherwise, if the value of the loss function of the current obtained intermediate pointer generation network model does not meet the preset accuracy requirement, a new target sample chapter text is determined by replacing the original target sample chapter text with a new preset sample pronoun, the model output result corresponding to the pointer generation network model is used as a new initial pointer generation network model, and the new initial pointer generation network model is trained again using the new target sample chapter text for a preset number of times. Training is stopped until the value of the loss function is minimized and the model converges.
[0096] The chapter-level relation extraction method provided by the application determines the loss function of the intermediate pointer generation network model based on the co-reference sample entity for the preset sample pronoun output by the intermediate pointer generation network model after each iteration training, and determines the preset pointer generation network model based on the loss function and the preset accuracy condition. This improves the reliability and stability of training the initial pointer generation network model, thereby improving the accuracy of the preset pointer generation network model.
[0097] Optionally, in the case where the preset relation extraction model includes a preset encoder sub-model, a preset referential level graph aggregation sub-model, a preset entity level graph reasoning sub-model and a preset classifier sub-model, the specific implementation process of step 120 can include:
[0098] The target chapter text is input into the preset encoder sub-model to obtain the initial semantic information vector corresponding to each target vocabulary in the target chapter text output by the preset encoder sub-model; the initial semantic information vector is input into the preset referential level graph aggregation sub-model to obtain the target semantic information vector of different category referential nodes and the heterogeneous edge vector connecting different category referential nodes output by the preset referential level graph aggregation sub-model; the target semantic information vector and the heterogeneous edge vector are input into the preset entity level graph reasoning sub-model to obtain the entity semantic vector information of the entity and the path information between the entity pairs output by the preset entity level graph reasoning sub-model; the entity semantic vector information and the path information are input into the preset classifier sub-model to obtain the semantic relationship between different entity pairs and the relationship category of the semantic relationship output by the preset classifier sub-model.
[0099] Wherein, the target vocabulary can be any one of the target chapter text.
[0100] Specifically, the preset encoder sub-model first performs vectorization processing on the target passage text, that is, each target word in the target passage text is mapped to a multidimensional vector space, so that each target word has a coordinate value in each dimension; thereby obtaining the target word vector of each target word, and then for each target word vector, learning the contextual meaning of each target word vector in the target passage text, thereby obtaining the initial semantic information vector of each target word; the preset reference-level graph aggregation sub-model first aggregates different categories of reference nodes based on the initial semantic information vector of each target word, that is, aggregating three types of reference nodes, namely, noun phrase entity reference nodes, pronoun entity reference nodes and passage nodes, and determining the three types of heterogeneous edges connecting the three types of reference nodes as entity internal edges, entity external edges and passage edges, and then learning the vector representation relationship between the three types of reference nodes and the three types of heterogeneous edges in the target passage text, obtaining the target semantic information vectors of noun phrase entity reference nodes, pronoun entity reference nodes and passage nodes, as well as the heterogeneous edge vectors of entity internal edges, entity external edges and passage edges. The referential text diagram constructed in this way is as follows Figure 2 As shown, the reference-level text graph includes the target semantic information vectors of noun phrase entity reference nodes, pronoun entity reference nodes and text nodes, as well as the heterogeneous edge vectors of entity internal edges, entity external edges and text edges. And, Figure 2 Encoder is the preset encoder sub-model, and Classifier is the preset classifier sub-model.
[0101] Furthermore, the pre-set entity-level graph reasoning sub-model contains a trained graph convolutional network (GCN), which uses the trained GCN to learn the global representation of entities and the reasoning path information between entity pairs, that is, the target semantic information vectors of noun phrase entity reference nodes, pronoun entity reference nodes and text nodes, as well as the heterogeneous edge vectors of entity internal edges, entity external edges and text edges are averaged, that is, all target semantic information vectors representing the same entity are averaged, for example Figure 2 The target semantic information vectors of 1 Skai TV and 2 It representing Skai TV are averaged to obtain Figure 3 The entity semantic vector information of the entity Skai TV in this way is obtained Figure 3 The entity semantic vectors of each entity in the entity-level text graph shown in FIG; and, while performing the entity reference averaging process, the heterogeneous edge vectors corresponding to each entity reference node to be averaged are fused to obtain Figure 2 The path information between entity pairs in the entity-level text graph shown is represented by straight arrows.
[0102] Then, the preset classifier sub-model classifies the entity relationship according to the entity semantic vector of each entity in the entity-level text graph and the path information between the entity pairs, first, for the entity pair (e h ,e t ) in the entity-level text graph, the entity semantic vector information e h of the head entity and the entity semantic vector information e t of the tail entity, the enhanced feature of the entity pair (e h ,e t ) is |e h -e t |, and the chapter node in the mention-level text graph is represented as m doc , the path information between the entity pair (e h ,e t ) is p ht , and finally the entity representation information of the entity pair (e h ,e t ) is obtained. Then, the entity relationship classification is performed on the entity representation information of the entity pair (e h ,e t ), and the classification model is:
[0103] P(r|e h ,e t )=sigmoid(W b σ(W a I h,t +b a )+b b ) (4)
[0104] In formula (4), h represents the head entity, t represents the tail entity, e h represents the semantic vector information of the head entity, e t represents the semantic vector information of the tail entity, r represents the semantic relationship category between the entity pair, P(r|e h ,e t ) represents the probability that the entity pair (e h ,e t ) belongs to the relationship r. I h,t represents the representation vector information of the entity pair (e h ,e t ), and I h,t is input into two nonlinear layers to predict the semantic relationship between the entity pair, W a represents the weight matrix of the first nonlinear layer, b a represents the bias vector of the first nonlinear layer, σ represents the nonlinear activation function (such as ReLU, etc.) of the first nonlinear layer, W b represents the weight matrix of the second nonlinear layer, and bb is a bias vector of the second nonlinear layer, sigmoid represents a nonlinear activation function of the second nonlinear layer.
[0105] The binary cross-entropy is used as the loss function of classification, and the expression is as follows:
[0106]
[0107] In formula (5), L represents a loss function, r j represents the jth relationship in the preset relationship list, the preset relationship list includes R relationships, each relationship refers to a different relationship category, R is a positive integer, and the specific value of R can be artificially set according to an actual task, for example, the preset relationship list can include 96 relationships such as father, found by, part of and the like; I(·) represents an indicator function, I(r j =1) represents that the entity pair has the relationship r j , I(r j =0) represents that the entity pair does not have the relationship r j , I(r i =1)logP(r j |e h ,e t )+I(r j =0)log(1-P(r j |e h ,e t )) represents a binary cross-entropy calculation function; the innermost sum function represents summing cross-entropies of all different relationship categories of the current entity pair, and R represents all entity categories; the middle sum function represents summing cross-entropies of all different entity pairs in the current text, h represents a head entity, and t represents a tail entity; the outermost sum function represents summing cross-entropies of all texts in the entire data set, D represents a document text, and S represents the entire data set.
[0108] The loss function of formula (5) is optimized until the value of the loss function reaches the minimum, and the semantic relationship between the entity pair (e h ,e t ) and the relationship category of the semantic relationship are output.
[0109] It should be noted that the document node is a vectorized representation of the target document text, the noun phrase entity reference node and the pronoun entity reference node are connected with the document node respectively, so that the information transmission speed between distant nodes can be accelerated, and the information interaction efficiency can be improved; in addition, the entity internal edge is an edge between different representations belonging to the same entity, for example Figure 2The connection edges between Skai TV and It and Skai Group, Athens and Pirarus can model the interactions between different representations of the same entity through the entity internal edges; and the entity external edges model the connection edges between different entity representations in the same sentence, such as Figure 2 The connection edges between Skai TV and Skai Group, Athens and Pirarus can model the interactions between different representations of the same entity through the entity external edges; and the discourse edges are the connection edges between all the NP entity mention nodes and pronoun entity mention nodes and the discourse node, such as Figure 2 The connection edges indicated by the dashed lines, each of the NP entity mention nodes and pronoun entity mention nodes can ensure that there are connection edges between all the nodes and form a connected graph by connecting with the discourse node.
[0110] The method for extracting discourse-level relations provided by the embodiment of the present application can learn the context semantic information of target words in target discourse text, aggregate the entity-level text graph, reason the entity-level text graph and classify the entity relations through the preset relation extraction model, determine the semantic relations between different entity pairs in the target discourse text and the relation categories of the semantic relations, and thus extract the entity relations by combining pronouns as entity mentions, which greatly improves the richness and accuracy of the extracted entity relations.
[0111] Optionally, the training process of the preset relation extraction model comprises:
[0112] The sample discourse text, the verification discourse text and the test discourse text are determined; the initial relation extraction model is trained using the sample discourse text to obtain the trained intermediate relation extraction model; the hyperparameters of the intermediate relation extraction model are adjusted using the verification discourse text to determine the intermediate relation extraction model after the adjustment of the hyperparameters and the training stop condition; when it is determined that the training stop condition is reached, the test discourse text is used to test the relation extraction model corresponding to the training end, and the preset relation extraction model corresponding to the test result satisfying the preset condition is determined; when it is determined that the training stop condition is not reached, the sample discourse text is used to retrain the intermediate relation extraction model after the adjustment of the hyperparameters; until the training stop condition is reached and the test result satisfies the preset condition.
[0113] Specifically, the initial relation extraction model contains an initial encoder submodel, an initial mention-level graph aggregation submodel, an initial entity-level graph reasoning submodel, and an initial classifier submodel. The sample chapter text can be 3053 texts, the verification chapter text can be 1000 texts, the test chapter text can be 1000 texts, the training times Q are preset, the initial relation extraction model is trained using the sample chapter text, and the trained intermediate relation extraction model is obtained. Here, the intermediate relation extraction model can be trained for P times, P≤Q; then the hyperparameters of the intermediate relation extraction model are adjusted using the verification chapter text, the hyperparameter-adjusted intermediate relation extraction model and the training stop condition are determined, and the training stop condition can be the maximum training times. Based on this, if the current training times are the same as the maximum training times, it is determined that the training stop condition is reached, at this time the test chapter text is used to test the relation extraction model corresponding to the training end, and the preset relation extraction model corresponding to the test result satisfying the preset condition is determined. The test result satisfying the preset condition indicates that the accuracy of the test result satisfies the preset accuracy threshold; otherwise, if the current training times are less than the maximum training times, the hyperparameter-adjusted intermediate relation extraction model is trained again using the sample chapter text; until the training stop condition is reached and the test result satisfies the preset condition.
[0114] The chapter-level relation extraction method provided by the application determines the preset relation extraction model by training the initial relation extraction model using the sample chapter text, adjusting the hyperparameters of the trained model using the verification chapter text, determining the training stop condition, testing the model corresponding to the training stop condition using the test chapter text, thereby improving the accuracy of model training by combining training, verification and testing, and greatly improving the accuracy and reliability of relation extraction.
[0115] Referring to Figure 3 The flowchart of the chapter-level relation extraction method is shown in Figure 3In the method, the DocRED chapter text set is first preprocessed, that is, at least two noun phrases representing the same content are selected from the DocRED chapter text set, such as Peking University and Peking University representing the same content; the initial chapter text obtained by preprocessing is then input into the preset GPN for reference resolution, and the reference resolution result obtained is the target chapter text. The preset GPN is a preset pointer generation network model; then the target chapter text is input into the preset GAIN, which is a preset relationship extraction model, and the contextual semantic information of the target vocabulary is learned through the preset encoder sub-model in the preset GAIN, the reference-level graph aggregation sub-model is used to aggregate the reference-level text graph, the entity-level graph reasoning sub-model is used to reason about the entity-level text graph, and the entity relationship classification is performed through the preset classifier sub-model, so as to determine the semantic relationship between different entity pairs in the target chapter text and the relationship category of the semantic relationship. The specific implementation process involved is referred to the aforementioned method embodiment and will not be repeated here.
[0116] To validate the effectiveness of this invention, we conducted experiments on the DocRED text dataset. The DocRED text dataset is a large-scale, artificially constructed dataset for extracting text-level relationships. The dataset is selected from text from multiple domains on Wikipedia and Wikidata. The input is English-language text, and the output is entity relationship triples within the text. The dataset size is shown in the following table:
[0117]
[0118] The average chapter in the DocRED chapter text set contains 8 sentences, of which 40.7% of the semantic relations require multiple sentences to be judged.
[0119] The comparative methods include: an encoder model based on a convolutional neural network (CNN), a long short-term memory artificial neural network (LSTM), a bidirectional long short-term memory neural network (BiLSTM), and a context-aware network (Yao, 2019): directly using an encoder to encode the text and the entity, and using the entity context representation for the relationship classification model; in 2019, Christopoulou et al. proposed using edge representation in a text graph as entity representation for a relationship classification model; in 2021, Nan et al. proposed constructing a text graph and integrating syntactic dependency information to select the shortest path as the representation for a relationship classification model; in 2021, Zeng et al. proposed a double-text graph model, which uses the referential-level text graph provided by the present application to learn the target semantic information vector of the different category reference nodes and the heterogeneous edge vector connecting the different category reference nodes, and the entity-level text graph to infer the semantic relationship between the entity pairs and the relationship category of the semantic relationship. The final results are shown in Table 1, where Model is the model used by different methods, Dev is the verification, Test is the test, and Ign F1 is an index for evaluating relationship extraction results. The method of the present application is more effective than directly using an encoder to learn the entity context, and the evaluation index F1 value is significantly improved, indicating that the method of the present application is more effective in processing the document-level relationship extraction task; the text graph model with pronoun nodes performs better in the relationship extraction task, showing the effectiveness of the relationship extraction with pronouns in the present application.
[0120] Table 1
[0121]
[0122] The document-level relationship extraction device provided by the present application is described below. The document-level relationship extraction device described below can be referred to in conjunction with the document-level relationship extraction method described above.
[0123] Figure 4 An example of a structural schematic diagram of a document-level relationship extraction device is shown in Figure 4 The document-level relationship extraction device 400 includes:
[0124] The text acquisition module 410 is configured to acquire a target document text, and the target document text is a document text identified with a pronoun and a noun phrase reference aligned with the pronoun;
[0125] The relationship extraction module 420 is configured to obtain the semantic relationship between different entity pairs in the target document text and the relationship category of the semantic relationship based on the target document text and a preset relationship extraction model.
[0126] Optionally, the text acquisition module 410 can include a first text acquisition module and a second text acquisition module, wherein:
[0127] The first text acquisition module can be specifically used for acquiring an initial chapter text, and the initial chapter text is marked with a noun phrase reference and contains a pronoun matching the noun phrase reference; the second text acquisition module can be specifically used for inputting the initial chapter text into a preset pointer generation network model to obtain a target chapter text output by the preset pointer generation network model; wherein the preset pointer generation network model is used for performing entity alignment on the pronoun and the noun phrase reference in the initial chapter text to acquire the target chapter text.
[0128] Optionally, the relation extraction module 420 can include an encoding module, an aggregation model, an inference module, and an extraction module, wherein:
[0129] The encoding module can be specifically used for inputting the target chapter text into a preset encoder sub-model to obtain an initial semantic information vector corresponding to each target vocabulary in the target chapter text output by the preset encoder sub-model; the aggregation model can be specifically used for inputting the initial semantic information vector into a preset reference level graph aggregation sub-model to obtain a target semantic information vector of different category reference nodes and a heterogeneous edge vector connecting different category reference nodes output by the preset reference level graph aggregation sub-model; the inference module can be specifically used for inputting the target semantic information vector and the heterogeneous edge vector into a preset entity level graph inference sub-model to obtain an entity semantic vector information of an entity and path information between entity pairs output by the preset entity level graph inference sub-model; and the extraction module can be specifically used for inputting the entity semantic vector information and the path information into a preset classifier sub-model to obtain a semantic relation between different entity pairs and a relation category of the semantic relation output by the preset classifier sub-model.
[0130] Optionally, the chapter-level relation extraction model provided by the present application can further include a first determination module, a second determination module, and a first training module, wherein:
[0131] The first determination module can be specifically used for determining an initial sample chapter text, and the initial sample chapter text is marked with at least two sample noun phrase references; the second determination module can be specifically used for replacing a target sample noun phrase reference in the at least two sample noun phrase references with a preset sample pronoun to determine a target sample chapter text; and the first training module can be specifically used for training an initial pointer generation network model using the target sample chapter text to determine a preset pointer generation network model corresponding to a training stop; wherein the initial pointer generation network model is an encoder containing a preset attention mechanism and a preset coverage mechanism.
[0132] Optionally, the first training module can include a first training submodule, a first determination submodule, and a second determination submodule, wherein:
[0133] The first training submodule can be specifically used to iteratively train the initial pointer generation network model using the target sample passage text, and determine the coreference sample entity for the preset sample pronoun output by the intermediate pointer generation network model after each iterative training; the first determination submodule can be specifically used to determine the loss function of the intermediate pointer generation network model based on the coreference sample entity; the second determination submodule can be specifically used to determine the corresponding preset pointer generation network model when training stops based on the loss function and the preset accuracy condition.
[0134] Optionally, the chapter-level relationship extraction model provided by the present invention may further include a third determination module, a second training module, a fourth determination module, and a testing module, wherein:
[0135] The third determination module can be specifically used to determine the sample chapter text, verification chapter text and test chapter text; the second training module can be specifically used to use the sample chapter text to train the initial relationship extraction model to obtain the trained intermediate relationship extraction model; the fourth determination module can be specifically used to use the verification chapter text to adjust the hyperparameters of the intermediate relationship extraction model, determine the intermediate relationship extraction model after the hyperparameter adjustment and the training stop condition; the testing module can be specifically used to use the test chapter text to test the corresponding relationship extraction model at the end of training when it is determined that the training stop condition is met, and determine the preset relationship extraction model corresponding to the test result when the preset condition is met; the second training module can also be specifically used to use the sample chapter text to train the intermediate relationship extraction model after the hyperparameter adjustment again when it is determined that the training stop condition is not met; until the training stop condition is met and the test result meets the preset condition.
[0136] Figure 5 An example of a physical structure diagram of an electronic device is shown below. Figure 5 As shown, the electronic device 500 may include: a processor 510, a communication interface 520, a memory 530, and a communication bus 540, wherein the processor 510, the communication interface 520, and the memory 530 communicate with each other via the communication bus 540. The processor 510 may call the logic instructions in the memory 530 to execute the chapter-level relationship extraction method, which includes:
[0137] Obtaining a target text, where the target text is a text marked with a pronoun and a noun phrase aligned with the pronoun;
[0138] Based on the target text and the preset relationship extraction model, the semantic relationships between different entity pairs in the target text and the relationship categories of the semantic relationships are obtained.
[0139] In addition, the logic instructions in the memory 530 described above can be implemented in the form of a software function unit and sold or used as an independent product, and can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes several instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0140] In another aspect, the present application also provides a computer program product, which comprises a computer program, the computer program can be stored on a non-transitory computer readable storage medium, and the computer program can be executed by a processor to enable a computer to execute the passage-level relationship extraction method provided by the above-mentioned methods, and the method comprises:
[0141] obtaining a target passage text, the target passage text being a passage text marked with pronouns and noun phrases aligned with the pronouns;
[0142] based on the target passage text and a preset relationship extraction model, obtaining semantic relationships between different entity pairs in the target passage text and relationship categories of the semantic relationships.
[0143] In another aspect, the present application also provides a non-transitory computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the passage-level relationship extraction method provided by the above-mentioned methods, and the method comprises:
[0144] obtaining a target passage text, the target passage text being a passage text marked with pronouns and noun phrases aligned with the pronouns;
[0145] based on the target passage text and a preset relationship extraction model, obtaining semantic relationships between different entity pairs in the target passage text and relationship categories of the semantic relationships.
[0146] The device embodiments described above are merely illustrative, wherein the units described as separate components can or can not be physically separate, and the components displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed to multiple network units. Part or all of the modules can be selected to achieve the purposes of the embodiments according to actual needs. Those skilled in the art can understand and implement without creative labor.
[0147] Through the description of the above embodiments, those skilled in the art can clearly understand that the embodiments can be realized by means of software and the necessary general hardware platform, and of course can also be realized by hardware. Based on such understanding, the above technical solutions can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in each embodiment or some parts of the embodiments.
[0148] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A chapter-level relationship extraction method, characterized in that: include: Acquire a target text, wherein the target text is a text marked with a pronoun and a noun phrase aligned with the pronoun; Based on the target passage text and a preset relationship extraction model, obtaining semantic relationships between different entity pairs in the target passage text and relationship categories of the semantic relationships; The preset relationship extraction model includes a preset encoder sub-model, a preset reference-level graph aggregation sub-model, a preset entity-level graph reasoning sub-model, and a preset classifier sub-model. The semantic relationships between different entity pairs in the target passage text and the preset relationship extraction model are obtained based on the target passage text and the relationship categories of the semantic relationships, including: Inputting the target passage text into the preset encoder sub-model to obtain an initial semantic information vector corresponding to each target word in the target passage text output by the preset encoder sub-model; Inputting the initial semantic information vector into the preset reference-level graph aggregation sub-model to obtain target semantic information vectors of different categories of reference nodes output by the preset reference-level graph aggregation sub-model and heterogeneous edge vectors connecting the different categories of reference nodes; Inputting the target semantic information vector and the heterogeneous edge vector into the preset entity-level graph reasoning sub-model to obtain entity semantic vector information of the entity and path information between entity pairs output by the preset entity-level graph reasoning sub-model; The entity semantic vector information and the path information are input into the preset classifier sub-model to obtain the semantic relationship between different entity pairs output by the preset classifier sub-model and the relationship category of the semantic relationship.
2. The chapter-level relationship extraction method according to claim 1, characterized in that: The step of obtaining the target chapter text includes: Acquiring an initial text, wherein the initial text is marked with a noun phrase reference and the initial text contains a pronoun matching the noun phrase reference; Inputting the initial chapter text into a preset pointer generation network model to obtain a target chapter text output by the preset pointer generation network model; The preset pointer generation network model is used to perform entity alignment between the pronouns and the noun phrase references in the initial text to obtain the target text.
3. The chapter-level relationship extraction method according to claim 2, characterized in that: The training process of the preset pointer generation network model includes: Determining an initial sample text, wherein the initial sample text is identified with at least two sample noun phrase references; Replacing the target sample noun phrase reference in the at least two sample noun phrase references with a preset sample pronoun to determine a target sample passage text; The target sample passage text is used to train the initial pointer generation network model, and the corresponding preset pointer generation network model when the training stops is determined; wherein, the initial pointer generation network model is an encoder containing a preset attention mechanism and a preset coverage mechanism.
4. The chapter-level relationship extraction method according to claim 3 is characterized in that: The step of training the initial pointer generation network model using the target sample passage text and determining the corresponding preset pointer generation network model when the training stops includes: Iteratively training the initial pointer generation network model using the target sample passage text, and determining the coreference sample entity for the preset sample pronoun output by the intermediate pointer generation network model after each iterative training; Determining a loss function of the intermediate pointer generation network model based on the coreference sample entity; Based on the loss function and the preset accuracy condition, a preset pointer corresponding to when training stops is determined to generate a network model.
5. The method for extracting chapter-level relationships according to any one of claims 1 to 4, characterized in that: The training process of the preset relationship extraction model includes: Determine the sample text, verification text and test text; Using the sample passage text to train the initial relation extraction model to obtain a trained intermediate relation extraction model; Using the verification passage text to adjust the hyperparameters of the intermediate relationship extraction model, and determining the intermediate relationship extraction model after the hyperparameter adjustment and the training stop condition; When it is determined that the training stop condition is met, the relationship extraction model corresponding to the end of the training is tested using the test passage text to determine the preset relationship extraction model corresponding to the test result meeting the preset condition; When it is determined that the training stop condition has not been met, the intermediate relationship extraction model after the hyperparameter adjustment is trained again using the sample chapter text; until the training stop condition is met and the test result meets the preset condition.
6. A chapter-level relationship extraction device, characterized in that: include: A text acquisition module is used to acquire a target text, wherein the target text is a text marked with a pronoun and a noun phrase aligned with the pronoun; A relationship extraction module, configured to obtain, based on the target text and a preset relationship extraction model, semantic relationships between different entity pairs in the target text and relationship categories of the semantic relationships; The preset relationship extraction model includes a preset encoder sub-model, a preset reference-level graph aggregation sub-model, a preset entity-level graph reasoning sub-model and a preset classifier sub-model. The relationship extraction module includes an encoding module, an aggregation model, a reasoning module and an extraction module, wherein: The encoding module is used to input the target passage text into the preset encoder sub-model to obtain the initial semantic information vector corresponding to each target vocabulary in the target passage text output by the preset encoder sub-model; The aggregation model is used to input the initial semantic information vector into the preset reference-level graph aggregation sub-model to obtain the target semantic information vectors of different categories of reference nodes output by the preset reference-level graph aggregation sub-model and the heterogeneous edge vectors connecting the different categories of reference nodes; The reasoning module is used to input the target semantic information vector and the heterogeneous edge vector into the preset entity-level graph reasoning sub-model to obtain the entity semantic vector information of the entity and the path information between entity pairs output by the preset entity-level graph reasoning sub-model; The extraction module is used to input the entity semantic vector information and the path information into the preset classifier sub-model to obtain the semantic relationship between different entity pairs output by the preset classifier sub-model and the relationship category of the semantic relationship.
7. The apparatus for extracting chapter-level relationships according to claim 6, characterized in that: The text acquisition module includes a first text acquisition module and a second text acquisition module, wherein: The first text acquisition module is used to acquire an initial text, wherein the initial text is marked with a noun phrase reference and the initial text contains a pronoun matching the noun phrase reference; The second text acquisition module is used to input the initial chapter text into a preset pointer generation network model to obtain a target chapter text output by the preset pointer generation network model; wherein the preset pointer generation network model is used to perform entity alignment between the pronouns in the initial chapter text and the noun phrase references to obtain the target chapter text.
8. The apparatus for extracting chapter-level relationships according to claim 7, characterized in that: It also includes a first determination module, a second determination module and a first training module, wherein: The first determining module is used to determine an initial sample text, wherein the initial sample text is identified as having at least two sample noun phrase references; The second determining module is configured to replace the target sample noun phrase reference in the at least two sample noun phrase references with a preset sample pronoun to determine the target sample passage text; The first training module is used to train the initial pointer generation network model using the target sample chapter text, and determine the corresponding preset pointer generation network model when the training stops; wherein, the initial pointer generation network model is an encoder containing a preset attention mechanism and a preset coverage mechanism.
9. The apparatus for extracting chapter-level relationships according to claim 8, characterized in that: The first training module includes a first training submodule, a first determination submodule and a second determination submodule, wherein: The first training submodule is configured to iteratively train the initial pointer generation network model using the target sample passage text, and determine the coreference sample entity for the preset sample pronoun output by the intermediate pointer generation network model after each iterative training; The first determining submodule is configured to determine a loss function of the intermediate pointer generation network model based on the coreference sample entity; The second determining submodule is used to determine the preset pointer generation network model corresponding to when training stops based on the loss function and the preset accuracy condition.
10. The apparatus for extracting chapter-level relationships according to any one of claims 6 to 9, characterized in that: It also includes a third determination module, a second training module, a fourth determination module and a testing module, wherein: The third determination module is used to determine the sample chapter text, the verification chapter text and the test chapter text; The second training module is used to train the initial relation extraction model using the sample passage text to obtain a trained intermediate relation extraction model; The fourth determination module is configured to adjust the hyperparameters of the intermediate relationship extraction model using the verification passage text, and determine the intermediate relationship extraction model after the hyperparameter adjustment and the training stop condition; The testing module is configured to, when it is determined that the training stop condition is met, use the test passage text to test the corresponding relation extraction model at the end of training, and determine the corresponding preset relation extraction model when the test result meets the preset condition; The second training module is also used to use the sample chapter text to re-train the intermediate relationship extraction model after the hyperparameter adjustment when it is determined that the training stop condition has not been met; until the training stop condition is met and the test result meets the preset condition.
11. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the chapter-level relationship extraction method as described in any one of claims 1 to 5 is implemented.
12. 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, the method for extracting chapter-level relationships as described in any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Entity relationship extraction method of concerned associated words
CN110196978A
Chapter-level relationship extraction method
CN111831783A