Conversational emotion recognition method based on common sense perception and hierarchical multi-task learning
By adopting common sense perception and hierarchical multi-task learning methods in dialogue emotion recognition, combined with common sense knowledge base and self-attention mechanism, the problem of difficult to capture the interaction between dialogue behavior and emotional state is solved, and the performance of dialogue emotion recognition is improved. Significantly improves and performs well on conversational behavior classification.
Patent Information
- Application Number
- CN202210373158.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-11
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2042-04-11
AI Technical Summary
It is difficult for existing technologies to effectively capture the interactive relationship between dialogue behaviors and emotional states in conversational emotion recognition, and it is difficult to select the most helpful external knowledge items in multi-task learning, resulting in poor model performance in downstream tasks.
Using a method based on common sense perception and hierarchical multi-task learning, word-level and discourse-level encoding is constructed through the self-attention mechanism and Transformer architecture, combined with the common sense knowledge base to obtain common sense knowledge related to dialogue, and complete the dialogue simultaneously in a hierarchical structure Behavior classification, emotion recognition and emotion reasoning tasks, the optimization goal includes the prediction loss of the three tasks.
It has significantly improved the performance of dialogue emotion recognition, has good dialogue behavior classification capabilities and certain emotional reasoning capabilities, and is better than multiple powerful baseline models, especially on data sets with more noise.
Smart Images

Figure CN114722838B
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of natural language processing and natural language processing methods, and in particular, to a method involving knowledge graph application, dialogue modeling and text sentiment classification. Background Art
[0002] Emotion recognition is a long-standing research task in the field of artificial intelligence. With the increasing popularity of research on human-computer interaction and conversational artificial intelligence, research on emotion recognition for conversational texts has also received more attention. Emotion recognition in conversations is a core step towards fine-grained conversation understanding, which is crucial for downstream tasks such as emotion-aware conversation systems, multimodal question-answering, and psychological assistance conversations. The direction of topics and the rules of emotion transfer in natural conversations are often affected by many factors, including conversation scenes, topics, personality traits of participants, their thinking logic and intentions, etc. Compared with traditional emotion recognition tasks, conversational emotion recognition is obviously more challenging.
[0003] Ideally, conversation emotion recognition requires context modeling of individual utterances in a conversation, where context refers to the preceding utterances that depend on the time sequence of the conversational sentences. Recent research shows that methods applied to common sentiment classification tasks, including traditional methods based on language features and methods based on deep learning, are difficult to achieve satisfactory results on conversation emotion recognition datasets. Most of these methods ignore special factors in the conversational context, such as implicit clues in the context (e.g., topics, intentions), relevant common sense knowledge, and complex transition patterns between emotional states.
[0004] The task of conversation emotion recognition has only begun to make progress in recent years due to the emergence of public conversation datasets collected from sources such as social media platforms and drama subtitles. The DialogueRNN algorithm uses multiple gated recurrent units to model the global state of the conversation and the local state of the participants respectively to capture emotional changes at the discourse level. The hierarchical neural network model is modeled at the word and sentence levels to enhance the model's ability to perceive the laws of emotional changes between sentences. The extension of the DialogueRNN algorithm takes into account the dependencies between participants' internal discourse and the relative position between context and target, and uses graph convolutional neural networks to construct these relationships. These works have achieved more significant results in the task of conversation emotion recognition than traditional models, but most of them focus on the lexical and semantic information in the conversation text.
[0005] Recently, there have been various explorations on methods to enhance the model's emotion inference ability by combining various contexts with external knowledge bases, such as: 1) extracting entity concept representations from the ConceptNet knowledge graph to enrich dialogue sentences; 2) obtaining a variety of common sense knowledge from the ATOMIC knowledge base, such as the mental state of the participants, events, causal relationships, etc., and learning the interactive relationship between dialogue participants based on such knowledge. Combined with the topic-enhanced language model fine-tuned based on the pre-trained model, a pointer network was designed to integrate the two ways of retrieving knowledge from the ATOMIC knowledge base. These methods that integrate external knowledge bases have shown advantages over baseline methods in dialogue emotion recognition tasks conducted on multiple public datasets. In addition, some existing technologies focus on other factors related to emotional expression in dialogue. For example, 3) Emotional cognition theory believes that cognitive factors can effectively influence the formation of emotional states. Inspired by this theory, in addition to extracting representation learning of emotional states from dialogue texts, studying the interaction information between cognitive factors and emotional factors such as user intentions and dialogue behaviors reflected in dialogue texts is beneficial for dialogue emotion recognition. 4) In Co-GAT, a bidirectional interactive graph attention network is constructed using cross-sentence connections and cross-task connections to process the interaction information of dialogue behavior and emotion. Co-GAT has made breakthroughs in both dialogue behavior classification and dialogue emotion recognition tasks, proving that jointly modeling cognitive factors and emotional states and exploring the consistency between multiple factors has beneficial effects on individual subtasks.
[0006] Based on the research status of the above-mentioned conversation emotion recognition tasks, this field faces two major challenges:
[0007] (1) Unlike previous work that only considers emotional factors when modeling context, this paper extracts and represents both dialogue behavior and emotional state, and designs a multi-task learning framework to explore the interaction between the two factors. Common multi-task learning methods treat different factors as independent tasks, which is not applicable in the scenario designed by this paper.
[0008] (2) Considering the design of the multi-task learning framework in the task decoding layer of the present invention, how to retrieve the external knowledge base and improve the performance of the model in each downstream task becomes another challenge. Most previous works use the attention mechanism to connect the dialogue sentences with the candidate knowledge in the knowledge base and fuse them into the decoding layer. This method makes it difficult to select the most helpful knowledge items for each downstream task. Summary of the invention
[0009] Based on the research status of the above-mentioned conversation emotion recognition task, the present invention proposes a conversation emotion recognition method based on common sense perception and hierarchical multi-task learning, which improves the performance of conversation emotion recognition by introducing multi-task learning related to emotion recognition.
[0010] The present invention is achieved by the following technical solutions:
[0011] A method for conversation emotion recognition based on common sense perception and hierarchical multi-task learning. The method specifically includes the following processes:
[0012] Step 1: Obtain common sense knowledge related to the discourse in the dialogue from the common sense knowledge base, select five relation types sI, sR, oR, sE, oE related to cognitive and emotional factors for the phrases describing the events of a given role X, and generate a relation type sI, sR, oR, sE, oE related to the discourse u in the dialogue for each relation type i The K most similar event phrases are combined as candidate knowledge and recorded as
[0013] Step 2: Use the pre-trained language model RoBERTa based on the self-attention mechanism and the Transformer architecture to build word-level and utterance-level hierarchical encodings, and encode each input sentence in the conversation into an embedded representation in the form of a vector; word-level encoding and utterance-level encoding extract semantic information of different granularities respectively, and model the transfer mode of cognitive and emotional factors between sentences at the utterance level while considering historical sentences; the specific processing included in this step is as follows:
[0014] Step 2.1: Construct word-level encoding: Use the pre-trained language model RoBERTa based on the multi-layer self-attention mechanism to encode the input sentence into the corresponding embedding representation. i |Word Input statement Add special symbols [CLS] and [SEP] at the beginning and end of the statement, that is, will u i Send it to the language model RoBERTa to get the embedding representation of each word, as shown in the following formula:
[0015]
[0016] Among them, d is the hidden layer dimension of the language model RoBERTa, is a real number space of dimension d;
[0017] The statement u i The first embedding representation of That is, the symbol [CLS] is used as the representation of the entire statement, denoted by x i , corresponding to the sequence (x1, x2, ..., x N );
[0018] Step 2.2: Construct utterance-level encoding: Use a Transformer block to take the embedding representation of each word in the conversation obtained by word-level encoding in step 1 as the input of this step, model the contextual dependencies between sentences in the conversation, and convert the sequence of sentence representations obtained from the word-level encoder (x1, x2, ..., x N ) is converted into a context-sensitive sentence representation (h1, h2, ..., h N ), as shown below:
[0019]
[0020] Where N is the number of sentences in the conversation, Trm is the Transformer encoder layer;
[0021] Step 3: Under the hierarchical structure multi-task learning framework, the hierarchical relationship between the tasks is modeled using a hierarchical structure to simultaneously complete three tasks related to dialogue understanding: first, based on the sentence representation, the dialogue behavior category prediction label corresponding to the sentence is obtained; then, based on the prediction results of the sentence representation and the dialogue behavior classification, the emotion prediction label of the current sentence is obtained; finally, based on the two prediction results of the sentence representation and the dialogue behavior category label and the emotion label of the current sentence, emotion reasoning is performed to obtain the emotion prediction label of the next sentence; the specific processing included in this step is as follows:
[0022] Step 3.1: Classify dialogue behaviors: Get sentence u i The utterance-level embedding representation h i After that, the attention mechanism is used to obtain the relevant knowledge of the candidate knowledge for the classification of dialogue behaviors and calculate the attention vector As shown below:
[0023]
[0024] in, is a vector concatenation operation, x i is the representation of the entire sentence of the ith sentence, Attn (1) A method for calculating the attention vector;
[0025] After another non-linear layer x i With attention vector After fusion, predict the dialogue behavior label corresponding to the current sentence As shown below:
[0026]
[0027]
[0028] in, is another nonlinear layer, M A is the embedding matrix of the dialogue act category labels, is the probability distribution function, ~ is the variable value that obeys the probability distribution function;
[0029] Step 3.2: Perform conversation emotion recognition: Also use the attention mechanism to perceive the most beneficial knowledge for the conversation emotion recognition task from the candidate knowledge and obtain the attention vector As shown below:
[0030]
[0031] The predicted label of the current sentence sentiment label As shown below:
[0032]
[0033]
[0034] Among them, F E is the nonlinear layer, d E is the number of sentiment category labels, M E is the embedding matrix of the sentiment category label;
[0035] Step 3.3, dialogue emotion reasoning: Based on the prediction results of dialogue behavior classification and dialogue emotion recognition tasks, infer the future emotional trend of the dialogue and select a reasonable emotion category for the upcoming response. Given the first i sentences in the dialogue, additionally consider the predicted emotion category label of the i-th sentence. The predicted label of the sentiment category corresponding to the i+1th sentence As shown below:
[0036]
[0037]
[0038]
[0039] Among them, F R is the nonlinear layer, M E Embedding matrix for common sentiment category labels;
[0040] Step 3.4: Perform model training to obtain the optimization target.
[0041] Compared with the existing technology, the present invention can significantly improve the performance of emotion recognition, while having good dialogue behavior classification capabilities and certain emotion reasoning capabilities. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 This is an overall flow chart of a conversation emotion recognition method based on common sense perception and hierarchical multi-task learning in the present invention;
[0043] Figure 2 This is a module diagram of a specific embodiment of a method for dialogue emotion recognition based on common sense perception and hierarchical multi-task learning of the present invention;
[0044] Figure 3 This is a flowchart of a specific embodiment of a method for dialogue emotion recognition based on common sense perception and hierarchical multi-task learning of the present invention. DETAILED DESCRIPTION
[0045] The technical solution of the present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0046] A specific embodiment of a method for dialogue emotion recognition based on common sense perception and hierarchical multi-task learning of the present invention is described as follows:
[0047] like Figure 1 As shown, a specific embodiment of the method for dialogue emotion recognition based on common sense perception and hierarchical multi-task learning of the present invention is a module diagram. Specifically, it includes a common sense retrieval module, a multi-level encoder module and a hierarchical multi-task decoder module. ① The multi-level encoder module is used to encode each sentence of the dialogue into an embedded representation in the form of a vector, specifically including building a hierarchical encoder at the word level and the discourse level based on a pre-trained language model based on a multi-layer self-attention mechanism, and the word-level encoder and the discourse-level encoder extract semantic information of different granularities, and enable the model to model the transfer mode of cognitive and emotional factors between sentences at the discourse level while considering historical sentences. ② The hierarchical decoder is used to simultaneously complete three dialogue understanding-related tasks under the framework of multi-task learning. Inspired by the theory of emotional cognition, in order to enable the model to capture the influence mode of cognitive factors on emotional factors during the process of dialogue advancement, the present invention designs a dialogue behavior classification task; at the same time, it is believed that having a certain emotional reasoning ability is a key step towards a human-computer interaction system that is truly close to humans and understands the emotional state of dialogue participants. The present invention designs a more challenging dialogue emotional reasoning task, which requires the model to have a higher degree of understanding of the emotional state of dialogue participants and make a reasonable empathetic response. Unlike common multi-task learning methods, the hierarchical multi-task decoder module described in ③ does not process the three tasks independently, but is inspired by the thought process generated by human emotions and uses a hierarchical structure to model the hierarchical relationship between them. The decoder first predicts the dialogue behavior category label based on the context encoding, and then predicts the emotional label of the current sentence based on the prediction results of the context encoding and dialogue behavior classification. Finally, the decoder performs emotional reasoning based on the context encoding and the prediction results of the first two steps to predict the emotional label of the next sentence.
[0048] like Figure 3 As shown, the conversation emotion recognition method based on common sense perception and hierarchical multi-task learning proposed in the present invention specifically includes the following process:
[0049] Step 1: Obtain common sense knowledge related to the discourse in the dialogue from the common sense knowledge base. For the phrases describing the events of a given character X, select five relation types sI, sR, oR, sE, oE related to cognitive and emotional factors, and generate a relation type for each relation type related to the discourse u in the dialogue. i The K most similar event phrases are combined as candidate knowledge and recorded as
[0050] For example, the present invention attempts to obtain common sense phrases in text form from the ATOMIC knowledge base. To this end, a common sense generation model COMET is introduced. When given a phrase describing an "event" surrounding a character X, COMET infers other event phrases through nine "relationship" types. Five of the relationship types xIntent, xReact, oReact, xEffect, and oEffect related to cognitive and emotional factors are selected, and these five relationship types are respectively recorded as sI, sR, oR, sE, and oE. As shown in Table 1, it is a description of five relationship types and event examples in the ATOMIC knowledge base, which describes the concept descriptions of five relationship types related to cognitive and emotional factors and the combination examples of <subject event, relationship type, object event> formed by their connection.
[0051] The Atlas of Machine Commonsense (ATOMIC) is used to capture complex interactive clues between personality traits, mental states, factual events, behavioral intentions, and emotions that may exist in conversations. These additional information that are not fully reflected in the conversation text can enable context modeling to have a better understanding of the changes in cognitive and emotional factors.
[0052] Table 1
[0053]
[0054] Step 2: Use the pre-trained language model RoBERTa based on the self-attention mechanism and the Transformer architecture to build word-level and utterance-level hierarchical encodings, and encode each input sentence in the conversation into an embedded representation in the form of a vector; word-level encoding and utterance-level encoding extract semantic information of different granularities respectively, and model the transfer mode of cognitive and emotional factors between sentences at the utterance level while considering historical sentences; the specific processing included in this step is as follows:
[0055] Step 2.1: Construct word-level encoding: Use the pre-trained language model RoBERTa based on the multi-layer self-attention mechanism to encode the input sentence into the corresponding embedding representation. i |Word Input statement Add special symbols [CLS] and [SEP] at the beginning and end of the statement, that is, will u i Send it to the language model RoBERTa to get the embedding representation of each word, as shown in the following formula:
[0056]
[0057] Among them, d is the hidden layer dimension of the language model RoBERTa, is a real number space of dimension d;
[0058] For example, specifically, Words Embedding representation of ;
[0059] The statement u i The first embedding representation of That is, the symbol [CLS] is used as the representation of the entire statement, denoted by x i , corresponding to the sequence (x1, x2, ..., x N );
[0060] Step 2.2: Construct utterance-level encoding: Use a Transformer block to take the embedding representation of each word in the conversation obtained by word-level encoding in step 1 as the input of this step, model the contextual dependencies between sentences in the conversation, and convert the sequence of sentence representations obtained from the word-level encoder (x1, x2, ..., x N ) is converted into a context-sensitive sentence representation (h1, h2, ..., h N ), as shown below:
[0061]
[0062] Where N is the number of sentences in the conversation, Trm is the Transformer encoder layer;
[0063] Due to the masking strategy set, for x i The corresponding utterance-level embedding representation h i , we can only see the context before the i-th sentence, i.e. x≤i, but cannot notice the information after the i-th sentence. This setting is necessary for the task of dialogue emotion recognition.
[0064] Step 3: In the hierarchical structure multi-task learning framework, the hierarchical relationship between the tasks is modeled using a hierarchical structure to simultaneously complete three tasks related to dialogue understanding: first, the sentence representation is obtained to obtain the dialogue behavior category prediction label corresponding to the sentence, and then the emotion prediction label of the current sentence is obtained based on the prediction results of the sentence representation and the dialogue behavior classification. Finally, based on the two prediction results of the sentence representation and the dialogue behavior category label and the emotion label of the current sentence, emotion reasoning is performed to obtain the emotion prediction label of the next sentence. The specific processing included in this step is as follows:
[0065] Step 3.1: Classify dialogue behaviors: Get sentence u i The utterance-level embedding representation h i After that, the attention mechanism is used to obtain the knowledge that is most beneficial to the classification of dialogue behaviors among the candidate knowledge. The RoBERTa language model is also used to obtain the embedding representation of each piece of knowledge, which is recorded as Where K is the amount of knowledge, and the calculation is done after h i With c i,k The dot product of determines the attention weight and calculates the attention vector As shown below:
[0066]
[0067]
[0068]
[0069] in, is a nonlinear layer with tanh as the activation function. The method of calculating the attention vector using formula (3) to formula (5) is recorded as Attn(·), and we get After another non-linear layer x i and After fusion, predict the dialogue behavior label corresponding to the current sentence where d A is the number of dialogue behavior category labels:
[0070]
[0071]
[0072] in, represents another nonlinear layer, M A represents the embedding matrix of the dialogue act category labels, represents the probability distribution function, and ~ indicates that the variable value obeys the probability distribution function;
[0073] Step 3.2: Perform conversation emotion recognition: Also use the attention mechanism to perceive the most beneficial knowledge for the conversation emotion recognition task from the candidate knowledge. The method of obtaining the attention vector is similar to that in step 3.1:
[0074]
[0075] Prediction of the current sentence sentiment label Similar to step 3.1, but additionally taking into account the predicted dialogue act category labels in 3.1 d E is the number of sentiment category labels:
[0076]
[0077]
[0078] Among them, F E represents the nonlinear layer, d E Indicates the number of sentiment category labels, M E Embedding matrix representing sentiment category labels;
[0079] Step 3. Conversational Sentiment Inference
[0080] Based on the prediction results of the dialogue behavior classification and dialogue emotion recognition tasks, we finally try to infer the future emotional trend of the dialogue and select a reasonable emotion category for the upcoming response. Given the first i sentences in the dialogue, the emotion category label corresponding to the i+1th sentence The prediction of is similar to the process in step 3.2, but additionally considers the sentiment category label of the i-th sentence predicted in step 3.2
[0081]
[0082]
[0083]
[0084] Among them, F R It is also a nonlinear layer. Please note that the common sentiment category label embedding matrix M is used in formulas (10) and (13). E .
[0085] Step 3.4: Perform model training: The optimization objectives of the model framework proposed in this invention include the prediction losses of three tasks: Step 3.2 of the conversation emotion recognition task and the dialogue sentiment inference task in step 3.3
[0086]
[0087]
[0088]
[0089] The complete model optimization objective is the sum of the above three losses: Among them, λ1, λ2, and λ3 are the weights of the prediction loss of each part. In the experiment, all three weights are set to 1.0.
[0090] The present invention has been proven to be an effective method to help the model extract the emotional state representation in the dialogue text through the knowledge base. Retrieving conceptual entities or textual knowledge from an external knowledge base can enrich the semantic information contained in the discourse in the dialogue text. At the same time, the present invention attempts to simultaneously consider the three tasks of dialogue behavior classification, dialogue emotion recognition, and dialogue emotion reasoning, and then construct an effective multi-task learning framework to explore the mutual influence pattern of dialogue behavior factors and emotional state factors. The present invention conducts experiments on two public open domain dialogue datasets, DailyDialog and Mastodon, which annotate each sentence with dialogue behavior category and emotion category labels.
[0091] The DailyDialog dataset is widely used in the study of openness and dialogue generation. It contains a large-scale corpus of daily life chats written by native English speakers. According to Ekman's basic emotion theory, each sentence is annotated with six basic emotions: anger, disgust, fear, happiness, sadness, and surprise. Other sentences that do not belong to these six emotion types or have ambiguous emotional expressions are annotated as neutral, accounting for 83%. In addition, each sentence is annotated with four types of dialogue behaviors: notification, question, instruction, and promise.
[0092] The Mastodon dataset was collected on the social networking media platform Mastodon, and the conversation behavior category and sentiment category of each sentence were manually annotated. The sentiment category of each sentence was annotated as: positive, negative, and neutral. In addition, Mastodon divided the conversation behavior categories into 27 more fine-grained categories, and then retained 15 of them after merging. Compared with DailyDialog, Mastodon contains more low-quality sentences and noise because its corpus comes from online chats.
[0093] The training / validation / test set division method of the two datasets when they were made public is retained. Table 2 shows the statistical information of the two datasets.
[0094] Table 2
[0095]
[0096]
[0097] The present invention improves the performance of conversation emotion recognition by integrating common sense knowledge base and introducing multi-task learning related to emotion recognition on this basis. It has been proven to be an effective method to help the model extract the emotional state representation in the conversation text through the knowledge base. Retrieving conceptual entities or textual knowledge from external knowledge bases can enrich the semantic information contained in the discourse in the conversation text. At the same time, the present invention attempts to consider three tasks: conversation behavior classification, conversation emotion recognition, and conversation emotion reasoning, and then construct an effective multi-task learning framework to explore the mutual influence pattern of conversation behavior factors and emotional state factors.
[0098] Experimental results show that the conversation emotion recognition method of the present invention can significantly improve the performance of emotion recognition, while having good conversation behavior classification ability and certain emotion reasoning ability.
[0099] The beneficial effects of the present invention are as follows:
[0100] For the prediction results of the three tasks, the present invention uses micro-F1 value (micro-F1) and weighted F1 as evaluation indicators. Micro-F1 is calculated by the total accuracy and recall of all categories. In the case of extremely unbalanced samples, the performance of the classifier on categories with a large number of samples will greatly affect the value of micro-F1. Weighted F1 takes into account the number of samples in each category and assigns different weights to each category. The total weighted F1 value is obtained by the weighted sum of the F1 values on each category. It should be noted that considering that the proportion of sentences with neutral sentiment in the DailyDialog dataset is as high as 83%, neutral categories are excluded when calculating micro-F1 and weighted F1.
[0101] The experimental results are compared with several powerful dialogue emotion recognition models. The baseline models selected are DialogueRNN, DialogueGCN, Co-GAT, COSMIC, and TODKAT:
[0102] DialogueRNN uses three gated recurrent unit networks (GRU) to track context, participant status, and sentiment information respectively. DialogueGCN constructs the interaction relationship within and between participants as a graph network, and uses global context and participant local status to predict sentiment labels. Co-GAT uses cross-sentence connections and cross-task connections to construct a bidirectional interactive graph attention network to process the interaction information of dialogue behavior and emotion, and jointly learns dialogue behavior classification and emotion recognition tasks. The best performing Co-GAT+XLNet model in its paper is selected as the baseline model. COSMIC is the first work to use the ATOMIC knowledge base to improve the performance of dialogue emotion recognition. TODKAT obtains a topic-enhanced language model by fine-tuning the pre-trained model, and uses a pointer network to fuse the common sense knowledge obtained from the two approaches. As shown in Table 3, the experimental results of the model of the present invention and five baseline models on two datasets (DailyDialog and Mastodon) are shown.
[0103] Table 3
[0104]
[0105] From the results of the comparative experiments in Table 3, it can be found that the conversation emotion recognition method proposed in the present invention shows significant advantages over multiple strong baseline models. Compared with TODKAT, which has recently performed well in the conversation emotion recognition task of multiple public datasets, the weighted F1 and micro F1 indicators of the DailyDialog dataset have been improved by 4.3% and 1.4% respectively, and the improvement is more obvious on Mastodon, which has a smaller data scale, which are 6.5% and 6.3% respectively. One possible reason is that the multi-task learning framework in the encoder module of the present invention can make full use of the cognitive factor of conversation behavior to help the model understand the transfer pattern of emotional factors.
[0106] An ablation experiment was designed to verify the effectiveness of the design of each module in the model framework proposed in this invention. The comparison settings of each group in the ablation experiment are as follows:
[0107] w / o KB: without using the common sense retrieval module;
[0108] w / o multi-tasks: The decoder module does not use multi-task learning and only predicts the conversation emotion recognition task;
[0109] w / o DAR: The decoder module does not use the dialogue act classification task;
[0110] w / o EPC: The decoder module does not use the conversational sentiment inference task;
[0111] DAR||ERC||EPC: Decoder module does not apply to layers
[0112] Except for the changes mentioned above, the other parts of the above 5 ablation experiment settings are the same as the complete model of the present invention. In order to explore the mutual influence of multiple tasks in the encoder module of the present invention, in addition to the dialogue emotion recognition task, the micro F1 values of the dialogue behavior classification task and the dialogue emotion reasoning task are additionally evaluated in the ablation experiment. As shown in Table 4, the results of the ablation experiment designed by the present invention on DailyDialog and Mastodon (the indicator is micro F1 (%)), and CoGAT+XLNet is added to compare the results of the dialogue behavior classification task.
[0113] Table 4
[0114]
[0115] The following conclusions can be drawn from the analysis of the ablation experiment results:
[0116] (1) Compared with other modules, when the common sense retrieval module of the present invention is not used ("w / o KB"), we observed that the performance of the model on the three downstream tasks of both datasets dropped sharply, especially on the Mastodon dataset, where the performance of the conversation emotion recognition task dropped by nearly 5%. In the social media platform scenario with more noise and less standardized expressions, it is particularly important to use external knowledge to understand the cognitive and emotional factors in the conversation because it is difficult to obtain sufficient effective and reliable information from the conversation text.
[0117] (2) When the multi-task learning design in the decoder module is removed ("w / o multi-tasks"), the performance of the model in the conversation emotion recognition task on the two datasets is also significantly reduced. We designed several combinations of the three tasks ("w / o DAR" and "w / o EPC"). From the comparison of the experimental results, it can be found that the dialogue behavior classification task has a significant gain on the other two tasks, especially in the DailyDialog dataset, which has dramatically improved the performance of the emotion reasoning task. This result supports the hypothesis that cognitive factors have a decisive influence on emotional factors, and reflects that the present invention can capture the consistency between the two factors; at the same time, the emotion reasoning task can also effectively promote the model's emotion recognition effect on the current sentence, so that the model can further understand the emotions in the conversation.
[0118] (3) When the multi-task hierarchical modeling design ("DAR||ERC||EPC") in the decoder module is removed, it can be observed that the performance of the model in both the dialogue emotion recognition and emotion reasoning tasks has declined to varying degrees. This shows that the hierarchical modeling in the encoder module of the present invention is necessary, and the subsequent tasks can gain from the prediction results of the previous tasks. The reason for this phenomenon may be that our hierarchical modeling effectively avoids the conflict between certain cognitive factors and emotional factors and their future trends, and makes these factors closer to the consistency of common sense.
[0119] From the results and analysis of the comparative experiments and ablation experiments, it can be seen that the emotion recognition performance of the present invention on two public open domain dialogue datasets has been significantly improved compared with the baseline model. The design of each module in the model framework of the present invention can effectively contribute to the overall performance of the model. The beneficial effects of the present invention are as follows:
[0120] (1) The present invention does not directly use dialogue sentences to retrieve relevant knowledge from an external knowledge base. Instead, it uses a common sense generation model to obtain "events" that do not appear in the dialogue context as common sense knowledge. This process benefits from the diversified knowledge already included in the pre-trained model and is the result of forward reasoning based on the dialogue content, which effectively enriches the source of information obtained by the model.
[0121] (2) The present invention designs a multi-task learning framework and uses hierarchical modeling heuristically to reasonably connect multiple tasks. The experimental results show that the three tasks we designed are mutually reinforcing as a whole. The processing order of the three tasks in the hierarchical modeling makes the two auxiliary tasks consistently improve the performance of the dialogue emotion recognition task. At the same time, the dialogue emotion reasoning task enables the model of the present invention to make appropriate emotional responses after understanding the dialogue state. We believe that this result can be further used in the study of emotional response generation.
[0122] Although the present invention has been described above in conjunction with the accompanying drawings, the present invention is not limited to the above-mentioned specific embodiments, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in this field can make many modifications without departing from the purpose of the present invention, all of which fall within the protection scope of the present invention.
Claims
1. A conversation emotion recognition method based on common sense perception and hierarchical multi-task learning, characterized in that: The method specifically includes the following processes: Step 1: Obtain common sense knowledge related to the discourse in the dialogue from the common sense knowledge base, select five relation types sI, sR, oR, sE, oE related to cognitive and emotional factors for the phrases describing the events of a given role X, and generate a relation type sI, sR, oR, sE, oE related to the discourse u in the dialogue for each relation type i The K most similar event phrases are combined as candidate knowledge and recorded as Step 2: Use the pre-trained language model RoBERTa based on the self-attention mechanism and the Transformer architecture to build word-level and utterance-level hierarchical encodings, and encode each input sentence in the conversation into an embedded representation in the form of a vector; word-level encoding and utterance-level encoding extract semantic information of different granularities respectively, and model the transfer mode of cognitive and emotional factors between sentences at the utterance level while considering historical sentences; the specific processing included in this step is as follows: Step 2.1: Construct word-level encoding: Use the pre-trained language model RoBERTa based on the multi-layer self-attention mechanism to encode the input sentence into the corresponding embedding representation. i |Word Input statement Add special symbols [CLS] and [SEP] at the beginning and end of the statement, that is, will u i Send it to the language model RoBERTa to get the embedding representation of each word, as shown in the following formula: Among them, d is the hidden layer dimension of the language model RoBERTa, is a real number space of dimension d; The statement u i The first embedding representation of That is, the symbol [CLS] is used as the representation of the entire statement, denoted by x i , corresponding to the sequence (x1, x2, ..., x N ); Step 2.2: Construct utterance-level encoding: Use a Transformer block to take the embedding representation of each word in the conversation obtained by word-level encoding in step 1 as the input of this step, model the contextual dependencies between sentences in the conversation, and convert the sequence of sentence representations obtained from the word-level encoder (x1, x2, ..., x N ) is converted into a context-sensitive sentence representation (h1, h2, ..., h N ), as shown below: Where N is the number of sentences in the conversation, Trm is the Transformer encoder layer; Step 3: Under the hierarchical structure multi-task learning framework, the hierarchical relationship between the tasks is modeled using a hierarchical structure to simultaneously complete three tasks related to dialogue understanding: first, based on the sentence representation, the dialogue behavior category prediction label corresponding to the sentence is obtained; then, based on the prediction results of the sentence representation and the dialogue behavior classification, the emotion prediction label of the current sentence is obtained; finally, based on the two prediction results of the sentence representation and the dialogue behavior category label and the emotion label of the current sentence, emotion reasoning is performed to obtain the emotion prediction label of the next sentence; the specific processing included in this step is as follows: Step 3.1: Classify dialogue behaviors: Get sentence u i The utterance-level embedding representation h i After that, the attention mechanism is used to obtain the relevant knowledge of the candidate knowledge for the classification of dialogue behaviors and calculate the attention vector As shown below: Among them, [·;·] is a vector concatenation operation, x i is the representation of the entire sentence of the ith sentence, Attn (1) A method for calculating the attention vector; After another non-linear layer x i With the attention vector After fusion, predict the dialogue behavior label corresponding to the current sentence As shown below: in, is another nonlinear layer, M A is the embedding matrix of the dialogue act category labels, is the probability distribution function, ~ is the variable value that obeys the probability distribution function, d A is the number of dialogue behavior category labels; Step 3.2: Perform conversation emotion recognition: Also use the attention mechanism to perceive the most beneficial knowledge for the conversation emotion recognition task from the candidate knowledge and obtain the attention vector As shown below: Consider the predicted dialogue act class labels in step 3.1 The predicted label of the current sentence sentiment label As shown below: Among them, F E is the nonlinear layer, d E is the number of sentiment category labels, M E is the embedding matrix of the sentiment category label; Step 3.3, dialogue emotion reasoning: Based on the prediction results of dialogue behavior classification and dialogue emotion recognition tasks, infer the future emotional trend of the dialogue and select a reasonable emotion category for the upcoming response. Given the first i sentences in the dialogue, additionally consider the predicted emotion category label of the i-th sentence. The predicted label of the sentiment category corresponding to the i+1th sentence As shown below: Among them, F R is the nonlinear layer, M E Embedding matrix for common sentiment category labels; Step 3.4: Perform model training to obtain the optimization target.
2. The method for dialogue emotion recognition based on common sense perception and hierarchical multi-task learning as claimed in claim 1, characterized in that: The specific meanings of the five relationship types sI, sR, oR, sE, and oE are as follows: The relationship type sI indicates the reason why role X triggers the subject event; The relationship type sR represents the reaction of role X to the subject event; The relationship type oR represents other people’s reactions to the subject’s events; The relationship type sE represents the possible impact of the subject event on role X; Relationship type oE indicates the impact that the subject event may have on other people besides role X.
3. The method for dialogue emotion recognition based on common sense perception and hierarchical multi-task learning as claimed in claim 1, characterized in that: In the model training of step 3.4, the prediction loss functions of the three tasks are designed, namely the prediction loss function of the dialogue behavior classification task Prediction loss function for conversation emotion recognition task And the prediction loss function of the dialogue sentiment reasoning task in, are all probability distribution functions, are the true dialogue behavior category label, emotion category label of the i-th sentence, and the true emotion category label of the i+1-th sentence; Then we can get the complete model optimization goal Among them, λ1, λ2, and λ3 are the weights of the prediction loss of each part.
