A method and apparatus for identifying an emotional cause segment

CN122287649BActive Publication Date: 2026-08-11SHANDONG UNIV OF SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-05-25
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

[0005]本申请实施例提供一种情绪原因片段识别方法和装置,旨在解决常识知识噪声干扰模型学习的技术问题,打破了传统技术中直接使用生成常识或完全回避常识引入的技术惯性,采用大语言模型引导的常识过滤解决机制,从而重构了外部常识知识的有效利用路径,提高模型情绪原因识别准确率的技术效果

Benefits of technology

本申请提供的一种情绪原因片段识别方法和装置,采取了将输入文本、情绪片段和生成的常识知识组合为提示词输入同一大语言模型的技术手段,由大语言模型基于其对语义的深度理解能力判断常识知识与当前文本语境的相关性,仅保留被判定为高度相关的常识知识融入模型输入;这一机制利用了同一大语言模型体系完成常识生成和语义过滤的双重任务,保持了判断标准的一致性,避免了跨模型语义理解偏差;通过预设相关性阈值控制过滤严格度,当大语言模型输出的相关性置信度大于该阈值时,判定为有效常识知识,进而达到减少噪声干扰、提升常识知识有效性的目的,因此达到提高模型情绪原因识别准确率的技术效果;采用大语言模型引导的常识过滤解决机制,从而重构了外部常识知识的有效利用路径,打破了传统技术中直接使用生成常识或完全回避常识引入的技术惯性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122287649B_ABST
    Figure CN122287649B_ABST
Patent Text Reader

Abstract

This application provides a method and apparatus for identifying emotional reason fragments, belonging to the field of natural language processing technology. It employs a technique that combines input text, emotional fragments, and generated common sense knowledge into prompts input into the same large language model. The large language model, based on its deep semantic understanding, judges the relevance of common sense knowledge to the current text context, retaining only the highly relevant common sense knowledge for integration into the model input. This mechanism utilizes the same large language model system to complete the dual tasks of common sense generation and semantic filtering, maintaining consistency in judgment standards and avoiding cross-model semantic understanding bias. By pre-setting a relevance threshold to control the filtering strictness, when the relevance confidence of the large language model output exceeds this threshold, it is determined to be valid common sense knowledge, thereby reducing noise interference and improving the effectiveness of common sense knowledge. Therefore, it achieves the technical effect of improving the accuracy of the model in identifying emotional reasons.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of natural language processing technology, and in particular to a method and apparatus for identifying emotional reason fragments. Background Technology

[0002] In the field of sentiment computing within natural language processing, emotion causation analysis, as a key task for understanding the mechanisms of user emotion generation, is widely applied in scenarios such as human-computer interaction dialogue systems and psychological health auxiliary analysis. The core of this technology is to process user-input text through semantic analysis models to identify the text fragments that trigger specific emotions. Current mainstream solutions model emotion causation analysis as an emotion-cause clause pair extraction task, that is, dividing the text into clause units using punctuation marks as boundaries, and then identifying the emotion-cause correspondence between clauses. However, in actual language expression, the emotional cause content often does not completely occupy the entire clause; a clause may contain both cause fragments and non-cause content simultaneously. This division method using fixed punctuation marks as boundaries leads to inherent ambiguity in the identification of cause fragment boundaries. Furthermore, the generation of emotions usually relies on socio-psychological common sense and background knowledge not explicitly expressed in the text, and existing technical frameworks lack effective mechanisms for utilizing external common sense knowledge, limiting the depth of semantic understanding.

[0003] Existing technologies commonly employ methods including rule-based pattern matching, traditional deep learning models such as convolutional memory networks, and sequence labeling methods based on pre-trained language models such as BERT combined with conditional random fields. Rule-based methods rely on manually designed patterns, resulting in limited coverage and difficulty adapting to the diversity of language expressions. While traditional deep learning models can learn text features, they do not explicitly incorporate emotion-related common sense knowledge, leading to insufficient reasoning ability regarding implicit causal relationships. Pre-trained language model methods, although possessing strong semantic representation capabilities, are still limited by the scarcity and uniformity of training data in fine-grained emotion cause segment recognition tasks. Furthermore, automatic data augmentation techniques, such as random word replacement or back-translation, can easily disrupt the correspondence between emotion segments and cause segments when applied to emotion cause tasks, reducing the semantic plausibility of augmented samples. The root cause of these shortcomings lies in the failure of existing technological frameworks to effectively address noise filtering when incorporating external common sense knowledge and the lack of closed-loop control mechanisms for augmented data quality, resulting in insufficient recognition accuracy and limited generalization ability when dealing with complex contexts and diverse expressions.

[0004] Therefore, there is a need to provide a fine-grained method for identifying emotional reason fragments that can effectively utilize external common sense knowledge and ensure enhanced data quality, so as to overcome the performance bottlenecks caused by blurred boundaries, insufficient semantic understanding depth, and scarce training data in existing technologies. Summary of the Invention

[0005] This application provides a method and apparatus for identifying emotional cause fragments, aiming to solve the technical problem of common sense knowledge noise interfering with model learning. It breaks the technical inertia of directly using generated common sense or completely avoiding the introduction of common sense in traditional technologies. It adopts a common sense filtering solution mechanism guided by a large language model, thereby reconstructing the effective utilization path of external common sense knowledge and improving the technical effect of improving the accuracy of model emotional cause identification.

[0006] Firstly, this application provides a method for identifying emotional cause fragments, the method comprising: Receive user text input containing emotional expression and corresponding emotional fragments, and perform semantic analysis on the text using a large language model based on instruction fine-tuning to identify the text fragments that trigger the emotions; An external common sense knowledge enhancement mechanism is introduced. By calling the common sense reasoning model, multi-dimensional social and psychological common sense is generated for the input text. The generated common sense is then semantically filtered based on a large language model. The filtered common sense knowledge is then integrated into the model input in a preset format. Simultaneously, a self-feedback data augmentation mechanism is adopted to generate diverse expression samples based on the original training samples through various text generation strategies. The generated samples undergo dual checks for label integrity and semantic rationality, and samples that fail the checks are iteratively rewritten and repaired. Through the synergistic effect of the common sense enhancement mechanism and the data enhancement mechanism, the parameters of the large language model are efficiently fine-tuned, enabling the model to accurately identify emotional reason fragments by combining text content and external common sense knowledge.

[0007] Optionally, the common sense reasoning model is the COMET model, and the generated common sense knowledge includes the following five types: possible intentions of the actor xIntent, potential results of the event xEffect, preconditions that may be required for the event xNeed, emotional or psychological reaction of the party xReact, and actions that the subject may want to take after the event xWant.

[0008] Optionally, the self-feedback data augmentation mechanism includes a data generation module, a data inspection module, and a feedback and rewriting module. The data generation module generates diverse expression samples based on the original training samples through various text generation strategies. The data inspection module performs dual checks on the generated samples for label integrity and semantic rationality. The feedback and rewriting module iteratively rewrites and repairs samples that fail the checks.

[0009] Optionally, the various text generation strategies include: Synonym substitution strategies for using synonyms or shifting the tone of emotional expressions in the original text; A contextual change strategy that keeps the core events unchanged while modifying peripheral information such as time, location, and people; A boundary perturbation strategy that involves adding or deleting words in the causal segment that do not affect the core semantics to perturb the causal boundary.

[0010] Optionally, the step of filtering the generated common sense based on a large language model for semantic relevance specifically includes: The input text, emotional fragments, and generated common sense knowledge are combined into prompt words and input into a large language model. The large language model judges the relevance of the common sense knowledge to the current text context and retains only the common sense knowledge that is judged to be relevant.

[0011] Optionally, the dual check for tag integrity and semantic reasonableness includes: Tag integrity check: Determines whether the generated text completely contains the corresponding emotion fragments and reason tags; Semantic plausibility check assesses whether there is a consistent and natural semantic connection between the generated text, emotion, and reason.

[0012] Optionally, the iterative rewriting and repair of samples that fail the check specifically includes: Samples that fail the inspection are input into the generation prompt based on the label information for regeneration. The repaired samples continue to pass through the data inspection module, forming a continuous iterative loop until the generated samples meet the quality inspection standards.

[0013] Optionally, the common sense enhancement mechanism and the data augmentation mechanism are executed in parallel during model training, and the common sense knowledge generated by the common sense enhancement is directly used as additional information for the data augmentation samples.

[0014] Secondly, this application also provides an emotional cause fragment recognition device, which is configured to the above-described emotional cause fragment recognition method.

[0015] Thirdly, this application also provides an emotional cause fragment recognition system, which is configured as the emotional cause fragment recognition method described above.

[0016] The beneficial technical effects of this application are as follows: This application provides a method and apparatus for identifying emotional reason fragments. It employs a technique that combines input text, emotional fragments, and generated common sense knowledge into prompts input into the same large language model. The large language model, based on its deep semantic understanding, judges the relevance of common sense knowledge to the current text context, retaining only the highly relevant common sense knowledge for integration into the model input. This mechanism utilizes the same large language model system to complete the dual tasks of common sense generation and semantic filtering, maintaining consistency in judgment criteria and avoiding cross-model semantic understanding bias. By controlling the filtering strictness through a preset relevance threshold, when the relevance confidence of the large language model output exceeds this threshold, it is determined to be valid common sense knowledge, thereby reducing noise interference and improving the effectiveness of common sense knowledge. This achieves the technical effect of improving the accuracy of the model in identifying emotional reasons. The common sense filtering mechanism guided by the large language model reconstructs the effective utilization path of external common sense knowledge, breaking the technical inertia of directly using generated common sense or completely avoiding the introduction of common sense in traditional technologies. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 A flowchart illustrating a method for identifying emotional reason fragments provided in this application; Figure 2 A schematic diagram of the model framework for an emotion cause fragment recognition method provided in this application; Figure 3 A schematic diagram illustrating a data augmentation framework provided in this application; Figure 4 A schematic diagram of a knowledge enhancement framework provided for this application; Figure 5 This is a schematic diagram of the structure of an electronic device provided in this application. Detailed Implementation

[0019] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0020] It should be understood that in the various embodiments of this application, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0021] It should be understood that in this application, "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, for example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units that are explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to such process, method, product, or device.

[0022] The technical solutions of this application will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.

[0023] In the technical framework of emotion cause identification systems, the system uses natural language processing models to perform semantic analysis on user-input text to identify the text fragments that trigger specific emotions. Existing technologies often model emotion cause analysis as an emotion-cause clause pair extraction task. This clause-level analysis unit divides text using punctuation marks as boundaries. However, in actual language expression, a clause may contain both emotional cause and non-cause content simultaneously, leading to ambiguity in cause fragment boundary identification. A deeper problem is that the generation of emotions often relies on socio-psychological common sense not explicitly expressed in the text, while traditional methods only rely on surface information for semantic understanding, lacking the mining and utilization of implicit common sense.

[0024] In the common sense knowledge enhancement module of the emotion cause recognition system, external common sense knowledge needs to be introduced to enrich the semantic representation in order to compensate for the lack of implicit information in the text. This module generates multi-dimensional socio-psychological common sense for the input event by calling a common sense reasoning model, including the possible intentions of the actor, the potential consequences of the event, and the possible preconditions for the event to occur. However, automatically generated common sense knowledge suffers from semantic relevance noise, meaning that some of the generated common sense has low relevance to the current text context and may even provide misleading information. In existing technologies, either no external common sense is introduced at all, resulting in insufficient semantic understanding depth; or unfiltered common sense knowledge is used directly, causing noise information to interfere with model learning. This technological inertia stems from the lack of a mechanism that fails to effectively distinguish between general common sense and context-specific common sense.

[0025] To overcome the technical problem of common sense noise interfering with model learning, and breaking away from the traditional approach of directly using generated common sense or completely avoiding its introduction, this invention employs a common sense filtering mechanism guided by a large language model, thereby reconstructing an effective path for utilizing external common sense knowledge. Specifically, it combines the input text, emotional fragments, and generated common sense knowledge into prompts input into the same large language model. The large language model, based on its deep semantic understanding, judges the relevance of common sense knowledge to the current text context, retaining only the highly relevant common sense knowledge for integration into the model input. This mechanism utilizes the same large language model system to complete both common sense generation and semantic filtering, maintaining consistency in judgment criteria and avoiding cross-model semantic understanding bias. By pre-setting a relevance threshold to control the filtering strictness, when the relevance confidence of the large language model output exceeds this threshold, it is determined to be valid common sense knowledge, thereby reducing noise interference and improving the effectiveness of common sense knowledge. This results in improved accuracy in identifying the cause of emotion in the model.

[0026] refer to Figure 1 and Figure 2 As shown, this invention provides a method for identifying emotional cause fragments, applicable to scenarios such as human-computer interaction and empathetic dialogue. This method improves the architecture of emotion cause identification based on a large language model, introducing a common sense knowledge enhancement module and a data augmentation module to enhance the performance of emotion cause identification. This invention provides a method for identifying emotional cause fragments, including: Step 100: Receive user text input containing emotional expression and corresponding emotional fragments, and perform semantic analysis on the text using a large language model based on instruction fine-tuning to identify the text fragments that trigger the emotion; The common-sense reasoning model used in this invention is the COMET model. The generated common-sense knowledge includes the following five types: the possible intention of the actor (xIntent), the potential consequences of the event (xEffect), the preconditions that may have led to the event (xNeed), the emotional or psychological reaction of the parties involved (xReact), and the actions the actor may take after the event (xWant). Different types of common-sense knowledge are acquired based on the COMET knowledge base to enrich the semantic representation of the text. Subsequently, instructions are designed to guide the large model to filter redundant knowledge, retain effective knowledge, and strengthen the model's understanding of the semantics implied in the text. By employing multi-dimensional socio-psychological common-sense types, the problem of incomplete coverage of single-type common-sense information is solved. xIntent provides clues to behavioral motivation, xEffect provides information on the consequences of the event, xNeed provides preconditions and background, xReact provides emotional reaction patterns, and xWant provides subsequent behavioral tendencies. This further constructs a complete causal chain for emotion generation, thereby achieving a comprehensive understanding of the mechanism of emotion formation.

[0027] Step 200: Introduce an external common sense knowledge enhancement mechanism. Generate multi-dimensional social and psychological common sense for the input text by calling the common sense reasoning model, and perform semantic relevance filtering on the generated common sense based on the large language model. Integrate the filtered common sense knowledge into the model input in a preset format. The semantic relevance filtering of generated common sense based on a large language model involves: combining input text, sentiment fragments, and generated common sense knowledge into prompt words, which are then input into the large language model. The large language model judges the relevance of the common sense knowledge to the current text context, retaining only the common sense knowledge deemed relevant. This common sense filtering mechanism guided by a large language model solves the semantic noise problem in automatically generated common sense. By utilizing the same large language model system for generation and filtering, consistency in semantic judgment is maintained, further improving the effectiveness and reliability of external common sense knowledge, thereby achieving the technical effects of reducing noise interference and improving model learning efficiency.

[0028] Step 300: Simultaneously, a self-feedback data augmentation mechanism is adopted to generate diverse expression samples based on the original training samples through various text generation strategies. The generated samples are then subjected to dual checks for label integrity and semantic rationality. Samples that fail the checks are iteratively rewritten and repaired. The self-feedback data augmentation mechanism comprises a data generation module, a data inspection module, and a feedback and rewriting module. The data generation module produces diverse expression samples based on the original training samples using various text generation strategies. The data inspection module performs dual checks on the generated samples for label integrity and semantic rationality. The feedback and rewriting module iteratively rewrites and repairs samples that fail the checks. This closed-loop data augmentation architecture of generation-inspection-feedback-rewriting solves the problem of uncontrollable quality in traditional data augmentation methods. By expanding expression diversity through the data generation module, ensuring sample quality through the data inspection module, and achieving iterative optimization of samples through the feedback and rewriting module, the reliability and effectiveness of augmented data are further improved, ultimately providing high-quality training samples for the model.

[0029] The self-feedback data augmentation mechanism guides the large model to expand the original samples in three aspects: sentence expression diversity, semantic consistency of emotional causes, and perturbation of cause boundaries. Subsequently, to ensure the semantic rationality of the generated text, a generation consistency check and correction mechanism is introduced to enhance the quality of the generated data.

[0030] Multiple text generation strategies are employed, including: a synonym substitution strategy that replaces or modifies the emotional expression in the original text; a context modification strategy that keeps the core event unchanged while altering peripheral information such as time, location, and people; and a boundary perturbation strategy that adds or deletes words that do not affect the core semantics in the causal segment to perturb the causal boundary. By employing these targeted text generation strategies, the problems of limited training sample expression and insufficient boundary recognition ability are addressed. Synonym substitution increases vocabulary diversity, context modification enhances contextual adaptability, and boundary perturbation specifically improves the model's robustness in recognizing causal segment boundaries. These strategies further enhance the model's ability to handle diverse expressions and complex boundaries, thereby improving the model's generalization performance.

[0031] The dual quality check for label integrity and semantic reasonableness includes: label integrity check, which determines whether the generated text completely contains the corresponding emotion fragment and cause label; and semantic reasonableness check, which assesses whether there is a consistent and natural semantic relationship between the generated text, emotion, and cause. This dual quality check mechanism addresses potential issues of label alignment failure and semantic unreasonableness in automatically generated data. Label integrity check ensures the emotion-cause correspondence is not disrupted, while semantic reasonableness check guarantees the naturalness and logical consistency of the generated text. This further improves the quality and reliability of augmented data, ultimately providing high-quality training samples for the model.

[0032] The iterative rewriting and repair process for samples that fail the inspection involves: inputting the failed samples into the generation prompts based on label information for regeneration; the repaired samples then continue to pass through the data inspection module, forming a continuous iterative loop until the generated samples meet the quality inspection standards. This iterative rewriting and repair mechanism addresses the potential quality instability issues that may arise from single-generation processes. Through a closed-loop process of generation-inspection-feedback-rewriting, the quality of generated samples is gradually optimized, further improving the success rate and efficiency of data augmentation, thereby achieving the technical effect of obtaining high-quality augmented data within a limited number of iterations.

[0033] Step 400: Through the synergistic effect of the common sense enhancement mechanism and the data enhancement mechanism, the parameters of the large language model are efficiently fine-tuned, enabling the model to accurately identify emotional reason fragments by combining text content and external common sense knowledge.

[0034] The technical solution of this application differs from the conventional approach of relying solely on text content for emotion cause identification. It cleverly utilizes external common sense knowledge to compensate for the lack of implicit information in the text. Employing a dual-mechanism approach of common sense enhancement and data augmentation, it addresses the issues of ambiguous boundaries in clause-level emotion cause analysis and insufficient generalization ability due to scarce training data. Common sense knowledge provides socio-psychological background clues for emotion generation, while self-feedback data augmentation expands the expressive diversity of training samples, further improving the model's accuracy in identifying fine-grained emotion cause fragments. This achieves the technical effect of accurately identifying emotion cause fragments in complex contexts. The synergistic application of common sense enhancement and data augmentation mechanisms in the large language model emotion cause identification task supplements semantic understanding depth through external common sense and overcomes training resource limitations through self-feedback data augmentation, enabling high-precision identification of fine-grained emotion cause fragments.

[0035] The method in this embodiment of the invention also includes an instruction design step, in which a natural language instruction containing a task description is designed as part of the model input. The instruction explicitly requires the model to combine text and common sense knowledge to locate the causal fragment leading to the emotion, and to keep the output concise, containing only the fragment content. By employing explicit task instruction design, the problems of non-standard model output format and redundant content are solved. By clarifying task requirements and output format constraints through instructions, the model is guided to focus on the causal fragment location task, further improving the accuracy and standardization of the output results, thereby achieving the technical effect of standardized emotion cause identification output.

[0036] During the model inference phase, when the input text contains multiple emotional cause fragments, the model can sequentially generate all relevant emotional cause fragments. It supports multi-cause fragment recognition, thus solving the problem of multiple coexisting emotional causes in complex text. By sequentially outputting all relevant cause fragments through a sequence generation mechanism, it further improves the model's ability to handle complex emotional structures, thereby achieving the technical effect of comprehensively recognizing all emotional cause fragments in the text.

[0037] Common sense augmentation and data augmentation mechanisms are executed in parallel during model training. The common sense knowledge generated by common sense augmentation is directly used as additional information for data augmentation samples. By adopting an architecture that executes common sense augmentation and data augmentation in parallel, the problem of excessively long training processes caused by the serial execution of the two augmentation mechanisms is solved. Parallel processing improves training efficiency while ensuring that all augmented samples receive corresponding common sense knowledge assistance, further enhancing the synergy and efficiency of the overall training process, thus achieving the technical effect of efficiently utilizing the dual augmentation mechanisms.

[0038] This invention provides a method for identifying emotional cause fragments, using a system architecture as follows: Figure 2As shown, it consists of three important parts: a data augmentation module, a common-sense knowledge augmentation module, and a large language model instruction fine-tuning module. In the data augmentation module, rules guide the LLM to generate text data with sentiment and causal annotations, while a self-feedback data filtering mechanism is designed to ensure the quality of the augmented data. In the common-sense knowledge augmentation module, COMET is called to generate different types of external common-sense knowledge, and the large language model is used to filter the generated common-sense knowledge for validity, retaining only valid common-sense knowledge. In the large language model instruction fine-tuning section, this embodiment of the invention designs a prompt word with clear instruction expression and task description, and then the model is fine-tuned using LoRA.

[0039] The LLM-based self-feedback data augmentation mechanism expands the original samples in three aspects: sentence expression diversity, label constraints, and boundary perturbation generation. During data augmentation, the original emotional fragments and their causes are referenced; that is, when generating new text, the emotional category and corresponding semantic reasons must remain unchanged. To ensure the semantic rationality of the generated text, this embodiment introduces a generation consistency check and correction mechanism, thereby improving the model's performance in extracting emotional causes. The data augmentation mechanism is as follows: Figure 3 As shown, it mainly includes three modules: data generation, data checking, and feedback and rewriting.

[0040] Data Generation: Since unreasonable text may be introduced during the text generation process, to ensure that the augmented data retains the semantic information of the original emotion and cause, it is necessary to refer to the labels of the original data. That is, it is required to generate natural and reasonable sentences based on the "emotion" and "cause" labels of the given text. This requires synonym substitution or tone shifting of the original emotion portion, and reasonable rewriting of the original cause content without changing its semantics. Furthermore, this embodiment of the invention also specifically requires the generation of some "cause boundary perturbations," such as adding or deleting some personal pronouns, modifiers (actually, finally, even), and modifiers (suddenly, just right) in the cause portion, without changing the core meaning of the cause, and includes some example causes boundary perturbations. These texts can subsequently improve the model's ability to extract causes with boundary perturbations.

[0041] Data Inspection: This section checks the generated data from two aspects: label completeness and semantic rationality. (1) Label Completeness Check: Determine whether the generated text completely contains the corresponding emotion fragment and cause label to avoid the situation where the emotion or cause is omitted or does not match the text. This check can ensure that the generated text strictly contains the generated emotion fragment and cause label, and prevent the introduction of non-aligned noise samples. (2) Semantic Rationality Check: Evaluate whether there is a consistent and natural semantic relationship between the generated text, emotion and cause. This step focuses on whether the generated text can reasonably express the labeled emotional state, and whether the labeled cause can fully explain the generation of the emotion semantically, to avoid the situation where the emotion and text do not match or the causal relationship is not established.

[0042] Feedback and Rewriting: This section adds samples that pass the data inspection to the final augmented dataset. Samples that fail are fed into another generation tool based on label information for regeneration, where the text is rewritten using a large language model. The corrected samples continue to pass through the data inspection module, forming a continuous iterative loop until all generated samples meet the quality inspection standards.

[0043] This generative-verification-feedback rewriting framework ensures high reliability in terms of semantic expression, structural form, and consistency between emotion and cause. While expanding the diversity of textual expression, the framework effectively avoids deviations in emotion categories or cause content, thus providing stable and reliable training samples for the model.

[0044] This invention introduces a knowledge enhancement mechanism, utilizing COMET to generate external common sense knowledge for each sample, such as... Figure 4 As shown, COMET is a generative model based on a large-scale common sense graph, capable of automatically reasoning and generating multi-dimensional common sense knowledge around input events. For each sample, this invention calls the COMET model to generate five types of common sense knowledge, including the possible intention of the actor (xIntent), the potential consequences of the event (xEffect), the preconditions that may be necessary for the event to occur (xNeed), the emotional or psychological reaction of the person involved (xReact), and the action that the subject may want to take after the event occurs (xWant). A common sense text is generated for each relationship. By introducing these relevant common sense knowledge, the model can obtain additional reasoning clues beyond the original text, thereby more accurately locating the key causal fragments that trigger specific emotions and enhancing the understanding of the relationship between emotional causes.

[0045] While COMET provides rich reasoning knowledge, its generation process inevitably introduces noise, and some common sense may be irrelevant to the current context. For example, the text "He felt very tired and frustrated because of continuous overtime work" generates the common sense "People feel frustrated after failure." This common sense is quite different from the semantics of "continuous overtime work." To address this, this invention designs a common sense filtering mechanism based on a large language model. Specifically, by calling the large language model, it determines whether the common sense knowledge corresponding to each sample is relevant, retaining only common sense highly relevant to the text semantics as auxiliary information and filtering out irrelevant common sense. This filtering step effectively improves the reliability of external knowledge while ensuring knowledge diversity, allowing the model to benefit from more accurate causal information.

[0046] The instruction tuning in this invention can effectively guide large language models to output emotion reasons in a specified format, thereby improving the model's performance in the emotion reason extraction task. To minimize the number of trainable parameters, this invention employs a low-rank adaptive strategy, fine-tuning only a small subset of key parameters, which helps reduce computational resources.

[0047] This invention uses a clearly defined natural language instruction: "Based on the text and common sense, locate the causal fragment that causes this emotion, keeping the output concise and containing only the fragment." This prompt emphasizes "locating the causal fragment that causes this emotion," preventing the model from mistakenly expanding the result to explanatory content or the emotion itself; it explicitly requires the model to incorporate generated common sense, thus enabling stable inference even when the original text lacks sufficient clues; and by requiring the output to be concise and contain only the fragment, it significantly reduces redundant descriptions and improves the consistency between the final result and the original text fragment.

[0048] Large language models typically contain tens of millions to hundreds of millions of parameters, and optimizing them is a significant challenge due to the substantial computational resources and time required. Directly performing full parameter fine-tuning is not only costly but also prone to overfitting or training instability. Therefore, efficient parameter fine-tuning methods have become an important direction for adapting large models. Low-rank adaptation (LoRA) is a representative technique that introduces two compact matrices, denoted as A and B, which introduce only a limited number of trainable parameters. This method significantly reduces computational requirements, minimizes resource consumption, and improves training efficiency. To understand the basic principles of LoRA, it's necessary to examine how a standard linear layer processes the input. Without considering bias terms, the standard linear transformation can be expressed as: , where the input vector Output vector Weight matrix The core idea of ​​LoRA is to restrict the update of W to a low-rank matrix: ,in, , Furthermore, the rank r is significantly smaller than d and k. Thus, the linear layer becomes: Since only A and B are trainable parameters, this method effectively reduces the memory and computational requirements during training. Therefore, LoRA has become a commonly used parameter fine-tuning technique in many downstream tasks of large language models.

[0049] The finely tuned model in this embodiment of the invention analyzes the input text according to pre-set instructions and can generate causal fragments corresponding to a given emotion from the sentences. When the text contains multiple causal fragments, the model can also generate relevant causal fragments in sequence, demonstrating its ability to express complex emotional causal structures.

[0050] This invention provides a method for identifying emotional reason fragments. It incorporates common sense knowledge generated by COMET to enhance the model's understanding of text semantics. Considering the potential noise in common sense knowledge, a common sense knowledge filtering mechanism is designed. Subsequently, prompts are designed to guide the large model in identifying the corresponding emotional reason fragments in the text. Furthermore, to alleviate the scarcity of labeled emotional reason data, a self-feedback data augmentation mechanism based on a large language model is proposed. Through multiple rounds of generation and quality screening, the model is guided to generate new training samples, gradually enriching the sample expression forms. During the model training phase, to further reduce computational costs and improve training efficiency, this paper employs low-rank adaptation (LoRA) technology for efficient parameter fine-tuning of the large language model.

[0051] To study the technical effectiveness of the emotion cause fragment identification method provided in this embodiment of the invention, the emotion cause analysis dataset constructed by Gui et al., with data sourced from Sina Weibo news, was used. This dataset is widely used in emotion cause analysis research and is one of the most commonly used benchmark datasets for current emotion cause fragment extraction tasks. To ensure fairness, the method of this invention adopts the same data partitioning scheme as existing methods. In the original dataset, documents containing multiple emotional contents are split into several samples so that each document contains only one emotion. The statistical information of the dataset is shown in Table 1. #D、#S emotion and #S cause These represent the number of text segments, the number of emotional fragments, and the number of fragments explaining the reasons for the emotions, respectively. #D E=1 (or #D) C=1 ), #D E=2 (or #D) C=2 ) and #D E≥3 (or #D) C≥3 The numbers ) represent the presence of one, two, and three or more emotional (or causal) fragments in the document, respectively. Additionally, AveLen... C AveLen E and Ave ClauThese represent the length of the emotional segment, the average length of the emotional reason segment, and the average number of clauses in each text, respectively.

[0052] Table 1. Detailed information about the dataset

[0053] Several representative baseline models were selected for comparison to evaluate the effectiveness of the proposed method in the emotion cause extraction task. The comparison objects included rule-based models, feature learning models, pre-trained language-based models, and large language-based models, as detailed below: Rule-Based: This paper proposes a rule-based method for detecting the causes of emotions. It identifies potential emotional causes through manually designed language patterns and keywords.

[0054] ConvMS-Memnet: This method categorizes the task of extracting emotional causes as a question-and-answer question, and within the question-and-answer framework, it fuses word-level sequence features and lexical features through convolutional neural networks and memory networks, and uses these features to identify emotional cause clauses in the text.

[0055] BERT+CRF: This method introduces conditional random field modeling to the BERT encoding representation to model the transition dependencies between labels, and decodes with the goal of maximizing the overall sequence probability to extract the causes of emotions at the fragment level.

[0056] BERT+Softmax: The Softmax classifier is used to predict word-by-word labels on the word-level representation output by BERT, and the emotional reason fragments are identified through sequence labeling.

[0057] BERT+GRU: Based on BERT representation, GRU is used to predict sequence labels step by step, and historical label information is used to model the sequential dependency relationship between labels to realize the identification of emotional cause segments.

[0058] BERT+Pointer: Employs a pointer network for boundary prediction and uses an attention mechanism to directly select the start and end positions of emotional cause segments from the input sequence, achieving segment-level extraction of emotional causes.

[0059] BGAT: This method uses BERT to encode the text, obtains the contextual semantic representation of each word, then constructs a graph structure to represent the relationship between clauses in the text, and uses a graph attention network to model the text structure information to achieve accurate localization of emotional cause segments.

[0060] LLaMA, Baichuan, and Qwen represent the LLaMA2-7B, Baichuan2-7B, and Qwen2-7B models, respectively. All models were fine-tuned and trained within a unified experimental framework, including identical training data, data partitioning, prompts, and LoRA parameter fine-tuning strategies, thus ensuring fairness and consistency in the experimental comparisons.

[0061] Using fragment-level precision ( ), recall rate ( ), and F1 value ( These metrics, used as evaluation indicators, have been widely applied to assess tasks involving fragment-level emotion causation analysis. Their calculation method is as follows: ; ; ; in, This indicates the number of reason fragments correctly predicted by the model. This represents the number of cause fragments predicted by the model but not present in the actual annotations, while This indicates the number of cause fragments that exist in the actual annotations but were not predicted by the model. Therefore, This represents the total number of cause fragments predicted by the model. This represents the total number of truly annotated cause segments in the test set.

[0062] In fragment-level evaluation, a prediction is considered correct only if the predicted cause fragment perfectly matches the ground truth annotation at the boundary. To evaluate the model's performance in the cause extraction task from a more granular perspective, this invention further introduces a word-level evaluation metric. The word-level metric is calculated based on the word-level overlap between the predicted cause fragment and the ground truth annotation, and its calculation method is as follows: ; Among them, word-level precision With recall rate The definition is as follows: ; ; in, This indicates the number of words in the segment that were correctly predicted by the model that overlapped with the actual annotations. This represents the number of words predicted by the model but not present in the actual cause segment; This represents the number of words present in the true cause segment but not predicted by the model. Because word-level evaluation does not consider word order and allows for partial matching within the word, this metric is more lenient than segment-level evaluation criteria and can more comprehensively reflect the model's ability to locate emotional causes in complex contexts.

[0063] To evaluate the effectiveness of the method of this invention in the task of extracting emotional causes, a series of experiments were conducted on the task of extracting emotional causes at the fragment level, and the performance of the model was analyzed from two different granularities: fragment level and word level.

[0064] Tables 2 and 3 present the experimental results of the proposed CometDAGLM and various comparative models on fragment-level and word-level emotion cause extraction tasks, respectively. Overall, the CometDAGLM model consistently outperforms all comparative models, validating the effectiveness of the proposed CometDAGLM model in emotion cause recognition tasks. Models based on pre-trained language (such as BERT+Softmax, BGAT, Qwen, CometDAGLM, etc.) outperform rule-based models and traditional deep learning models like ConvMS-Memnet. This is likely because pre-trained language models, through self-supervised learning on unlabeled corpora, can learn general semantic knowledge and syntactic representations, thus providing better initial parameters and strong prior knowledge for downstream tasks. The proposed model, CometDAGLM, outperforms models like Baichuan and LLaMA. This is likely due to the synergistic effect of the proposed knowledge enhancement mechanism and data augmentation strategy, which improves the model's ability to identify emotion causes by supplementing semantic information and diversifying training samples. Under the fragment-level evaluation metric, CometDAGLM achieves higher recall (…). ) and F1 score ( The highest results were achieved across all metrics, directly demonstrating its effectiveness in the task of extracting emotional reasoning fragments. Furthermore, compared to ChatGLM, the best-performing large language model method, CometDAGLM achieved a significant improvement in the F1 score, and this improvement was statistically significant in the t-test (p-value less than 0.05). Compared to earlier methods and methods based on pre-trained language models, CometDAGLM exhibits superior performance, which may be related to its construction based on a large language model and its more powerful contextual semantic modeling capabilities. Among large language model-based methods, CometDAGLM achieved the highest F1 score. This may be because while large language models such as LLaMA, Baichuan, Qwen, and ChatGLM possess powerful contextual semantic modeling capabilities, these methods rely solely on the content of the text itself for reasoning, lacking the assistance of external common sense, making it difficult to fully identify the semantic information contained within the text. In addition, CometDAGLM further introduces knowledge enhancement mechanisms and data augmentation strategies on top of the semantic representation capabilities of large language models, enabling the model to learn richer text representations and effectively utilize semantic information supplemented by external common sense. Fragment-level metrics primarily measure the model's ability to extract complete emotional cause fragments, while word-level emotional cause evaluation metrics further demonstrate the model's fine-grained ability to identify emotional causes. From the word-level evaluation results, CometDAGLM achieved the highest F1 score, further validating the effectiveness of the model proposed in this invention on the emotional cause extraction task.

[0065] Table 2 Results of extracting fragment-level emotional causes

[0066] Table 3. Results of word-level emotion extraction

[0067] To analyze the effectiveness of the data augmentation and knowledge augmentation modules proposed in this paper, this section designs an ablation experiment based on the proposed method CometDAGLM. The comparison models are as follows: Full: This model is the CometDAGLM model proposed in this paper, which includes a knowledge augmentation module and a data augmentation module. Full-DA: This model removes data augmentation mechanisms and trains the model using only the original training data. This setting is used to evaluate the impact of data diversity on model performance.

[0068] Full-CS: This model removes the knowledge enhancement mechanism. This setting is used to analyze the impact of external semantic supplementary information on model performance.

[0069] Table 4 shows the results of the ablation experiment. The overall results show that the model performance decreased to varying degrees after removing any module, indicating that each module plays an important role in the task of extracting emotional cause fragments. Specifically, the following conclusions can be drawn: (1) When the data augmentation module was removed, the model's F1 score decreased from 0.6023 to 0.5911. Simultaneously, both precision and recall decreased, indicating the effectiveness of the data augmentation module, which helps to expand the diversity of training samples. (2) When the knowledge augmentation module was removed, the model performance further decreased, with the F1 score dropping to 0.5763. This performance decline may reflect that the lack of external semantic supplementary information limits the model's ability to identify the relationship between emotional causes. In summary, the ablation experiment results validated the effectiveness of each component module of CometDAGLM from different perspectives. The complete model maintained a better performance in terms of precision and recall, and each module collectively improved the model's performance in the task of extracting emotional causes.

[0070] Table 4 Results of the ablation experiment

[0071] This section primarily verifies the impact of different types of common sense knowledge on the recognition of emotion-related fragments. Five common sense relationships—xEffect, xIntent, xNeed, xReact, and xWant—generated by COMET are introduced into the ChatGLM model to analyze the influence of different types of common sense on model performance. The comparison models are as follows: No_CS: This means that no external common sense knowledge is introduced into the ChatGLM model.

[0072] CS_xEffect: Only adds the "xEffect" common sense and evaluates the impact of "xEffect" on model performance.

[0073] CS_xIntent: Only add the "xIntent" common sense and evaluate the impact of "xIntent" on model performance.

[0074] CS_xNeed: Only add the "xNeed" common sense and evaluate the impact of "xNeed" on model performance.

[0075] CS_xReact: Only adds "xReact" common sense to evaluate the impact of "xReact" on model performance.

[0076] CS_xWant: Only add the common sense "xWant" to evaluate the impact of "xWant" on model performance.

[0077] Full_CS: Incorporates five common sense principles to evaluate the combined impact of these principles on model performance.

[0078] Table 5. Impact of different types of common sense knowledge on model performance

[0079] Table 5 shows the experimental results of extracting emotional cause fragments using the ChatGLM large language model based on the method of the present invention after introducing different types of common sense knowledge. Overall, the introduction of external common sense improved the model performance to varying degrees, verifying that supplementing the text with common sense knowledge helps in the extraction of emotional cause fragments. Different types of knowledge played different roles in the task of extracting emotional causes. Specifically, (1) after introducing two types of knowledge, xEffect reflecting the possible consequences of an event and xIntent reflecting the motivation for behavior, respectively, the model The values ​​increased by 1.2% and 0.98% respectively. This may be because these two types of common sense help the model establish semantic connections between "behavior-consequence-emotional response", enabling the model to better distinguish between emotion-related background events and the real emotional causes, thereby improving the ability to identify emotional causes. (2) After introducing three types of common sense knowledge, xNeed, xReact and xWant, the model's The scores reached 0.5901 and 0.5874 respectively. This may be because the three types of knowledge, xNeed, xReact, and xWant, supplement the internal semantic information in the process of emotion formation from the three stages of individual state before the event, emotional reaction after the event, and subsequent behavioral tendency. After introducing these common sense related to changes in individual state, the model can be assisted in understanding text information, thereby improving the performance of emotional cause segment recognition. (3) When all types of common sense knowledge are introduced, the model performance is better than the model that introduces only one type of knowledge. The value reached 0.5911. This indicates that different types of common sense can provide different types of information, and multiple types of common sense knowledge can provide more complete semantic clues, thereby improving the overall recognition ability of the model.

[0080] The method in this invention generates various types of external common sense knowledge by introducing the COMET common sense knowledge base, semantically supplementing the behavioral consequences and individual state changes related to emotion formation in the text. Simultaneously, it combines data augmentation strategies based on a large language model to expand the expressive diversity of training samples, thereby improving the model's adaptability to diverse expressions. Furthermore, efficient fine-tuning of the large language model is achieved through low-rank adaptation (LoRA) technology. Comparative experiments with multiple baseline models show that CometDAGLM achieves superior results in experimental metrics, validating the effectiveness of the proposed model in the task of extracting emotional cause fragments.

[0081] Based on the same inventive concept, this application also provides an emotional cause fragment recognition device that can execute the processing flow provided in an embodiment of an emotional cause fragment recognition method.

[0082] This application provides an emotional cause fragment recognition device, which can be used to execute any of the emotional cause fragment recognition and segmentation methods in the above embodiments. Its implementation principle and technical effects are similar and will not be repeated here. The device provided in this application can be specifically used to execute the scheme provided in the corresponding method embodiments; its specific functions and achievable technical effects will not be repeated here.

[0083] It should be noted that the division of the various modules in the above device is merely a logical functional division. In actual implementation, they can be fully or partially integrated into a single physical entity, or they can be physically separated. Furthermore, these modules can be implemented entirely in software via processing element calls; they can be fully implemented in hardware; or some modules can be implemented by processing element calls to software, while others are implemented in hardware. Additionally, these modules can be fully or partially integrated together, or implemented independently. The processing element mentioned here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each of the above modules can be completed through the integrated logic circuits in the hardware of the processor element or through software instructions.

[0084] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 3 As shown, the electronic device may include: a processor 21, a memory 22, and computer program instructions stored in the memory 22 and executable on the processor 21. When the processor 21 executes the computer program instructions, it implements a method for identifying emotional reason fragments provided in any of the foregoing embodiments.

[0085] Optionally, the various components of the electronic device can be connected via a system bus.

[0086] The memory 22 can be a separate memory unit or a memory unit integrated into the processor. The number of processors can be one or more.

[0087] Optionally, the electronic device may also include a communication interface for interacting with other devices.

[0088] It should be understood that the processor 21 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.

[0089] The system bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The system bus can be divided into address bus, data bus, control bus, etc. For ease of representation, only one thick line is used in the diagram, but this does not indicate that there is only one bus or one type of bus. Memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.

[0090] All or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a readable memory. When the program is executed, it performs the steps of the above method embodiments; and the aforementioned memory (storage medium) includes: read-only memory (ROM), RAM, flash memory, hard disk, solid-state drive, magnetic tape, floppy disk, optical disk, and any combination thereof.

[0091] The electronic device provided in this application embodiment can be used to execute an emotional reason fragment recognition method provided in any of the above method embodiments. Its implementation principle and technical effect are similar, and will not be described again here.

[0092] This application provides a computer-readable storage medium storing computer execution instructions. When the computer execution instructions are run on a computer, the computer executes the aforementioned method for identifying emotional reason fragments.

[0093] The aforementioned computer-readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory, electrically erasable programmable read-only memory, erasable programmable read-only memory, programmable read-only memory, read-only memory, magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.

[0094] Optionally, a readable storage medium can be coupled to the processor, enabling the processor to read information from and write information to the readable storage medium. Alternatively, the readable storage medium can be an integral part of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.

[0095] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.

Claims

1. A method for identifying fragments indicating emotional causes, characterized in that, The method for identifying emotional cause fragments includes: The system receives user text input containing emotional expressions and corresponding emotional fragments, and performs semantic analysis on the text using a large language model that is fine-tuned based on instructions to identify the text fragments that trigger the emotions. An external common sense knowledge enhancement mechanism is introduced. By calling the common sense reasoning model, multi-dimensional social and psychological common sense is generated for the input text. The generated common sense is then semantically filtered based on a large language model. The filtered common sense knowledge is then integrated into the model input in a preset format. Simultaneously, a self-feedback data augmentation mechanism is adopted to generate diverse expression samples based on the original training samples through various text generation strategies. The generated samples undergo dual checks for label integrity and semantic rationality, and samples that fail the checks are iteratively rewritten and repaired. Through the synergistic effect of the common sense knowledge enhancement mechanism and the data augmentation mechanism, the parameters of the large language model are efficiently fine-tuned, enabling the model to accurately identify emotional reason fragments by combining text content and external common sense knowledge. The self-feedback data augmentation mechanism includes a data generation module, a data checking module, and a feedback and rewriting module. The data generation module generates diverse expression samples based on the original training samples through various text generation strategies. The data checking module performs dual checks on the generated samples for label integrity and semantic rationality. The feedback and rewriting module iteratively rewrites and repairs samples that fail the checks. Among these, the semantic relevance filtering of generated common sense based on a large language model specifically includes: The input text, emotional fragments, and generated common sense knowledge are combined into prompt words and input into the large language model. The large language model then judges the relevance of the common sense knowledge to the current text context based on its deep understanding of semantics. The strictness of filtering is controlled by a preset relevance threshold. When the relevance confidence score output by the large language model is greater than the threshold, it is determined to be valid common sense knowledge.

2. The method for identifying emotional cause fragments according to claim 1, characterized in that, The common sense reasoning model is the COMET model, and the generated common sense knowledge includes the following five types: possible intentions of the actor xIntent, potential results of the event xEffect, possible preconditions for the occurrence of the event xNeed, emotional or psychological reaction of the party xReact, and actions that the subject may want to take after the event occurs xWant.

3. The method for identifying emotional cause fragments according to claim 2, characterized in that, The various text generation strategies include: Synonym substitution strategies for using synonyms or shifting the tone of emotional expressions in the original text; A contextual change strategy that keeps the core events unchanged while modifying peripheral information such as time, location, and people; A boundary perturbation strategy that involves adding or deleting words in the causal segment that do not affect the core semantics to perturb the causal boundary.

4. The method for identifying emotional cause fragments according to claim 3, characterized in that, The dual checks on tag integrity and semantic reasonableness include: Tag integrity check: Determines whether the generated text completely contains the corresponding emotion fragments and reason tags; Semantic plausibility check assesses whether there is a consistent and natural semantic connection between the generated text, emotion, and reason.

5. The method for identifying emotional cause fragments according to claim 3, characterized in that, The iterative rewriting and repair of samples that fail the check specifically includes: Samples that fail the inspection are input into the generation prompt based on the label information for regeneration. The repaired samples continue to pass through the data inspection module, forming a continuous iterative loop until the generated samples meet the quality inspection standards.

6. The method for identifying emotional cause fragments according to claim 1, characterized in that, The common sense knowledge enhancement mechanism and the data augmentation mechanism are executed in parallel during model training. The common sense knowledge generated by the common sense enhancement is directly used as additional information for the data augmentation samples.

7. A device for recognizing fragments of emotional causes, characterized in that, The emotional cause fragment recognition device is configured to perform the emotional cause fragment recognition method according to any one of claims 1 to 6.

8. A system for recognizing fragments of emotional causes, characterized in that, The emotional cause fragment recognition system is configured to perform the emotional cause fragment recognition method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Text emotion deep reason identification method and device based on common sense reasoning

    CN119179754A

  • Dialogue emotion recognition model determination method, dialogue emotion recognition method and dialogue emotion recognition device

    CN121212327A