A long dialogue emotion detection method and system based on common sense knowledge graph

By using a common sense knowledge graph method in dialogue emotion detection, building a graph model and extracting prior knowledge of discourse, the problem that dialogue emotion detection in the prior art is difficult to quickly and effectively identify, achieving rapid and accurate emotion detection, and combining the influence of self-emotion and mutual emotions.

CN115033695BActive Publication Date: 2025-04-11TIANJIN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210676215.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-15
Publication Date
2025-04-11
Estimated Expiration
2042-06-15

AI Technical Summary

Technical Problem

The prior art is difficult to quickly and effectively identify the emotions of conversation in dialogue emotion detection, and usually ignores the role of prior knowledge on emotional recognition and the relationship information between the speaker, and cannot integrate the influence of self-emotion and mutual emotions.

Method used

A long dialogue emotion detection method based on common sense knowledge graph is adopted, and a priori knowledge of discourse is constructed by constructing a graph model and extracting discourse prior knowledge, combining the GNN model to update the discourse features, and using the transformer decoder structure to determine the emotion label, so as to achieve fast and accurate emotion detection.

Benefits of technology

By introducing prior knowledge into the graph model, the role of dialogue emotion recognition and the relationship between the speaker can be better described, the influence of self-emotion and mutual emotions is combined, and the performance and accuracy of dialogue emotion detection are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115033695B_ABST
    Figure CN115033695B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of sentiment analysis technology, and discloses a long-dialogue sentiment detection method and system based on common sense knowledge graphs. The graph model g is constructed by using the speech features at time t. t (V t ,E t ), add the prior knowledge of the utterance #imgabs1# as a new node to the graph model g t (V t ,E t ) to get the updated graph model g t * (V t ,E t ); Use the GNN model to update the graph model g t * (V t ,E t ) to obtain the updated discourse features; based on the discourse element u at time t i m utterances before, determine the final utterance topic f at time t t , based on the updated discourse features and the final discourse topic f at time t t , determine the emotion label of the long dialogue. The present invention adds prior knowledge as a new node to the graph model g t (V t ,E t ) describes the role of conversation emotion recognition and the relationship between speakers, combines the influence of self-emotion and mutual emotion, and quickly and effectively identifies the emotion of the conversation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of sentiment analysis, and in particular to a long conversation sentiment detection method and system based on common sense knowledge graph. Background Art

[0002] In recent years, with the rapid development of computer technology and social networks, conversational robots have gradually replaced traditional human workers in many application fields, such as healthcare, early education, and court proceedings. In order to ensure the logic of conversational robots' communication, it is necessary not only to evaluate the settings of the conversation, but also to evaluate the emotions of humans during the conversation stage, so the research on conversational emotion detection is becoming increasingly important.

[0003] How to capture human emotions in a rapidly changing context is a prominent problem in conversation emotion detection. Classical methods such as LSTM and RNN can only extract part of the context information and cannot achieve fast and effective recognition. Li et al. proposed a bidirectional recurrent unit for conversation emotion analysis. The model includes a generalized neural tensor block for obtaining context information and a dual-channel classifier for emotion classification. However, a conversation often contains multiple speakers, who are affected by both their own emotions and the emotions of other speakers. The above model considers the influence of time more and ignores the relationship information between speakers. It does not integrate the influence of self-emotion and mutual emotion. Hazarika et al. proposed a deep neural network called conversation memory network (CMN) and conducted an extensive discussion on the two factors of comprehensive self-emotion and mutual emotion. The past words of each speaker are modeled as memories, and then attention-based jumps are used to merge these memories and long short-term memory networks (LSTM) and gated recurrent units (GRU) are used to propagate context and sequence information. However, the extracted context information is limited and the actual performance is poor.

[0004] In the existing technology of conversation emotion detection, the extracted context information is limited, and it is impossible to quickly and effectively identify the emotion of the conversation. It usually ignores the role of prior knowledge in conversation emotion recognition and the relationship information between speakers, and does not integrate the influence of self-emotion and mutual emotion. Summary of the invention

[0005] The purpose of the present invention is to provide a long conversation emotion detection method and system based on common sense knowledge graph, which can quickly identify the emotion of the conversation in combination with prior knowledge, and can integrate the influence of self-emotion and mutual emotion.

[0006] To achieve the above object, the present invention provides the following solutions:

[0007] A long conversation emotion detection method based on a common sense knowledge graph, the long conversation emotion detection method comprising:

[0008] Discourse features based on time t Building a graph model t (V t ,E t ), where V t is a node set, E t For different nodes v i and v j The set of undirected edges between them, where i∈1…n, j∈1…n; the graph model g t (V t ,E t ) is used to represent the conversation data at time t;

[0009] Discourse based on time t Extracting utterances Prior knowledge of

[0010] The words The prior knowledge is added as a new node to the graph model g t (V t ,E t ) to get the updated graph model g t * (V t ,E t );

[0011] Use the GNN model to update the graph model g t * (V t ,E t ) to obtain updated discourse features;

[0012] Based on the discourse element u at time t i m utterances before, determine the final utterance topic f at time t t , where, m=1...i-1, i=1...n;

[0013] Based on the updated discourse features and the final discourse topic f at time t t , determine the long conversation emotion tags; the long conversation emotion tags include: happiness, frustration, surprise, no emotion, fear, disgust, anger.

[0014] Optionally, based on the utterance at time t Extracting utterances The prior knowledge is:

[0015] Get the discourse element u iThe search results are the first k results in triple format, expressed as:

[0016] Based on the discourse element u i The search results for the discourse The search result set is expressed as:

[0017] Based on the retrieval result set, the retrieval results in the set are combined to obtain the utterance prior knowledge.

[0018] Optionally, based on the utterance element u at time t i The m discourse elements before determine the final discourse topic f at time t t , specifically:

[0019] Get the discourse element u at time t i The first m discourse elements;

[0020] The utterance element u at time t i The previous m discourse elements are converted into m discourse features;

[0021] The 3×N different utterance elements u at time t are i The first m speech elements are input into the self-attention mechanism layer to obtain N sample speech topics f t , N positive sample discourse topics f p And N negative sample discourse topics f n ; Each time a topic is extracted, the time interval is greater than or equal to T interval , the N sample discourse topics f t , N positive sample discourse topics f p And N negative sample discourse topics f n The triple (f t ,f p ,f n );

[0022] Based on the triple (f t ,f p ,f n ), construct a loss function; the loss function is specifically:

[0023]

[0024] Among them, sim(f t ,f p ) as the theme t and f p The dot product between them is the cosine similarity, sim(f t,f n ) as the theme t and f n The dot product between them is the cosine similarity, f t is the sample utterance topic, f p Yes t The positive sample discourse topic, f n Yes t The negative sample discourse topic, N is the number of training samples, N∈1…n, α is the model parameter;

[0025] Based on the loss function, determine the final discourse topic f at time t t .

[0026] Optionally, based on the updated discourse features and the final discourse topic f at time t t , determine the long dialogue emotion label specifically as:

[0027] The updated discourse features and the final discourse topic f at time t are combined t Input into the transformer decoder structure to obtain the final speech features l is the maximum number of layers in the transformer decoder structure;

[0028] The final utterance features Input the softmax function to get the sentiment label of the long conversation.

[0029] Optionally, a layer in the transformer decoder structure includes:

[0030] Self-attention module, used to integrate and update speech features Get the first utterance feature Wherein, k = 1…l;

[0031] A cross attention module, connected to the self-attention module, for fusing and updating the first speech feature Get the second utterance features The cross attention module is also used to fuse and update the second speech feature Get the third discourse feature Wherein, k = 1…l;

[0032] A feedforward neural network module, connected to the cross attention module, for updating the third utterance feature Get the updated fourth discourse feature

[0033] Optionally, the self-attention module specifically uses the following formula to analyze the speech features: To merge and update:

[0034]

[0035]

[0036]

[0037] in, is the weight parameter of the attention Key index that the k-th layer self-attention module needs to learn, is the first weight parameter of the attention Value that the k-th layer self-attention module needs to learn, MultiHead is the multi-head self-attention function, Attention is the self-attention function, and softmax is the classification function. for The variance of .

[0038] Optionally, the cross attention module specifically uses the following formula to calculate the first speech feature: To merge and update:

[0039]

[0040]

[0041] in, It is the second weight parameter of the attention Value that the k-th layer cross attention module needs to learn. MultiHead is the multi-head self-attention function, Attention is the self-attention function, and softmax is the classification function. for The variance of

[0042] The cross attention module specifically uses the following formula to calculate the second utterance feature To merge and update:

[0043]

[0044]

[0045] in, It is the third weight parameter of the attention Value that the k-th layer cross attention module needs to learn. MultiHead is the multi-head self-attention function, Attention is the self-attention function, and softmax is the classification function. for The variance of .

[0046] Optionally, the feedforward neural network module uses the following formula to calculate the third speech feature: To update:

[0047]

[0048] in, It is the fourth utterance feature after the k-th layer transformer decoder structure is updated.

[0049] Based on the above method, the present invention also provides a long dialogue emotion detection system based on common sense knowledge graph, and the long dialogue emotion detection system includes:

[0050] The graph model building module is used to calculate the speech characteristics at time t. Building a graph model t (V t ,E t ), where V t is a node set, E t For different nodes v i and v j The set of undirected edges between them, where i∈1…n, j∈1…n; the graph model g t (V t ,E t ) is used to represent the conversation data at time t;

[0051] Prior knowledge acquisition module for utterances based on time t Extracting utterances Prior knowledge of

[0052] A graph model updating module is connected to the prior knowledge acquisition module and is used to update the speech The prior knowledge is added as a new node to the graph model g t (V t ,E t ) to get the updated graph model g t * (V t ,E t );

[0053] The speech feature updating module is connected to the graph model updating module and is used to update the graph model g using the GNN model. t * (V t ,E t ) to obtain updated discourse features;

[0054] A discourse topic determination module is used to determine the discourse element u at time t based on the i m utterances before, determine the final utterance topic f at time t t , where, m=1...i-1, i=1...n;

[0055] The long dialogue emotion label determination module is connected to the speech feature updating module and the speech topic determination module, and is used to determine the emotion label of the long dialogue based on the updated speech feature and the final speech topic f at time t. t , determine the long conversation emotion tags; the long conversation emotion tags include: happiness, frustration, surprise, no emotion, fear, disgust, anger.

[0056] Optionally, the prior knowledge acquisition module specifically includes:

[0057] Discourse elementu i The retrieval result acquisition unit is used to obtain the discourse element u i The search results are the first k results in triple format, expressed as:

[0058] Discourse The retrieval result set acquisition unit and the utterance element u i The retrieval result acquisition unit connection is used to obtain the retrieval result based on the discourse element u i The search results for the discourse The search result set is expressed as:

[0059] Prior knowledge acquisition unit, and the discourse The retrieval result set acquisition unit is connected to the retrieval result set, and is used to obtain a union of each retrieval result in the set based on the retrieval result set to obtain a discourse prior knowledge.

[0060] According to the specific embodiments provided by the present invention, the present invention discloses the following technical effects:

[0061] The present invention provides a long dialogue emotion detection method and system based on common sense knowledge graph, which detects the emotion of the conversation at time t. Building a graph model t (V t ,E t ), the words The prior knowledge is added as a new node to the graph model g t (V t ,E t ) to get the updated graph model g t * (V t ,E t ); Use the GNN model to update the graph model g t * (V t ,E t) to obtain the updated discourse features; based on the discourse element u at time t i m utterances before, determine the final utterance topic f at time t t , based on the updated discourse features and the final discourse topic f at time t t , determine the long conversation emotion label; the long conversation emotion label includes: happiness, frustration, surprise, no emotion, fear, disgust, anger. The present invention adds prior knowledge as a new node to the graph model g t (V t ,E t ) describes the role of conversation emotion recognition and the relationship between speakers, combines the influence of self-emotion and mutual emotion, and quickly and effectively identifies the emotion of the conversation. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0063] Figure 1 This is a flow chart of a method for detecting emotion in long conversations based on a common sense knowledge graph according to an embodiment of the present invention;

[0064] Figure 2 A flow chart of the updated speech features obtained for the embodiment of the present invention;

[0065] Figure 3 A flow chart for determining the final discourse topic at time t according to an embodiment of the present invention;

[0066] Figure 4 Schematic diagram of the structure layer of the transformer decoder according to an embodiment of the present invention;

[0067] Figure 5 This is a schematic diagram of the structure of a long conversation emotion detection system based on a common sense knowledge graph according to an embodiment of the present invention. DETAILED DESCRIPTION

[0068] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0069] The purpose of the present invention is to provide a long conversation emotion detection method and system based on common sense knowledge graph, which can comprehensively consider the influence of self-emotion and mutual emotion, and quickly and effectively identify the emotion of the conversation.

[0070] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0071] See attached picture Figure 1 The present invention provides a long conversation emotion detection method based on a common sense knowledge graph, and the long conversation emotion detection method comprises:

[0072] S1. Discourse features based on time t Building a graph model t (V t ,E t ), where V t is a node set, E t For different nodes v i and v j The set of undirected edges between them, where i∈1…n, j∈1…n; the graph model g t (V t ,E t ) is used to represent the conversation data at time t.

[0073] Specifically, E t There are two types of edges: one is the time edge, which represents the discourse v i and v j The order of appearance in the conversation, when speaker A says utterance feature v i Then speaker B says utterance feature v j That is, node v i and v j There is a temporal order between them. If v i In v j Before, the edge exists and the weight is defined as 1, otherwise, the change does not exist and the weight is 0. The other is the semantic edge, which uses the cosine distance to measure the discourse v i and v j The similarity between .

[0074] S2. Discourse based on time t Extracting utterances The specific steps are:

[0075] S21. Get the discourse element u i The search results are the first k results in triple format, expressed as: Among the first k results, each similar utterance is composed of a triple, and the relationships among these triples include intention, reaction, etc.

[0076] Specifically, based on the common sense knowledge corpus ATOMIC and the common sense knowledge base ConceptNet, the common sense knowledge retrieval method is applied to search for the prior knowledge of the discourse.

[0077] S22. Based on discourse element u i The search results for the discourse The search result set is expressed as:

[0078] S23, based on the retrieval result set, taking the union of each retrieval result in the set, and obtaining the utterance prior knowledge.

[0079] Specifically, these prior knowledge are extracted into feature vectors through BiLSTM and added to the graph as new nodes as auxiliary information to help discourse embedding learning.

[0080] Specifically, the utterance at time t Transformed into speech features at time t through the BiLSTM (Bi-directional Long Short-Term Memory) bidirectional long short-term memory network model

[0081] S3. The prior knowledge is added as a new node to the graph model g t (V t ,E t ) to get the updated graph model g t * (V t ,E t ).

[0082] S4. Update the graph model g using the GNN model t * (V t ,E t ) to obtain the updated discourse features.

[0083] Specifically, see the accompanying drawings Figure 2 , the utterance at time t Transformed into speech features at time t through the BiLSTM layer bidirectional long short-term memory network model Building a graph model t (V t ,E t), prior knowledge is retrieved based on the common sense knowledge corpus ATOMIC and the common sense knowledge base ConceptNet. The prior knowledge is used to update the graph model, and the node features in the graph are updated through the classic GNN model to obtain the updated discourse features.

[0084] S5. Discourse element u based on time t i m utterances before, determine the final utterance topic f at time t t , where m=1…i-1, i=1…n, the specific steps are:

[0085] S51. Get the discourse element u at time t i The first m discourse elements.

[0086] S52: The utterance element u at time t i The previous m discourse elements are converted into m discourse features.

[0087] S53, 3×N different speech elements u at time t i The first m speech elements are input into the self-attention mechanism layer to obtain N sample speech topics f t , N positive sample discourse topics f p And N negative sample discourse topics f n ; Each time a topic is extracted, the time interval is greater than or equal to T interval , the N sample discourse topics f t , N positive sample discourse topics f p And N negative sample discourse topics f n The triple (f t ,f p ,f n ).

[0088] S54, based on the triple (f t ,f p ,f n ), construct a loss function; the loss function is specifically:

[0089]

[0090] Among them, sim(f t ,f p ) as the theme t and f p The dot product between them is the cosine similarity, sim(f t ,f n ) as the theme t and f n The dot product between them is the cosine similarity, f t is the sample utterance topic, f pYes t The positive sample discourse topic, f n Yes t The negative sample discourse topic, N is the number of training samples, N∈1…n, and α is the model parameter.

[0091] Specifically, the goal of the loss function is to reduce the probability that two sample utterances with the same topic f t and the positive sample utterance topic f p The difference between the two, and adding two different sample discourse topics f t and negative sample utterance topic f n The difference between.

[0092] Specifically, for the triple (f t ,f p ,f n ) for contrastive learning. The contrastive learning task is to make the positive sample and the negative sample have the same or similar feature vectors and dissimilar representations. (f t ,f p ,f n )Acquire changing discourse topics through comparative learning.

[0093] S55: Based on the loss function, determine the final discourse topic f at time t t .

[0094] Specifically, see the accompanying drawings Figure 3 , input the m utterances of the current conversation into the BiLSTM layer bidirectional long short-term memory network model to obtain m utterance features, and input the m utterance features into the self-attention mechanism to obtain N sample utterance topics f t , N positive sample discourse topics f p And N negative sample discourse topics f n , the triple (f t ,f p ,f n ) to conduct comparative study and obtain the current topic.

[0095] Specifically, conversation topic extraction focuses on the background topics of conversations at different periods and guides discourse emotion recognition.

[0096] S6, based on the updated speech features and the final speech topic f at time t t , determine the long conversation emotion tags; the long conversation emotion tags include: happiness, frustration, surprise, no emotion, fear, disgust, anger.

[0097] Specifically, see the accompanying drawings Figure 4 , based on the updated discourse features and the final discourse topic f at time t t, determine the long dialogue emotion label specifically as:

[0098] The updated discourse features and the final discourse topic f at time t are combined t Input into the transformer decoder structure to obtain the final speech features l is the maximum number of layers in the transformer decoder structure;

[0099] The final utterance features Input the softmax function to get the sentiment label of the long conversation.

[0100] Specifically, the loss function of the softmax function is:

[0101]

[0102] Among them, L final is the cross entropy loss value when calculating the softmax function, Indicates discourse features The k-th layer transformer decoder structure is updated with the utterance features, M is the number of sentiment labels, Discourse Features The utterance features after the k-th layer transformer decoder structure is updated, k = 1…l.

[0103] Specifically, the transformer decoder structure has a total of l layers, wherein one layer of the transformer decoder structure includes: a self-attention module, a cross-attention module, and a feedforward neural network module;

[0104] The self-attention module is used to integrate and update speech features Get the first utterance feature Wherein, k = 1…l;

[0105] Specifically, the self-attention module uses the following formula to analyze the speech features: To merge and update:

[0106]

[0107]

[0108]

[0109] in, is the weight parameter of the attention Key index that the k-th layer self-attention module needs to learn, is the first weight parameter of the attention Value that the k-th layer self-attention module needs to learn, MultiHead is the multi-head self-attention function, Attention is the self-attention function, and softmax is the classification function. for The variance of .

[0110] The cross attention module is connected to the self-attention module, and the cross attention module is used to fuse and update the first speech feature Get the second utterance features The cross attention module is also used to fuse and update the second speech feature Get the third discourse feature Wherein, k = 1…l;

[0111] Specifically, the cross attention module uses the following formula to calculate the first speech feature: To merge and update:

[0112]

[0113]

[0114] in, It is the second weight parameter of the attention Value that the k-th layer cross attention module needs to learn. MultiHead is the multi-head self-attention function, Attention is the self-attention function, and softmax is the classification function. for The variance of

[0115] The cross attention module specifically uses the following formula to calculate the second utterance feature To merge and update:

[0116]

[0117]

[0118] in, It is the third weight parameter of the attention Value that the k-th layer cross attention module needs to learn. MultiHead is the multi-head self-attention function, Attention is the self-attention function, and softmax is the classification function. for The variance of .

[0119] The feedforward neural network module is connected to the cross attention module to update the third speech feature Get the updated fourth discourse feature

[0120] Specifically, the feedforward neural network module uses the following formula to calculate the third speech feature: To update:

[0121]

[0122] in, It is the fourth utterance feature after the k-th layer transformer decoder structure is updated.

[0123] See attached picture Figure 5 Based on the above method, the present invention also provides a long dialogue emotion detection system of common sense knowledge graph, and the long dialogue emotion detection system includes: a graph model construction module 1, a priori knowledge acquisition module 2, a graph model update module 3, a discourse feature update module 4, a discourse topic determination module 5 and a long dialogue emotion label determination module 6.

[0124] The graph model building module 1 is used to construct the speech features at time t. Building a graph model t (V t ,E t ), where V t is a node set, E t For different nodes v i and v j The set of undirected edges between them, where i∈1…n, j∈1…n; the graph model g t (V t ,E t ) is used to represent the conversation data at time t;

[0125] The prior knowledge acquisition module 2 is used to obtain the utterance at time t. Extracting utterances Prior knowledge of

[0126] The graph model updating module 3 is connected to the prior knowledge acquisition module 2, and the graph model updating module 3 is used to update the speech The prior knowledge is added as a new node to the graph model g t (V t ,E t ) to get the updated graph model g t * (V t ,E t );

[0127] The speech feature updating module 4 is connected to the graph model updating module 3, and the speech feature updating module 4 is used to update the graph model g using the GNN model.t * (V t ,E t ) to obtain updated discourse features;

[0128] The speech topic determination module 5 is used to determine the speech element u at the time t. i m utterances before, determine the final utterance topic f at time t t , where, m=1...i-1, i=1...n;

[0129] The long dialogue emotion label determination module 6 is connected to the speech feature updating module 4 and the speech topic determination module 5. The long dialogue emotion label determination module is used to determine the emotion label of the speech based on the updated speech feature and the final speech topic f at time t. t , determine the long dialogue emotion tags; the long dialogue emotion tags include: happy, frustrated, surprised, neutral, fear, disgust, and anger.

[0130] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0131] The present invention provides a long dialogue emotion detection method and system based on common sense knowledge graph, which not only retains the correlation between discourses, but also retains the time change information. By searching each discourse feature from the common sense knowledge graph, the relevant prior knowledge is learned, the global semantic information is obtained, and the discourse feature update is guided, thereby improving the final performance of emotion detection. The transformer decoder structure is used to detect emotions, and the deep fusion of discourse features containing prior knowledge and discourse topics is achieved, and potential dialogue semantic information and prior knowledge are introduced to improve the emotion recognition ability.

[0132] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of ​​the present invention. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. A long dialogue emotion detection method based on common sense knowledge graph, characterized in that: The long conversation emotion detection method comprises: Discourse features based on time t Building a graph model t (V t ,E t ), where V t is a node set, E t For different nodes v i and v j The set of undirected edges between them, where i∈1…n, j∈1…n; the graph model g t (V t ,E t ) is used to represent the conversation data at time t; Discourse based on time t Extracting utterances Prior knowledge, including: Get the discourse element u i The search results are the first k results in triple format, expressed as: Based on the discourse element u i The search results for the discourse The search result set is expressed as: Based on the retrieval result set, the retrieval results in the set are combined to obtain the utterance Prior knowledge of The words The prior knowledge is added as a new node to the graph model g t (V t ,E t ) to get the updated graph model g t * (V t ,E t ); Use the GNN model to update the graph model g t * (V t ,E t ) to obtain updated discourse features; Based on the discourse element u at time t i m utterances before, determine the final utterance topic f at time t t , where, m=1...i-1, i=1...n; Based on the updated discourse features and the final discourse topic f at time t t , determine the long conversation emotion tags; the long conversation emotion tags include: happiness, frustration, surprise, no emotion, fear, disgust, anger.

2. According to the method for detecting emotion in long dialogues based on common sense knowledge graphs according to claim 1, it is characterized in that: Based on the discourse element u at time t i The m discourse elements before determine the final discourse topic f at time t t , specifically: Get the discourse element u at time t i The first m discourse elements; The utterance element u at time t i The previous m discourse elements are converted into m discourse features; The 3×N different utterance elements u at time t are i The first m speech elements are input into the self-attention mechanism layer to obtain N sample speech topics f t , N positive sample discourse topics f p And N negative sample discourse topics f n ; Each time a topic is extracted, the time interval is greater than or equal to T interval , the N sample discourse topics f t , N positive sample discourse topics f p And N negative sample discourse topics f n The triple (f t ,f p ,f n ); Based on the triple (f t ,f p ,f n ), construct a loss function; the loss function is specifically: Among them, sim(f t ,f p ) as the theme t and f p The dot product between them is the cosine similarity, sim(f t ,f n ) as the theme t and f n The dot product between them is the cosine similarity, f t is the sample utterance topic, f p Yes t The positive sample discourse topic, f n Yes t The negative sample discourse topic, N is the number of training samples, N∈1…n, α is the model parameter; Based on the loss function, determine the final discourse topic f at time t t .

3. According to the method for detecting emotion in long dialogues based on common sense knowledge graphs in claim 1, it is characterized in that: Based on the updated discourse features and the final discourse topic f at time t t , determine the long dialogue emotion label specifically as: The updated discourse features and the final discourse topic f at time t are combined t Input into the transformer decoder structure to obtain the final speech features l is the maximum number of layers in the transformer decoder structure; The final utterance features Input the softmax function to get the sentiment label of the long conversation.

4. The method for detecting emotion in long conversations based on a common sense knowledge graph according to claim 3, characterized in that: A layer in the transformer decoder structure includes: Self-attention module, used to integrate and update speech features Get the first utterance feature Wherein, k = 1…l; A cross attention module, connected to the self-attention module, for fusing and updating the first speech feature Get the second utterance features The cross attention module is also used to fuse and update the second speech feature Get the third discourse feature Wherein, k = 1…l; A feedforward neural network module, connected to the cross attention module, for updating the third utterance feature Get the updated fourth discourse feature 5. According to claim 4, the method for detecting emotion in long conversations based on common sense knowledge graphs is characterized in that: The self-attention module specifically uses the following formula to analyze the speech features To merge and update: in, is the weight parameter of the attention Key index that the k-th layer self-attention module needs to learn, It is the first weight parameter of the attention Value that the k-th layer self-attention module needs to learn. MultiHead is the multi-head self-attention function, Attention is the self-attention function, and softmax is the classification function. for The variance of .

6. The method for detecting emotion in long conversations based on a common sense knowledge graph according to claim 4, characterized in that: The cross attention module specifically uses the following formula to calculate the first utterance feature To merge and update: in, It is the second weight parameter of the attention Value that the k-th layer cross attention module needs to learn. MultiHead is the multi-head self-attention function, Attention is the self-attention function, and softmax is the classification function. for The variance of The cross attention module specifically uses the following formula to calculate the second utterance feature To merge and update: in, It is the third weight parameter of the attention Value that the k-th layer cross attention module needs to learn. MultiHead is the multi-head self-attention function, Attention is the self-attention function, and softmax is the classification function. for The variance of .

7. The method for detecting emotion in long conversations based on a common sense knowledge graph according to claim 4, characterized in that: The feedforward neural network module uses the following formula to calculate the third speech feature To update: in, It is the fourth utterance feature after the k-th layer transformer decoder structure is updated.

8. A common sense knowledge graph-based long dialogue emotion detection system, characterized in that: The long conversation emotion detection system comprises: The graph model building module is used to calculate the speech characteristics at time t. Building a graph model t (V t ,E t ), where V t is a node set, E t For different nodes v i and v j The set of undirected edges between them, where i∈1…n, j∈1…n; the graph model g t (V t ,E t ) is used to represent the conversation data at time t; Prior knowledge acquisition module for utterances based on time t Extracting utterances Prior knowledge, including: The retrieval result acquisition unit of the discourse element ui is used to acquire the retrieval result of the discourse element ui, and the retrieval result is the first k results in triple format, which are expressed as: Discourse The retrieval result set acquisition unit is connected to the retrieval result acquisition unit of the utterance element ui, and is used to obtain the retrieval result of the utterance element u based on the utterance element u. i The search results for the discourse The search result set is expressed as: Prior knowledge acquisition unit, and the discourse The retrieval result set acquisition unit is connected to the retrieval result set, and is used to obtain a union of each retrieval result in the set based on the retrieval result set to obtain a discourse Prior knowledge of A graph model updating module is connected to the prior knowledge acquisition module and is used to update the speech The prior knowledge is added as a new node to the graph model g t (V t ,E t ) to get the updated graph model g t * (V t ,E t ); The speech feature updating module is connected to the graph model updating module and is used to update the graph model g using the GNN model. t * (V t ,E t ) to obtain updated discourse features; The speech topic determination module is used to determine the final speech topic f at time t based on the m speeches before the speech element ui at time t. t , where, m=1...i-1, i=1...n; The long dialogue emotion label determination module is connected to the speech feature updating module and the speech topic determination module, and is used to determine the emotion label of the long dialogue based on the updated speech feature and the final speech topic f at time t. t , determine the long conversation emotion tags; the long conversation emotion tags include: happiness, frustration, surprise, no emotion, fear, disgust, anger.

Citation Information

Patent Citations

  • Emotion recognition method based on multi-modal dialogue text

    CN113609289A

  • Dialogue emotion recognition network model based on knowledge enhancement and backtracking loss, construction method, electronic device and storage medium

    CN113987179A