Dialogue emotion prediction method and system based on emotion dynamics
By using a method based on sentiment dynamics and utilizing BERT, BiGRU, and CRF structures to process conversation emotions, we solved the problem of poor interpretability of prediction results in existing technologies and achieved conversation emotion prediction with more scientific theoretical support.
Patent Information
- Application Number
- CN202210813349.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-12
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2042-07-12
AI Technical Summary
Existing technologies lack the support of psychological emotion theory in conversation emotion prediction, resulting in poor interpretability of prediction results.
A method based on emotion dynamics is adopted to obtain and preprocess historical conversations through the BERT pre-training model, BiGRU structure, attention weighting and conditional random field (CRF) structure, obtain global inference vectors and emotion dynamic vectors, perform emotion sequence labeling, and consider the damping and contagiousness of speaking roles and emotions.
The interpretability of sentiment prediction results is improved, and more reasonable prediction results are obtained by modeling the persistence and contagion of emotions.
Smart Images

Figure CN115374794B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of emotion prediction, and in particular to a method, system, storage medium and electronic device for predicting dialogue emotion based on emotion dynamics. Background Art
[0002] Affective forecasting is the prediction of future emotions (emotional states). As a process that influences preferences, decisions, and behavior, affective forecasting is studied by psychologists and economists and has a wide range of applications.
[0003] Currently, emotion modeling methods in conversations can be divided into two types according to the modeling object: one is not modeling the speaking role (i.e., not distinguishing the speaker role), and it is assumed that the speaker's own influence and the influence of others in the conversation are of equal importance. When using this modeling method to complete conversation emotion detection or prediction tasks, it mainly relies on analyzing the potential information in the conversation content; the other is modeling the speaking role (i.e., distinguishing the speaker role). This modeling method of distinguishing the speaker role believes that the speaker's own influence and the influence of others have different influences, and therefore models them separately.
[0004] However, the existing technical solutions were not designed based on relevant psychological theories. That is, most of them analyzed the content of the conversation intuitively and ignored the psychological emotion theory. The lack of support from psychological emotion theory will make the emotion prediction results less interpretable. Summary of the Invention
[0005] (1) Technical problems solved
[0006] In response to the shortcomings of the existing technology, the present invention provides a conversation emotion prediction method, system, storage medium and electronic device based on emotion dynamics, which solves the technical problem of poor interpretability of emotion prediction results.
[0007] (2) Technical solution
[0008] To achieve the above objectives, the present invention is implemented through the following technical solutions:
[0009] A method for predicting conversation emotions based on emotion dynamics, comprising:
[0010] S1. Obtain and preprocess the historical conversations to be predicted;
[0011] S2. Obtain a global inference vector based on the preprocessed historical conversations;
[0012] S3. Based on the global inference vector, perform attention weighting for each historical dialogue;
[0013] S4. Obtain the emotional dynamic vector based on the weighted historical conversations;
[0014] S5. According to the emotion dynamic vector, obtain the globally optimal emotion sequence and determine the emotion prediction result.
[0015] Preferably, the sentence vector obtained by embedding the historical conversation using the BERT pre-training model in S1 is
[0016]
[0017] Among them, the roles in the historical dialogue are represented as: Speakers = {A, B};
[0018] are the sentence vectors corresponding to the 1st, 2nd, ..., tth sentences respectively.
[0019] Preferably, the BiGRU structure is used in S2 to obtain the global inference vector, specifically including:
[0020]
[0021] Among them, H global is the hidden state of the final output of BiGRU, which serves as the global inference vector.
[0022] Preferably, the step S3 performs attention weighting for each historical conversation, specifically including:
[0023]
[0024]
[0025] Among them, α i h i The attention weight of h i In step S2, the BiGRU structure is used to The hidden state obtained by encoding h i Dimensions, h i The transpose of .
[0026] Preferably, obtaining the emotion dynamic vector in S4 specifically includes:
[0027]
[0028] Among them, α t-1 , α t-2 is the attention weight of the t-1 and t-2 sentences. The t-2 sentence has the same speaking role as the t sentence, but different from the speaking role of the t-1 sentence. t-2 is the weakening coefficient of the current speaking role;
[0029] Finally, the emotional dynamic vector corresponding to each sentence is generated
[0030] Preferably, the conditional random field (CRF) structure is used for labeling in S5 to obtain the globally optimal emotion sequence, which specifically includes:
[0031]
[0032] in, For the final emotional sequence; is the task objective, that is, the final emotional label to be predicted.
[0033] A conversation emotion prediction system based on emotion dynamics, comprising:
[0034] The preprocessing module is used to obtain and preprocess the historical conversations to be predicted;
[0035] The global inference module is used to obtain the global inference vector based on the preprocessed historical conversations;
[0036] The attention allocation module is used to weight the attention of each historical conversation based on the global inference vector;
[0037] The emotional dynamics module is used to obtain the emotional dynamics vector based on the weighted historical conversations;
[0038] The sequence labeling module is used to obtain the globally optimal emotion sequence based on the emotion dynamic vector and determine the emotion prediction result.
[0039] A storage medium stores a computer program for predicting conversation emotions based on emotion dynamics, wherein the computer program enables a computer to execute the conversation emotion prediction method described above.
[0040] An electronic device, comprising:
[0041] one or more processors;
[0042] Memory; and
[0043] One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the programs including instructions for executing the conversation emotion prediction method as described above.
[0044] (3) Beneficial effects
[0045] The present invention provides a method, system, storage medium, and electronic device for predicting conversational emotions based on emotion dynamics. Compared with existing technologies, the present invention has the following advantages:
[0046] The present invention involves acquiring and preprocessing historical conversations to be predicted; obtaining a global inference vector based on the preprocessed historical conversations; assigning attention weights to each historical conversation sentence based on the global inference vector; obtaining an emotion dynamic vector based on the weighted historical conversations; and obtaining a globally optimal emotion sequence based on the emotion dynamic vector to determine the emotion prediction result. Modeling is based on Gross's emotion regulation theory, which is scientifically supported by psychological theory, making the model's predictions more interpretable. The roles in the conversation are differentiated, modeling the damping (persistence) and contagiousness of emotions. The task of predicting conversation emotions is transformed into a task of labeling conversation emotion sequences, analyzing the transfer relationships between emotions to make the predictions more reasonable. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] 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 or the description of the prior art. 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.
[0048] Figure 1 A flowchart of a method for predicting conversation emotions based on emotion dynamics is provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0049] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention are clearly and completely described. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0050] The embodiments of the present application solve the technical problem of poor interpretability of emotion prediction results by providing a conversation emotion prediction method, system, storage medium and electronic device based on emotion dynamics.
[0051] The technical solution in the embodiments of the present application is to solve the above technical problems, and the overall idea is as follows:
[0052] The present invention comprises acquiring and preprocessing historical conversations to be predicted; obtaining a global inference vector based on the preprocessed historical conversations; assigning attention weights to each sentence of the historical conversation based on the global inference vector; obtaining an emotion dynamic vector based on the weighted historical conversations; and obtaining a globally optimal emotion sequence based on the emotion dynamic vector to determine the emotion prediction result. Modeling is based on Gross's emotion regulation theory, which is scientifically supported by psychological theory and makes the model's prediction results more interpretable. The roles in the conversation are differentiated, modeling the damping (persistence) and contagiousness of emotions. The task of predicting conversation emotions is transformed into a task of labeling conversation emotion sequences, analyzing the transfer relationships between emotions to make the prediction results more reasonable.
[0053] Among them, Gross's emotion regulation theory is a classic evaluation theory, which includes situation selection, situation modification, attention allocation, cognitive change, and response adjustment.
[0054] 1) Situational selection refers to individuals approaching or avoiding certain people, events, and situations to regulate their emotions.
[0055] 2) Situation modification refers to coping with problems or exercising initial control over emotional events in an effort to change the situation.
[0056] 3) Attention allocation refers to focusing on one or more aspects of the many aspects of a situation, including trying to focus attention on a specific topic or task.
[0057] 4) Cognitive change refers to choosing possible explanations for the meaning of emotional events.
[0058] 5) Response adjustment refers to influencing the trend of emotional response after the emotion has been aroused and reducing the behavioral expression of the emotional response.
[0059] In order to better understand the above technical solution, the above technical solution will be described in detail below with reference to the accompanying drawings and specific implementation methods.
[0060] Example:
[0061] like Figure 1 As shown, an embodiment of the present invention provides a method for predicting conversation emotions based on emotion dynamics, comprising:
[0062] S1. Obtain and preprocess the historical conversations to be predicted;
[0063] S2. Obtain a global inference vector based on the preprocessed historical conversations;
[0064] S3. Based on the global inference vector, perform attention weighting for each historical dialogue;
[0065] S4. Obtain the emotional dynamic vector based on the weighted historical conversations;
[0066] S5. According to the emotion dynamic vector, obtain the globally optimal emotion sequence and determine the emotion prediction result.
[0067] The embodiment of the present invention is modeled based on Gross's emotion regulation theory, which is supported by scientific psychological theories and makes the model's prediction results more interpretable. It distinguishes the roles in the conversation and models the damping (persistence) and contagiousness of emotions. It transforms the conversation emotion prediction task into a conversation emotion sequence labeling task and analyzes the transfer relationship between emotions to make the prediction results more reasonable.
[0068] Next, we will introduce the various steps of the above technical solution in detail based on the specific content:
[0069] First, it's important to note that when analyzing emotions in conversations, if the speaker's roles are not distinguished, the persistence and contagion of emotions are overlooked. Emotional persistence refers to the persistence of the speaker's own emotions throughout a conversation, maintaining their own emotions. Emotional contagion, on the other hand, refers to the influence of others on the speaker's emotions, contagiously affecting them. Therefore, the embodiments of the present invention model the roles in a conversation, effectively modeling the damping and contagion of emotions.
[0070] In step S1, historical conversations to be predicted are acquired and preprocessed.
[0071] In this step, the sentence vectors obtained by embedding the historical conversations using the BERT pre-training model are
[0072]
[0073] Among them, the roles in the historical dialogue are represented as: Speakers = {A, B};
[0074] are the sentence vectors corresponding to the 1st, 2nd, ..., tth sentences respectively;
[0075] In this embodiment of the present invention, the embedding dimension H=521 is selected.
[0076] In step S2, a global inference vector is obtained based on the preprocessed historical dialogue.
[0077] In this step, the BiGRU structure is used to obtain the global inference vector, which includes:
[0078]
[0079] Among them, H global is the hidden state of the final output of BiGRU, which serves as the global inference vector.
[0080] In step S3, attention weighting is performed for each sentence history and dialogue based on the global inference vector.
[0081] In this step, attention weighting is performed for each historical dialogue, specifically including:
[0082]
[0083] Among them, α i h i The attention weight of h i In step S2, the BiGRU structure is used to The hidden state obtained by encoding h i Dimensions, h i The transpose of .
[0084] The embodiment of the present invention introduces an attention allocation mechanism to model the focus of the speaking character on the topic content during the dialogue process, which is more in line with objective common sense.
[0085] In step S4, an emotional dynamic vector is obtained based on the weighted historical conversations.
[0086] This step considers the dynamic changes in emotion during a conversation and designs an emotion dynamics unit for updating the emotional state. This unit considers the influence of attention distribution and emotion damping during a conversation. Ultimately, the emotion dynamics unit models the emotion latent vector of the historical conversation, which represents the emotional changes between the two parties during the conversation. Emotion damping refers to the degree to which the speaker strives to maintain their current emotional state throughout the conversation. A damping coefficient β is designed to model this emotional damping.
[0087] Obtain emotional dynamic vectors, including:
[0088]
[0089] Among them, α t-1 , α t-2 is the attention weight of the t-1 and t-2 sentences. The t-2 sentence has the same speaking role as the t sentence, but different from the speaking role of the t-1 sentence. t-2 is the weakening coefficient of the current speaking role;
[0090] Finally, the emotional dynamic vector corresponding to each sentence is generated
[0091] In step S5, the globally optimal emotion sequence is obtained according to the emotion dynamic vector, and the emotion prediction result is determined.
[0092] In this step, the conditional random field (CRF) structure is used for labeling to obtain the globally optimal emotion sequence, which specifically includes:
[0093]
[0094] in For the final emotional sequence; is the task objective, that is, the final emotional label to be predicted.
[0095] Among them, CRF uses the Viterbi algorithm for sequence prediction. The calculation process of CRF can be formalized as follows:
[0096]
[0097] This embodiment of the present invention transforms the task of predicting conversations into the task of modeling the emotion sequences within a conversation. It introduces a conditional random field (CRF) and uses CRF for inference, ultimately obtaining a globally optimal sequence. This more accurately models the emotion transition process, resulting in more precise predictions. Compared to other prediction methods based on conversation sequence, CRF's predictions consider the relationships between emotion labels in nearby sentences, which helps model emotion consistency (similar emotions are more likely to appear adjacent to each other than dissimilar ones).
[0098] An embodiment of the present invention provides a conversation emotion prediction system based on emotion dynamics, comprising:
[0099] The preprocessing module is used to obtain and preprocess the historical conversations to be predicted;
[0100] The global inference module is used to obtain the global inference vector based on the preprocessed historical conversations;
[0101] The attention allocation module is used to weight the attention of each historical conversation based on the global inference vector;
[0102] The emotional dynamics module is used to obtain the emotional dynamics vector based on the weighted historical conversations;
[0103] The sequence labeling module is used to obtain the globally optimal emotion sequence based on the emotion dynamic vector and determine the emotion prediction result.
[0104] An embodiment of the present invention provides a storage medium storing a computer program for conversation emotion prediction based on emotion dynamics, wherein the computer program enables a computer to execute the conversation emotion prediction method described above.
[0105] An embodiment of the present invention further provides an electronic device, including:
[0106] one or more processors;
[0107] Memory; and
[0108] One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the programs including instructions for executing the conversation emotion prediction method as described above.
[0109] It is understandable that the conversation emotion prediction system based on emotion dynamics, storage medium and electronic device provided in the embodiments of the present invention correspond to the conversation emotion prediction method based on emotion dynamics provided in the embodiments of the present invention. The explanations, examples and beneficial effects of the relevant contents can refer to the corresponding parts in the conversation emotion prediction method and will not be repeated here.
[0110] In summary, compared with the existing technology, the present invention has the following beneficial effects:
[0111] 1. The embodiment of the present invention is modeled based on Gross's emotion regulation theory, which is supported by scientific psychological theories and makes the model's prediction results more interpretable. It distinguishes the roles in the conversation and models the damping (persistence) and contagiousness of emotions. It transforms the conversation emotion prediction task into a conversation emotion sequence labeling task and analyzes the transfer relationship between emotions to make the prediction results more reasonable.
[0112] 2. The embodiment of the present invention models the characters in the dialogue, which can effectively model the damping and infectiousness of emotions.
[0113] 3. The embodiment of the present invention introduces an attention allocation mechanism to model the focus of the speaking character on the topic content during the conversation, which is more in line with objective common sense.
[0114] 4. This embodiment of the present invention transforms the task of predicting conversations into the task of modeling the emotion sequences within a conversation. It introduces a conditional random field (CRF) and uses CRF for inference, ultimately obtaining a globally optimal sequence. This more accurately models the emotion transition process, resulting in more precise predictions. Compared to other prediction methods based on conversation sequence, CRF's predictions consider the relationships between emotion labels in nearby sentences, which helps model emotion consistency (similar emotions are more likely to appear adjacent to each other than dissimilar emotions).
[0115] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.
[0116] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A method for predicting conversation emotions based on emotion dynamics, characterized by: include: S1. Obtain and preprocess the historical conversations to be predicted; S2. Obtain a global inference vector based on the preprocessed historical conversations; S3. Based on the global inference vector, perform attention weighting for each historical dialogue; S4. Obtain the emotional dynamic vector based on the weighted historical conversations; S5. Obtain the globally optimal emotion sequence based on the emotion dynamic vector and determine the emotion prediction result; In S1, the sentence vectors are obtained by embedding the historical conversation using the BERT pre-training model. Among them, the roles in the historical dialogue are represented as: Speakers = {A, B}; are the sentence vectors corresponding to the 1st, 2nd, ..., tth sentences respectively; the BiGRU structure is used in S2 to obtain the global inference vector, specifically including: Among them, H global is the hidden state of the final output of BiGRU, which serves as the global inference vector. In S3, attention weighting is performed for each sentence of historical dialogue, specifically including: Among them, α i h i The attention weight of h i In step S2, the BiGRU structure is used to The hidden state obtained by encoding h i Dimensions, h i The transpose of The acquisition of the emotion dynamic vector in S4 specifically includes: Among them, α t-1 , α t-2 is the attention weight of the t-1 and t-2 sentences. The t-2 sentence has the same speaking role as the t sentence, but different from the speaking role of the t-1 sentence. t-2 is the weakening coefficient of the current speaking role; Finally, the emotional dynamic vector corresponding to each sentence is generated In S5, the conditional random field (CRF) structure is used for labeling to obtain the globally optimal emotion sequence, which specifically includes: in, For the final emotional sequence; is the task objective, that is, the final emotional label to be predicted.
2. A conversation emotion prediction system based on emotion dynamics, characterized by: The method for predicting conversation emotions according to claim 1 comprises: The preprocessing module is used to obtain and preprocess the historical dialogue to be predicted; the global inference module is used to obtain the global inference vector based on the preprocessed historical dialogue; the attention allocation module is used to weight the attention of each historical dialogue sentence based on the global inference vector; The emotional dynamics module is used to obtain the emotional dynamics vector based on the weighted historical conversations; the sequence labeling module is used to obtain the globally optimal emotional sequence based on the emotional dynamics vector and determine the emotional prediction result.
3. A storage medium, characterized in that: It stores a computer program for predicting conversation emotions based on emotion dynamics, wherein the computer program enables a computer to execute the conversation emotion prediction method according to claim 1.
4. An electronic device, characterized in that: include: one or more processors; Memory; as well as One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the programs including instructions for executing the conversation emotion prediction method according to claim 1.
Citation Information
Patent Citations
Personalized human-computer emotional session system
CN108846073A
Emotional dialogue generation method and device and emotional dialogue model training method and device
CN111897933A