Semantic perception enhancement-based event causal relationship identification method
By creating a dynamic adaptable prompt template library and multi-layer feature extraction method, the problem that the causal relationship recognition model in the existing technology fails to fully consider semantic association, and achieves more accurate event causal relationship recognition and stronger semantic understanding capabilities.
Patent Information
- Application Number
- CN202510515561.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-23
- Publication Date
- 2025-08-05
AI Technical Summary
In the prior art, the event causal relationship recognition model fails to fully consider the multi-level semantic association of the original text sequence, resulting in the inaccurate judgment of causal relationships.
Using a method based on semantic perception enhancement, a dynamic adaptable prompt template library is created. Through context encoder, hierarchical feature extraction module, prompt perception attention module, feature fusion module and knowledge retrieval module, combined with data enhancement technology, the input data and template selection of the language model are optimized to improve the accuracy of causal relationship recognition.
Through dynamically adapted prompt template library and multi-layer feature extraction, the model can more accurately identify event causality, enhance the understanding of complex event semantic associations, and improve the accuracy and robustness of causality recognition.
Smart Images

Figure CN120430397A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of causal relationship identification, and in particular to an event causal relationship identification method based on semantic perception enhancement. Background Art
[0002] Event Causality Identification (ECI) aims to predict the causal relationship between two events in text and is a fundamental research direction in natural language processing and information extraction. For example, for example, an earthquake caused a large number of deaths and separated countless families. An ECI model should be able to accurately identify the causal relationship between the two events, such as the earthquake causing deaths. This technology has broad application prospects in natural language processing, including event knowledge graphs, machine reading comprehension, future event prediction, and question answering.
[0003] In recent years, event causal relationship recognition has attracted extensive research interest. Compared with feature-based methods, the latest deep learning methods have demonstrated superior performance in terms of ECI. However, existing methods directly use pre-trained language models (PLMs) for text modeling. These models mainly rely on large-scale text data for pre-training, but often fail to fully consider the global connections and semantic associations between events. To address this limitation, researchers have introduced external knowledge to enhance the model's understanding of event semantics. In addition, some researchers have attempted to generate additional training data through data augmentation to enrich the model's training samples. These methods have improved the ability to identify explicit causal relationships to a certain extent. However, these methods rarely pay attention to the multi-level semantic associations of the original text sequence itself, resulting in a lack of semantic clues in the reasoning process. Therefore, we explore a new semantic feature extraction framework to deepen the understanding of event semantics. Summary of the Invention
[0004] To overcome the shortcomings of the prior art, the present invention aims to provide a method for identifying event causal relationships based on enhanced semantic perception. This method addresses the problem that the prior art often ignores the multi-level semantic associations of the original text sequence itself, resulting in the model's inaccurate judgment of causal relationships.
[0005] To achieve the above object, the present invention provides the following solutions:
[0006] A method for identifying event causal relationships based on semantic perception enhancement, comprising:
[0007] Create a dynamically adaptable prompt template library;
[0008] Determining an optimal prompt template according to the dynamically adaptable prompt template library;
[0009] Obtaining original text sequence data and combining it with the optimal prompt template to obtain model input data;
[0010] Inputting the model input data into the constructed language model to obtain a prediction result;
[0011] The language model includes: a context encoder, a hierarchical feature extraction module, a cue-aware attention module, a feature fusion module, a knowledge retrieval module, and a model prediction module;
[0012] Among them, the context encoder is used to encode the input data of the model into a context encoding representation, the hierarchical feature extraction module is used to determine the context-aware event features and local semantic features based on the context encoding representation; the prompt-aware attention module is used to fuse the prompt information and the context encoding representation to obtain the prompt feature; the feature fusion module is used to fuse the prompt feature, the context-aware event feature and the local semantic feature to obtain the fusion feature, the knowledge retrieval module is used to obtain knowledge elements related to the event; the model prediction module is used to determine the causal relationship of the original text sequence data based on the fusion feature and the knowledge element.
[0013] Preferably, the prompt template includes:
[0014] Learnable [MASK] location tagging, event pair structured, causal temporal indicators.
[0015] Preferably, it also includes:
[0016] Use data augmentation techniques to generate diverse training samples;
[0017] Performing data cleaning on the diverse training samples to obtain filtered data samples;
[0018] The language model is trained using the filtered data samples and parameters of the language model during the training process are monitored in real time to obtain an optimal language model.
[0019] Preferably, the data enhancement technology includes:
[0020] Synonym replacement, sentence reorganization, negative sample generation, and text augmentation.
[0021] Preferably, determining the optimal prompt template according to the dynamically adaptable prompt template library includes:
[0022] Determining dynamic features and static features of the original text sequence data, wherein the dynamic features include context information of the original text sequence data, and the static features include event frequencies and similar event pairs of the original text sequence data;
[0023] Constructing a scoring model, inputting the dynamic features and the static features into the scoring model, scoring each prompt template in the prompt template library, and obtaining a scoring result set;
[0024] An optimal prompt template is determined according to the scoring result set.
[0025] Preferably, the scoring model is expressed as:
[0026] Score(T i )=α·σ(f(D,T i ))+β·τ(g(S,T i ))+γ·h(D,S,T i )-λ·R(T i );
[0027] Among them, σ and τ are the first nonlinear activation function and the second nonlinear activation function, α, β, γ and λ are the first model hyperparameter, the second model hyperparameter, the third model hyperparameter and the fourth model hyperparameter, respectively. i ) is a function for evaluating the correlation between dynamic features and prompt templates, which characterizes the fitness of dynamic features to give prompt templates, g(S,T i ) is a function for evaluating the correlation between static features and prompt templates, h(D,S,T i ) is the interaction effect function of the dynamic and static features after fusion with the template correlation, D is the vector representation of the context information feature, S is the vector representation of the event frequency and similar event pair features, T i To prompt the template, R(T i ) is the regularization term.
[0028] Preferably, the hierarchical feature extraction module includes:
[0029] Event mention attention submodule and segment focus attention submodule;
[0030] The event mention attention submodule is used to determine context-aware event features based on the context encoding representation, and the segmented focus attention submodule is used to determine local semantic features based on the context encoding representation.
[0031] Preferably, the expression of the context-aware event feature is:
[0032]
[0033] Among them, h g1 is the context-aware event feature of the first event in the event pair, H s is the context encoding representation, wg1 is the linear transformation matrix of the first event in the event pair, h e1 represents the first event in the event pair, Scaling factor, h g2 is the context-aware event feature of the second event in the event pair, w g2 is the linear transformation matrix of the second event in the event pair, h e2 Represents the second event in an event pair.
[0034] Preferably, the expression of the prompt feature is:
[0035]
[0036] Among them, h mask is the vector representation of the prompt information, h p is the prompt feature, W mask is the linear transformation matrix, B is the learnable bias matrix, d k is the dimension of the feature vector.
[0037] The present invention discloses the following technical effects:
[0038] The present invention provides an event causal relationship identification method based on semantic perception enhancement, comprising: creating a dynamically adaptable prompt template library; determining an optimal prompt template based on the dynamically adaptable prompt template library; obtaining original text sequence data and combining it with the optimal prompt template to obtain model input data; inputting the model input data into a constructed language model to obtain a prediction result; wherein the language model comprises: a context encoder, a hierarchical feature extraction module, a prompt-aware attention module, a feature fusion module, a knowledge retrieval module and a model prediction module; wherein the context encoder is used to encode the model input data into a context encoding representation, the hierarchical feature extraction module is used to determine context-aware event features and local semantic features based on the context encoding representation; the prompt-aware attention module is used to fuse prompt information and the context encoding representation to obtain prompt features; the feature fusion module is used to fuse the prompt features, context-aware event features and local semantic features to obtain fused features, and the knowledge retrieval module is used to obtain knowledge elements related to the event; and the model prediction module is used to determine the causal relationship of the original text sequence data based on the fused features and the knowledge elements. By constructing a dynamically adaptable prompt template library, the present invention enables the model to flexibly select appropriate prompt templates based on different contexts, thereby improving the model's understanding of event causal relationships. The template's flexibility allows it to adapt to the specific context of the input text, thereby enhancing the model's generalization across different text types. By optimizing the selection of prompt templates, the system can more accurately focus on features related to specific events, thereby reducing information noise and improving the model's accuracy in causal relationship identification tasks. This selection process enhances the model's ability to handle complex semantic relationships. The context encoder effectively combines the original text sequence with the prompt template to generate a rich contextual encoding representation, providing a solid foundation for subsequent feature extraction. This process ensures that the importance of contextual information in event causal constraints is fully captured, enhancing the depth of semantic understanding. The hierarchical feature extraction module combines global and local semantic features to extract more detailed and targeted event features. This approach enables the model to better identify and describe the subtle connections between events when handling complex event relationships. The module effectively integrates prompt information with contextual features, allowing the model to focus more closely on the contextual components related to the prompt information, greatly enhancing the model's accuracy in inferring causal relationships. By extracting prompt-related features, the model can utilize the logic and reasoning capabilities contained in the language model; the event causal relationship recognition method based on semantic perception enhancement, by integrating multiple technical components and dynamic adaptation mechanisms, not only improves the accuracy of causal relationship recognition, but also enhances the model's ability to understand the semantic relationships between complex events. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0040] Figure 1 A flow chart of a method for identifying event causal relationships based on semantic perception enhancement provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0041] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0042] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0043] like Figure 1 As shown, the present invention provides an event causal relationship identification method based on semantic perception enhancement, comprising:
[0044] Step 100: Create a dynamically adaptable prompt template library;
[0045] Step 200: determining an optimal prompt template according to the dynamically adaptable prompt template library;
[0046] Step 300: obtaining original text sequence data and combining it with the optimal prompt template to obtain model input data;
[0047] Step 400: input the model input data into the constructed language model to obtain a prediction result;
[0048] The language model includes: a context encoder, a hierarchical feature extraction module, a cue-aware attention module, a feature fusion module, a knowledge retrieval module, and a model prediction module;
[0049] Among them, the context encoder is used to encode the input data of the model into a context encoding representation, the hierarchical feature extraction module is used to determine the context-aware event features and local semantic features based on the context encoding representation; the prompt-aware attention module is used to fuse the prompt information and the context encoding representation to obtain the prompt feature; the feature fusion module is used to fuse the prompt feature, the context-aware event feature and the local semantic feature to obtain the fusion feature, the knowledge retrieval module is used to obtain knowledge elements related to the event; the model prediction module is used to determine the causal relationship of the original text sequence data based on the fusion feature and the knowledge element.
[0050] Furthermore, the prompt template includes:
[0051] Learnable [MASK] location markers, event pair structured descriptions, and causal temporal indicators.
[0052] Specific, learnable [MASK] position markers: These position markers indicate the unfilled portion of the current template, allowing the model to fill in the specific content here based on contextual information. By using the [MASK] marker, pre-trained language models (such as BERT) can dynamically predict words or phrases related to event relationships based on context when performing text reasoning.
[0053] Event Pair Structured Description: This section clarifies the relationship between two events. This structured description helps the model clearly understand the correlation and causal relationships between events. This structured description ensures effective information exchange, making it easier for the model to capture potential causal relationships. This structured description can include relevant event attributes and their associated context, enriching the model's understanding of the events and improving the accuracy of reasoning.
[0054] Causal temporal indicators: Causal temporal indicators are used to indicate the order in which events occur, which is crucial for determining causal relationships. Effective temporal indicators help models understand which event is the cause and which event is the effect, as well as the temporal dependency between the two.
[0055] Through the detailed description of the three components above, it can be seen that these prompt templates are designed to improve the accuracy and robustness of event causal relationship recognition, especially in complex and multi-layered text contexts, enabling the model to fully capture the implicit relationships between events. Such structured prompt templates not only enhance the model's reasoning capabilities but also effectively utilize the rich semantic information in the pre-trained language model to promote more accurate causal relationship analysis.
[0056] Furthermore, it also includes:
[0057] Use data augmentation techniques to generate diverse training samples;
[0058] Performing data cleaning on the diverse training samples to obtain filtered data samples;
[0059] The language model is trained using the filtered data samples and parameters of the language model during the training process are monitored in real time to obtain an optimal language model.
[0060] Specifically, the specific training process of the language model is as follows:
[0061] 1. Data enhancement technology generates diverse training samples
[0062] 1.1 Determine the initial dataset:
[0063] Collect an initial dataset related to event causal relationship identification. This dataset should contain different event pairs and their corresponding causal relationship labels. The initial dataset can come from an existing text library, and be careful to select a variety of event types, such as natural disasters and economic events.
[0064] 1.2 Select data enhancement technology:
[0065] Choose appropriate data augmentation techniques, such as:
[0066] Synonym replacement: Randomly select keywords in the text and replace them with synonyms, keeping the meaning of the sentence unchanged.
[0067] Text insertion: Add background information or additional descriptions to the text to enhance the richness of the context.
[0068] Random deletion: Randomly delete some non-key words in the text to test the robustness of the model to missing information.
[0069] Generative Adversarial Network (GAN): GAN is used to generate synthetic samples similar to training samples to expand data diversity.
[0070] 1.3 Generate enhanced samples:
[0071] Multiple diverse training samples are generated through the above techniques to construct an enhanced dataset, ensuring that the samples cover different events and causal relationships.
[0072] 2. Data Cleaning
[0073] 2.1 Data preprocessing:
[0074] The enhanced dataset is preprocessed, including standardizing the text, removing noise (such as HTML tags and irrelevant characters), and unifying the encoding format (such as UTF-8).
[0075] 2.2 Setting of screening conditions:
[0076] Establish clear screening criteria, such as:
[0077] Delete samples with grammatical errors or illogical logic.
[0078] Ensure that each sample contains labels for event pairs and their causal relationships.
[0079] Filter out duplicate samples or very similar samples to reduce the impact of redundant data on model training.
[0080] 2.3 Implement data cleaning:
[0081] Apply the prepared cleaning algorithm to filter the data, generate the final filtered data sample set, and record the statistical information of each filtering for subsequent analysis.
[0082] 3 Language Model Training
[0083] 3.1 Data Segmentation:
[0084] The filtered dataset is divided into training set, validation set and test set to ensure that the sample distribution of each set is consistent for subsequent model training, parameter adjustment and evaluation.
[0085] 3.2 Language model selection:
[0086] Select a suitable pre-trained language model (such as BERT, GPT, etc.) and determine the model architecture based on specific task requirements.
[0087] 3.3 Model training preparation:
[0088] Converting the filtered training samples into a format suitable for language model input usually includes:
[0089] The encoding (Tokenization) of the input text.
[0090] Add necessary features (such as position code and segment code).
[0091] 3.4 Training process monitoring:
[0092] Use monitoring tools (such as TensorBoard) to observe parameter changes during training in real time, including loss function, accuracy, etc.
[0093] Set the initial values of hyperparameters such as learning rate, batch size, and number of training rounds, and adjust them dynamically.
[0094] 3.5 Model Evaluation
[0095] Regularly evaluate the model on the validation set and monitor performance metrics such as precision, recall, F1-score, etc. to check whether the model is overfitting or underfitting.
[0096] Adjust hyperparameters and training strategies based on the evaluation results to ensure the best language model.
[0097] 4. Determination of the optimal model
[0098] 4.1 Model Performance Comparison:
[0099] A final evaluation is performed on the test set to compare the performance of models under different configurations and training processes, and the best performing model is selected as the final model.
[0100] 4.2 Parameter storage and recording:
[0101] Save the parameters and training logs of the final model for subsequent reproduction and further research.
[0102] 4.3 System Deployment:
[0103] Deploy the trained language model to practical applications to identify event causal relationships and monitor its performance in real-world scenarios.
[0104] Specifically, the data enhancement technology includes:
[0105] Synonym replacement, sentence reorganization, negative sample generation, and text augmentation.
[0106] Furthermore, determining the optimal prompt template according to the dynamically adaptable prompt template library includes:
[0107] Determining dynamic features and static features of the original text sequence data, wherein the dynamic features include context information of the original text sequence data, and the static features include event frequencies and similar event pairs of the original text sequence data;
[0108] Constructing a scoring model, inputting the dynamic features and the static features into the scoring model, scoring each prompt template in the prompt template library, and obtaining a scoring result set;
[0109] An optimal prompt template is determined according to the scoring result set.
[0110] Specifically, the expression of the scoring model is:
[0111] Score(T i )=α·σ(f(D,T i ))+β·τ(g(S,T i ))+γ·h(D,S,T i)-λ·R(T i );
[0112] Among them, σ and τ are the first nonlinear activation function and the second nonlinear activation function, α, β, γ and λ are the first model hyperparameter, the second model hyperparameter, the third model hyperparameter and the fourth model hyperparameter, respectively. i ) is a function for evaluating the correlation between dynamic features and prompt templates, which characterizes the fitness of dynamic features to give prompt templates, g(S,T i ) is a function for evaluating the correlation between static features and prompt templates, h(D,S,T i ) is the interaction effect function of the dynamic and static features after fusion with the template correlation, D is the vector representation of the context information feature, S is the vector representation of the event frequency and similar event pair features, T i To prompt the template, R(T i ) is a regularization term used to penalize overly complex templates, prevent overfitting, and provide a measure of template complexity to evaluate the template's characteristics in terms of quantity and structural complexity. It can usually be the L1 or L2 norm of the template parameters, aiming to encourage the model to use simpler templates.
[0113] The first, second, third, and fourth model hyperparameters are the weights of dynamic features, static features, interaction terms, and regularization terms, respectively. The weight of dynamic features controls their influence in scoring. Increasing this parameter causes the model to prioritize the role of contextual information in prompt template selection. The weight of static features controls the strength of the static feature's influence. Increasing this parameter causes the model to prioritize background knowledge such as event frequency and similar events. The weight of the interaction term determines the importance of the combined influence of dynamic and static features in scoring. If the combined effect of these two factors is desired, the weight of the regularization term can be appropriately increased to control the degree of regularization's influence on scoring. Increasing this parameter increases the penalty for complexity in the scoring model, promoting its simplification and thus enhancing the model's generalization.
[0114] Specifically, the first nonlinear activation function and the second nonlinear activation function are one of ReLU (Rectified Linear Unit) and Sigmoid, which are used to enhance the sensitivity of the model to feature changes; the use of nonlinear activation functions can make the scoring model have stronger expression ability in the feature space and can capture the complex relationship between dynamic features and static features; by retaining the interaction term h(D, S, T i) The model can quantify the joint impact of dynamic features and static features on the score, thereby improving the prediction accuracy; the introduction of regularization terms makes the model more constrained during learning, which helps to improve the generalization ability of the model and reduce the risk of overfitting caused by training data noise.
[0115] Furthermore, we constructed prompt templates for the ECI task and incorporated these templates into the model input to guide the model to focus on the potential relationships between events. These templates are composed of corresponding [MASK] tags and event pairs. For example, for the given events "flood" and "casualties", the template is defined as: X t =There is a[MASK]relation between[e1] flood [ / e1]and[e2] casualties In the template, [e1] and [e2] represent the start and end of the source event and target event, respectively. The underlined events are placeholders for the source event and target event, and [MASK] is the location where the pre-trained language model fills in information.
[0116] Context encoder: After concatenating the input original text sequence with the previously constructed prompt template, the two are input into the pre-trained language model BERT to obtain the context encoding representation H s .
[0117] Furthermore, the hierarchical feature extraction module includes:
[0118] Event mention attention submodule and segment focus attention submodule;
[0119] The event mention attention submodule is used to determine context-aware event features based on the context encoding representation, and the segmented focus attention submodule is used to determine local semantic features based on the context encoding representation.
[0120] Event mention attention extracts mention-level features for a given event pair, effectively extracting relevant features from sequence input. Using the event representation as the query and the context representation as the key and value, the attention mechanism calculates weights based on the similarity between the event representation and the context. These weights are then combined with the context representation to generate context-aware event features.
[0121] Specifically, the expression of the context-aware event feature is:
[0122]
[0123] Among them, h g1 is the context-aware event feature of the first event in the event pair, H sis the context encoding representation, w g1 is the linear transformation matrix of the first event in the event pair, h e1 represents the first event in the event pair, Scaling factor, h g2 is the context-aware event feature of the second event in the event pair, w g2 is the linear transformation matrix of the second event in the event pair, h e2 It represents the second event in the event pair. g ∈R d*d represents the linear transformation matrix, where d represents the hidden dimension of the vector.
[0124] Segment-wise focus attention is to extract segment information related to event mention level features to selectively focus on different segments within a given text sequence. s To extract features, we first use convolution operations to extract local information from the sequence. We use the following formula to use convolution kernels of different sizes to capture local semantic features of different lengths (2, 3). The specific expression is:
[0125]
[0126] in, It is a local semantic feature.
[0127] Then, the event mention feature is combined with the currently obtained local semantic feature through the attention mechanism to obtain the fragment-level feature related to the event mention. is the trainable parameter matrix:
[0128]
[0129] in, It is a combination of context-aware event features and local semantic features.
[0130] Furthermore, the cue-aware attention module: In order to make the model better focus on the context related to the cue information, the cue information should be combined with the context information of the given text sequence to improve the performance of the model on the ECI task. We design the perceptual attention module to extract the cue information h from the input. mask Used as query value. Context H s Represents the key and value. The model's attention to the prompt information is calculated by the following formula to accurately utilize the prompt information when performing causal reasoning. The expression of the prompt feature is:
[0131]
[0132] Among them, h maskis the vector representation of the prompt information, h p is the prompt feature, W mask is a linear transformation matrix used to map the features of the prompt information to the same space as the context features to calculate the similarity, B is a learnable bias matrix, d k is the dimension of the feature vector.
[0133] Specifically, the formula calculates the attention score between the prompt information and the context information, and generates the final prompt feature by effectively weighting the prompt information; by focusing on the context part most relevant to the prompt information, the model's responsiveness to the prompt is enhanced; the auxiliary model uses the prompt information more accurately when performing causal reasoning, improving the overall performance of the EC task; the model can extract useful information from multiple contexts, rather than just relying on the global context.
[0134] Furthermore, the feature fusion module integrates semantic features from different layers and modules to generate rich event representations, providing a foundation for subsequent causal relationship prediction. We fuse event mention-level features, segment-level features, and cue-level features through linear layers and activation functions to obtain an enhanced, semantically rich event representation.
[0135] We then take the encoded representation at the [cls] position as the context representation, and concatenate it with the enhanced event representation obtained above to form the final joint representation of the event pair.
[0136] Furthermore, the implementation process of the feature fusion module is as follows:
[0137] Input features: A combination of context-aware event features and local semantic features; Cue features: Features extracted from the Cue-aware Attention module, representing the encoding of contextual cue information; Context-aware event features: Features extracted by the Context Encoder and Event Mention Attention submodules, reflecting the contextual information of the event; Local semantic features: Features extracted by the Segment-focused Attention submodule, describing the semantic relationships between different parts of the text. A weighted summation is used: weights are assigned to each feature and then summed.
[0138] Implementation process of knowledge retrieval module:
[0139] Input data: event information and context features: The fused features obtained from the feature fusion module will be used as the retrieval basis.
[0140] Search method:
[0141] Knowledge graph query: construct query statements based on keywords or event types in the fused features and access the graph database; similar event retrieval: query relevant knowledge elements from labeled events based on similarity metrics (such as cosine similarity).
[0142] Implementation process of the model prediction module:
[0143] The goal of the model prediction module is to predict the causal relationship in the original text sequence based on the fused features and the retrieved knowledge elements. The implementation process is as follows:
[0144] The input data includes:
[0145] Fusion features: fusion features from the feature fusion module; knowledge elements: relevant knowledge from the knowledge retrieval module.
[0146] The prediction method is:
[0147] Feature combination: combine the fused features with the knowledge element; model forward calculation: input the combined features into the classifier (such as a deep neural network) for causal relationship prediction; output the predicted causal relationship category through Softmax, and select the label with the highest probability as the final prediction result.
[0148] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0149] This document uses specific examples to illustrate the principles and implementation methods of the present invention. The above examples are only intended to help understand the method and core concept of the present invention. At the same time, those skilled in the art will find that the specific implementation methods and application scopes may vary based on the concept of the present invention. In summary, the contents of this specification should not be construed as limiting the present invention.
Claims
1. A method for identifying event causal relationships based on semantic perception enhancement, characterized in that: include: Create a dynamically adaptable prompt template library; Determining an optimal prompt template according to the dynamically adaptable prompt template library; Obtaining original text sequence data and combining it with the optimal prompt template to obtain model input data; Inputting the model input data into the constructed language model to obtain a prediction result; The language model includes: a context encoder, a hierarchical feature extraction module, a cue-aware attention module, a feature fusion module, a knowledge retrieval module, and a model prediction module; Among them, the context encoder is used to encode the input data of the model into a context encoding representation, the hierarchical feature extraction module is used to determine the context-aware event features and local semantic features based on the context encoding representation; the prompt-aware attention module is used to fuse the prompt information and the context encoding representation to obtain the prompt feature; the feature fusion module is used to fuse the prompt feature, the context-aware event feature and the local semantic feature to obtain the fusion feature, the knowledge retrieval module is used to obtain knowledge elements related to the event; the model prediction module is used to determine the causal relationship of the original text sequence data based on the fusion feature and the knowledge element.
2. The method for identifying event causal relationships based on semantic perception enhancement according to claim 1, characterized in that: The prompt template includes: Learnable [MASK] location tagging, event pair structured, causal temporal indicators.
3. The method for identifying event causal relationships based on semantic perception enhancement according to claim 1, characterized in that: Also includes: Use data augmentation techniques to generate diverse training samples; Performing data cleaning on the diverse training samples to obtain filtered data samples; The language model is trained using the filtered data samples and parameters of the language model during the training process are monitored in real time to obtain an optimal language model.
4. The method for identifying event causal relationships based on semantic perception enhancement according to claim 1, characterized in that: The data enhancement technology includes: Synonym replacement, sentence reorganization, negative sample generation, and text augmentation.
5. The method for identifying event causal relationships based on semantic perception enhancement according to claim 1, characterized in that: The determining of the optimal prompt template according to the dynamically adaptable prompt template library includes: Determining dynamic features and static features of the original text sequence data, wherein the dynamic features include context information of the original text sequence data, and the static features include event frequencies and similar event pairs of the original text sequence data; Constructing a scoring model, inputting the dynamic features and the static features into the scoring model, scoring each prompt template in the prompt template library, and obtaining a scoring result set; An optimal prompt template is determined according to the scoring result set.
6. The method for identifying event causal relationships based on semantic perception enhancement according to claim 5, characterized in that: The expression of the scoring model is: Score(T i )=α·σ(f(D,T i ))+β·τ(g(S,T i ))+γ·h(D,S,T i )-λ·R(T i ); Among them, σ and τ are the first nonlinear activation function and the second nonlinear activation function, α, β, γ and λ are the first model hyperparameter, the second model hyperparameter, the third model hyperparameter and the fourth model hyperparameter, respectively. i ) is a function for evaluating the correlation between dynamic features and prompt templates, which characterizes the fitness of dynamic features to give prompt templates, g(S,T i ) is a function for evaluating the correlation between static features and prompt templates, h(D,S,T i ) is the interaction effect function of the dynamic and static features after fusion with the template correlation, D is the vector representation of the context information feature, S is the vector representation of the event frequency and similar event pair features, T i To prompt the template, R(T i ) is the regularization term.
7. The method for identifying event causal relationships based on semantic perception enhancement according to claim 6, characterized in that: The hierarchical feature extraction module includes: Event mention attention submodule and segment focus attention submodule; The event mention attention submodule is used to determine context-aware event features based on the context encoding representation, and the segmented focus attention submodule is used to determine local semantic features based on the context encoding representation.
8. The method for identifying event causal relationships based on semantic perception enhancement according to claim 6, characterized in that: The expression of the context-aware event feature is: Among them, h g1 is the context-aware event feature of the first event in the event pair, H s is the context encoding representation, w g1 is the linear transformation matrix of the first event in the event pair, h e1 represents the first event in the event pair, Scaling factor, h g2 is the context-aware event feature of the second event in the event pair, w g2 is the linear transformation matrix of the second event in the event pair, h e2 Represents the second event in an event pair.
9. The method for identifying event causal relationships based on semantic perception enhancement according to claim 7, characterized in that: The expression of the prompt feature is: Among them, h mask is the vector representation of the prompt information, h p is the prompt feature, W mask is the linear transformation matrix, B is the learnable bias matrix, d k is the dimension of the feature vector.
Citation Information
Cited By
Geological metallogenic causal knowledge extraction method, storage medium, equipment and product
CN121301895A