Multi-round dialogue emotion reasoning method and system based on emotion dynamics

Through the multi-round dialogue emotion reasoning method based on emotion dynamics, the Transformer and GRU networks are used to obtain emotion features and dynamic transfer, which solves the accuracy problem of multi-round dialogue emotion reasoning and achieves higher-precision emotion prediction.

CN115878776BActive Publication Date: 2025-09-23HEFEI UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211683986.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-27
Publication Date
2025-09-23
Estimated Expiration
2042-12-27

AI Technical Summary

Technical Problem

Existing multi-round dialogue emotion reasoning technology has low accuracy, especially the failure to effectively utilize emotion regulation theory to support the model, resulting in inaccurate emotion prediction.

Method used

A multi-round dialogue emotion reasoning method based on emotion dynamics is adopted. The global context vector is obtained through emotion feature extraction and Transformer neural network. The emotion damping vector is obtained by combining a recurrent neural network with a damping gate. The GRU is used to model emotion transfer. Finally, emotion prediction is performed through the fully connected layer and the softmax layer.

Benefits of technology

It improves the accuracy of emotional reasoning in multi-round dialogues, takes into account the dynamic flow of emotions and the user's own emotional expression during interaction, constructs an interpretable deep learning model, and improves the accuracy of emotional prediction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115878776B_ABST
    Figure CN115878776B_ABST
Patent Text Reader

Abstract

The present invention provides a multi-round dialogue emotion reasoning method and system based on emotion dynamics, which relates to the technical field of dialogue emotion reasoning. The present invention first extracts emotion features from dialogue sentences to obtain coded sentences, and uses a Transformer neural network to obtain a global context vector based on the coded sentences; then, based on the coded sentences of the user whose emotion is to be inferred at the previous moment, a recurrent neural network with a damping gate is used to obtain the emotion damping vector of the user whose emotion is to be inferred at the previous moment, and at the same time, based on the global context vector and the coded sentences of the user whose emotion is to be inferred at the previous moment, the global emotion transfer vector of the user during the dialogue is obtained; finally, the global context vector, the global emotion transfer vector, and the emotion damping vector are connected and sent to the fully connected layer and the softmax layer in sequence to obtain the emotion of the user whose emotion is to be inferred. Compared with the existing technology, the present invention can accurately obtain the emotion reasoning results in multiple rounds of user dialogues.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of emotional reasoning technology, and in particular to a multi-round dialogue emotional reasoning method and system based on emotional dynamics. Background Art

[0002] With the growth of conversational data from social media, online forums, and other platforms, conversational sentiment analysis has garnered increasing attention in recent years. Existing work on conversational sentiment analysis primarily focuses on emotion recognition. Given a sentence or utterance, sentiment analysis is performed based on the context of the conversation. Emotional inference, on the other hand, aims to predict a user's next emotion during a conversation without knowing their reaction. However, current emotion recognition models lack this ability to infer emotions.

[0003] Initial emotion reasoning tasks used only two rounds as a context, which doesn't fit the real-world scenarios of multi-round conversations and no longer meets practical needs. Currently, researchers are studying emotion reasoning tasks in multi-round conversations. These reasoning tasks can be categorized into two main types: models that don't consider the dynamic interaction of emotions within the conversation, and models that consider the dynamic evolution of emotions. The former typically achieves emotion reasoning by learning the mapping between conversation context and response emotion, or by first predicting responses based on the conversation history and analyzing the emotion of the responses. However, this approach fails to consider the dynamic nature of emotions between the two parties in a conversation. The latter models the dynamic evolution of emotions to infer the emotional response at the next moment, making the reasoning process more intuitive and interpretable.

[0004] However, although the above-mentioned method based on dynamic emotion modeling takes into account the emotional impact brought about by the interaction between the two parties in the emotional dialogue process, it does not systematically use emotion regulation theory to support the model, so it cannot accurately infer the user's future emotions. Summary of the Invention

[0005] (1) Technical problems solved

[0006] In response to the shortcomings of the existing technology, the present invention provides a multi-round dialogue emotion reasoning method and system based on emotion dynamics, which solves the problem of low accuracy of the existing multi-round dialogue emotion reasoning technology.

[0007] (2) Technical solution

[0008] To achieve the above objectives, the present invention is implemented through the following technical solutions:

[0009] In a first aspect, the present invention further proposes a multi-round dialogue emotion reasoning method based on emotion dynamics, the method comprising:

[0010] Extract emotional features from conversation sentences in the user's conversation history to obtain coded sentences;

[0011] Obtaining a global context vector using a Transformer neural network based on the encoded sentence;

[0012] Based on the encoded sentence of the user whose emotion is to be inferred at the previous moment, a recurrent neural network with a damping gate is used to obtain the emotion damping vector of the user whose emotion is to be inferred at the previous moment;

[0013] Obtaining the user's global emotion transfer vector during the conversation based on the global context vector and the encoded sentence of the user's emotion to be inferred at the previous moment;

[0014] The global context vector, the global emotion transfer vector, and the emotion damping vector are connected and sent to the fully connected layer and the softmax layer in sequence to obtain the emotion of the user to be inferred.

[0015] Preferably, extracting emotional features from conversation sentences in the user conversation history to obtain coded sentences includes:

[0016] The conversation sentences in the user's conversation history are fed into the BERT model for encoding to obtain the corresponding encoded sentence representation, which can be described by the formula:

[0017] u1,u2,...,u t =BERT(X1,X2,...,X t )

[0018] Among them, u1,u2,...,u t represents the relevant encoded sentence representation after BERT encoding; X1, X2,…, X t is the conversation sentence in the conversation history; H is the dimension of BERT output vector.

[0019] Preferably, obtaining a global context vector based on the encoded sentence using a Transformer neural network includes:

[0020] The sequence of encoded sentences is fed into the multi-head attention mechanism and forward feedback network encoding in the Transformer neural network to obtain a global context vector; it can be expressed as:

[0021] c t =FNN(MultiHead(U,U,U))

[0022] Among them, U=[u1,u2,...,u t ] represents the sequence of coded sentences; c trepresents the global context vector; FFN(x) represents the activation function.

[0023] Preferably, the method of obtaining the emotion damping vector of the user whose emotion is to be inferred at the previous moment by using a recurrent neural network with a damping gate added thereto based on the encoded sentence of the user whose emotion is to be inferred at the previous moment comprises:

[0024]

[0025]

[0026] Among them, q t-1 Represents the user's emotion damping vector at the last moment; u t-1 Indicates the user's speech at the last moment; q t-3 Represents the user's emotional damping vector at the last moment; Represents the intermediate value used to calculate the emotional damping vector; W is the weight parameter in the neural network; b is the bias parameter; Indicates the product of the corresponding position elements of two matrices.

[0027] Preferably, the connecting of the global context vector, the global emotion transfer vector, and the emotion damping vector and sequentially sending them to the fully connected layer and the softmax layer to obtain the emotion of the user to be inferred includes:

[0028] o t =[s t ,q t-1 ,c t ]

[0029]

[0030] Among them, t represents the user's emotional expression at time t; s t represents the global sentiment transfer vector; q t-1 represents the user's emotion damping vector at the last moment; c t represents the global context vector; Represents the probability distribution of the user's final emotion category; represents the M utterances in the conversation between users A and B; W o is the weight parameter; b o is the bias parameter.

[0031] In a second aspect, the present invention further proposes a multi-round dialogue emotion reasoning system based on emotion dynamics, the system comprising:

[0032] The emotional feature extraction module is used to extract emotional features from conversation sentences in the user's conversation history to obtain coded sentences;

[0033] A contextual sentiment attention module for obtaining a global context vector based on the encoded sentence using a Transformer neural network;

[0034] An emotion damping module is used to obtain the emotion damping vector of the user whose emotion is to be inferred at the previous moment by using a recurrent neural network with a damping gate added based on the encoded sentence of the user whose emotion is to be inferred at the previous moment;

[0035] An emotion transfer module is used to obtain the global emotion transfer vector of the user during the conversation based on the global context vector and the encoded sentence of the user whose emotion is to be inferred at the previous moment;

[0036] The emotion reasoning module is used to connect the global context vector, the global emotion transfer vector, and the emotion damping vector and send them to the fully connected layer and the softmax layer in sequence to obtain the emotion of the user to be inferred.

[0037] Preferably, the emotional feature extraction module extracts emotional features from conversation sentences in the user conversation history to obtain coded sentences, including:

[0038] The conversation sentences in the user's conversation history are fed into the BERT model for encoding to obtain the corresponding encoded sentence representation, which can be described by the formula:

[0039] u1,u2,…,u t =BERT(X1,X2,…,X t )

[0040] Among them, u1,u2,…,u t represents the relevant encoded sentence representation after BERT encoding; X1, X2,…, X t is the conversation sentence in the conversation history; H is the dimension of BERT output vector.

[0041] Preferably, the context emotion attention module obtains a global context vector based on the encoded sentence using a Transformer neural network, including:

[0042] The sequence of encoded sentences is fed into the multi-head attention mechanism and forward feedback network encoding in the Transformer neural network to obtain a global context vector; it can be expressed as:

[0043] c t =FNN(MultiHead(U,U,U))

[0044] Among them, U=[u1,u2,...,u t ] represents the sequence of coded sentences; c trepresents the global context vector; FFN(x) represents the activation function.

[0045] Preferably, the emotion damping module obtains the emotion damping vector of the user whose emotion is to be inferred at the last moment based on the coded sentence of the user whose emotion is to be inferred at the last moment by using a recurrent neural network with a damping gate added, including:

[0046]

[0047]

[0048] Among them, q t-1 Represents the user's emotion damping vector at the last moment; u t-1 Indicates the user's speech at the last moment; q t-3 Represents the user's emotional damping vector at the last moment; Represents the intermediate value used to calculate the emotional damping vector; W is the weight parameter in the neural network; b is the bias parameter; Indicates the product of the corresponding position elements of two matrices.

[0049] Preferably, the emotion inference module connects the global context vector, the global emotion transfer vector, and the emotion damping vector and sequentially sends them to the fully connected layer and the softmax layer to obtain the emotion of the user to be inferred.

[0050] ot=[s t ,q t-1 ,c t ]

[0051]

[0052] Among them, t represents the user's emotional expression at time t; s t represents the global sentiment transfer vector; q t-1 represents the user's emotion damping vector at the last moment; c t represents the global context vector; Represents the probability distribution of the user's final emotion category; represents the M utterances in the conversation between users A and B; W o is the weight parameter in the neural network; b o is the bias parameter.

[0053] (3) Beneficial effects

[0054] This invention provides a multi-round dialogue emotion reasoning method and system based on emotion dynamics. Compared with the existing technology, it has the following advantages:

[0055] 1. The present invention first extracts emotional features from the conversation sentences in the user's conversation history to obtain coded sentences, and uses the Transformer neural network to obtain the global context vector based on the coded sentences; then, based on the coded sentences of the emotional user to be inferred at the previous moment, a recurrent neural network with a damping gate is used to obtain the emotional damping vector of the emotional user to be inferred at the previous moment, and at the same time, based on the global context vector and the coded sentences of the emotional user to be inferred at the previous moment, the global emotional transfer vector of the user during the conversation is obtained; finally, the global context vector, global emotional transfer vector, and emotional damping vector obtained above are connected and sent to the fully connected layer and softmax layer in sequence to obtain the emotion of the emotional user to be inferred. The present invention takes the Gross emotional regulation model as the theoretical basis to construct an interpretable deep learning emotional reasoning model, and takes into account the dynamic flow of emotions in the interaction process of two users and the emotional expression of a single user in multiple rounds of user conversations, so that the final multi-round conversation emotional reasoning result is more accurate.

[0056] 2. This paper proposes a contextual emotion attention module, which uses a multi-head self-attention mechanism to learn long-term dependency information in multiple rounds of discourse and capture more comprehensive contextual information to ensure that the final multi-round dialogue emotion reasoning results are more accurate.

[0057] 3. The emotion transfer proposed in this invention takes into account the dynamic flow of emotions during the interaction between two users, integrates global context information, models the emotion transfer in the conversation history through GRU time evolution, and finally obtains the global emotion transfer vector, which can help make the final multi-round conversation emotion reasoning results more accurate.

[0058] 4. The present invention adds a damping gate to GRU to propose an emotion damping module. GRU models the user's emotion damping vector through time evolution. This operation takes into account the emotional expression of a single user and can reduce the user's expression of emotional response. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] 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.

[0060] Figure 1 This is a flow chart of a multi-round dialogue emotion reasoning method based on emotion dynamics of the present invention;

[0061] Figure 2 This is a system block diagram of a multi-round dialogue emotion reasoning system based on emotion dynamics in the present invention. DETAILED DESCRIPTION

[0062] 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 obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0063] The embodiments of the present application solve the problem of low accuracy of existing multi-round dialogue emotion reasoning technology by providing a multi-round dialogue emotion reasoning method and system based on emotion dynamics, and achieve the purpose of using scientific theory to reasonably infer the user's future emotions.

[0064] The technical solution in the embodiments of the present application is to solve the above technical problems, and the overall idea is as follows:

[0065] In order to solve the problem of low accuracy of existing multi-round dialogue emotion reasoning technology, the technical solution of this application is based on the knowledge of Gross emotion regulation theory and proposes a multi-round dialogue emotion reasoning method based on emotion dynamics. This method extracts emotion features from the dialogue sentences in the user's dialogue history to obtain coded sentences; and uses the Transformer neural network based on the coded sentences to obtain the global context vector; then, based on the coded sentences of the emotion user to be inferred at the previous moment, a recurrent neural network with a damping gate is used to obtain the emotion damping vector of the emotion user to be inferred at the previous moment; then, based on the global context vector and the coded sentences of the emotion user to be inferred at the previous moment, the global emotion transfer vector of the user during the dialogue process is obtained; finally, the global context vector, the global emotion transfer vector, and the emotion damping vector are connected and sent to the fully connected layer and the softmax layer in sequence to obtain the emotion of the emotion user to be inferred. This application follows the scientific theory of Gross emotion regulation and reasonably infers the user's emotions in the future, and its accuracy is higher than that of the existing technology.

[0066] 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.

[0067] Gross believes that emotion regulation occurs during the emotional process, and different emotion regulation strategies are generated at different stages of the emotion. Gross proposed five emotion regulation strategies, including situation selection, situation modification, attention allocation, cognitive change, and response adjustment, which are described as follows:

[0068] 1. Situational selection refers to individuals approaching or avoiding certain people, events, and situations to regulate their emotions. This is a common or primary emotion regulation strategy used by people to avoid or reduce negative emotions and increase the chances of experiencing positive emotions. For example, individuals with social anxiety may try to avoid social situations to reduce anxiety, which falls under the category of situational selection.

[0069] ② Situation modification refers to coping with problems or exerting initial control over emotional events, and striving to change the situation. For example, when an individual is in an embarrassing situation, they will try to change the embarrassing situation.

[0070] ③ Attention allocation: Focusing on one or more aspects of a situation. This includes striving to focus attention on a specific topic or task, and shifting attention away from the original topic or task. For example, when discussing unpleasant topics, individuals may ignore them and focus on other things.

[0071] ④ Cognitive change involves choosing possible interpretations of the meaning of an emotional event. Personal interpretations of emotional events can have a powerful influence on the psychological experience, behavioral expression, and physiological responses to emotions in a given situation. Cognitive change is often used to reduce or increase emotional reactions or to alter the nature of an emotion. For example, if someone steps on your foot, you can avoid getting angry by interpreting it as unintentional.

[0072] 5. Response adjustment refers to influencing emotional responses, such as psychological experience, behavioral expression, and physiological reactions, after emotions have been aroused. This is primarily manifested in behavioral expressions that reduce emotional reactions. For example, if someone steps on your foot and doesn't apologize, even though you're angry, you try to control your anger. This is response adjustment.

[0073] This application integrates the Gross emotion regulation process into the emotion reasoning model and proposes the following technical solution for multi-round dialogue emotion reasoning based on emotion dynamics.

[0074] Example 1:

[0075] In the first aspect, the present invention first proposes a multi-round dialogue emotion reasoning method based on emotion dynamics, see Figure 1 , the method comprising:

[0076] S1. Extract emotional features from conversation sentences in the user's conversation history to obtain coded sentences;

[0077] S2. Obtain a global context vector using a Transformer neural network based on the encoded sentence.

[0078] S3. Based on the encoded sentence of the user whose emotion is to be inferred at the previous moment, the emotion damping vector of the user whose emotion is to be inferred at the previous moment is obtained using a recurrent neural network with an added damping gate.

[0079] S4. Obtain the global emotion transfer vector of the user during the conversation based on the global context vector and the encoded sentence of the user whose emotion is to be inferred at the previous moment.

[0080] S5. Connect the global context vector, the global emotion transfer vector, and the emotion damping vector and send them to the fully connected layer and the softmax layer in sequence to obtain the emotion of the user to be inferred.

[0081] As can be seen, this embodiment first extracts emotional features from the conversation sentences in the user's conversation history to obtain encoded sentences, and then uses the Transformer neural network to obtain a global context vector based on the encoded sentences. Then, based on the encoded sentences of the user whose emotions are to be inferred at the previous moment, a recurrent neural network with a damping gate is used to obtain the emotional damping vector of the user whose emotions are to be inferred at the previous moment. At the same time, based on the global context vector and the encoded sentences of the user whose emotions are to be inferred at the previous moment, the global emotional transfer vector of the user during the conversation is obtained. Finally, the obtained global context vector, global emotional transfer vector, and emotional damping vector are connected and sent to the fully connected layer and softmax layer in sequence to obtain the emotion of the user whose emotions are to be inferred. This embodiment uses the Gross emotion regulation model as the theoretical basis to construct an interpretable deep learning emotion inference model. In addition, in the multi-round user conversation, the dynamic flow of emotions during the interaction between two users and the emotional expression of a single user are taken into account, making the final multi-round conversation emotion inference result more accurate.

[0082] The following is combined with Figure 1 , and explanations of specific steps S1-S5 are provided to describe in detail the implementation process of an embodiment of the present invention.

[0083] In this embodiment, when user A and user B are interacting with each other, the process is as follows: Assume that a conversation D is exchanged between user A and user B, A is the initiator, and B is the responder. Conversation D consists of M utterances, which can be expressed as Among them, the words of A or B Is a |X M | A sequence of words. Sentiment label Represents the speech of user A or B at time t Contains emotional states.

[0084] The problem to be solved by the multi-round dialogue emotion reasoning method based on emotion dynamics in this embodiment can be defined as: given a historical dialogue at the previous t moments of a dialogue To accurately predict the sentiment of user A or B’s speech at the next moment (i.e., time t+1)

[0085] S1. Extract emotional features from conversation sentences in the user's conversation history to obtain coded sentences.

[0086] The conversation sentences in the conversation history of the two users are respectively fed into the pre-trained BERT model to encode the corresponding sentence representations. The formula can be described as:

[0087] u1,u2,...,u t =BERT(X1,X2,...,X t )

[0088] Among them, u1,u2,...,u t Represents the relevant sentence representation after BERT encoding; X1, X2,…, X t is the conversation sentence in the conversation history, that is, the M utterances in the conversation D H is the dimension of the BERT output vector. In this embodiment, we choose H = 521.

[0089] S2. Obtain a global context vector using a Transformer neural network based on the encoded sentence.

[0090] In this embodiment, we construct a contextual emotion attention module based on the multi-head attention mechanism and forward feedback network in the Transformer neural network. The contextual emotion attention module is used to achieve modeling of situational correction and attention allocation of dialogue emotions. The multi-head attention mechanism enables the contextual emotion attention module to simultaneously focus on information in different representation subspaces at different positions and effectively retrieve dependencies in the input sequence. It divides the model into multiple heads to form a representation subspace. Multiple heads allow it to capture different aspects of information, and multiple value vectors can be trained in parallel and then spliced ​​together. Given an input query Q, key K, value V. This can be formalized as:

[0091] MultiHead(Q,K,V)=Concat(head1,…,head h )W O

[0092] where head i =Attenti on (QW i Q ,KW i K ,VW i V )

[0093]

[0094] in, and are all trainable weight parameters in the neural network, d k and d v are the dimensions of key K and value V respectively.

[0095] We then feed the output of the multi-head attention mechanism into a feedforward network, which consists of two linear transformations with a ReLU function in the middle as the activation function, which can be expressed as:

[0096] FFN(x)=max(0,xW1+b1)W2+b2

[0097] Among them, W1 and W2 are both trainable weight parameters; b1 and b2 are both trainable bias parameters.

[0098] According to the above steps, the sequence U composed of the above coded sentences obtained after the emotional features are extracted is [u1,u2,…,u t ] is fed into the multi-head attention mechanism and forward feedback network in the Transformer neural network, and the global context vector c is encoded. t This can be formalized as:

[0099] c t =FNN(MultiHead(U,U,U))

[0100] S3. Based on the encoded sentence of the user whose emotion is to be inferred at the previous moment, the emotion damping vector of the user whose emotion is to be inferred at the previous moment is obtained using a recurrent neural network with an added damping gate.

[0101] When a user's emotions are aroused during a conversation, they will attempt to resist these changes in their emotions to counteract external influences. In this embodiment, we implement an emotion damping module to enable users to control their emotional expression. Specifically, we use this module to obtain the emotion damping vector of the user whose emotion is to be inferred at the previous moment.

[0102] The emotion damping module is based on the emotion modeling of a specific user. For the convenience of description, we mark the user at time t+1 to be inferred as B, and the utterance u of another user A at time t is t , the speech of user B at the last moment is expressed as u t-1 .

[0103] Based on the gated recurrent unit GRU in the recurrent neural network, a damping gate is added to it to construct an emotional damping module, which can reduce the user's expression of emotional response. For user B, the user emotional damping vector q is obtained at the last moment (i.e., time t-1) t-1 The specific formula is described as follows:

[0104]

[0105]

[0106] Among them, W is a trainable weight parameter; b is a trainable bias parameter, Indicates the product of the corresponding position elements of two matrices.

[0107] S4. Obtain the global emotion transfer vector of the user during the conversation based on the global context vector and the encoded sentence of the user whose emotion is to be inferred at the previous moment.

[0108] The user's emotions will change under the stimulation of other users' emotions. This emotion transfer is for the global conversation. We use GRU to model the global emotion transfer generated by the interaction stimulation of users during the conversation. At time t, we obtain the global emotion transfer vector s t , the specific formula is as follows:

[0109] s t =GRU(s t-1 ,(u t-1 +c t ))

[0110] S5. Connect the global context vector, the global emotion transfer vector, and the emotion damping vector and send them to the fully connected layer and the softmax layer in sequence to obtain the emotion of the user to be inferred.

[0111] The goal of the sentiment inference task is to use the conversation history to predict the future emotions of the interlocutor. Therefore, we transform the global context vector c t , the global sentiment transfer vector s that evolves over time t and the user emotion damping vector q that evolves over time t-1 The concatenated vectors are then fed into the fully connected layer and the softmax layer to predict the user's emotion. The specific formula is as follows:

[0112] o t =[s t ,q t-1 ,c t ]

[0113]

[0114] Among them, W o is the trainable weight parameter in the neural network; b o is a trainable bias parameter. The output of the softmax layer is the probability distribution of the user's final emotion category, where the emotion category with the highest probability is considered to be the user emotion prediction label.

[0115] In addition, during the model parameter training process, the back propagation algorithm is used to reversely calculate the error term value of each neuron; the Adam gradient descent optimization scheme is used to optimize the loss function. The cross entropy error is used as the loss function, and the formula is as follows:

[0116]

[0117] where |ε| is the number of sentiment categories.

[0118] Finally, we will output the result The emotion category with the highest probability is used as the label of the user's emotion prediction to determine the emotion of the user at the next moment.

[0119] At this point, the entire process of the multi-round dialogue emotion reasoning method based on emotion dynamics in this embodiment is completed.

[0120] Example 2:

[0121] In the second aspect, the present invention also provides a multi-round dialogue emotion reasoning system based on emotion dynamics, see Figure 2 , the system comprises:

[0122] The emotional feature extraction module is used to extract emotional features from conversation sentences in the user's conversation history to obtain coded sentences;

[0123] A contextual sentiment attention module for obtaining a global context vector based on the encoded sentence using a Transformer neural network;

[0124] An emotion damping module is used to obtain the emotion damping vector of the user whose emotion is to be inferred at the previous moment by using a recurrent neural network with a damping gate added based on the encoded sentence of the user whose emotion is to be inferred at the previous moment;

[0125] An emotion transfer module is used to obtain the global emotion transfer vector of the user during the conversation based on the global context vector and the encoded sentence of the user whose emotion is to be inferred at the previous moment;

[0126] The emotion reasoning module is used to connect the global context vector, the global emotion transfer vector, and the emotion damping vector and send them to the fully connected layer and the softmax layer in sequence to obtain the emotion of the user to be inferred.

[0127] Optionally, the emotional feature extraction module extracts emotional features from conversation sentences in the user conversation history to obtain coded sentences, including:

[0128] The conversation sentences in the user's conversation history are fed into the BERT model for encoding to obtain the corresponding encoded sentence representation, which can be described by the formula:

[0129] u1,u2,…,u t =BERT(X1,X2,…,X t )

[0130] Among them, u1,u2,…,u t represents the relevant encoded sentence representation after BERT encoding; X1, X2,…, X t is the conversation sentence in the conversation history; H is the dimension of BERT output vector.

[0131] Optionally, the context emotion attention module obtains a global context vector based on the encoded sentence using a Transformer neural network, including:

[0132] The sequence of encoded sentences is fed into the multi-head attention mechanism and forward feedback network encoding in the Transformer neural network to obtain a global context vector; it can be expressed as:

[0133] c t =FNN(MultiHead(U,U,U))

[0134] Among them, U=[u1,u2,...,u t ] represents the sequence of coded sentences; c t represents the global context vector; FFN(x) represents the activation function.

[0135] Optionally, the emotion damping module obtains the emotion damping vector of the user whose emotion is to be inferred at the previous moment based on the encoded sentence of the user whose emotion is to be inferred at the previous moment by using a recurrent neural network with a damping gate added thereto, including:

[0136]

[0137]

[0138] Among them, q t-1 Represents the user's emotion damping vector at the last moment; ut-1 Indicates the user's speech at the last moment; q t-3 Represents the user's emotional damping vector at the last moment; Represents the intermediate value used to calculate the emotional damping vector; W is the weight parameter in the neural network; b is the bias parameter; Indicates the product of the corresponding position elements of two matrices.

[0139] Optionally, the emotion inference module connects the global context vector, the global emotion transfer vector, and the emotion damping vector and sequentially feeds them into a fully connected layer and a softmax layer to obtain the emotion of the user to be inferred.

[0140] o t =[s t ,q t-1 ,c t ]

[0141]

[0142] Among them, t represents the user's emotional expression at time t; s t represents the global sentiment transfer vector; q t-1 represents the user's emotion damping vector at the last moment; c t represents the global context vector; Represents the probability distribution of the user's final emotion category; represents the M utterances in the conversation between users A and B; W o is the weight parameter in the neural network; b o is the bias parameter.

[0143] It is understandable that the multi-round dialogue emotion reasoning system based on emotion dynamics provided in the embodiment of the present invention corresponds to the above-mentioned multi-round dialogue emotion reasoning method based on emotion dynamics. The explanations, examples, beneficial effects, etc. of the relevant contents can refer to the corresponding contents in the multi-round dialogue emotion reasoning method based on emotion dynamics, and will not be repeated here.

[0144] In summary, compared with the existing technology, the present invention has the following beneficial effects:

[0145] 1. The present invention first extracts emotional features from the conversation sentences in the user's conversation history to obtain coded sentences, and uses the Transformer neural network to obtain the global context vector based on the coded sentences; then, based on the coded sentences of the emotional user to be inferred at the previous moment, a recurrent neural network with a damping gate is used to obtain the emotional damping vector of the emotional user to be inferred at the previous moment, and at the same time, based on the global context vector and the coded sentences of the emotional user to be inferred at the previous moment, the global emotional transfer vector of the user during the conversation is obtained; finally, the global context vector, global emotional transfer vector, and emotional damping vector obtained above are connected and sent to the fully connected layer and softmax layer in sequence to obtain the emotion of the emotional user to be inferred. The present invention takes the Gross emotional regulation model as the theoretical basis to construct an interpretable deep learning emotional reasoning model, and takes into account the dynamic flow of emotions in the interaction process of two users and the emotional expression of a single user in multiple rounds of user conversations, so that the final multi-round conversation emotional reasoning result is more accurate.

[0146] 2. This paper proposes a contextual emotion attention module, which uses a multi-head self-attention mechanism to learn long-term dependency information in multiple rounds of discourse and capture more comprehensive contextual information to ensure that the final multi-round dialogue emotion reasoning results are more accurate.

[0147] 3. The emotion transfer proposed in this invention takes into account the dynamic flow of emotions during the interaction between two users, integrates global context information, models the emotion transfer in the conversation history through GRU time evolution, and finally obtains the global emotion transfer vector, which can help make the final multi-round conversation emotion reasoning results more accurate.

[0148] 4. The present invention adds a damping gate to GRU to propose an emotion damping module. GRU models the user's emotion damping vector through time evolution. This operation takes into account the emotional expression of a single user and can reduce the user's expression of emotional response.

[0149] 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.

[0150] 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 multi-round dialogue emotion reasoning method based on emotion dynamics, characterized by: The method comprises: Extract emotional features from conversation sentences in the user's conversation history to obtain coded sentences; Obtaining a global context vector using a Transformer neural network based on the encoded sentence; Based on the encoded sentence of the user whose emotion is to be inferred at the previous moment, a recurrent neural network with a damping gate is used to obtain the emotion damping vector of the user whose emotion is to be inferred at the previous moment; Obtaining the user's global emotion transfer vector during the conversation based on the global context vector and the encoded sentence of the user's emotion to be inferred at the previous moment; The global context vector, the global emotion transfer vector, and the emotion damping vector are connected and sent to the fully connected layer and the softmax layer in sequence to obtain the emotion of the user to be inferred; The method of obtaining the emotion damping vector of the user to be inferred at the last moment based on the coded sentence of the user to be inferred at the last moment by using a recurrent neural network with a damping gate added thereto includes: in, Represents the user's emotion damping vector at the previous moment; Indicates the user's coded sentence at the last moment; Represents the user's emotional damping vector at the last moment; represents the intermediate value used to calculate the emotion damping vector; W is the weight parameter in the neural network; b is the bias parameter; Indicates the product of the corresponding position elements of two matrices.

2. The method according to claim 1, wherein The step of extracting emotional features from conversation sentences in the user conversation history to obtain coded sentences includes: The conversation sentences in the user's conversation history are fed into the BERT model for encoding to obtain the corresponding encoded sentence representation, which can be described by the formula: in, Represents the relevant encoded sentence representation after BERT encoding; is the conversation sentence in the conversation history; , H The dimension of BERT output vector.

3. The method according to claim 2, wherein Obtaining a global context vector using a Transformer neural network based on the encoded sentence includes: The sequence of encoded sentences is fed into the multi-head attention mechanism and forward feedback network encoding in the Transformer neural network to obtain a global context vector; it can be expressed as: in, Represents a sequence of encoded sentences; represents the global context vector; Represents the activation function.

4. The method according to claim 1, wherein The global context vector, the global emotion transfer vector, and the emotion damping vector are connected and sent to the fully connected layer and the softmax layer in sequence to obtain the emotion of the user to be inferred, including: in, Represents a user t Emotional expression at the moment; represents the global sentiment transfer vector; Represents the user's emotion damping vector at the previous moment; represents the global context vector; Represents the probability distribution of the user's final emotion category; Represents a user A and B In the conversation M a discourse; is the weight parameter; is the bias parameter.

5. A multi-round dialogue emotional reasoning system based on emotional dynamics, characterized by: The system comprises: The emotional feature extraction module is used to extract emotional features from conversation sentences in the user's conversation history to obtain coded sentences; A contextual sentiment attention module for obtaining a global context vector based on the encoded sentence using a Transformer neural network; An emotion damping module is used to obtain the emotion damping vector of the user whose emotion is to be inferred at the previous moment by using a recurrent neural network with a damping gate added based on the encoded sentence of the user whose emotion is to be inferred at the previous moment; An emotion transfer module is used to obtain the global emotion transfer vector of the user during the conversation based on the global context vector and the encoded sentence of the user whose emotion is to be inferred at the previous moment; The emotion inference module is used to connect the global context vector, the global emotion transfer vector, and the emotion damping vector and send them to the fully connected layer and the softmax layer in sequence to obtain the emotion of the user to be inferred; The emotion damping module obtains the emotion damping vector of the user to be inferred at the last moment based on the coded sentence of the user to be inferred at the last moment by using a recurrent neural network with a damping gate added, including: in, Represents the user's emotion damping vector at the previous moment; Indicates the user's coded sentence at the last moment; Represents the user's emotional damping vector at the last moment; represents the intermediate value used to calculate the emotion damping vector; W is the weight parameter in the neural network; b is the bias parameter; Indicates the product of the corresponding position elements of two matrices.

6. The system according to claim 5, wherein: The emotional feature extraction module extracts emotional features from conversation sentences in the user's conversation history to obtain coded sentences, including: The conversation sentences in the user's conversation history are fed into the BERT model for encoding to obtain the corresponding encoded sentence representation, which can be described by the formula: in, Represents the relevant encoded sentence representation after BERT encoding; is the conversation sentence in the conversation history; , H The dimension of BERT output vector.

7. The system according to claim 6, wherein: The context emotion attention module obtains a global context vector based on the encoded sentence using a Transformer neural network, including: The sequence of encoded sentences is fed into the multi-head attention mechanism and forward feedback network encoding in the Transformer neural network to obtain a global context vector; it can be expressed as: in, Represents a sequence of encoded sentences; represents the global context vector; Represents the activation function.

8. The system according to claim 5, wherein: The emotion inference module connects the global context vector, the global emotion transfer vector, and the emotion damping vector and sequentially sends them to the fully connected layer and the softmax layer to obtain the emotion of the user to be inferred, including: in, Represents a user t Emotional expression at the moment; represents the global sentiment transfer vector; Represents the user's emotion damping vector at the previous moment; represents the global context vector; Represents the probability distribution of the user's final emotion category; Represents a user A and B In the conversation M a discourse; is the weight parameter; is the bias parameter.

Citation Information

Patent Citations

  • Dialogue emotion prediction method and system based on emotion dynamics

    CN115374794A

  • Methods for Emotion Classification in Text

    US20220292261A1