Fine-grained emotion recognition method based on sentiment distribution enhancement integrated with VAD knowledge
By integrating VAD knowledge and self-attention mechanisms to generate emotion distribution information, the challenges of fine-grained emotion recognition models in capturing emotional complexity and nuanced gaps are solved, and the discrimination between emotions and model performance is improved.
Patent Information
- Application Number
- CN202410971769.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-19
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2044-07-19
AI Technical Summary
Existing fine-grained emotion recognition models have challenges in capturing emotional complexity and nuanced gaps. Direct use of VAD scores fails to fully tap into the meticulous connections between emotions and cannot provide more adequate external knowledge support.
A fine-grained emotion recognition method that integrates the emotional distribution enhancement of VAD knowledge. By constructing a semantic information module, an emotion distribution information module and a fusion prediction module, the BERT model and the VAD emotion knowledge base are used to combine self-attention mechanism and Gaussian kernel function to generate emotions. Distribute information to enhance the discrimination between emotions.
It effectively improves the discrimination between emotions, includes more detailed connections, and improves model performance. It is more conducive to fine-grained emotion recognition than traditional methods.
Smart Images

Figure CN118535741B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of emotion recognition, and in particular to a fine-grained emotion recognition method integrating VAD knowledge with emotion distribution enhancement. Background Art
[0002] Emotion recognition is an important task in natural language processing and is widely used in different fields, including artificial intelligence, message filtering systems, and psychology. In recent years, text emotion recognition has mainly relied on neural networks such as CNN, LSTM, and RNN. With the development of deep learning, the Transformer-based pre-trained language model (Bidirectional Encoder Representations From Transformers, BERT) proposed by Google has made breakthrough progress in the field of natural language processing. Due to the outstanding performance of BERT in a variety of natural language processing tasks, more and more scholars are using pre-trained models for emotion recognition research. Traditional emotion recognition models are based on the exploration of the six basic emotions proposed by psychologist Ekman (happiness, anger, fear, surprise, sadness, and disgust), or the eight basic emotions proposed by Plutchik (with the addition of "expectation" and "trust").
[0003] However, basic emotion models based on only 6 to 8 emotions often fail to fully capture the complexity of human emotions. Fine-grained emotion models provide stronger emotional expression capabilities through a large number of emotion categories. Psychologist Keltner et al. proposed a fine-grained emotion model consisting of 34 emotions. On this basis, Demszky et al. constructed the GoEmotions fine-grained text emotion dataset containing 54,000 comments, which contains 27 emotion tags and a "neutral" tag. Although fine-grained emotion models provide richer emotional expressions, the large number of increased emotion categories and their interrelationships and ambiguity have brought challenges to fine-grained emotion recognition models. In order to address these challenges, existing fine-grained emotion recognition research has improved model performance by introducing psychological emotion knowledge.
[0004] The emotion theory models in psychology mainly include classification theory models and dimension theory models. The classification theory model assumes that emotions are discrete and independent constructions. The dimension model believes that the construction of emotions is based on multiple evaluation factors such as valence and arousal, and defines emotions through quantitative variables, forming a high-dimensional continuous emotion space system. The continuous space emotion model uses continuous values to define emotions, which can better capture the potential relationship between various emotions. Therefore, the continuous space emotion model can express the correlation between emotions more finely. The VAD emotion model proposed by Russell believes that the three dimensions of valence (emotional polarity), arousal (calmness or excitement) and dominance (perceived control) are necessary conditions for defining emotional states. The VAD model uses mean and standard deviation to define 151 fine-grained emotions on these three dimensions. In the VAD emotion model, the distance between two emotions is measured by Euclidean distance. The smaller the distance, the smaller the difference between the two emotions and the greater the correlation; conversely, the larger the distance, the greater the difference and the smaller the correlation. Since the emotional distance is a continuous value, the VAD emotion model can more accurately express the subtle gap between emotions than the discrete space emotion model.
[0005] External knowledge can provide valuable emotional information for fine-grained emotion recognition tasks and effectively supplement the representation of deep learning models. A common approach is to fuse external knowledge with the contextual representation obtained by the pre-trained model through attention mechanisms and concatenation operations. However, the method of directly obtaining emotion scores from the sentiment dictionary as external knowledge does not take into account that the VAD psychological emotion model is a three-dimensional continuous space. In the VAD space, the distance between emotions reflects the interrelationship and ambiguity between fine-grained emotions. Therefore, the direct use of VAD scores fails to fully explore the detailed connections between fine-grained emotions and cannot provide more sufficient external knowledge for fine-grained emotion recognition models. Summary of the invention
[0006] In view of the deficiencies in the prior art, the present invention provides a fine-grained emotion recognition method for emotion distribution enhancement integrating VAD knowledge, which aims to solve the problems mentioned in the background technology.
[0007] To achieve the above object, the present invention provides the following technical solution: a fine-grained emotion recognition method for emotion distribution enhancement integrating VAD knowledge, comprising the following steps:
[0008] Step S1: construct a fine-grained text emotion dataset; the fine-grained text emotion dataset includes several comments, and each comment is regarded as a sample; the samples in the fine-grained text emotion dataset are 28 categories, including 27 emotion categories and one neutral category, and the neutral category means that the sample has no emotion category; the fine-grained text emotion dataset is divided into a training set, a validation set, and a test set in a ratio of 8:1:1;
[0009] Step S2: construct a text fine-grained emotion recognition model; the text fine-grained emotion recognition model includes a semantic information module, an emotion distribution information module, and a fusion prediction module; the semantic information module adopts a BERT model; the emotion distribution information module is composed of an emotion dictionary and a VAD emotion knowledge base; the fusion prediction module is composed of an emotion knowledge encoding layer, a prediction layer, and a cross entropy loss function;
[0010] Step S3: Initializing the parameters and hyperparameters of the text fine-grained emotion recognition model, inputting the training set into the text fine-grained emotion recognition model in a random input manner to train the text fine-grained emotion recognition model, and obtaining a trained text fine-grained emotion recognition model;
[0011] Step S4: Input the sample into the semantic information module and output the text semantic information representation vector ,in, Indicates the sample Words The text semantic information representation vector output by the BERT model;
[0012] Step S5: Sample Input into the sentiment distribution information module, extract sentiment words from the sample through the sentiment dictionary in the sentiment distribution information module, and combine them to obtain the sentiment word set ,in, Represents the total number of sentiment words in the sentiment word set; Indicates the sentiment word set sentiment words; ; Each sentiment word is associated with at least one sentiment label , that is, The sentiment word Emotional labels, , according to the position relationship of the emotion categories corresponding to the emotion labels in the VAD psychological emotion model, and based on the VAD distance between each emotion category, the emotion distribution is generated for each emotion word’s emotion label , the sentiment distribution of each sentiment label for sentiment words Take the mean and get the sentiment distribution of sentiment words , according to the number of sentiment words in the input sample And the sentiment distribution of each sentiment word , get the sentiment distribution of the input sample ,in, Indicates the sample Emotion distribution;
[0013] Step S6: Input the sentiment knowledge encoding layer in the fusion prediction module to obtain the sentiment knowledge encoding , emotional knowledge encoding and text semantic information representation vector Dimensional consistency, encoding emotional knowledge and text semantic information representation vector Through attention and concatenation operations, a fusion sequence of semantic information and sentiment distribution information is obtained. ;
[0014] Step S7: Fusing the semantic information and sentiment distribution information into a sequence The input prediction layer performs emotion prediction and uses the Softmax function to obtain the emotion probability prediction distribution corresponding to the sample.
[0015] Furthermore, the VAD emotion knowledge base is composed of a VAD psychological emotion model and a VAD emotion distance matrix based on the spatial position relationship of the VAD psychological emotion model; specifically, the VAD psychological emotion model and the VAD emotion distance matrix based on the spatial position relationship of the VAD psychological emotion model are used to construct a VAD emotion knowledge base of 27 emotion categories in the fine-grained text emotion dataset GoEmotions; the VAD psychological emotion model defines emotions through three dimensions: valence, arousal, and dominance; the NRC-VAD dictionary is used to obtain the three-dimensional scores of the 27 emotion categories in the fine-grained text emotion dataset GoEmotions, and the three-dimensional space of the VAD psychological emotion model of the 27 emotions is established through the three-dimensional scores; in the VAD psychological emotion model, the distance between emotions represents the similarity between emotions, which is called the VAD distance; the VAD distance between each of the 27 emotions and different emotions is calculated:
[0016] Set Emotion One of 27 emotions. ,mood The three-dimensional coordinates in the VAD psychological emotion model are μ i =[ V i , A i , D i ] ,in, Expressing emotions The valence score, Expressing emotions The awakening score, Expressing emotions Dominance score, emotion Remove emotions from 27 emotions Other emotions, ,mood The three-dimensional coordinates in the VAD psychological emotion model are μ j =[ V j , A j , D j ] ,in, Expressing emotions The valence score, Expressing emotions The awakening score, Expressing emotions Dominance score; Emotion in the three-dimensional space of VAD psychological emotion model using Euclidean distance metric and emotions The distance between them is calculated as follows:
[0017] (1);
[0018] In the formula, Expressing emotions and emotions VAD distance between them;
[0019] Similarly, the VAD distance matrix of the spatial position relationship of 27 emotions based on the VAD psychological emotion model is calculated to form a VAD emotion knowledge base of 27 emotion categories.
[0020] Further, the specific process of step S4 is: set the sample to X= [ x 0 , x 1 , x 2 , x 3 ,…, x n ] ,in, Indicates the sample words, Indicates the length, that is, the number of words in the sample; Input into the BERT model and converted into a text semantic information representation vector , expressed as:
[0021] (2);
[0022] In the formula, Indicates the nth row, A matrix of columns, where is the output dimension of the last layer of the BERT model; R represents a set of real numbers.
[0023] Furthermore, based on the positional relationship of the emotion categories corresponding to the emotion labels in the VAD psychological emotion model and based on the VAD distance between each emotion category, an emotion distribution is generated for the emotion label of each emotion word. , the sentiment distribution of each sentiment word is , expressed as:
[0024] (3);
[0025] In the formula, Indicates the number of emotion labels for each sentiment word.
[0026] Furthermore, the sentiment distribution of the sentiment labels of sentiment words It is constructed based on the VAD distance between each emotion category and is a 1×27 vector. An emotion word has at least one emotion label. Let the emotion category corresponding to this emotion label be the main emotion α of the emotion word, and let the other emotion categories except the main emotion α be the secondary emotion e of the emotion word. Perform the conversion, assign weights to the main emotions and secondary emotions, and regenerate the emotional distribution of the emotional labels of the emotional words; the purpose of the conversion is: the score of the main emotion is the emotional distribution The maximum value among them; the weight of the secondary emotion decreases as the VAD distance from the main emotion α increases, so that the score of the secondary emotion decreases as the VAD distance from the main emotion increases.
[0027] Furthermore, the Gaussian kernel function expression is:
[0028] (4);
[0029] In the formula, Expressing secondary emotions ; Indicates main emotion ; express and The Euclidean distance between them in the three-dimensional space of VAD psychological emotion model is VAD distance; is the offset, ; is the bandwidth parameter of local linear weighting;
[0030] The sentiment distribution calculation formula of the sentiment label of the regenerated sentiment word is as follows:
[0031] (5);
[0032] (6);
[0033] (7);
[0034] (8);
[0035] In the formula, The VAD distance from the main emotion to the secondary emotion is transformed by the Gaussian kernel function; is the coordinate of emotion e in the three-dimensional space of VAD psychological emotion model, where Expressing emotions The valence score, Expressing emotions The awakening score, Expressing emotions 's dominance score; It's emotion Coordinates in the three-dimensional space of the VAD psychological emotion model, where Expressing emotions The valence score, Expressing emotions The awakening score, Expressing emotions 's dominance score; is the normalization factor;
[0036] Based on the sentiment distribution of the sentiment labels of the regenerated sentiment words, the sentiment distribution of the sample is obtained .
[0037] Furthermore, the sentiment knowledge encoding layer consists of an input dimension of 27 and an output dimension of The fully connected layer is composed as follows:
[0038] (9);
[0039] In the formula, ; represents the set of real numbers; is the number of sentiment words; is the output dimension of the last layer of the BERT model; represents a fully connected layer; Represents the sentiment distribution of the input sample.
[0040] Further, the specific process of step S6 is: and Input fusion prediction module, using self-attention mechanism and fusion through splicing and Specifically, we first use the self-attention mechanism to As the key K, the text semantic information representation vector In As query Q, the key K and query Q are then matrix multiplied and passed through the Softmax function to obtain the attention score s. As the value V, do matrix multiplication with the obtained attention score s and output the attention emotion vector , the formula is as follows:
[0041] (10);
[0042] (11);
[0043] In the formula, express Converted into text semantic information representation vector by BERT model The transpose of represents the transpose of the attention score s;
[0044] Finally, Attention emotion vector Splicing to form a fusion sequence of semantic information and sentiment distribution information , expressed as:
[0045] (12).
[0046] Furthermore, the prediction layer is composed of a fully connected layer, and step S7 is expressed as:
[0047] (13);
[0048] (14);
[0049] In the formula, represents the sample sentiment prediction; is the probability prediction of the i-th sample on the j-th emotion.
[0050] Furthermore, the multi-classification cross entropy loss function is used Measures the difference between the predicted distribution of the emotion probability corresponding to the sample and the true label, expressed as:
[0051] (15);
[0052] In the formula, the function ; is the number of samples in the training set; C is the number of categories in the training set; For the The true labels corresponding to the samples.
[0053] Compared with the existing technology, the present invention has the following beneficial effects: the present invention can more effectively enhance the distinguishability between emotions by using sentiment distribution to quantitatively measure the mutual relationship between fine-grained emotions in the VAD sentiment space, including more detailed connections between fine-grained emotions, and is more helpful to improve the performance of the model than the traditional method of using the VAD score of sentiment words in the sentiment dictionary; by using self-attention technology, the expression of external sentiment knowledge is enhanced. Compared with the method of directly splicing direct semantic information with external knowledge, the method of using the self-attention mechanism and then splicing can help the external knowledge and the contextual representation of the pre-trained language model to construct a more effective data representation for fine-grained emotion recognition, thereby improving the fine-grained emotion recognition ability of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 It is a schematic diagram of the structure of the text fine-grained emotion recognition model of the present invention.
[0055] Figure 2 Schematic diagram of 27 emotions in the VAD psychological emotion model space.
[0056] Figure 3 Schematic diagram of the emotion distance matrix of 27 emotions based on VAD emotion knowledge. DETAILED DESCRIPTION
[0057] like Figure 1 As shown, the present invention provides a technical solution: a fine-grained emotion recognition method for emotion distribution enhancement integrating VAD knowledge, comprising the following steps:
[0058] Step S1: construct a fine-grained text emotion dataset; the fine-grained text emotion dataset adopts the fine-grained text emotion dataset GoEmotions released by Google, the fine-grained text emotion dataset GoEmotions includes 54,000 English comments, and each English comment is regarded as a sample; the fine-grained text emotion dataset GoEmotions is a 28-category task, including 27 emotion categories and one neutral category, and the neutral category indicates that the sample has no emotion category; all samples in the fine-grained text emotion dataset GoEmotions are labeled into 27 emotion categories; the fine-grained text emotion dataset is divided into a training set, a validation set and a test set in a ratio of 8:1:1, wherein the training set contains 43,410 training samples, the validation set contains 5,426 validation samples, and the test set contains 5,427 test samples.
[0059] Step S2: construct a text fine-grained emotion recognition model; the text fine-grained emotion recognition model includes a semantic information module, a sentiment distribution information module, and a fusion prediction module; the semantic information module adopts the BERT model; the sentiment distribution information module is composed of a sentiment dictionary and a VAD sentiment knowledge base; the fusion prediction module is composed of a sentiment knowledge encoding layer, a prediction layer, and a cross entropy loss function.
[0060] Among them, the VAD emotion knowledge base is composed of the VAD psychological emotion model and the VAD emotion distance matrix based on the spatial position relationship of the VAD psychological emotion model; specifically, the VAD psychological emotion model and the VAD emotion distance matrix based on the spatial position relationship of the VAD psychological emotion model are used to construct the VAD emotion knowledge base of 27 emotion categories in the fine-grained text emotion dataset GoEmotions; the VAD psychological emotion model defines emotions through three dimensions: valence (emotional polarity), arousal (calmness or excitement), and dominance (perceived control degree); the NRC-VAD dictionary is used to obtain the three-dimensional scores of the 27 emotion categories in the fine-grained text emotion dataset GoEmotions, and the three-dimensional space of the VAD psychological emotion model of the 27 emotions is established through the three-dimensional scores. The positional relationship of the 27 emotions in the three-dimensional space of the VAD psychological emotion model is as follows: Figure 2 As shown in the figure; in the VAD psychological emotion model, the distance between emotions represents the similarity between emotions, which is called VAD distance. The smaller the VAD distance between two emotions, the smaller the difference between the two emotions and the greater the correlation, and vice versa; calculate the VAD distance between each of the 27 emotions and different emotions:
[0061] Set Emotion One of 27 emotions. ,mood The three-dimensional coordinates in the VAD psychological emotion model are μ i =[ V i , A i , D i ] ,mood Remove emotions from 27 emotions Other emotions, ,mood The three-dimensional coordinates in the VAD psychological emotion model are μ j =[ V j , A j , D j ] ; Using Euclidean distance metric to measure emotions in the three-dimensional space of VAD psychological emotion model and emotions The distance between them is calculated as follows:
[0062] (1);
[0063] In the formula, Expressing emotions and emotions The VAD distance between them.
[0064] Similarly, the VAD distance matrix of the spatial position relationship of 27 emotions based on the VAD psychological emotion model was finally obtained through calculation, such as Figure 3 As shown, the VAD emotion knowledge base consists of 27 emotion categories.
[0065] Step S3: Initialize the parameters and hyperparameters of the text fine-grained emotion recognition model, input the training set into the text fine-grained emotion recognition model in a random input manner to train the text fine-grained emotion recognition model, and obtain a trained text fine-grained emotion recognition model.
[0066] Step S4: Input the sample into the semantic information module and output the text semantic information representation vector ,in, Indicates the sample The text semantic information representation vector of the word output by the BERT model; specifically, the sample is set to X= [ x 0 ,x 1 , x 2 , x 3 ,…, x n ] ,in, Indicates the sample words, Indicates the length, that is, the number of words in the sample; Input into the BERT model and converted into a text semantic information representation vector , which can be expressed as:
[0067] (2);
[0068] In the formula, Indicates the nth row, A matrix of columns, where is the output dimension of the last layer of the BERT model; R represents a set of real numbers.
[0069] Step S5: Sample Input into the sentiment distribution information module, extract sentiment words from the sample through the sentiment dictionary in the sentiment distribution information module, and combine them to obtain the sentiment word set ,in, Represents the total number of sentiment words in the sentiment word set; Indicates the sentiment word set sentiment words; ; Each sentiment word is associated with at least one sentiment label , that is, The sentiment word Emotional labels, , according to the position relationship of the emotion categories corresponding to the emotion labels in the VAD psychological emotion model, and based on the VAD distance between each emotion category, the emotion distribution is generated for each emotion word’s emotion label , the sentiment distribution of each sentiment label for sentiment words Take the mean and get the sentiment distribution of sentiment words , according to the number of sentiment words in the input sample And the sentiment distribution of each sentiment word , get the sentiment distribution of the input sample ,in, Indicates the sample A distribution of emotions.
[0070] Among them, according to the position relationship of the emotion category corresponding to the emotion label in the VAD psychological emotion model, and based on the VAD distance between each emotion category, the emotion distribution is generated for each emotion word emotion label , the sentiment distribution of each sentiment word is , which can be expressed as:
[0071] (3);
[0072] In the formula, Indicates the number of emotion labels for each sentiment word.
[0073] Sentiment distribution of sentiment labels of sentiment words It is constructed based on the VAD distance between each emotion category and is a 1×27 vector. An emotion word has at least one emotion label. Let the emotion category corresponding to this emotion label be the main emotion α of the emotion word, and let the other emotion categories except the main emotion α be the secondary emotion e of the emotion word. Perform the conversion, assign weights to the main emotions and secondary emotions, and regenerate the emotional distribution of the emotional labels of the emotional words; the purpose of the conversion is: 1. The score of the main emotion is the emotional distribution The maximum value among them; 2. The weight of the secondary emotion decreases as the VAD distance from the main emotion α increases, so that the score of the secondary emotion decreases as the VAD distance from the main emotion increases.
[0074] The Gaussian kernel function expression is:
[0075] (4);
[0076] In the formula, Expressing secondary emotions ; Indicates main emotion ; express and The Euclidean distance (VAD distance) between them in the three-dimensional space of VAD psychological emotion model; is the offset, ; It is a local linear weighted bandwidth parameter used to control the dispersion of sentiment distribution.
[0077] The sentiment distribution calculation formula of the sentiment label of the regenerated sentiment word is as follows:
[0078] (5);
[0079] (6);
[0080] (7);
[0081] (8);
[0082] In the formula, The VAD distance from the main emotion to the secondary emotion is transformed by the Gaussian kernel function; is the coordinate of emotion e in the three-dimensional space of VAD psychological emotion model, where Expressing emotions The valence score, Expressing emotions The awakening score, Expressing emotions 's dominance score; It's emotion Coordinates in the three-dimensional space of the VAD psychological emotion model, where Expressing emotions The valence score, Expressing emotions The awakening score, Expressing emotions 's dominance score; is a normalization factor such that .
[0083] Based on the sentiment distribution of the sentiment labels of the regenerated sentiment words, the sentiment distribution of the sample is obtained .
[0084] Step S6: Input the sentiment knowledge encoding layer in the fusion prediction module to obtain the sentiment knowledge encoding , emotional knowledge encoding and text semantic information representation vector The dimensions are consistent; the emotional knowledge encoding layer consists of an input dimension of 27 and an output dimension of The fully connected layer is composed as follows:
[0085] (9);
[0086] In the formula, ; represents the set of real numbers; is the number of sentiment words; is the output dimension of the last layer of the BERT model; is a fully connected layer; Represents the sentiment distribution of the input sample.
[0087] Encoding emotional knowledge and text semantic information representation vector Input fusion prediction module, using self-attention mechanism and fusion through splicing and , construct a more effective context representation to achieve sample emotion prediction; specifically, firstly adopt the self-attention mechanism to As the key (Key, K), the text semantic information representation vector In As the query (Query, Q), the key K and the query Q are then matrix multiplied and passed through the Softmax function to obtain the attention score s. As the value (Value, V) and the obtained attention score s, do matrix multiplication and output the attention emotion vector , the formula is as follows:
[0088] (10);
[0089] (11);
[0090] In the formula, express Converted into text semantic information representation vector by BERT model The transpose of represents the transpose of the attention score s;
[0091] Finally, the emotional knowledge is encoded Attention emotion vector Splicing to form a fusion sequence of semantic information and sentiment distribution information , which can be expressed as:
[0092] (12);
[0093] Step S7: Fusing the semantic information and sentiment distribution information into a sequence The input prediction layer performs emotion prediction and uses the Softmax function to obtain the emotion probability prediction distribution corresponding to the sample; the prediction layer is composed of a fully connected layer, and the input dimension of the fully connected layer is , the output dimension is the number of categories of the classification task; (the present invention uses the GoEmotions dataset, the classification task of this dataset is 28 categories, so the output dimension is 28);
[0094] (13);
[0095] (14);
[0096] In the formula, represents the sample sentiment prediction; is the probability prediction of the i-th sample on the j-th emotion.
[0097] Finally, the multi-classification cross entropy loss function is used The difference between the predicted distribution of the emotion probability corresponding to the sample and the true label can be expressed as:
[0098] (15);
[0099] In the formula, the function ; is the number of samples in the training set; C is the number of emotion categories in the training set; For the The true labels corresponding to the samples.
[0100] The training set is used to train the trained text fine-grained emotion recognition model for 15 epochs, the learning rate is set to 3e-05, the Adam optimizer is used for optimization, and the early stopping method is used. The early stop patience is set to 4 to avoid overfitting; after all the training is completed, the parameters of the optimal text fine-grained emotion recognition model are saved, and finally the text fine-grained emotion recognition model is predicted and evaluated on the test set.
[0101] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A fine-grained emotion recognition method based on emotion distribution enhancement integrated with VAD knowledge, characterized in that: The steps include: Step S1: construct a fine-grained text emotion dataset; the fine-grained text emotion dataset includes several comments, and each comment is regarded as a sample; the samples in the fine-grained text emotion dataset are 28 categories, including 27 emotion categories and one neutral category, and the neutral category means that the sample has no emotion category; the fine-grained text emotion dataset is divided into a training set, a validation set, and a test set in a ratio of 8:1:1; Step S2: construct a text fine-grained emotion recognition model; the text fine-grained emotion recognition model includes a semantic information module, an emotion distribution information module, and a fusion prediction module; the semantic information module adopts a BERT model; the emotion distribution information module is composed of an emotion dictionary and a VAD emotion knowledge base; the fusion prediction module is composed of an emotion knowledge encoding layer, a prediction layer, and a cross entropy loss function; Step S3: Initializing the parameters and hyperparameters of the text fine-grained emotion recognition model, inputting the training set into the text fine-grained emotion recognition model in a random input manner to train the text fine-grained emotion recognition model, and obtaining a trained text fine-grained emotion recognition model; Step S4: Input the sample into the semantic information module and output the text semantic information representation vector ,in, Indicates the sample Words The text semantic information representation vector output by the BERT model; Step S5: Sample Input into the sentiment distribution information module, extract sentiment words from the sample through the sentiment dictionary in the sentiment distribution information module, and combine them to obtain the sentiment word set ,in, Represents the total number of sentiment words in the sentiment word set; Indicates the sentiment word set sentiment words; ; Each sentiment word is associated with at least one sentiment label , that is, The sentiment word Emotional labels, , according to the position relationship of the emotion categories corresponding to the emotion labels in the VAD psychological emotion model, and based on the VAD distance between each emotion category, the emotion distribution is generated for each emotion word’s emotion label , the sentiment distribution of each sentiment label for sentiment words Take the mean and get the sentiment distribution of sentiment words , according to the number of sentiment words in the input sample And the sentiment distribution of each sentiment word , get the sentiment distribution of the input sample ,in, Indicates the sample Emotion distribution; Step S6: Input the sentiment knowledge encoding layer in the fusion prediction module to obtain the sentiment knowledge encoding , emotional knowledge encoding and text semantic information representation vector Dimensional consistency, encoding emotional knowledge and text semantic information representation vector Through attention and concatenation operations, a fusion sequence of semantic information and sentiment distribution information is obtained. ; Step S7: Fusing the semantic information and sentiment distribution information into a sequence The input prediction layer performs emotion prediction and uses the Softmax function to obtain the emotion probability prediction distribution corresponding to the sample; The VAD emotion knowledge base is composed of a VAD psychological emotion model and a VAD emotion distance matrix based on the spatial position relationship of the VAD psychological emotion model; specifically, the VAD psychological emotion model and the VAD emotion distance matrix based on the spatial position relationship of the VAD psychological emotion model are used to construct a VAD emotion knowledge base of 27 emotion categories in the fine-grained text emotion dataset GoEmotions; the VAD psychological emotion model defines emotions through three dimensions: valence, arousal, and dominance; the NRC-VAD dictionary is used to obtain the three-dimensional scores of the 27 emotion categories in the fine-grained text emotion dataset GoEmotions, and the three-dimensional space of the VAD psychological emotion model of the 27 emotions is established through the three-dimensional scores; in the VAD psychological emotion model, the distance between emotions represents the similarity between emotions, which is called the VAD distance; the VAD distance between each of the 27 emotions and different emotions is calculated: Set Emotion One of 27 emotions. ,mood The three-dimensional coordinates in the VAD psychological emotion model are ,in, Expressing emotions The valence score of Expressing emotions The awakening score, Expressing emotions Dominance score, emotion Remove emotions from 27 emotions Other emotions, ,mood The three-dimensional coordinates in the VAD psychological emotion model are ,in, Expressing emotions The valence score of Expressing emotions The awakening score, Expressing emotions Dominance score; Emotion in the three-dimensional space of VAD psychological emotion model using Euclidean distance metric and emotions The distance between them is calculated as follows: ; In the formula, Expressing emotions and emotions VAD distance between them; Similarly, the VAD distance matrix of the spatial position relationship of 27 emotions based on the VAD psychological emotion model is calculated to form a VAD emotion knowledge base of 27 emotion categories; The specific process of step S4 is: set the sample to ,in, Indicates the sample words, Indicates the length, that is, the number of words in the sample; Input into the BERT model and converted into a text semantic information representation vector , expressed as: ; In the formula, Indicates the nth row, A matrix of columns, where is the output dimension of the last layer of the BERT model; R represents a set of real numbers; According to the position relationship of the emotion categories corresponding to the emotion labels in the VAD psychological emotion model, and based on the VAD distance between each emotion category, the emotion distribution is generated for each emotion word’s emotion label , the sentiment distribution of each sentiment word is , expressed as: ; In the formula, Indicates the number of emotion tags for each sentiment word; Sentiment distribution of sentiment labels of sentiment words It is constructed based on the VAD distance between each emotion category and is a 1×27 vector. An emotion word has at least one emotion label. Let the emotion category corresponding to this emotion label be the main emotion α of the emotion word, and let the other emotion categories except the main emotion α be the secondary emotion e of the emotion word. Perform the conversion, assign weights to the main emotions and secondary emotions, and regenerate the emotional distribution of the emotional labels of the emotional words; the purpose of the conversion is: the score of the main emotion is the emotional distribution The maximum value among; the weight of the secondary emotion decreases as the VAD distance from the primary emotion α increases, so that the score of the secondary emotion decreases as the VAD distance from the primary emotion increases; The specific process of step S6 is: and Input fusion prediction module, using self-attention mechanism and fusion through splicing and Specifically, we first use the self-attention mechanism to As the key K, the text semantic information representation vector In As query Q, the key K and query Q are then matrix multiplied and passed through the Softmax function to obtain the attention score s. As the value V, do matrix multiplication with the obtained attention score s and output the attention emotion vector , the formula is as follows: ; ; In the formula, express Converted into text semantic information representation vector by BERT model The transpose of represents the transpose of the attention score s; Finally, Attention emotion vector Splicing to form a fusion sequence of semantic information and sentiment distribution information , expressed as: 。 2. The fine-grained emotion recognition method with enhanced emotion distribution integrating VAD knowledge according to claim 1 is characterized in that: The Gaussian kernel function expression is: ; In the formula, Expressing secondary emotions ; Indicates main emotion ; express and The Euclidean distance between them in the three-dimensional space of VAD psychological emotion model is VAD distance; is the offset, ; is the bandwidth parameter of local linear weighting; The sentiment distribution calculation formula of the sentiment label of the regenerated sentiment word is as follows: ; ; ; ; In the formula, The VAD distance from the main emotion to the secondary emotion is transformed by the Gaussian kernel function; is the coordinate of emotion e in the three-dimensional space of VAD psychological emotion model, where Expressing emotions The valence score of Expressing emotions The awakening score, Expressing emotions 's dominance score; It's emotion Coordinates in the three-dimensional space of the VAD psychological emotion model, where Expressing emotions The valence score of Expressing emotions The awakening score, Expressing emotions 's dominance score; is the normalization factor; Based on the sentiment distribution of the sentiment labels of the regenerated sentiment words, the sentiment distribution of the sample is obtained .
3. The fine-grained emotion recognition method with enhanced emotion distribution integrating VAD knowledge according to claim 2 is characterized in that: The emotional knowledge encoding layer consists of an input dimension of 27 and an output dimension of The fully connected layer is composed as follows: ; In the formula, ; represents the set of real numbers; is the number of sentiment words; is the output dimension of the last layer of the BERT model; represents a fully connected layer; Represents the sentiment distribution of the input sample.
4. The fine-grained emotion recognition method with enhanced emotion distribution integrating VAD knowledge according to claim 3 is characterized in that: The prediction layer is composed of a fully connected layer, and step S7 is expressed as: ; ; In the formula, represents the sample sentiment prediction; is the probability prediction of the i-th sample on the j-th emotion.
5. The fine-grained emotion recognition method with enhanced emotion distribution integrating VAD knowledge according to claim 4 is characterized in that: Using multi-class cross entropy loss function Measures the difference between the predicted distribution of the emotion probability corresponding to the sample and the true label, expressed as: ; In the formula, the function ; is the number of samples in the training set; C is the number of categories in the training set; For the The true labels corresponding to the samples.