A multi-speaker sentiment analysis method based on heterogeneous graph structure and topic semantic enhancement
By adopting the heterogeneous graph structure method with theme semantic enhancement in multi-sessional conversations, the problem of complexity of emotion analysis in multi-sessional conversations is solved, effective capture of emotional changes and theme transformations and accurate modeling of emotional interactions is achieved, and the accuracy of emotion classification is improved.
Patent Information
- Application Number
- CN202210429360.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-22
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2042-04-22
AI Technical Summary
In multi-sessional conversations, how to effectively identify the emotions of the speaker and model the degree of emotional infection and emotional persistence between speakers, especially in scenarios where information interactions are frequent and emotional states continue to change.
The multi-sessional sentiment analysis method of heterogeneous graph structure based on theme semantic enhancement is used to extract and analyze the emotional characteristics and theme information in the conversation through technical means such as emotional word embedding, syntactic dependency graph construction, theme extraction model and graph recurrent network, and construct heterogeneous dialogue graphs for emotion classification.
It improves the accuracy of emotion analysis in a multi-sessional environment, can effectively capture emotional changes and theme changes in chat content, enhances the modeling ability of emotional interactions between interlocutors, and improves the accuracy and efficiency of emotional classification.
Smart Images

Figure CN114911932B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of natural language processing, and in particular relates to a heterogeneous graph structure multi-speaker sentiment analysis method based on topic semantic enhancement. Background Art
[0002] Emotion recognition in conversation is an emerging task in natural language processing, which aims to identify the emotion of each utterance in a conversation. It can be seen as an extension of traditional text emotion detection, or a problem that arises in conversation systems, which helps machines understand the emotions generated by users and thus generate emotion-aware conversation responses with emotions. Traditional conversation sentiment analysis research focuses on two-person conversations, and less on multi-speaker environments. The goal of this paper is to solve the problem of identifying speaker emotions in conversations with three or more speakers. Compared with two-speaker conversations, the information interaction in multi-speaker conversations is more frequent and diverse, so emotion recognition is also more complex.
[0003] First, because personal statements are usually logical and coherent, but chats are more jumpy, the uncertainty of information jumps exponentially increases the difficulty of sentiment analysis, so it is necessary to pay attention to the context, especially the change of topics during the chat. At the same time, group chat is information exchange between multiple people, and interaction is a continuous process rather than a short-term fixed process. This essentially changes the evaluation method of sentiment judgment. In non-interactive sentiment analysis applications, such as product reviews, when the sentiment of the review is successfully judged, its application value can be realized, which is a clear classification task. However, in the state of dialogue, the emotional state is constantly changing, and it is not meaningful to analyze a single sentence. Finally, the existence of interaction will hide some state information. In chat, usually, both parties in the interaction assume that the other party knows a lot of information. For example, the relationship between the subject and the object of communication, the purpose of each other's needs, social relations, common sense, personality, etc. This problem is more complicated when extended to the context of group chat, and it is necessary to consider the personality and characteristics of each speaker and their reactions to different opinions. Some people are stubborn, while others are easily shaken, and the emotions they produce are also different. Therefore, how to effectively model the degree of emotional contagion between speakers and the degree to which speakers persist in their own emotions is also an important and challenging issue.
[0004] The invention with patent number CN113656564A mentions a method for detecting emotion in power grid business dialogue data based on graph neural network, which includes the following steps: Step 1, extracting dialogue sets, constructing sentence-level self-influence and mutual influence relationship graphs and feature extraction models; Step 2, constructing word-level undirected graphs and feature extraction models; Step 3, constructing relationship undirected graphs between topic words and context words and feature extraction models; Step 4, integrating sentence-level features, word graph features, and relationship features between topic words and context words in steps 1, 2, and 3, and calculating dialogue emotion. This invention can greatly improve the accuracy of interactive emotion analysis, thereby providing important technical support for building human-like interactive systems such as question-answering systems, chatbots, and public service robots. However, this invention does not involve emotion analysis processing in the scenario of multi-talker chats. Summary of the invention
[0005] Technical problems to be solved: The problem to be solved by the present invention is the problem of sentiment analysis in multi-speaker conversations, with a focus on semantic modeling and the interaction between speakers. Specifically, (1) How to provide more sentiment features to facilitate subsequent sentiment classification when obtaining the semantic content of input sentences in semantic modeling, while also eliminating as much redundant information as possible to prevent interference with computer judgment. (2) When the sentiment of a sentence cannot be judged based on semantic content alone, how to judge the sentiment of the current discourse based on contextual information and sentiment, especially in scenarios where the speakers' emotions change due to information interaction during the conversation.
[0006] Technical solution:
[0007] A method for sentiment analysis of multiple speakers in a heterogeneous graph structure based on topic semantic enhancement, the method comprising the following steps:
[0008] S10, performs sentiment word embedding operation on the input dialogue, converting it from human language into a vector representation with sentiment;
[0009] S20, for each sentence input in step S10, a syntactic dependency graph is constructed according to the dependency syntactic relationship, where the nodes are the words in the sentence, and the syntactic dependency graph is input into the graph convolutional neural network to update the node information, thereby obtaining a semantically enhanced word vector and a corresponding sentence representation vector;
[0010] S30, constructing a topic extraction model based on the semantically enhanced word vectors obtained in step S20, extracting the topic of each conversation sentence, and obtaining a topic-enhanced sentence representation;
[0011] S40, taking the sentence representation enhanced by the topic obtained in step S30 as the initial node, clustering according to the topic similarity, constructing a conversation subgraph according to the topic information and the temporal relationship of the sentences, constructing a heterogeneous conversation graph, where the node is the sentence representation of each sentence, and updating the graph nodes using a graph recurrent network;
[0012] S50, inputting the graph nodes obtained in step S40 into a classifier to obtain a classification result, namely, an emotion category.
[0013] Furthermore, in step S10, the process of performing the sentiment word embedding operation on the input dialogue to convert it from human language into a vector representation with sentiment includes the following sub-steps:
[0014] S11, let the input be a multi-talker dialogue text D containing N rounds of dialogue:
[0015]
[0016] where u i represents the i-th utterance in the dialogue text D, Indicates the discourse u i The corresponding speaker, u i ={w i,1 ,w i,2 ,...,w i,n} means that the sentence consists of n words, i = 1, 2, ... N, j = 1, 2, ... M; M is the total number of participants; N is the total number of sentences in the conversation;
[0017] For each input sentence u i , use word2vec to encode the vector in chronological order and obtain the basic vector representation word2vec (w i );
[0018] S12, obtain the sentiment vector representation of each word from the external sentiment dictionary VAD, and map the word to the sentiment dictionary using the following formula:
[0019]
[0020] Among them, l(w) represents the word form restoration of each word; when a word has actual emotional meaning, the word sentiment vector W2AV has a corresponding real value in each dimension of VAD. On the contrary, when a word does not have emotional meaning, the sentiment vector of the word is uniformly expressed as,5,1,5], where these three values represent extremely weak emotional fitness V, medium emotional intensity A, and extremely weak emotional importance D respectively;
[0021] S13, concatenate and merge the sentiment word embedding W2AV of word w obtained in step S12 with the basic word2vec word vector obtained in step S11 to obtain the final word vector representation w′ i The initial input to the encoder is called sentiment word embedding.
[0022] Furthermore, in step S20, a syntactic dependency graph is constructed for each sentence input in step S10 according to the dependency syntactic relationship, and the nodes are the words in the sentence. The syntactic dependency graph is input into the graph convolutional neural network to update the node information, and the process of obtaining the semantically enhanced word vector and the corresponding sentence representation vector includes the following sub-steps:
[0023] S21, construct a syntactic dependency tree for the input sentence of step S10, by analyzing the dependency relationship between words, i Construct a relationship tree to represent the syntactic structure of the sentence. The original node is the word vector representation w′ obtained in step S10. i , the core verb of the sentence is the root node of the tree, which is represented as the central word. The root node is allowed to dominate other components, and it itself is not dominated by any other components;
[0024] S22, according to the grammatical rules, find the dependent words that have a dependency relationship with the central word, distinguish the left and right nodes of the tree according to the temporal order of the central word and the dependent words, and include the dependent words into the tree until all words are detected and the syntactic dependency graph is completed;
[0025] S23, input the syntactic dependency graph into the graph convolutional neural network to update the node information and obtain the semantically enhanced word vector:
[0026] w i ″=GRU(w′1,w′2,...,w′ n );
[0027] The sentence representation vector v of each sentence is obtained by calculating the mean of the words i .
[0028] Further, in step S22, dependent words having a dependency relationship with the central word are found according to the grammatical rules, and the dependent words are included in the tree by distinguishing the left and right nodes of the tree according to the temporal order of the central word and the dependent words, until all words are detected. The process of completing the syntactic dependency graph includes the following sub-steps:
[0029] S221, construct a syntactic dependency graph using a stack and a queue containing words to be processed; initialize the stack and the queue, clear the stack, and initially have only one root node in the stack; import all words in the sentence into the queue;
[0030] S222, using the Oracle function to select and execute a corresponding operation type according to the current state. The operation types include three types:
[0031] When the top of the stack and the word below it form a dependency relationship, and the center word is the top element of the stack, pop the two words from the stack, add this dependency relationship to the analyzed data structure, and finally add the center word to the stack again;
[0032] When the top of the stack and the word below it form a dependency relationship, and the central word is the element below, pop the two words from the stack, add this dependency relationship to the analyzed data structure, and finally add the central word to the stack again;
[0033] Otherwise, add a word in the queue to the top of the stack;
[0034] S223, loop step S222 until there is only the root node in the stack and the queue is empty.
[0035] Furthermore, in step S30, a topic extraction model is constructed based on the semantically enhanced word vector obtained in step S20 to extract the topic of each conversation sentence. The process of obtaining a topic-enhanced sentence representation includes the following steps:
[0036] S31, using a variational autoencoder to form a topic extraction module; the semantically enhanced word vector w″ obtained in step S20 i The training is performed in a topic extraction module that recursively inputs temporal information, and its output is a latent vector of the topic discussed in the sentence; the latent vector constrains the coherent topic of a single conversation through a recurring hidden state, and the variational distribution of its posterior approximation is:
[0037]
[0038] where h n-1 =f τ (z n-1 ,w″ n-1 ), n>1; and All are fully connected layers, f τ () is a recurrent unit that uses the Transformer's multi-head attention mechanism. Its input query is the previous hidden variable z n-1 :
[0039]
[0040] In the formula, For a given input x n of The output, Represents the lower layer network of the language model before the topic layer;
[0041] S32, the latent variable z trained by the topic extraction module i Considered as the current statement u i The topic vector z i and the sentence representation vector v obtained in step S20 i Concatenate to get the topic-enhanced sentence representation vector ve i .
[0042] Further, in step S40, the sentence representations enhanced by the topic obtained in step S30 are used as initial nodes, clustered according to topic similarity, and a conversation subgraph is constructed according to the topic information and the temporal relationship of the sentences, and a heterogeneous conversation graph is constructed, where the nodes are the sentence representations of each sentence. The process of updating the graph nodes using the graph recurrent network includes the following substeps:
[0043] S41, taking the sentence representation enhanced by the topic obtained in step S30 as the initial node, clustering the conversations of multiple participants according to the similarity of the topic information, connecting the nodes according to the spatial distance, and constructing edges if the spatial distances of the nodes are close and the nodes are adjacent in time, and finally obtaining a number of conversation subgraphs; each conversation subgraph indicates that the same thing is discussed in the time period, and the emotions are connected;
[0044] S42, process the nodes in each dialogue subgraph, where the nodes of the graph are the words spoken by each speaker. i , the corresponding speaker is represented by p vei ; For each conversation subgraph, a heterogeneous graph is constructed. There are two types of edges: edges with the same speaker e 1 , different sides of the speaker 0 ; Each node is arranged in time order, and the rule for node i to construct an edge is: ve i Build an edge with the subsequent node. If the subsequent node ve j Speaker Then connect two nodes, expressed as Until the node with the same speaker is detected, it is assumed to be ve k , k>i, that is, when When constructing the edge And stop detection and start building node ve i+1 The edges with subsequent nodes are checked until all nodes are checked to obtain the final subgraph initial graph;
[0045] S43, using the graph convolutional network to update the nodes of the subgraph initial graph obtained in step S42, the node update is determined by the previous node and the edge connected to it, and the edge relationship type is different and the weight is different. The updated node is the sentence node after sentence semantic enhancement and emotional interaction processing vse i .
[0046] Further, step S51, the final sentence obtained in step S43 is represented by vse i This is fed into a classifier to classify the sentiment of the utterance; the classifier uses a fully connected layer:
[0047] h i =ReLU(W h vse i +b h )
[0048] l i =softmax(W l h i +b l )
[0049]
[0050] Among them, k represents the number of emotion category labels, is the final predicted emotion label, W h 、b h , W l 、b l are learnable parameters.
[0051] Further, in step S52, the entire method is trained in an end-to-end manner, and the loss function of the overall method is defined as follows:
[0052]
[0053] Among them, λ is a learnable parameter, is the loss function of the topic module, is the loss function of the classifier; Using the lower limit of evidence, Calculated using the cross entropy loss function.
[0054] Beneficial effects:
[0055] First, the heterogeneous graph structure multi-talker sentiment analysis method based on topic semantic enhancement of the present invention constructs a syntactic dependency graph and a topic extraction model to improve the semantic expression of a single sentence. Since the chat content is jumpy in a multi-talker environment, it is necessary to extract topic features for each conversation, pay attention to the change of multi-talker chat topics, judge the chat object and chat status of the interlocutor, help lock the local context of the current conversation dependency, model the semantic expression of topic enhancement, and pave the way for the next step.
[0056] Second, the method of sentiment analysis of multiple speakers based on heterogeneous graph structure with topic semantic enhancement of the present invention clusters the discourses with similar semantic topics, and then constructs a local dependency subgraph in temporal order. The construction of edges reflects the emotional influence between users. This method clusters sentences with the same topic and temporal information into the same subgraph, and the continuity and infectiousness of the emotions are more distinct, which can be used to improve the accuracy of sentiment analysis in a multi-speaker environment.
[0057] Third, the method for analyzing the sentiment of multiple participants in heterogeneous graph structures based on topic semantic enhancement of the present invention constructs a syntactic dependency graph and a topic extraction model to optimize the feature extraction problem. Based on this, useful features with sentiment information are retained and redundant information is removed, which greatly facilitates the subsequent sentiment classification. The present invention constructs a heterogeneous dialogue subgraph module to model the sentiment interaction problem, simplifies the multi-person chat task with a large amount of data, and divides it into multiple dialogue subgraphs with the same topic, which speeds up the operation speed of the model and improves the accuracy of the classifier. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] Figure 1 It is a flow chart of a method for sentiment analysis of multiple speakers in a heterogeneous graph structure based on topic semantic enhancement according to an embodiment of the present invention;
[0059] Figure 2 Schematic diagram of the overall system architecture corresponding to the sentiment analysis method described in an embodiment of the present invention. DETAILED DESCRIPTION
[0060] The following examples will enable those skilled in the art to more fully understand the present invention, but are not intended to limit the present invention in any way.
[0061] This implementation case uses sentiment word embedding and a graph network structure model of multi-task collaborative interaction to analyze conversation sentiment.
[0062] like Figure 1 and Figure 2 As shown, the method comprises the following steps:
[0063] Step 1) Perform word embedding on the input dialogue to obtain the initial input of the encoder.
[0064] Step 101) The word embedding operation is to map words to real-valued vectors of fixed dimension. Assume that the input is a multi-talker dialogue text containing N rounds of dialogue, where u i represents the i-th utterance in the dialogue text D, Indicates the discourse u i The corresponding speaker, u i ={w i,1 ,w i,2 ,...,w i,n} indicates that the sentence consists of n words, i = 1, 2, ... N, j = 1, 2, ... M; M is the total number of participants; N is the total number of sentences in the conversation. Given an input conversation sequence, the sequence is first subjected to a word2vec operation to obtain a word vector with basic semantics of the word.
[0065] Step 102) The dialogue sequence is then input into an external cognitive engineering sentiment dictionary, and the three-dimensional sentiment space is used to enhance the traditional word embedding to obtain a three-dimensional sentiment-containing word vector. The method for mapping words to the sentiment dictionary is as follows:
[0066]
[0067] Among them, l(w) represents the word form restoration of each word. When a word has actual emotional meaning, the word sentiment vector W2AV has a corresponding real value in each dimension of VAD. On the contrary, when a word does not have emotional meaning, such as a stop word, the sentiment vector of the word is uniformly expressed as [5,1,5]. These three values represent extremely weak emotional fitness (V), medium emotional intensity (A), and extremely weak emotional importance (D).
[0068] Step 103) concatenates the vectors obtained in step 101) and step 102) to obtain the final sentiment word vector. As the input of the next encoder, it is called sentiment word embedding.
[0069] Step 2) constructs a syntactic dependency graph for the input sentence to maximize the extraction of dialogue features and obtain semantically enhanced sentence representations and word representations. i It is represented as the initial node, and the dependency syntactic relationship is detected according to the temporal order of the words to construct a syntactic dependency graph.
[0070] Step 201) Use a stack and a queue containing the words to be processed to build a syntactic dependency graph. At the beginning, the stack is empty, and the queue contains all the words in the sentence. Each step has two operations: inserting an element from the queue into the stack; merging (reduce) the top two elements of the stack into one element.
[0071] Step 202) In the initial state, there is only one root node in the stack, and all the words are in the queue, and then the loop continues until the end state. Each step of the loop uses the Oracle function to select the appropriate operation based on the current state, and then execute the operation. There are three types of operations to be executed:
[0072] LEFT-ARC: The top of the stack and the words below it form a dependency relationship, and the center word is the top element of the stack. Pop these two words from the stack, add this dependency relationship to the analyzed data structure, and finally add the center word to the stack again
[0073] RIGHT-ARC: The top of the stack and the words below it form a dependency relationship. The central word is the element below. Pop these two words from the stack, add this dependency relationship to the analyzed data structure, and finally add the central word to the stack again.
[0074] SHIFT: Add a word in the queue to the top of the stack
[0075] When the state is that there is only root in the stack and the queue is empty, it is the end state, indicating that the syntactic dependency graph representing the sentence has been constructed.
[0076] Step 203) Input the syntactic dependency graph and the initial graph nodes into the graph convolutional neural network (GRU) to update the node information and obtain the semantically enhanced word vector:
[0077] w″ i =GRU(w′1,w′2,...,w′ n )
[0078] By calculating the mean of the words, we get the sentence representation vector v of the sentence. i .
[0079] Step 3), considering the factors that multi-person dialogues have many turns and the text content is large and complex, a topic extraction model is built for the input sentences to extract the topic of each sentence.
[0080] Step 301) The topic extraction module is mainly composed of a variational autoencoder (VAE), which extracts the semantically enhanced word vector w″ obtained in step 2) i Training is performed in VAE by recursively inputting temporal information.
[0081] Step 302) The output of the VAE is a latent vector of the topic discussed in the sentence. The latent vector constrains the coherent topic of a single conversation through a recurring hidden state, and the variational distribution of its posterior approximation is:
[0082]
[0083] where h n-1 =f τ (z n-1 ,w″ n-1 ), for n>1. and All are fully connected layers, f τ() is a recurrent unit that uses the Transformer's multi-head attention mechanism. Its input query is the previous hidden variable z n-1 :
[0084]
[0085] Step 303) The latent variable z is trained through the subject module i , treating it as the current statement u i The topic vector z i The sentence representation vector v obtained in step 3) i Concatenate to get the topic-enhanced sentence representation vector ve i .
[0086] Step 4) uses the topic-enhanced sentence representation obtained in step 3) as the initial node to construct a conversation subgraph to solve the problem of complex content in multi-person conversations.
[0087] Step 401) Since the amount of information in a group chat conversation is large and the span is uncertain, if the entire conversation is directly constructed into a graph structure, useful information is easily filtered out during the information transmission process, so it is necessary to process the long conversation. The sentence representation enhanced by the topic obtained in step 3) is used as the initial node, and the multi-talker conversation is clustered according to the similarity of the topic information. The nodes are connected according to the spatial distance. If the spatial distance of the nodes is close and the nodes are adjacent in time, an edge is constructed, and finally a number of conversation subgraphs are obtained.
[0088] Step 402) Each subgraph represents the same discussion in this time period, and the emotions are connected. First, the nodes in each subgraph are processed. The nodes in the graph are the words said by each speaker. i , the corresponding speaker is represented by p i . For each subgraph, a heterogeneous graph is constructed. There are two types of edges: edges with the same speaker e 1 , different sides of the speaker 0 Each node is arranged in chronological order, and the rule for constructing an edge for node i is: ve i Build an edge with the subsequent node. If the subsequent node ve j Speaker p j ≠p i , then connect the two nodes, expressed as Until p is detected k =p i , construct the edge And stop detection and start building node ve i+1 The edges with subsequent nodes. Until all nodes are detected, the final subgraph initial graph can be obtained.
[0089] Step 403) uses a graph convolutional network (GCN) to update the nodes of the subgraph obtained in step 402). The node update is determined by the previous node and the edge connected to it, and the edge relationship type is different and the weight is different. The updated node is the sentence node after sentence semantic enhancement and emotional interaction processing. i .
[0090] Step 5), input the graph nodes into the classifier to obtain the classification results, i.e., the emotion categories.
[0091] Step 501), the final sentence obtained in step 403) is represented by vse i This is fed into a classifier to classify the sentiment of the utterance. The classifier uses a fully connected layer:
[0092] h i =ReLU(W h vse i +b h )
[0093] l i =softmax(W l h i +b l )
[0094]
[0095] Among them, k represents the number of emotion category labels, is the final predicted emotion label, W h 、b h , W l 、b l are learnable parameters.
[0096] Step 502), the entire method is trained in an end-to-end manner, and the loss function of the overall method is defined as follows:
[0097]
[0098] Among them, λ is a learnable parameter, is the loss function of the topic module, is the loss function of the classifier; Using the lower limit of evidence, Calculated using the cross entropy loss function.
[0099] The main purpose of the present invention is to perform emotion recognition, construct a syntactic dependency graph for each sentence, and then use a variational autoencoder network to reconstruct the sentence, train the latent variable as the theme of the sentence, facilitate the subsequent observation of the change of the group chat theme, and maximize the extraction of dialogue features. At the same time, a heterogeneous graph network is used to encode the sentence, cluster nodes with similar themes, and cut long-round dialogues with multiple themes, multiple conversation participants, and messy information into dialogue subgraphs with clear themes, concise information, and easy to classify. The use of heterogeneous graphs can also distinguish the emotional changes of different interlocutors after being affected by the outside world. The present invention simultaneously considers the semantic modeling and emotional interaction tasks in the multi-person dialogue task, and combines the two tasks for the purpose of improving the accuracy of emotion recognition in the dialogue. Considering that the change of the theme of the open dialogue will affect the continuity of the emotional interaction, the present invention also incorporates the theme detection task into the learning. The present invention uses a topic extraction model to simulate the jumping of chat information, and combines the dependency syntactic analysis method to jointly obtain the information of the input dialogue. The present invention also designs a heterogeneous graph network to update the feature information of the dialogue node, model the emotional interaction between different interlocutors, and use it for better emotion analysis. This method innovatively simplifies the task of multi-person conversation sentiment analysis, performs topic segmentation, and achieves a dual improvement in sentiment recognition speed and accuracy. In general, the present invention fully considers the interactive information between interlocutors and improves the prediction accuracy of multi-person conversation sentiment analysis.
Claims
1. A method for multi-talker sentiment analysis based on heterogeneous graph structure and topic semantic enhancement, characterized in that: The sentiment analysis method comprises the following steps: S10, performs sentiment word embedding operation on the input dialogue, converting it from human language into a vector representation with sentiment; S20, for each sentence input in step S10, a syntactic dependency graph is constructed according to the dependency syntactic relationship, where the nodes are the words in the sentence, and the syntactic dependency graph is input into the graph convolutional neural network to update the node information, thereby obtaining a semantically enhanced word vector and a corresponding sentence representation vector; S30, constructing a topic extraction model based on the semantically enhanced word vectors obtained in step S20, extracting the topic of each conversation sentence, and obtaining a topic-enhanced sentence representation; S40, taking the sentence representation enhanced by the topic obtained in step S30 as the initial node, clustering according to the topic similarity, constructing a conversation subgraph according to the topic information and the temporal relationship of the sentences, constructing a heterogeneous conversation graph, where the node is the sentence representation of each sentence, and updating the graph nodes using a graph recurrent network; S50, inputting the graph nodes obtained in step S40 into a classifier to obtain a classification result, namely, an emotion category.
2. The method for multi-talker sentiment analysis based on heterogeneous graph structure and topic semantic enhancement according to claim 1 is characterized in that: In step S10, the process of performing the sentiment word embedding operation on the input dialogue to convert it from human language into a vector representation with sentiment includes the following sub-steps: S11, let the input be a multi-talker dialogue text D containing N rounds of dialogue: where u i represents the i-th utterance in the dialogue text D, Indicates the discourse u i The corresponding speaker, u i ={w i,1 ,w i,2 ,...,w i,n } means that the sentence consists of n words, i = 1, 2, ... N, j = 1, 2, ... M; M is the total number of participants; N is the total number of dialogue sentences; For each input sentence u i , use word2vec to encode the vector in chronological order and obtain the basic vector representation word2vec (w i ); S12, obtain the sentiment vector representation of each word from the external sentiment dictionary VAD, and map the word to the sentiment dictionary using the following formula: Among them, l(w) represents the word form restoration of each word; when a word has actual emotional meaning, the word sentiment vector W2AV has a corresponding real value in each dimension of VAD. On the contrary, when a word does not have emotional meaning, the sentiment vector of the word is uniformly expressed as [5,1,5]. These three values represent extremely weak emotional fitness V, medium emotional intensity A, and extremely weak emotional importance D respectively. S13, concatenate and merge the sentiment word embedding W2AV of word w obtained in step S12 with the basic word2vec word vector obtained in step S11 to obtain the final word vector representation w i i The initial input to the encoder is called sentiment word embedding.
3. The method for multi-talker sentiment analysis based on heterogeneous graph structure and topic semantic enhancement according to claim 2 is characterized in that: In step S20, for each sentence input in step S10, a syntactic dependency graph is constructed according to the dependency syntactic relationship, and the nodes are the words in the sentence. The syntactic dependency graph is input into the graph convolutional neural network to update the node information. The process of obtaining the semantically enhanced word vector and the corresponding sentence representation vector includes the following sub-steps: S21, construct a syntactic dependency tree for the input sentence of step S10, by analyzing the dependency relationship between words, i Construct a relationship tree to represent the syntactic structure of the sentence. The original node is the word vector representation w obtained in step S10. i ′ , the core verb of the sentence is the root node of the tree, which is represented as the central word. The root node is allowed to dominate other components, and it itself is not dominated by any other components; S22, according to the grammatical rules, find the dependent words that have a dependency relationship with the central word, distinguish the left and right nodes of the tree according to the temporal order of the central word and the dependent words, and include the dependent words into the tree until all words are detected and the syntactic dependency graph is completed; S23, input the syntactic dependency graph into the graph convolutional neural network to update the node information and obtain the semantically enhanced word vector: In" i =DEC(w′1,w′2,...,w′ n ); The sentence representation vector v of each sentence is obtained by calculating the mean of the words i .
4. The method for multi-talker sentiment analysis based on heterogeneous graph structure and topic semantic enhancement according to claim 3 is characterized in that: In step S22, dependent words having a dependency relationship with the central word are found according to the grammatical rules, and the dependent words are included in the tree by distinguishing the left and right nodes of the tree according to the temporal order of the central word and the dependent words, until all words are detected. The process of completing the syntactic dependency graph includes the following sub-steps: S221, construct a syntactic dependency graph using a stack and a queue containing words to be processed; initialize the stack and the queue, clear the stack, and initially have only one root node in the stack; import all words in the sentence into the queue; S222, using the Oracle function to select and execute a corresponding operation type according to the current state. The operation types include three types: When the top of the stack and the word below it form a dependency relationship, and the center word is the top element of the stack, pop the two words from the stack, add this dependency relationship to the analyzed data structure, and finally add the center word to the stack again; When the top of the stack and the word below it form a dependency relationship, and the central word is the element below, pop the two words from the stack, add this dependency relationship to the analyzed data structure, and finally add the central word to the stack again; Otherwise, add a word in the queue to the top of the stack; S223, loop step S222 until there is only the root node in the stack and the queue is empty.
5. The method for multi-talker sentiment analysis based on heterogeneous graph structure and topic semantic enhancement according to claim 1 is characterized in that: In step S30, a topic extraction model is constructed based on the semantically enhanced word vectors obtained in step S20 to extract the topic of each conversation. The process of obtaining a topic-enhanced sentence representation includes the following steps: S31, using a variational autoencoder to form a topic extraction module; the semantically enhanced word vector w″ obtained in step S20 i The training is performed in a topic extraction module that recursively inputs temporal information, and its output is a latent vector of the topic discussed in the sentence; the latent vector constrains the coherent topic of a single conversation through a recurring hidden state, and the variational distribution of its posterior approximation is: where h n-1 =f τ (z n-1 ,w″ n-1 ), n>1; and All are fully connected layers, f τ () is a recurrent unit that uses the Transformer's multi-head attention mechanism. Its input query is the previous hidden variable z n-1 : In the formula, For a given input x n of The output, Represents the lower layer network of the language model before the topic layer; S32, the latent variable z trained by the topic extraction module i Considered as the current statement u i The topic vector z i and the sentence representation vector v obtained in step S20 i Concatenate to get the topic-enhanced sentence representation vector ve i .
6. The method for multi-talker sentiment analysis based on heterogeneous graph structure and topic semantic enhancement according to claim 1 is characterized in that: Step S40, taking the sentence representation enhanced by the topic obtained in step S30 as the initial node, clustering according to the topic similarity, constructing a conversation subgraph according to the topic information and the temporal relationship of the sentence, and constructing a heterogeneous conversation graph, where the node is the sentence representation of each sentence. The process of updating the graph node using the graph recurrent network includes the following substeps: S41, taking the sentence representation enhanced by the topic obtained in step S30 as the initial node, clustering the conversations of multiple participants according to the similarity of the topic information, connecting the nodes according to the spatial distance, and constructing edges if the spatial distances of the nodes are close and the nodes are adjacent in time, and finally obtaining a number of conversation subgraphs; each conversation subgraph indicates that the same thing is discussed in the time period, and the emotions are connected; S42, process the nodes in each dialogue subgraph, where the nodes of the graph are the words spoken by each speaker. i , the corresponding speaker is represented as A heterogeneous graph is constructed for each conversation subgraph. There are two types of edges: edges with the same speaker e 1 , different sides of the speaker 0 ; Each node is arranged in chronological order, and the rule for node i to construct an edge is: ve i Build an edge with the subsequent node. If the subsequent node ve j Speaker Then connect two nodes, expressed as Until the node with the same speaker is detected, it is assumed to be ve k , k>i, that is, when When constructing the edge And stop detection and start building node ve i+1 The edges with subsequent nodes are checked until all nodes are checked to obtain the final subgraph initial graph; S43, using the graph convolutional network to update the nodes of the subgraph initial graph obtained in step S42, the node update is determined by the previous node and the edge connected to it, and the edge relationship type is different and the weight is different. The updated node is the sentence node after sentence semantic enhancement and emotional interaction processing vse i .
7. The method for multi-talker sentiment analysis based on heterogeneous graph structure and topic semantic enhancement according to claim 6 is characterized in that: In step S50, the final sentence obtained in step S43 is represented by vse i This is fed into a classifier to classify the sentiment of the utterance; the classifier uses a fully connected layer: h i =ReLU(W h vse i +b h ) l i =softmax(W l h i +b l ) Among them, k represents the number of emotion category labels, is the final predicted emotion label, W h , b h , W l , b l are learnable parameters.
8. The method for multi-talker sentiment analysis based on heterogeneous graph structure and topic semantic enhancement according to claim 7 is characterized in that: The entire method is trained in an end-to-end manner, and the loss function of the overall method is defined as follows: Among them, λ is a learnable parameter, is the loss function of the topic module, is the loss function of the classifier; Using the lower limit of evidence calculation, Calculated using the cross entropy loss function.
Citation Information
Patent Citations
Power grid service conversation data emotion detection method based on graph neural network
CN113656564A
Method for analyzing emotional polarity of heterogeneous migration images based on multimodal depth potential correlation
CN107679580A
Semantic emotion analysis method and apparatus, device, and storage medium
WO2021169364A1