A dialogue text-oriented negative emotion recognition method

By integrating Bi-LSTM, RGAT, and BL methods, and utilizing a pre-trained RoBERTa model to extract features from dialogue text, this approach addresses the difficulty in capturing speaker influence and contextual semantics in existing technologies, achieving efficient recognition of negative emotions in dialogue text.

CN115658855BActive Publication Date: 2026-02-03GUANGDONG UNIVERSITY OF FOREIGN STUDIES
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210779093.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-30
Publication Date
2026-02-03
Estimated Expiration
2042-06-30

AI Technical Summary

Technical Problem

Existing methods for emotion recognition in dialogue texts struggle to effectively capture the mutual influence and interaction between speakers, and they neglect the contextual semantic information and local features of the dialogue text.

Method used

The approach integrates Bi-LSTM, RGAT, and BL. It extracts utterance-level and speaker-level features through a pre-trained RoBERTa model, captures contextual semantics using Bi-LSTM, captures long-distance dependencies between speakers using RGAT, and performs feature processing through BL to identify negative emotions.

Benefits of technology

It improves the recognition of negative emotions in dialogue text and significantly enhances the recognition accuracy, especially outperforming the baseline model in terms of macro-F1 score.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115658855B_ABST
    Figure CN115658855B_ABST
Patent Text Reader

Abstract

The application discloses a dialogue text-oriented negative emotion recognition method, which comprises the following steps: obtaining dialogue text data and pre-processing the obtained dialogue text data; adopting a pre-training model RoBERTa to perform vectorization representation on the dialogue text, wherein the pre-training model RoBERTa is an improved model of a BERT (Bidirectional Encoder Representations from Transformers) through robust optimization; adopting a Bi-LSTM (Bidirectional Long Short-Term Memory) to extract local features and context semantic features of the text vector and obtain speech level features; and adopting an RGAT (Relational Graph Attention Network) to extract long-distance dependency relationships between speakers and obtain speaker level features. The application provides a dialogue text-oriented negative emotion recognition method, so that the system can effectively extract speech level features and speaker level features at the same time, thereby improving the recognition effect of dialogue text negative emotions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of content security, specifically to a method for identifying negative emotions in conversational text. Background Technology

[0002] The rapid development of the internet has transformed people's daily communication patterns, with social networks becoming crucial tools for daily interaction. Platforms like WeChat and Taobao have become integral parts of people's daily lives. According to the 49th Statistical Report on Internet Development in China, as of December 2021, my country had 1.032 billion internet users, with an internet penetration rate of 73.0%. This has led to a surge in conversations with strong emotional biases on social networks, especially those with negative sentiments. Automatically identifying information carrying negative emotions from this massive volume of conversations is of great significance for social network security.

[0003] Dialogue text is generated by multiple speakers taking turns speaking, and its global semantics are jointly constructed by multiple users within the context of the dialogue. There is a strong correlation in emotional expression between utterances and between speakers. These characteristics make emotion recognition in dialogue text a research hotspot in natural language processing. Emotion refers to people's reactions to external stimuli, while negative emotion refers to people's subjective negative emotional reactions to negative events. With the continuous emergence of dialogue text containing negative emotions, traditional manual processing methods are insufficient to handle such massive amounts of data. Therefore, it is necessary to design an efficient method for automatic identification of negative emotions in dialogue text.

[0004] Most existing methods focus on sentiment classification for short texts. However, due to the dependencies between utterances and speakers in dialogue texts, sentiment recognition for dialogue texts is undoubtedly more challenging than for short texts. Existing methods for sentiment recognition of dialogue texts can be broadly categorized into dialogue sequence-based methods and graph neural network-based methods. Dialogue sequence-based methods mostly employ deep learning models such as LSTM (Long Short-Term Memory) and GRU (Gated Recurrent Unit) to extract utterance-level features. While these models can capture long-distance features and the correlation between utterances, they neglect the mutual influence and role of speakers in the dialogue.

[0005] Most graph neural network-based methods use graph convolutional neural networks (GCNNs) to model dialogue text, thereby better characterizing the influence and connections between speakers. Graph convolutional networks can capture the structural features of text as well as non-contiguous and long-distance dependencies between words. However, graph convolutional networks also have the following shortcomings: First, because they represent words as nodes in a graph and use adjacency matrices to represent the neighborhood information of nodes, they do not consider the sequential structure of the dialogue text, thus failing to capture the contextual semantic information of the text; second, they are insufficient in extracting local feature information. Summary of the Invention

[0006] The purpose of this invention is to overcome the shortcomings and deficiencies of existing technologies and propose a method for identifying negative emotions in dialogue text. This invention integrates the advantages of Bi-LSTM (Bidirectional Long Short-Term Memory), RGAT (Relational Graph Attention Network), and BL (Broad Learning), enabling the system to simultaneously and effectively extract both utterance-level and speaker-level features, thereby improving the recognition performance of negative emotions in dialogue text.

[0007] Therefore, this invention discloses a method for identifying negative emotions in dialogue text, comprising:

[0008] Acquire dialogue text data and preprocess the acquired dialogue text data;

[0009] The pre-trained model RoBERTa is used to vectorize the dialogue text. The pre-trained model RoBERTa is an improved model of BERT through robust optimization.

[0010] Bi-LSTM is used to extract local features and contextual semantic features from text vectors to obtain discourse-level features;

[0011] RGAT is used to extract long-distance dependencies between speakers and obtain speaker-level features;

[0012] By using black-and-white processing (BL) to process the two types of spliced ​​features, negative emotions can be identified.

[0013] Preferably, the use of a pre-trained model RoBERTa to vectorize the dialogue text, wherein the pre-trained model RoBERTa is specifically a model trained using a robust optimization BERT pre-training method:

[0014] Fine-tuning the pre-trained model is represented as follows:

[0015]

[0016] μ m-1 =δ×μ m

[0017] Where q i Let q represent the parameters of the i-th layer of the model, and n represent the time step. i n ▽ represents the parameters of the i-th layer of the model at the n-th time step. qi H(q) represents the gradient of the model's objective function, μ m Let δ represent the learning rate of the m-th layer, and δ represent the decay rate of the learning rate.

[0018] We pre-trained each sentence using a fine-tuned RoBERTa to generate word vectors, and took the vector corresponding to the word symbol "[CLS]" as the utterance vector. Thus, the utterance vector matrix can be represented as follows:

[0019]

[0020] Where N represents the number of utterances in a round of dialogue, and d represents the dimension of the sentence vector. This indicates that the operation involves a real number matrix.

[0021] Preferably, the step of using Bi-LSTM to extract local features and contextual semantic features from the text vector to obtain discourse-level features specifically involves:

[0022] Bi-LSTM is used to extract discourse-level features by effectively capturing contextual semantic features.

[0023] The basic idea of ​​Bi-LSTM is to use two LSTMs in opposite directions to process the forward and backward sequences respectively, so as to obtain the correlation between features in two directions, and output the correlation information in two directions as the forward and backward features of the LSTM.

[0024] Then, the forward and backward features are concatenated, enabling Bi-LSTM to effectively capture the contextual information of the text. The specific process is as follows:

[0025]

[0026]

[0027]

[0028] in and These represent the forward and backward LSTM features of the i-th sentence, respectively. This represents the discourse-level feature matrix generated in a single round of dialogue.

[0029] For a round of discourse, the characteristics of the discourse level can be represented as:

[0030]

[0031] Where d l Dimensions representing discourse-level characteristics.

[0032] Preferably, the step of using RGAT to extract long-distance dependencies between speakers and obtaining speaker-level features specifically involves:

[0033] Construct a directed graph, assuming the directed graph G = {V, E, R, W}. G} is used to represent a dialogue with N utterances, where V represents the set of nodes, E represents the set of edges, R represents the set of relation types of edges, and W represents the set of attention weights of edges;

[0034] V: Each utterance corresponds to a node l in G. i ∈V, i=1,2,…N, where each node is a discourse-oriented sentence vector generated using RoBERTa. Let p(·) represent the mapping relationship between utterance and speaker, i.e., p(l i )∈S represents node l i The corresponding speaker s j j = 1, 2, ..., M;

[0035] E: If node l i With l j The edge between them can be represented as e ij ∈E, i,j=1,2,…N, then e ij It can be used to represent the contextual relationship between utterances; if you want to represent l i In the context of other discourses, then l i It needs to be connected to all nodes in G, meaning G becomes a fully connected graph; however, this may consume a lot of computational resources; therefore, it is necessary to allocate resources to l. i A context window is set up to effectively capture local feature information. Assuming p represents the window size for historical utterances and f represents the window size for future utterances, then l i Only the first p nodes need to be connected. i-1 ,l i-2 ,...,l i-p and the last f nodes l i+1 ,l i+2 ,...,l i+f and itself;

[0036] R: Different edges represent different contextual relationships between utterances, including five types of relationships, which can be represented as R = {1, 2, 3, 4, 5}; when p(l i )=p(l j When i < j, e ij p(l) represents the same speaker i ) node l j For l i The effect, i.e., R = 1; when p(l i )=p(l j When i > j, e ij Indicates the speaker p(l) i ) node l j For l i The effect, i.e., R = 2; when p(l i )≠p(l j When i < j, e ij p(l) represents the same speaker j ) node l j For the speaker p(l) i ) node l i The effect, i.e., R = 3; when p(l i )≠p(l j When i > j, e ij Indicates the speaker p(l) j ) node l j For the speaker p(l) i ) node l i The effect is that R = 4; when i = j, e ij The influence of the discourse itself is represented by R=5; each edge can represent the influence of other speakers or the influence of itself on each speaker's discourse, thus effectively extracting the structural features of the dialogue text and the long-distance dependencies between words;

[0037] W G Node l i For l j The edge e ij The weight can be expressed as w ij ∈W G The magnitude of its value represents the discourse l i Confrontation with discourse j The extent of the impact;

[0038] RGAT is used to extract speaker-level features; first, the attention weights w of the edges are applied. ij To solve for l, a single-layer feedforward neural network is used to calculate l. j For l i Attention coefficient c ij Specifically, it is expressed as follows:

[0039] c ij =l i T W e [l i ,l j ],j=ip,…,i+f

[0040] Among them W e Let c represent a learnable weight matrix. ij This indicates the degree of influence of node j on node i. Preferably, RGAT is used to extract speaker-level features; first, the attention weight w of the edge is... ij To solve for l, a single-layer feedforward neural network is used to calculate l. j For l i Attention coefficient c ij Specifically, it is expressed as follows:

[0041] c ij =l i T W e [l i ,l j ],j=ip,…,i+f

[0042] Among them W e Let c represent a learnable weight matrix. ij After indicating the degree of influence of node j on node i, it also includes:

[0043] The attention coefficients are normalized using the softmax function, i.e., l j For l i attention weights w of the edges ij It can be represented as follows:

[0044]

[0045] Two layers of RGAT are used to encode the speaker;

[0046] For the first-level RGAT, node l is aggregated by aggregating neighbor node information. i Transformed into speaker-related feature vector h i The specific process is as follows:

[0047]

[0048] Where h i This represents the features extracted in the first layer operation, and σ represents the nonlinear activation function. and Represents the weight matrix. Indicates node li The set of neighbor nodes under relation r∈R, c ir This represents a normalization constant, typically taking the value of . That is, node l i The number of neighboring nodes;

[0049] For the second layer of RGAT, the same feature transformation method is used based on the first layer, transforming h... i Transform into feature vector o i The specific process is as follows:

[0050]

[0051] Among them, W 2 and Let σ represent the weight matrix, and let σ represent a non-linear activation function, such as ReLU.

[0052] via h i and o i This enables the model to effectively aggregate the neighbor node information of each node, thereby obtaining the long-distance dependencies between speakers. That is, the speaker-level features can be represented as:

[0053]

[0054] Where, d s This represents the feature dimension at the speaker level, i.e., the number of hidden units in RGAT.

[0055] Preferably, the step of processing the two spliced ​​features using BL to achieve negative emotion recognition includes:

[0056] The features at the discourse level and the speaker level are concatenated and specifically represented as follows:

[0057]

[0058] A negative emotion detector is designed using BL (Boolean) to identify the negative emotions contained in each utterance.

[0059] Preferably, the negative emotion recognizer specifically includes:

[0060] The extracted features G * Perform a linear mapping to generate multiple sets of feature nodes for BL, i.e., for G * Perform a linear mapping operation to generate k groups of feature nodes; the i-th group of feature nodes is represented as follows:

[0061]

[0062] Where F i This represents the i-th group of feature nodes. W represents a linear activation function. fi Describes a randomly generated weight matrix and φ fi Describes a randomly generated bias matrix and q represents the number of feature nodes in each group, and k represents the number of feature node groups;

[0063] Therefore, the k sets of feature nodes can be represented as follows:

[0064]

[0065] k groups of feature nodes F k Perform nonlinear mapping to generate multiple sets of augmentation nodes for BL, i.e., for F k Perform a nonlinear mapping operation to generate m groups of enhanced nodes; the j-th group of enhanced nodes is represented as follows:

[0066]

[0067] Among them B j Let ξ represent the j-th augmentation node, and W represent the nonlinear activation function. bj Describes a randomly generated weight matrix and φ bj Describes a randomly generated bias matrix and kq represents the total number of feature nodes, and r represents the number of augmentation nodes in each group;

[0068] Therefore, the m groups of augmenting nodes can be represented as follows:

[0069]

[0070] Where m represents the number of groups of augmented nodes;

[0071] The k groups of feature nodes and m groups of enhancement nodes are concatenated, as shown below:

[0072]

[0073] According to Y=AW B There is W B =A+Y, since A is not a square matrix in most cases, therefore, A can be used. + Let W represent the generalized inverse matrix of A; to compute W more quickly. B To enhance the model's generalization ability, the Ridge Regression algorithm can be used to solve for W. B Specifically, it is expressed as follows:

[0074]

[0075] Where λ represents the regularization coefficient. This represents the approximate output of BL;

[0076] W B The global optimal solution can be expressed as:

[0077]

[0078] The method of this invention identifies negative emotions in dialogue texts. By combining the advantages of deep learning and breadth learning, and designing a more intuitive method, the system can effectively extract local contextual information (i.e., discourse level) and global contextual information (i.e., speaker level) in the dialogue, thereby effectively improving the recognition effect of negative emotions in dialogue texts. The results show that the method proposed in this invention outperforms the baseline model in both weight-F1 and macro-F1. Attached Figure Description

[0079] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0080] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0081] Figure 1 This is a flowchart of a method for identifying negative emotions in dialogue text according to the present invention;

[0082] Figure 2 This is a control block diagram of a negative emotion recognition method for dialogue text according to the present invention. Detailed Implementation

[0083] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.

[0084] It should be noted that all directional indications (such as up, down, left, right, front, back, etc.) in the embodiments of the present invention are only used to explain the relative positional relationship and movement of each component in a certain specific posture (as shown in the figure). If the specific posture changes, the directional indication will also change accordingly.

[0085] Furthermore, the use of terms such as "first" and "second" in this invention is for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of that feature. Additionally, the technical solutions of the various embodiments can be combined with each other, but only on the basis of being achievable by those skilled in the art. When the combination of technical solutions is contradictory or impossible to implement, such a combination of technical solutions should be considered non-existent and not within the scope of protection claimed by this invention.

[0086] In a first aspect, this invention discloses a method for identifying negative emotions in dialogue text, including:

[0087] Step 1: Obtain the dialogue text data and preprocess the obtained dialogue text data;

[0088] Step 2: Use the pre-trained model RoBERTa (A Robustly Optimized BERT Pretraining Approach) to vectorize the dialogue text;

[0089] Step 3: Use Bi-LSTM to extract local features and contextual semantic features from the text vector to obtain discourse-level features;

[0090] Step 4: Use RGAT to extract long-distance dependencies between speakers, thereby obtaining speaker-level features;

[0091] Step 5: Use BL to process the two spliced ​​features to achieve the recognition of negative emotions.

[0092] Furthermore, step 2 specifically includes:

[0093] Step 2.1: First, fine-tune the pre-trained model RoBERTa, as shown below:

[0094]

[0095] μ m-1 =δ×μ m

[0096] Where q i Let represent the parameters of the i-th layer of the model, and n represent the time step. This represents the parameters of the i-th layer of the model at the n-th time step. μ represents the gradient of the model's objective function. m Let δ represent the learning rate of the m-th layer, and δ represent the decay rate of the learning rate.

[0097] Step 2.2: Pre-train each sentence using the fine-tuned RoBERTa to generate word vectors. Take the vector corresponding to the word symbol "[CLS]" as the utterance vector, so the utterance vector matrix can be represented as follows:

[0098]

[0099] Where N represents the number of utterances in a round of dialogue, and d represents the dimension of the sentence vector. This indicates that the operation involves a real number matrix.

[0100] Furthermore, step 3 specifically involves:

[0101] Bi-LSTM is used to extract utterance-level features by effectively capturing contextual semantic features. The basic idea of ​​Bi-LSTM is to use two LSTMs running in opposite directions to process the forward and backward sequences respectively, obtaining the correlation between features in both directions. The correlation information in both directions is then output as the forward and backward features of the LSTM. These forward and backward features are then concatenated, enabling Bi-LSTM to effectively capture the contextual information of the text. The specific process is as follows:

[0102]

[0103]

[0104]

[0105] in and These represent the forward and backward LSTM features of the i-th sentence, respectively. This represents the discourse-level feature matrix generated in a single round of dialogue.

[0106] Therefore, for a round of discourse, the characteristics of discourse level can be represented as:

[0107]

[0108] Where d l Dimensions representing discourse-level characteristics;

[0109] Furthermore, step (4) specifically involves:

[0110] Because RGAT can effectively capture the structural features of dialogue text and long-distance dependencies between words, it is used to encode the speaker level. First, a directed graph is constructed to store the dialogue and emotional interaction relationships between speakers. Then, RGAT is used to obtain the structural features of the dialogue text and the long-distance dependencies between words. The specific construction process is as follows.

[0111] Step 4-1: Construct a directed graph, assuming a directed graph G = {V, E, R, W}. G} is used to represent a dialogue with N utterances, where V represents the set of nodes, E represents the set of edges, R represents the set of relation types of edges, and W represents the set of attention weights of edges;

[0112] V: Each utterance corresponds to a node l in G. i ∈V, i=1,2,…N, where each node is a discourse-oriented sentence vector generated using RoBERTa. Let p(·) represent the mapping relationship between utterance and speaker, i.e., p(l i )∈S represents node l i The corresponding speaker s j j = 1, 2, ..., M;

[0113] E: If node l i With l j The edge between them can be represented as e ij ∈E, i,j=1,2,…N, then e ij It can be used to represent the contextual relationship between utterances; if you want to represent l i In the context of other discourses, then l i It needs to be connected to all nodes in G, meaning G becomes a fully connected graph; however, this may consume a lot of computational resources; therefore, it is necessary to allocate resources to l. i A context window is set up to effectively capture local feature information. Assuming p represents the window size for historical utterances and f represents the window size for future utterances, then l i Only the first p nodes need to be connected. i-1 ,l i-2 ,...,l i-p and the last f nodes l i+1 ,l i+2 ,...,l i+f and itself;

[0114] R: Different edges represent different contextual relationships between utterances, including five types of relationships, which can be represented as R = {1, 2, 3, 4, 5}; when p(l i )=p(l j When i < j, eij p(l) represents the same speaker i ) node l j For l i The effect, i.e., R = 1; when p(l i )=p(l j When i > j, e ij Indicates the speaker p(l) i ) node l j For l i The effect, i.e., R = 2; when p(l i )≠p(l j When i < j, e ij p(l) represents the same speaker j ) node l j For the speaker p(l) i ) node l i The effect, i.e., R = 3; when p(l i )≠p(l j When i > j, e ij Indicates the speaker p(l) j ) node l j For the speaker p(l) i ) node l i The effect is that R = 4; when i = j, e ij The influence of the discourse itself is represented by R=5; each edge can represent the influence of other speakers or the influence of itself on each speaker's discourse, thus effectively extracting the structural features of the dialogue text and the long-distance dependencies between words;

[0115] W G Node l i For l j The edge e ij The weight can be expressed as w ij ∈W G The magnitude of its value represents the discourse l i Confrontation with discourse j The extent of the impact;

[0116] Step 4-2: Use RGAT to extract speaker-level features; first, apply attention weights w to the edges. ij To solve for l, a single-layer feedforward neural network is used to calculate l. j For l i Attention coefficient c ij Specifically, it is expressed as follows:

[0117]

[0118] Among them W e Let c represent a learnable weight matrix.ij This indicates the degree of influence of node j on node i;

[0119] To better represent different node pairs l i To determine the degree of influence, the attention coefficient is normalized using the softmax function, i.e., l j For l i attention weights w of the edges ij It can be represented as follows:

[0120]

[0121] Step 4-2: Use two layers of RGAT to encode the speaker;

[0122] For the first-level RGAT, node l is aggregated by aggregating neighbor node information. i Transformed into speaker-related feature vector h i The specific process is as follows:

[0123]

[0124] Where h i This represents the features extracted in the first layer operation, and σ represents the nonlinear activation function. and Represents the weight matrix. Indicates node l i The set of neighbor nodes under relation r∈R, c ir This represents a normalization constant, typically taking the value of . That is, node l i The number of neighboring nodes;

[0125] For the second layer of RGAT, the same feature transformation method is used based on the first layer, transforming h... i Transform into feature vector o i The specific process is as follows:

[0126]

[0127] Among them, W 2 and Let σ represent the weight matrix, and let σ represent a non-linear activation function, such as ReLU.

[0128] via h i and o i This enables the model to effectively aggregate the neighbor node information of each node, thereby obtaining the long-distance dependencies between speakers. That is, the speaker-level features can be represented as:

[0129]

[0130] Where, d s This represents the feature dimension at the speaker level, i.e., the number of hidden units in RGAT.

[0131] Furthermore, step (5) specifically includes:

[0132] Step 5-1: First, concatenate the features at the discourse level and the speaker level, specifically as follows:

[0133]

[0134] Step 5-2: Use Blueprint (BL) to design a negative emotion detector to identify the negative emotions contained in each utterance. The design process of the negative emotion detector is as follows:

[0135] The features G extracted above * Perform a linear mapping to generate multiple sets of feature nodes for BL, i.e., for G * Perform a linear mapping operation to generate k groups of feature nodes; the i-th group of feature nodes is represented as follows:

[0136]

[0137] Where F i This represents the i-th group of feature nodes. W represents a linear activation function. fi Describes a randomly generated weight matrix and φ fi Describes a randomly generated bias matrix and q represents the number of feature nodes in each group, and k represents the number of feature node groups;

[0138] Therefore, the k sets of feature nodes can be represented as follows:

[0139]

[0140] Step 5-3: Combine k groups of feature nodes F k Perform nonlinear mapping to generate multiple sets of augmentation nodes for BL, i.e., for F k Perform a nonlinear mapping operation to generate m groups of enhanced nodes; the j-th group of enhanced nodes is represented as follows:

[0141]

[0142] Among them B j Let ξ represent the j-th augmentation node, and W represent the nonlinear activation function. bj Describes a randomly generated weight matrix and φ bj Describes a randomly generated bias matrix and kq represents the total number of feature nodes, and r represents the number of augmentation nodes in each group;

[0143] Therefore, the m groups of augmenting nodes can be represented as follows:

[0144]

[0145] Where m represents the number of groups of augmented nodes;

[0146] Step 5-4: Concatenate the k groups of feature nodes and the m groups of enhancement nodes, as shown below:

[0147]

[0148] Step 5-5: According to Y=AW B There is W B =A + Y, since A is not a square matrix in most cases, can be used with A + Let W represent the generalized inverse matrix of A; to compute W more quickly. B To enhance the model's generalization ability, the Ridge Regression algorithm can be used to solve for W. B Specifically, it is expressed as follows:

[0149]

[0150] Where λ represents the regularization coefficient. This represents the approximate output of BL;

[0151] W B The global optimal solution can be expressed as:

[0152]

[0153] Compared with existing technologies, this invention has the following advantages and effects: Comparative experiments were conducted on three publicly available datasets—IEMOCAP, MELD, and EmoryNLP—with eight existing baseline models (SVM, TextCNN, Bi-LSTM, Bi-LSTM-ATTN, DialogueRNN, HiTrans, DialogXL, and DialogueGCN). The results show that the method proposed in this invention effectively improves the recognition of negative emotions in dialogue texts by combining the advantages of deep learning and breadth learning, and by designing a more intuitive method. This allows the system to effectively extract local contextual information (i.e., utterance level) and global contextual information (i.e., speaker level) from the utterance. The results also demonstrate that the proposed method outperforms the baseline models in terms of macro-F1 scores.

[0154] This embodiment collected data from three publicly available datasets: IEMOCAP, MELD, and EmoryNLP, and conducted comparative experiments with eight existing baseline models (SVM, TextCNN, Bi-LSTM, Bi-LSTM-ATTN, DialogueRNN, HiTrans, DialogXL, and DialogueGCN). Specific parameter settings are shown in Table 1. Experimental results show that the proposed method outperforms the baseline models in macro-F1 scores, as shown in Table 2.

[0155] Table 1 Parameter Settings

[0156]

[0157] Table 2 shows the performance of negative emotion recognition on the three datasets.

[0158]

[0159]

[0160] The above description is merely a specific embodiment of the present invention, enabling those skilled in the art to understand or implement the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A method for identifying negative emotions in dialogue text, characterized in that, include: Acquire dialogue text data and preprocess the acquired dialogue text data; The pre-trained model RoBERTa is used to vectorize the dialogue text. The pre-trained model RoBERTa is an improved model of BERT through robust optimization. Bi-LSTM is used to extract local features and contextual semantic features from text vectors to obtain discourse-level features; RGAT is used to extract long-distance dependencies between speakers to obtain speaker-level features; the obtained discourse-level features and speaker-level features are two concatenated features. By using black-and-white processing (BL) to process the two types of spliced ​​features, negative emotions can be identified.

2. The method for identifying negative emotions in dialogue text according to claim 1, characterized in that, The pre-trained model RoBERTa is used to vectorize the dialogue text. Specifically, the pre-trained model RoBERTa is an improved version of BERT through robust optimization. Fine-tuning the pre-trained model is represented as follows: m m-1 =δ×μ m Where q i Let represent the parameters of the i-th layer of the model, and n represent the time step. This represents the parameters of the i-th layer of the model at the n-th time step. μ represents the gradient of the model's objective function. m Let δ represent the learning rate of the m-th layer, and δ represent the decay rate of the learning rate. We pre-trained each sentence using a fine-tuned RoBERTa to generate word vectors, and took the vector corresponding to the symbol "[CLS]" as the utterance vector. Thus, the utterance vector matrix can be represented as follows: Where N represents the number of utterances in a round of dialogue, and d represents the dimension of the sentence vector. This indicates that the operation involves a real number matrix.

3. The method for identifying negative emotions in dialogue text according to claim 1, characterized in that, The specific steps for extracting local features and contextual semantic features from text vectors using Bi-LSTM to obtain discourse-level features are as follows: Bi-LSTM is used to extract discourse-level features by effectively capturing contextual semantic features. The basic idea of ​​Bi-LSTM is to use two LSTMs in opposite directions to process the forward and backward sequences respectively, so as to obtain the correlation between features in two directions, and output the correlation information in two directions as the forward and backward features of the LSTM. The forward and backward features are concatenated to enable Bi-LSTM to effectively capture the contextual information of the text. The specific process is as follows: in and These represent the forward and backward LSTM features of the i-th sentence, respectively. This represents the discourse-level feature matrix generated in a single round of dialogue. For a round of discourse, the characteristics of the discourse level can be represented as: Where d l Dimensions representing discourse-level characteristics.

4. The method for identifying negative emotions in dialogue text according to claim 1, characterized in that, The specific steps for extracting long-distance dependencies between speakers using RGAT to obtain speaker-level features are as follows: Construct a directed graph, assuming the directed graph G = {V, E, R, W}. G } is used to represent a dialogue with N utterances, where V represents the set of nodes, E represents the set of edges, R represents the set of relation types of edges, and W represents the set of attention weights of edges; V: Each utterance corresponds to a node l in G. i ∈V, i=1,2,…N, where each node is a discourse-oriented sentence vector generated using RoBERTa. Let p(·) represent the mapping relationship between utterance and speaker, i.e., p(l i )∈S represents node l i The corresponding speaker s j j = 1, 2, ..., M; E: If node l i With l j The edge between them can be represented as e ij ∈E, i,j=1,2,…N, then e ij It can be used to represent the contextual relationship between utterances; if you want to represent l i In the context of other discourses, then l i It needs to be connected to all nodes in G, meaning G becomes a fully connected graph; however, this may consume a lot of computational resources; therefore, it is necessary to allocate resources to l. i A context window is set up to effectively capture local feature information; assuming p represents the window size for historical utterances and f represents the window size for future utterances, then l i Only the first p nodes need to be connected. i-1 ,l i-2 ,...,l i-p and the last f nodes l i+1 ,l i+2 ,...,l i+f and itself; R: Different edges represent different contextual relationships between utterances, including five types of relationships, which can be represented as R = {1, 2, 3, 4, 5}; when p(l i )=p(l j When i < j, e ij p(l) represents the same speaker i ) node l j For l i The effect, i.e., R = 1; when p(l i )=p(l j When i > j, e ij Indicates the speaker p(l) i ) node l j For l i The effect, i.e., R = 2; when p(l i )≠p(l j When i < j, e ij p(l) represents the same speaker j ) node l j For the speaker p(l) i ) node l i The effect, i.e., R = 3; when p(l i )≠p(l j When i > j, e ij Indicates the speaker p(l) j ) node l j For the speaker p(l) i ) node l i The effect is that R = 4; when i = j, e ij The influence of the discourse itself is represented by R=5; each edge can represent the influence of other speakers or the influence of itself on each speaker's discourse, thus effectively extracting the structural features of the dialogue text and the long-distance dependencies between words; W G Node l i For l j The edge e ij The weight can be expressed as w ij ∈W G The magnitude of its value represents the discourse l i Confrontation with discourse j The degree of impact; RGAT is used to extract speaker-level features; first, the attention weights w of the edges are applied. ij To solve for l, a single-layer feedforward neural network is used to calculate l. j For l i Attention coefficient c ij Specifically, it is expressed as follows: c ij =l i T W e [l i ,l j ],j=i-p,…,i+f Among them W e Let c represent a learnable weight matrix. ij This indicates the degree of influence of node j on node i.

5. The method for identifying negative emotions in dialogue text according to claim 4, characterized in that, The method employs RGAT to extract speaker-level features; first, the attention weights w on the edges are... ij To solve for l, a single-layer feedforward neural network is used to calculate l. j For l i Attention coefficient c ij Specifically, it is expressed as follows: c ij =l i T W e [l i ,l j ],j=i-p,…,i+f Among them W e Let c represent a learnable weight matrix. ij After indicating the degree of influence of node j on node i, it also includes: The attention coefficients are normalized using the softmax function, i.e., l j For l i attention weights w of the edges ij It can be represented as follows: Two layers of RGAT are used to encode the speaker; For the first-level RGAT, node l is aggregated by aggregating neighbor node information. i Transformed into speaker-related feature vector h i The specific process is as follows: Where h i This represents the features extracted in the first layer operation, and σ represents the nonlinear activation function. and Represents the weight matrix. Indicates node l i The set of neighbor nodes under relation r∈R, c ir Represents a normalized constant, with values ​​of 10 ... That is, node l i The number of neighboring nodes; For the second layer of RGAT, the same feature transformation method is used based on the first layer, transforming h... i Transform into feature vector o i The specific process is as follows: Among them W 2 and Let σ represent the weight matrix and σ represent the nonlinear activation function. via h i and o i This enables the model to effectively aggregate the neighbor node information of each node, thereby obtaining the long-distance dependencies between speakers. That is, the speaker-level features can be represented as: Where, d s This represents the feature dimension at the speaker level, i.e., the number of hidden units in RGAT.

6. The method for identifying negative emotions in dialogue text according to claim 1, characterized in that, The process of using Black-Blooded Interference (BL) to process the two types of spliced ​​features to achieve negative emotion recognition includes: The features at the discourse level and the speaker level are concatenated and specifically represented as follows: A negative emotion detector is designed using BL (Boolean) to identify the negative emotions contained in each utterance.

7. The method for identifying negative emotions in dialogue text according to claim 6, characterized in that, The negative emotion recognizer specifically includes: Extracted features G * Perform a linear mapping to generate multiple sets of feature nodes for BL, i.e., for G * Perform a linear mapping operation to generate k groups of feature nodes; the i-th group of feature nodes is represented as follows: Where F i This represents the i-th group of feature nodes. W represents a linear activation function. fi Describes a randomly generated weight matrix and φ fi Describes a randomly generated bias matrix and q represents the number of feature nodes in each group, and k represents the number of feature node groups; Therefore, the k sets of feature nodes can be represented as follows: k groups of feature nodes F k Perform nonlinear mapping to generate multiple sets of augmentation nodes for BL, i.e., for F k Perform a nonlinear mapping operation to generate m groups of enhanced nodes; the j-th group of enhanced nodes is represented as follows: Among them B j Let ξ represent the j-th augmentation node, and W represent the nonlinear activation function. bj Describes a randomly generated weight matrix and φ bbj Describes a randomly generated bias matrix and kq represents the total number of feature nodes, and r represents the number of augmentation nodes in each group; Therefore, the m groups of augmenting nodes can be represented as follows: Where m represents the number of groups of augmented nodes; The k groups of feature nodes and m groups of enhancement nodes are concatenated, as shown below: According to Y=AW B There is W B =A + Y, since A is not a square matrix in most cases, can be used with A + Let W represent the generalized inverse matrix of A; to compute W more quickly. B To enhance the model's generalization ability, the Ridge Regression algorithm can be used to solve for W. B Specifically, it is expressed as follows: Where λ represents the regularization coefficient. This represents the approximate output of BL; W B The global optimal solution can be expressed as:

Citation Information

Patent Citations

  • Coupling large-scale data flow width learning rapid prediction intelligent algorithm based on network community detection and GCN

    CN111696345A

  • Event time sequence relationship recognition method based on relation graph attention neural network

    CN112507077A