Relation extraction method for entity and mention enhancement based on semantic and association modeling
Through methods based on semantic and association modeling, pre-trained language models and dynamic relationship awareness enhancement mechanisms are used to construct document graphs, which solves the problems of insufficient utilization of structural information and long-distance dependency modeling in document-level relationship extraction, and achieves more accurate relationship extraction effect.
Patent Information
- Application Number
- CN202411047703.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-01
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-08-01
AI Technical Summary
It is difficult for the existing technology to fully utilize the structural information of documents and effectively model long-distance dependencies in document-level relationship extraction, and the classification target preprocessing is not strengthened enough, resulting in insufficient description of complex interaction patterns.
Using a method based on semantic and association modeling, the deep semantic features of the document are captured through the pre-trained language model, which is subdivided into entity-level, mention-level and sentence-level features, and the document graph is constructed, using the dynamic relationship perception enhancement mechanism and multi-scale features. The enhancement module generates rich structural features and calculates relationship type probabilities through feed-forward neural networks.
It achieves a more accurate and high-quality representation of document structure features, effectively solves the problem of insufficient long-distance dependency modeling, enhances the model's ability to capture complex interaction patterns, and improves the comprehensiveness and accuracy of relationship extraction.
Smart Images

Figure CN118569267B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of natural language processing, and in particular to a relationship extraction method for entity and mention enhancement based on semantic and association modeling. Background Art
[0002] The purpose of relation extraction is to detect relation instances between entities in text, thereby achieving information structuring of natural language text. Previous studies have mainly focused on sentence-level relation extraction tasks, aiming to assign relation instances to entities within a sentence by analyzing the grammatical structure of a single sentence. However, in actual large-scale text resources, the relations between entities often extend beyond the boundaries of a single sentence to multiple adjacent or non-adjacent sentences, paragraphs, or even entire documents. Due to the limitations of traditional methods in handling long-distance dependencies and cross-document relations, it is necessary to expand the relation extraction task from the sentence level to the document level.
[0003] In the current research, the contextual information and structural information of the document are shown to facilitate the reasoning of document-level relation extraction. In order to extract document structure information from documents, current methods usually model dependencies based on the relationship between entities, grammatical structure, and semantic information within the document. They use multi-layer graph neural networks to gradually extract and integrate feature details of the mention layer and salient features of the entity layer. Some works also use graph structures to extract document structure information from documents. They suggest dividing the global graph into multiple levels. The method of combining multiple subgraphs is used to extract features and then perform document-level relation extraction tasks. Therefore, using graph neural networks to aggregate features within the graph structure has become the mainstream method for achieving document-level relation extraction tasks.
[0004] Although the above graph-based document-level relation extraction methods have shown good performance, they still face three major limitations when performing document-level relation extraction:
[0005] 1. It is difficult to fully utilize the structural information of the document. Although graph-based attention networks and graph convolutional networks are used to capture mutual information in graphs. However, the graph attention network-based model only allows the model to assign different attention weights between different nodes in the graph, while the graph convolutional network-based model transfers information on the document graph through convolution operations, thereby capturing local and global relationships between entities. However, the importance of relationships in contextual reasoning is ignored, and there is an over-smoothing problem, that is, the relationship specificity may be weakened when aggregating neighbor information, thus affecting the accurate description of complex relationship patterns.
[0006] 2. After extracting context features, a graph is constructed to obtain structural features to infer the relationship between entities. This step-by-step approach may lead to insufficient interaction between context features and structural features. Specifically, it is difficult to effectively model long-distance dependencies when the two are combined only in the reasoning stage.
[0007] 3. Previous studies have not fully recognized the importance of preprocessing the classification targets before making the final classification decision; unenhanced target representations often fail to describe in detail the complex interaction patterns they cover, which is particularly evident when the model faces a dataset containing multiple and deep interactive relationships. Summary of the invention
[0008] The purpose of the present invention is to provide a relationship extraction method for entity and mention enhancement based on semantic and association modeling, so as to solve the problems existing in the prior art that it is difficult to fully utilize the structural information of the document and difficult to effectively model long-distance dependencies.
[0009] To achieve the above object, the present invention provides a relationship extraction method for entity and mention enhancement based on semantic and association modeling, comprising the following steps:
[0010] Step 1: Use the pre-trained language model to capture the deep and overall semantic features of the document and extract the global semantics of the document;
[0011] Step 2: Refine the acquired global semantic features and subdivide them into entity levels according to the tag information in the original document. , Mention level and sentence level Then, these features are used as nodes to construct a document graph, aiming to reveal and extract the intrinsic structural features of the document, where represents entity embedding, indicates a mention embedding, Represents sentence embedding;
[0012] Step 3: Use the dynamic relationship perception enhancement mechanism to process the nodes in the document graph to obtain structural features with rich semantic levels. ;
[0013] Step 4: Incorporate structural features into entities and mentions to generate the following four types of objects: Entities with document context features , entities that reflect the structural characteristics of the document , mentions containing document context features and mentions that reflect the structural characteristics of the document ;
[0014] Step 5: Add the entity with document context features generated in step 4 , entities that reflect the structural characteristics of the document , mentions containing document context features and mentions that reflect the structural characteristics of the document They are input into the multi-scale feature enhancement module for integration and processing to generate entity pairs and mentioned ;
[0015] Step 6: Input the entity pairs and mention pairs generated in step 5 into the entity pair and mention pair enhancement modules for deep feature extraction and enhancement;
[0016] Step 7: Use a feedforward neural network to calculate the probability of the relationship type to which each entity pair belongs.
[0017] Preferably, in step 1, the pre-trained language model is used to capture the deep and overall semantic features of the document, and the specific process of extracting the global semantics of the document is as follows:
[0018] S11. Use the pre-trained SciBERT model to extract global semantic features from the input document.
[0019] S12. Convert the document into a feature vector with fixed dimension , and the attention weight matrix , the specific expression is as follows:
[0020] ;
[0021] In the formula, , , Indicates the number of tokens contained in the input sequence. Represents the embedding dimension.
[0022] Preferably, in step 3, the dynamic relationship perception enhancement mechanism is used to process the nodes in the constructed document graph to obtain structural features with rich semantic levels. The specific process is as follows:
[0023] S31, obtain the input of the dynamic relationship perception enhancement mechanism, and convert a Different types of relationships and The mechanism takes as input a graph of nodes, in which the i-th interaction relationship is mapped into a matrix representation , all relation representations are summarized as the relation feature tensor , represents a collection of relations, Indicates the number of nodes, represents the number of relationships; for node features, let Represents the vector representation of the sentence node, where is the average result of connecting all token representations of two sentences; represents the vector representation of the entity node, Corresponding to the vector representation of the mentioned node, the i-th node feature is mapped to , the representations of all nodes are summarized as the node feature matrix ;
[0024] S32. Calculate each attention head The node feature map under , the calculation expression is as follows:
[0025] ;
[0026] In the formula, , It is a linear layer The weight matrix of Indicates the output dimension;
[0027] S33. Calculate the relationship attention weight , the calculation expression is as follows:
[0028] ;
[0029] In the formula, It means relationship The corresponding linear layer The weight matrix of a specific attention head in ;
[0030] S34. Get the attention score and map the node features and the corresponding relation attention weights Interact with each other and calculate the attention score for each relationship. The calculation expression is as follows:
[0031] ;
[0032] ;
[0033] In the formula, and Represent the number of nodes and the number of relationships respectively. represents the attention weight of the branch node, represents the normalized attention score of all input edges to the node;
[0034] S35. Obtaining structural features with rich semantic levels , the calculation expression is as follows:
[0035] ;
[0036] In the formula, is the specified size along the dimension, represents the attention score of k dimension.
[0037] Preferably, the entity with document context features in step 4 The calculation expression is as follows:
[0038] ;
[0039] ;
[0040] In the formula, Represents the contextual attention matrix of the entity, Indicates the number of entities, is the entity’s attention matrix, , It is an adjustable parameter.
[0041] Preferably, step 4 includes a mention of document context features The calculation expression is as follows:
[0042] ;
[0043] ;
[0044] In the formula, represents the contextual attention matrix of the mention, Indicates the number of mentions, represents the mention attention matrix, .
[0045] Preferably, in step 5, the entity with document context features generated in step 4 is , entities that reflect the structural characteristics of the document , mentions containing document context features and mentions that reflect the structural characteristics of the document They are input into the multi-scale feature enhancement module for integration and processing to generate entity pairs and mentioned The specific process is as follows:
[0046] S51. Use the direct summation method to preliminarily integrate the structural features and context features of the entity and calculate the adaptive weight coefficient related to the entity , the calculation expression is as follows:
[0047] ;
[0048] In the formula, the function and A multi-scale feature enhancement module that represents contextual features and structural features respectively;
[0049] S52: Weight the entity structure features and context features respectively to generate entity pairs , the calculation expression is as follows:
[0050] ;
[0051] S53, calculating the adaptive weight coefficient related to the mention , the calculation expression is as follows:
[0052] ;
[0053] S54, weight the structural features and context features of the mentions respectively to generate a mention pair , the calculation expression is as follows:
[0054] .
[0055] Preferably, in step 6, the specific process of inputting the entity pairs and mention pairs generated in step 5 into the entity pair and mention pair enhancement modules for deep feature extraction and enhancement is as follows:
[0056] S61. Acquisition of deep features of entity pairs. For each individual entity pair, deep interaction features are extracted through the entity pair and mention pair enhancement module combined with the BiLSTM gating mechanism. The specific formula is as follows:
[0057] ;
[0058] In the formula, represents the mechanism of enhancing the entity, Represents the deep features of the enhanced entity pair;
[0059] S62, entity pair enhancement, integrates the deep features obtained in S61 into the original entity features, completes the effective fusion of basic features and high-level abstract features, and then uses the Einstein summation convention to generate enhanced entity pairs, denoted as , the specific formula is as follows:
[0060] ;
[0061] S63. The mentioned pair is enhanced by the same method as the entity pair enhancement. The specific calculation expression is as follows:
[0062] ;
[0063] ;
[0064] In the formula, represents the deep features of the enhanced mention pair, Represents a mechanism for enhancing mentions.
[0065] Preferably, the specific process of using a feedforward neural network to calculate the probability of the relationship type to which each entity pair belongs in step 7 is as follows:
[0066] S71. Obtaining a Preliminary Representation of Relationships , and further uses the hyperbolic tangent function to add nonlinear characteristics, which enables the model to learn more complex relationship patterns and interactions between features, thereby obtaining relationship instances , the calculation expression is as follows:
[0067] ;
[0068] ;
[0069] S72, probability calculation, using a feedforward neural network to calculate the probability of each relationship instance, the specific formula is as follows:
[0070] ;
[0071] In the formula, and is a learnable parameter, represents the probability of each relation instance, Represents a relation instance, represents the final relation instance, Represents the head entity, Represents a tail entity.
[0072] Therefore, the present invention adopts the above-mentioned relationship extraction method based on semantic and association modeling for entity and mention enhancement, which has the following beneficial effects:
[0073] (1) The present invention utilizes a dynamic relationship perception enhancement mechanism to assign different attention weights to different types of edges, so as to achieve a more detailed processing of the influence of various relationships, avoid the over-smoothing phenomenon that occurs in the process of GCN aggregating adjacent entity information, and ensure that a more accurate and high-quality document structure feature representation is finally obtained;
[0074] (2) The multi-scale feature enhancement module mentioned in the present invention combines the contextual features and structural features of the entity itself, as well as the contextual features and structural features of the mention, to form a multi-dimensional feature space. Through a clever fusion strategy, these features can interact efficiently between different scales, effectively solving the problem of insufficient modeling of long-distance dependencies and enhancing the internal expression of entities and mentions, so that they can more comprehensively and three-dimensionally reflect their roles and functions in complex document environments.
[0075] (3) The entity pair and mention pair enhancement module mentioned in the present invention uses a gating mechanism to precisely regulate the information flow. The classification target can selectively remember, forget, and transfer information, which can effectively enhance the model's ability to focus on key classification information. Especially when facing time series data spanning a long period of time, it can keenly capture and deeply learn the complex interaction patterns between entity pairs and mention pairs.
[0076] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0077] Figure 1 It is an overall flow chart of the relationship extraction method for entity and mention enhancement based on semantic and association modeling of the present invention;
[0078] Figure 2 A flow chart of a dynamic relationship perception enhancement mechanism according to an embodiment of the present invention;
[0079] Figure 3 is a flow chart of a multi-scale feature enhancement module according to an embodiment of the present invention;
[0080] Figure 4 It is a flow chart of an entity pair and a pair enhancement module according to an embodiment of the present invention;
[0081] Figure 5 1 and 1 are performance comparison diagrams of different data sets according to an embodiment of the present invention, wherein (a) is a performance comparison diagram of a CDR data set, and (b) is a performance comparison diagram of a GDA data set. DETAILED DESCRIPTION
[0082] The following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0083] See also Figure 1-5 , a relation extraction method for entity and mention enhancement based on semantic and association modeling, comprising the following steps:
[0084] Step 1: Rough processing of input documents: The datasets used in the training process are CDR and GDA datasets, which contain 1500 and 30192 documents respectively. During the training process, the ratios of training set, validation set and test set are set to 1:1:1 and 80:19:3 respectively.
[0085] Step 2: Information Encoding: The proposed method uses the pre-trained SciBERT model to obtain a richer and more expressive hidden representation of each token in the input document.
[0086] Step 2.1 For a given document D containing n tokens, the model first checks the length of the input sequence. If the sequence length is less than or equal to the maximum input limit of the BERT model (i.e. 512 words), the entire sequence is directly input to the SciBERT model for encoding. However, if the length exceeds 512 words, the input sequence of the model is split into two overlapping parts and encoded separately.
[0087] Step 2.2 After encoding the model, reassemble the segmented parts to obtain the hidden representation And the attention weight matrix ,in ,matrix It indicates the degree to which the model pays attention to different positions of the input sequence when generating the final output. The formula is as follows:
[0088] (Formula 1)
[0089] Step 2.3 For each mention associated with an entity, the model first traverses the mention information of each entity. When an entity has multiple mentions, its representation is collected. And through the Logsumexp operation, it is pooled into entity node representation , the formula is as follows:
[0090] (Formula 2)
[0091] in Indicates the number of mentions the entity contains.
[0092] Step 3: Node feature enhancement: A dynamic relationship-aware enhancement mechanism based on a graph attention network is designed. This innovative strategy effectively enhances the model's ability to recognize and extract semantic coherence and complex relationship structures at the document level, thereby helping to obtain more insightful representations of entities and mentions.
[0093] Step 3.1 Obtain the input of the dynamic relationship awareness enhancement mechanism and convert a Different types of relationships and The graph of nodes is used as the input of the mechanism. In the graph, the i-th interaction relationship is mapped into a matrix representation , all relation representations are summarized as the relation feature tensor ; For node features, let Represents the vector representation of the sentence node, where is the average result of connecting all token representations of two sentences; represents the vector representation of the entity node, and Corresponding to the vector representation of the mentioned node, the i-th node feature is mapped to , the representations of all nodes are summarized as the node feature matrix .
[0094] Step 3.2 obtains the node feature map. The model first uses the Einstein joint summation convention to perform a deep integration operation on the node features and relationship features, aiming to extract a more expressive interactive feature representation, and creates multiple linear layers in the initialization part. and , which are used to calculate node feature maps and attention weights associated with relationships. Specifically, the model calculates each attention head The node feature map under , the formula is as follows:
[0095] (Formula 3)
[0096] in, ,and It is a linear layer The weight matrix of Convert to a more abstract and expressive representation.
[0097] Step 3.3 Calculate the relational attention weights. The model uses the relational attention mechanism to control the information flow from adjacent nodes. Perform relationship-related calculations. Specifically, for each relationship and attention head, the model calculates the relationship attention weight as follows:
[0098] (Formula 4)
[0099] in, It means relationship The corresponding linear layer The weight matrix of a specific attention head in .
[0100] Step 3.4, get the attention score, the model maps the node feature and the corresponding relation attention weights The attention scores for each relationship are calculated by interacting with each other. Furthermore, all attention scores generated by the same attention head under different relationships are organized into a high-dimensional tensor, and the attention scores of all nodes are accumulated and summed on this basis to obtain the attention score vector of a single node under the entire attention head. The specific implementation steps are detailed as follows:
[0101] (Formula 5)
[0102] (Formula 6)
[0103] in and Represent the number of nodes and the number of relationships respectively.
[0104] Step 3.5 Obtain enhanced node representation. After obtaining the attention score of a single node across all attention heads, the Leaky ReLU activation function is first used to perform a nonlinear transformation on it to enhance the expressiveness of the model. Subsequently, the Softmax function is applied to normalize these activated attention scores. Furthermore, after obtaining the normalized attention weights, the model uses element-by-element multiplication and summation of these weights with the corresponding node feature vectors. Through the multi-layer message passing process, the node can learn and integrate effective information from neighboring nodes and update its feature representation after each iteration. The specific formula is as follows:
[0105] (Formula 7)
[0106] in, is the specified size along the dimension, which means that for each position, its score will be compared and normalized with the scores of all positions in the same sequence, represents the attention score of k dimension.
[0107] Step 4: Multi-scale feature acquisition improves the quality of entity and mention representation by integrating and enhancing features at different granularities.
[0108] Step 4.1 Contextual features of entities. For each entity, the model first collects the attention matrix associated with all mention locations of the entity. If an entity is mentioned in multiple places, the attention vectors corresponding to each mention are averaged to obtain the attention representation of the entity If the entity is mentioned only once, the attention vector of the mentioned position is directly taken as the attention representation , and get the entity representation with context information as follows:
[0109] (Formula 8)
[0110] (Formula 9)
[0111] Step 4.2: Contextual features of mentions, obtain the mention attention matrix After that, we average them and multiply them by the original features output by the encoder to get the mention representation with context information. The specific formula is as follows:
[0112] (Formula 10)
[0113] (Formula 11)
[0114] in and denote the contextual attention matrix of the entity and the contextual attention matrix of the mention, respectively. and Represents the final entity and mentions the representation with contextual features. and denote the number of entities and the number of mentions, respectively. Is a tunable parameter.
[0115] Step 4.3: Structural features of entities. The model uses the global adjustment topology information processed by the dynamic relationship perception enhancement mechanism to integrate entity attributes and use it as the core foundation for building the mutual relationship and hierarchical structure awareness between entities. Specifically, in obtaining structural features with rich semantic levels, After that, the model further extracts the part corresponding to the entity pair from the entire entity feature matrix as the entity representation containing structural information, denoted as .
[0116] Step 4.4: The structural features of the mentioned items are extracted sequentially from the node feature matrix following the entity structural features. arrive The part within the range is then integrated into the structural information of the mentioned item representation, denoted as .
[0117] Step 5: Entity and Mention Enhancement: To enhance the expressiveness of entities and mentions, a multi-scale feature enhancement module is incorporated into the model to finely integrate the entity and mention representations containing contextual information and structural features captured in the previous step.
[0118] Step 5.1 Calculation of adaptive weight coefficients. The model first uses the direct summation method to preliminarily integrate the structural features and contextual features of the entity. Then, under the shared parameter architecture, the model applies the BiLSTM network to the preliminary fusion features, so that the model can explore its deep abstract structural attributes and contextual feature content respectively. Then, by superimposing two sets of high-level features extracted by deep processing, the adaptive weight coefficient is calculated by the sigmoid function. The specific formula is as follows:
[0119] (Formula 12)
[0120] Step 5.2 Entity Enhancement: After obtaining the adaptive weight coefficients, the entity structure features and context features are weighted respectively to enhance the representation ability of the entity. Subsequently, these weighted features are deeply integrated to form a high-quality entity pair representation. The specific formula is as follows:
[0121] (Formula 13)
[0122] Step 5.3: Mention enhancement. Similar to entity enhancement, the model first calculates the adaptive weight coefficients related to the mentions, and uses the adaptive weight coefficients to further weight the structural features and contextual features of the mentions, thereby achieving the effect of enhancing the mentions, and further integrating them to obtain the mention pair expression. The specific formula is as follows:
[0123] (Formula 14)
[0124] (Formula 15)
[0125] in and Represent the adaptive weight coefficients of entities and mentioned items respectively. and Respectively represent the entity pairs and mention pairs obtained. Function and Multi-scale feature enhancement modules representing contextual features and structural features respectively.
[0126] Step 6, entity pair and mention pair enhancement: In order to improve the model's sensitivity to key targets, a novel entity pair and mention pair enhancement module is proposed. This module aims to extract deep interaction features from entity pairs or mention pairs through an iterative process of three-layer BiLSTM and ReLU activation function, thereby performing deep feature extraction and enhancement on the entity pairs and their mention pairs obtained in the previous step.
[0127] Step 6.1: Acquisition of deep features of entity pairs. For each individual entity pair, this model applies the above-mentioned enhancement module and further extracts deep interaction features through the gating mechanism of BiLSTM. The specific formula is as follows:
[0128] (Formula 16)
[0129] Step 6.2 Entity pair enhancement: The acquired deep features are further integrated into the original entity features to achieve effective fusion of basic features and high-level abstract features. The Einstein summation convention is used to dynamically focus on the most significant interactive features within the entity pair. This process generates a richer entity pair representation, denoted as , the specific formula is as follows:
[0130] (Formula 17)
[0131] Step 6.3: Mention pair enhancement. For the mention pair, the model uses a similar structure to enhance it. The input is the information-rich mention pair representation, and the enhanced mention pair is denoted as , the specific formula is as follows:
[0132] (Formula 18)
[0133] (Formula 19)
[0134] in represents a mechanism for enhancing an entity or reference pair, while is the multiplication operation in the Einstein summation convention.
[0135] Step 7: Classifier and loss function: To correctly classify the relationship instances in the text , the model needs to further transform the obtained entity pairs and mention pairs into discriminative relational representations. Specifically, let Enhance expressions for entity relationships, To strengthen the expression for the mention relation. Here, Representatives in The representation of relation instances in It is obtained by effectively integrating all the mention pairs involved in the relationship instance. The specific formula is as follows:
[0136] (Formula 20)
[0137] in and Respectively represent The size in the specified dimension.
[0138] Step 7.1 Obtain the relationship representation. and Merge into the final relation instance representation In order to further enrich the relational features and make them more suitable for classification tasks, the model first connects the obtained relation instance representation with the entity representation obtained by the dynamic relation-aware enhancement mechanism to represent the relationship. Then, it is processed by a fully connected layer with an activation function for nonlinear transformation to produce a more refined and targeted classification target. , so that the model can accurately classify relationship types. The specific formula is as follows:
[0139] (Formula 21)
[0140] ;(Formula 22)
[0141] Step 7.2 Probability calculation: The model uses a feedforward neural network to calculate the probability of each relationship instance. The specific formula is as follows:
[0142] (Formula 23)
[0143] in and is a learnable parameter, Represents the probability of each relation instance.
[0144] Step 7.3 Loss function, in order to bridge the potential performance gap between the training phase and the test phase and effectively quantify the uncertainty of the model prediction, the cross entropy loss function is used as a metric. This involves measuring the reliability of the model output by comparing the predicted probability distribution with the actual distribution reflected by the true label, aiming to accurately and effectively correct the model prediction errors. The specific formula is as follows:
[0145] (Formula 24)
[0146] in For the The true label of each relation instance.
[0147] Finally, the paper compares the performance of the proposed method with several baseline models on the widely used datasets CDR and GDA for document-level relation extraction tasks. Figure 5 As shown, based on Figure 5 From the data shown in (a) and (b), we can draw the following conclusions:
[0148] (1) Our proposed method demonstrates significant competitive advantages, especially in the ability to capture cross-sentence relation reasoning in the document-level relation extraction task. Compared with all baseline models, our method achieves significant advantages and improvements in the key performance dimension of cross-sentence relation extraction (Inter-F1);
[0149] (2) In the experiments on the CDR dataset, the innovative model proposed in this paper outperforms all existing comparison models in all measurement indicators, especially in the comparison with the current most advanced baseline model FILR. Specifically, the proposed method achieved 90.6%, 86.0% and 89.2% in the Intra-F1, Inter-F1 and Overall-F1 indicators, respectively. In the above indicators, they are 1.7%, 11.4% and 4.1% higher than the most advanced model FILR, respectively. In particular, the Inter-F1 evaluation indicator, which measures the ability to recognize cross-sentence relations, has the largest improvement, which means that the model effectively utilizes and analyzes the complex structural information within the document, successfully crosses the sentence boundaries, and achieves accurate capture and efficient integration of implicit relationship information.
[0150] (3) At the same time, in the study of the GDA dataset, it can be clearly seen that the method we proposed shows strong competitiveness in various evaluation indicators. Specifically, the method achieved 87.3%, 65.8% and 84.1% in the Intra-F1, Inter-F1 and Overall-F1 indicators respectively. However, it should be noted that although the scale of the GDA dataset is fifty times that of the CDR dataset, its average entity density per document is only 71% of that of the CDR dataset, and the density of relational facts contained in each document is also only 71% of that of the CDR dataset. This feature shows that due to the sparsity of entities and relations in the GDA dataset, the performance improvement shown by this method is not as significant as that on the CDR dataset.
[0151] Therefore, the present invention adopts the above-mentioned relationship extraction method based on semantic and association modeling for entity and mention enhancement, obtains the upper and lower semantic features of the document through the pre-trained SciBERT language model, and extracts document context features; and obtains the structural features of the document using the dynamic relationship perception mechanism based on the construction of the document graph; then, the multi-scale feature enhancement module is used to enhance the relationship instances in the document to obtain a deep entity feature vector. Finally, these optimized feature vectors are used to accurately identify and extract various entities and their associations in the document, thereby improving the comprehensiveness and accuracy of relationship extraction.
[0152] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that they can still modify or replace the technical solution of the present invention with equivalents, and these modifications or equivalent replacements cannot cause the modified technical solution to deviate from the spirit and scope of the technical solution of the present invention.
Claims
1. A relation extraction method for entity and mention enhancement based on semantic and association modeling, characterized in that: The following steps are involved: Step 1: Use the pre-trained language model to capture the deep and overall semantic features of the document and extract the global semantics of the document; Step 2: Refine the acquired global semantic features and subdivide them into entity levels , Mention level And sentence level Then, these features are used as nodes to construct a document graph, where represents entity embedding, denotes a mention embedding, Represents sentence embedding; Step 3: Use the dynamic relationship perception enhancement mechanism to process the nodes in the document graph to obtain structural features with rich semantic levels. ; Step 4: Incorporate structural features into entities and mentions to generate the following four types of objects: Entities with document context features , entities that reflect the structural characteristics of the document , mentions containing document context features and mentions that reflect the structural characteristics of the document ; Step 5: Add the entity with document context features generated in step 4 , entities that reflect the structural characteristics of the document , mentions containing document context features and mentions that reflect the structural characteristics of the document They are input into the multi-scale feature enhancement module for integration and processing to generate entity pairs and mentioned ; Step 6: Input the entity pairs and mention pairs generated in step 5 into the entity pair and mention pair enhancement modules for deep feature extraction and enhancement; Step 7: Use a feedforward neural network to calculate the probability of the relationship type to which each entity pair belongs; In step 1, the pre-trained language model is used to capture the deep and overall semantic features of the document. The specific process of extracting the global semantics of the document is as follows: S11. Use the pre-trained SciBERT model to extract global semantic features from the input document. S12. Convert the document into a feature vector with fixed dimension , and the attention weight matrix , the specific expression is as follows: ; In the formula, , , Indicates that the input sequence contains token number, represents the embedding dimension; In step 3, the dynamic relationship perception enhancement mechanism is used to process the nodes in the document graph to obtain structural features with rich semantic levels. The specific process is as follows: S31, obtain the input of the dynamic relationship perception enhancement mechanism, and convert a Different types of relationships and The input of this mechanism is a graph of nodes. In the graph, i The interaction relationship is mapped into a matrix representation , all relation representations are summarized as the relation feature tensor , represents a collection of relations, Indicates the number of nodes, represents the number of relationships; for node features, let Represents the vector representation of the sentence node, where is the average result of connecting all token representations of two sentences; represents the vector representation of the entity node, Corresponding to the vector representation of the mentioned node, the i-th node feature is mapped to , the representations of all nodes are summarized as the node feature matrix ; S32. Calculate each attention head The node feature map under , the calculation expression is as follows: ; In the formula, , It is a linear layer The weight matrix of Indicates the output dimension; S33. Calculate the relationship attention weight , the calculation expression is as follows: ; In the formula, It means relationship The corresponding linear layer The weight matrix of a specific attention head in ; S34. Get the attention score and map the node features and the corresponding relation attention weights Interact with each other and calculate the attention score for each relationship. The calculation expression is as follows: ; ; In the formula, and Represent the number of nodes and the number of relationships respectively. represents the attention weight of the branch node, represents the normalized attention score of all input edges to the node; S35. Obtaining structural features with rich semantic levels , the calculation expression is as follows: ; In the formula, is the specified size along the dimension, represents the attention score of k dimension; Entities with document context features from step 4 The calculation expression is as follows: ; ; In the formula, Represents the contextual attention matrix of the entity, Indicates the number of entities, is the entity’s attention matrix, , is an adjustable parameter; Mentions containing document context features in step 4 The calculation expression is as follows: ; ; In the formula, represents the contextual attention matrix of the mention, Indicates the number of mentions, represents the mention attention matrix, ; In step 5, the entity with document context features generated in step 4 is , entities that reflect the structural characteristics of the document , mentions containing document context features and mentions that reflect the structural characteristics of the document They are input into the multi-scale feature enhancement module for integration and processing to generate entity pairs and mentioned The specific process is as follows: S51. Use the direct summation method to preliminarily integrate the structural features and context features of the entity and calculate the adaptive weight coefficient related to the entity , the calculation expression is as follows: ; In the formula, the function and A multi-scale feature enhancement module that represents contextual features and structural features respectively; S52: Weight the entity structure features and context features respectively to generate entity pairs , the calculation expression is as follows: ; S53, calculating the adaptive weight coefficient related to the mention , the calculation expression is as follows: ; S54, weight the structural features and context features of the mentions respectively to generate a mention pair , the calculation expression is as follows: ; In step 6, the entity pairs and mention pairs generated in step 5 are respectively input into the entity pair and mention pair enhancement module for deep feature extraction and enhancement. The specific process is as follows: S61. Acquisition of deep features of entity pairs. For each individual entity pair, deep interaction features are extracted through the entity pair and mention pair enhancement module combined with the BiLSTM gating mechanism. The specific formula is as follows: ; In the formula, represents the mechanism of enhancing the entity, Represents the deep features of the enhanced entity pair; S62, entity pair enhancement, integrates the deep features obtained in S61 into the original entity features, and then uses the Einstein summation convention to generate enhanced entity pairs, denoted as , the specific formula is as follows: ; S63. The mentioned pair is enhanced by the same method as the entity pair enhancement. The specific calculation expression is as follows: ; ; In the formula, represents the deep features of the enhanced mention pair, indicates the mechanism of enhancing the mention; The specific process of using the feedforward neural network in step 7 to calculate the probability of the relationship type to which each entity pair belongs is as follows: S71. Obtaining a Preliminary Representation of Relationships , using the hyperbolic tangent function to add nonlinear characteristics, we get the relationship example , the calculation expression is as follows: ; ; S72, probability calculation, using a feedforward neural network to calculate the probability of each relationship instance, the specific formula is as follows: ; In the formula, and is a learnable parameter, represents the probability of each relation instance, Represents a relationship instance, represents the final relation instance, Represents the head entity, Represents a tail entity.
