Common-situation dialogue generation method and system

By extracting emotional triples and constructing concept maps, we can accurately identify specific aspects and emotional tendencies in user discourse, generate empathetic responses, solve the accuracy problem of existing dialogue systems in mixed emotional scenarios, and improve dialogue quality and user experience.

CN120930801APending Publication Date: 2025-11-11JIANGXI UNIV OF SCI & TECH
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202511125752.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-12
Publication Date
2025-11-11

AI Technical Summary

Technical Problem

Existing dialogue systems struggle to accurately identify specific aspects and emotional inclinations in user discourse, resulting in responses that lack relevance and empathy.

Method used

By employing sentiment triplet extraction technology, aspect word combinations and sentiment word pairs are generated. Through context encoding and concept map construction, the specific aspects and sentiment tendencies in user discourse are accurately identified, generating empathetic responses.

Benefits of technology

It improves the accuracy and relevance of responses in dialogue systems with mixed emotions, thereby enhancing dialogue quality and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120930801A_ABST
    Figure CN120930801A_ABST
Patent Text Reader

Abstract

The invention discloses a common-situation dialogue generation method and system, and relates to the technical field of common-situation dialogue generation, and the method comprises the steps: obtaining dialogue data of a user; extracting the dialogue data by adopting an emotion triple, and generating an aspect word group and an emotion word pair group; the method comprises the following steps: acquiring a statement-level semantic vector, an aspect phrase vector and an emotion vector of a context text to obtain statement-level semantic conversion information, aspect phrase conversion information and emotion conversion information, and integrating the statement-level semantic vector, the emotion conversion information and the statement-level semantic conversion information to obtain an enhanced statement vector of each statement; integrating the aspect phrase vector and the aspect phrase conversion information to obtain an enhanced aspect phrase vector of each aspect phrase; constructing a conceptual graph for the context of each dialogue to obtain semantic features of the context, so as to generate a reply with high emotional sharing ability with the user; according to the method, the corresponding emotional tendency in the utterance of the user is accurately recognized, and the reply rich in emotional strength is generated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of natural language processing technology, specifically to a method and system for generating empathetic dialogues. Background Technology

[0002] In recent years, with the development of artificial intelligence, dialogue systems have played an increasingly important role in people's lives and work.

[0003] In existing technologies, some research has attempted to enhance the empathic capabilities of dialogue systems through the fusion of emotional knowledge. Patent CN116680369B proposes an empathic dialogue generation method and system, which achieves emotional perception through joint modeling of emotional state estimation and common-sense knowledge. However, it still suffers from two significant drawbacks: First, the method uses sentence-level emotional annotation without achieving fine-grained aspect-based emotional decoupling, resulting in an inability to accurately pinpoint the emotional polarity of specific objects in mixed emotional scenarios. For example, when a user expresses "This phone's camera is excellent, but the battery life isn't very good," existing technologies may only be able to identify the overall emotional tendency and cannot distinguish between the differentiated emotional expressions of "camera" (positive) and "battery life" (negative). Second, the generation of its mixed emotional matrix lacks an explicit conceptual association mechanism, making it difficult for the generated responses to establish semantic connections between emotional elements and domain knowledge. This limitation means that when faced with complex emotional interactions, the system may produce general responses such as "I understand your feelings; phone performance is indeed important," rather than empathetic expressions targeting specific aspects (such as camera / battery life).

[0004] Traditional dialogue systems often struggle to accurately identify specific aspects of a user's speech and the corresponding emotional inclinations, resulting in responses that lack relevance and empathy. Summary of the Invention

[0005] To address the shortcomings of existing technologies in accurately identifying specific aspects and corresponding emotional tendencies in user discourse, which leads to a lack of targeted and empathetic responses, this invention proposes an empathetic dialogue generation method and system. This system can accurately extract triplets composed of aspect words, emotion words, and emotion polarities from the user's input text, and accurately identify specific aspects and corresponding emotional tendencies in the user's discourse based on these triplets, thereby generating empathetic responses to improve the quality of dialogue and user experience, thus solving the problems existing in the prior art.

[0006] A method for generating empathic dialogue includes the following steps: Acquire dialogue data between users; extract dialogue data using sentiment triples to generate aspect word combinations composed of aspect words and sentiment word pairs composed of sentiment words and sentiment polarities; By transforming each statement in the dialogue data into a hidden state output sequence, the sentence-level meaning vector, concatenated aspect phrase vector, and sentiment word pair vector of the context text in the dialogue data are obtained. The sentence-level meaning vector, concatenated aspect phrase vector, and sentiment word pair vector of the current statement and the previous two statements are multiplied element-wise to obtain sentence-level meaning transformation information, aspect phrase transformation information, and sentiment transformation information. The sentence-level meaning vector, sentiment transformation information, and sentence-level meaning transformation information are concatenated to obtain the enhanced sentence vector of each statement. The aspect phrase vector and aspect phrase transformation information are concatenated to obtain the enhanced aspect phrase vector of each aspect phrase. A concept map is constructed for the context of each dialogue based on the augmented statement vector of each statement and the augmented aspect phrase vector of each aspect phrase. The semantic features of the context are then extracted from the concept map. Based on the semantic features of the context, the system predicts sentiment and generates responses that resonate with the user.

[0007] Furthermore, the extraction of dialogue data using sentiment triples to generate aspect word combinations composed of aspect words and sentiment word pairs composed of sentiment words and sentiment polarities specifically includes the following steps: Sentiment triples are extracted from the dialogue data, and sentiment words and sentiment polarities are combined to form a sentiment word pair. And each paragraph Emotional word pairs From each sentence The sentiment word pairs obtained are composed of sentiment triples, and then sentiment word pairs in the context of the dialogue data are obtained. ; Each paragraph aspect phrases From each sentence The aspect words in the obtained sentiment triples are composed of aspect words, which are then used to obtain aspect word groups in the context of the dialogue data. i This indicates the first word spoken by the speaker or listener within the context of the dialogue. i This passage, n This indicates the total number of statements in the dialogue context.

[0008] Furthermore, the step of converting each statement in the dialogue data into an output sequence of hidden states to obtain the statement-level meaning vector, concatenated aspect phrase vector, and sentiment word pair vector of the context text in the dialogue data specifically includes the following steps: Use a label Add a prefix to each sentence to get , For each sentence, a prefix is ​​used; each tag is embedded via aspect terms. Location embedding Character embedding and emotional words to embed The sum of four embeddings; where For the number of emotion types, d The dimension size in the hidden state; Through an embedding layer Mapping to continuous space: ; Employing a speech-level encoder Transform each statement into a hidden state output sequence: For each statement able to from the label Obtaining statement-level meaning vectors From the perspective of words Corresponding tags To obtain the concatenated aspect phrase vectors And sentiment word pair vectors , p This is an index of terms related to the topic.

[0009] Furthermore, the step of multiplying the sentence-level meaning vectors of the current sentence and the previous two sentences, the concatenated aspect phrase vectors, and the sentiment word pair vectors element-wise to obtain sentence-level meaning conversion information, aspect phrase conversion information, and sentiment conversion information specifically includes the following steps: Emotion word pair vectors Input Emotion Converter Calculate the emotional shift information : ; in: ; ; sentence-level meaning vectors Input Emotion Converter Calculate statement-level meaning transformation information : ; in, , Both are weight matrices; By using a size of d Fully connected layer This integrates sentence-level meaning vectors, sentiment, and sentence-level meaning transformation information to obtain an enhanced sentence vector for each sentence. ; Connecting aspect phrase vectors and cross-coding vector Input Emotion Converter Calculation-related phrase conversion information , : ; ; ; in, , Both are weight matrices; By using a size of d Fully connected layer By integrating aspect phrase vectors and aspect phrase transformation information, we obtain the enhanced aspect phrase vector for each aspect phrase: .

[0010] Furthermore, it also includes employing a six-layer encoder with BERT after obtaining the enhanced statement vector for each statement. This transforms the enhanced statement vector into a contextual representation, used to capture the relationships between statements, as follows: ; in, An enhanced statement vector for each statement. A context representation for each statement.

[0011] Furthermore, the step of constructing a concept map for the context of each dialogue based on the enhanced statement vector of each statement and the enhanced aspect phrase vector of each aspect phrase, and extracting the semantic features of the context based on the concept map, specifically includes the following steps: Each aspect phrase in the context is treated as a node and initialized with the corresponding enhanced aspect phrase vector; where, if the last word of one aspect phrase is the first word of another aspect phrase, then the last word is also a node and is connected to the first word. Edges are constructed in the concept graph by connecting the nodes; where an edge is formed between two aspect phrases from the same sentence, or between an aspect phrase and another aspect phrase in the previous two sentences. The nodes in the concept graph are updated using a multi-head graph attention mechanism, and the impact of each edge connecting the nodes in the concept graph is obtained: ; ; in Represents a node. This indicates the connection point of the MH attention head. Represents the nodes in adjacency matrix A Neighbors Represents the self-attention weights. Both are weight matrices; ; By using a size of d Fully connected layer This involves merging the sum of contextual representations and aspect term representations: Obtain the context representation of the fusion. .

[0012] Furthermore, the step of predicting sentiment based on the semantic features of the context and generating an empathetic response specifically includes the following steps: By using Activation function, aggregation network and emotional words to embed Predicting the next sentiment distribution: Among them, the most frequently used sentiment word pairs Generate the term; predict whether each word in the aggregation network belongs to the next aspect phrase using binary classification: ; in The weight matrix is ​​given, and... Words with a value >=0.8 are considered as aspect phrases. Generate; The generated sentiment word pairs and aspect phrases The probability distribution of generated responses is as follows, when inputting into a response generator with a BERT six-layer decoder as its backbone: ; in, For the generated response, con For the context of the dialogue, eps For pairs of emotion words, aps For aspect pairs, a For aspect phrases, For the next mark, yes Previously generated subsequences, t Indicates the first in the response t One location; The response generated with the highest probability is selected as the reply to the dialogue.

[0013] The present invention also provides an empathic dialogue generation system, comprising: The data acquisition module is used to acquire dialogue data between users; it uses sentiment triples to extract dialogue data and generates aspect word combinations composed of aspect words and sentiment word pairs composed of sentiment words and sentiment polarities. The context encoding module is used to obtain the sentence-level meaning vector, concatenated aspect phrase vector, and sentiment word pair vector of the context text in the dialogue data by transforming each sentence in the dialogue data into an output sequence of hidden states. It then performs element-wise multiplication of the sentence-level meaning vector, concatenated aspect phrase vector, and sentiment word pair vector of the current sentence and the previous two sentences to obtain sentence-level meaning transformation information, aspect phrase transformation information, and sentiment transformation information. Finally, it concatenates the sentence-level meaning vector, sentiment transformation information, and sentence-level meaning transformation information to obtain the enhanced sentence vector for each sentence. Finally, it concatenates the aspect phrase vector and aspect phrase transformation information to obtain the enhanced aspect phrase vector for each aspect phrase. The concept map construction module is used to construct a concept map for the context of each dialogue based on the augmented statement vector of each statement and the augmented aspect phrase vector of each aspect phrase; and to extract the semantic features of the context based on the concept map. The empathic dialogue generation module is used to predict emotions based on the semantic features of the context and generate responses that are empathetic to the user.

[0014] This invention provides a method and system for generating empathic dialogues, which has the following beneficial effects: This invention utilizes sentiment triplet extraction technology to accurately identify specific aspect words and their corresponding sentiment words and sentiment polarities in user dialogues, solving the problem of traditional methods failing to distinguish the sentiment tendencies of different objects in mixed sentiment scenarios. By integrating sentence vectors, sentiment transformation information, and semantic transformation information, it generates enhanced sentence vectors, improving sensitivity to changes in contextual sentiment. By constructing a dynamic concept graph, using aspect word groups as nodes and establishing semantic association edges, it explicitly captures the connections between sentiment elements and domain knowledge in the dialogue context, enhancing the relevance of responses. This method can accurately extract triplets composed of aspect words, sentiment words, and sentiment polarities from user-input text, and accurately identify specific aspects and corresponding sentiment tendencies in user discourse based on these triplets, thereby generating empathetic responses to improve dialogue quality and user experience. Attached Figure Description

[0015] Figure 1 This is a flowchart of the empathic dialogue generation method in an embodiment of the present invention. Detailed Implementation

[0016] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.

[0017] This invention proposes a method for generating empathic dialogues, such as... Figure 1 As shown, the specific steps include: S1. Obtain user dialogue data; the main data collected includes dialogue ID, speaker / listener ID, and dialogue text.

[0018] S2, the data processing and sentiment triple extraction module, preprocesses the acquired dialogue text, dividing the data into training, validation, and test sets in an 8:1:1 ratio. Sentiment triples, consisting of aspect words, sentiment words, and sentiment polarities, are extracted from the dataset, and sentiment words and sentiment polarities are combined to form sentiment word pairs. And each paragraph Emotional word pairs By each This consists of all possible aspect-level sentiment triples obtained from the sentence, forming sentiment word pairs. Furthermore, it yields sentiment word pairs throughout the entire dialogue context. Finally, the aspect words in the aspect-level emotion triplet will be... Each paragraph aspect phrases This allows us to obtain aspect phrases within the entire dialogue context. .

[0019] In order to make predictions for the next aspect phrase, aspect word pairs were also created, where each aspect word pair has two aspect words, which are respectively from the aspect phrases in the speaker's statement and the aspect phrases in the listener's statement in the same round of dialogue.

[0020] S3. The context encoding module converts the input context text into a vector representation through a word embedding layer. Then, through multiple layers of encoder processing, the semantic features and potential structural information of the context are gradually extracted.

[0021] The context encoding module includes a discourse-level encoder, a feature recognition converter, a context encoder, and a concept graph construction. The discourse-level encoder, based on BERT, obtains sentence-level meaning vectors, concatenated aspect phrase vectors, and sentiment vectors. The feature recognition converter obtains sentiment transformation information calculated from sentiment vectors, sentence-level meaning transformation information calculated from sentence-level meaning vectors, enhanced sentence vectors for each sentence calculated by integrating sentence-level meaning vectors, sentiment, and sentence-level meaning transformation information, aspect phrase transformation information derived from concatenated aspect phrase vectors, and enhanced aspect phrase vectors for each aspect phrase calculated by integrating aspect phrase vectors and aspect phrase transformation information. The sentence-level encoder contains an encoder with BERT's six-layer encoder, enhancing the conversion of sentence vectors into contextual representations to capture relationships between sentences. In concept graph construction, a concept graph is dynamically built for the context of each dialogue, resulting in a fused contextual representation. Therefore, aspect phrases are emphasized in each sentence and receive more attention when generating responses.

[0022] The context encoding module uses a The marker adds a prefix to each sentence, therefore the prefix... Each tag consists of the sum of the following four embeddings: aspect term embeddings. Position embedding Character embedding and emotional words to embed ( (where d is the number of emotion types and d is the dimension size in the hidden state). Then, an embedding layer will... Mapping to continuous space:

[0023] ; Then, the discourse-level encoder Transform each statement into a hidden state output sequence: For each statement It is possible to obtain a sentence-level meaning vector from this tag. From the perspective of words ( p (This is an index of terms) corresponding to the tags To obtain the concatenated aspect phrase vectors and emotional vector .

[0024] Use the obtained sentiment vector Information conversion calculation function Represents the Hadamar product and activation function To calculate sentiment shift information in And the weight matrix .

[0025] The obtained sentence-level meaning vectors can be used to calculate sentence-level meaning transformation information. The weight matrix Then, by using a size of d Fully connected layer This integrates sentence-level semantic vectors with sentiment and sentence-level semantic transformation information to obtain an enhanced sentence vector for each sentence. .

[0026] Aspect Phrase Conversion Information Through concatenated aspect phrase vectors and cross-coded vectors calculate, : , , ; The weight matrix Then by using A size of d The fully connected layer integrates aspect phrase vectors and aspect phrase transformation information to obtain the enhanced aspect phrase vector for each aspect phrase: Therefore, using the enhanced vectors can accurately capture the speaker's characteristics.

[0027] Use another six-layer encoder with BERT This allows you to convert enhanced statement vectors into contextual representations: This allows for a fine-grained understanding of each sentence, and based on that understanding, the context of the dialogue can be grasped by integrating the information.

[0028] First, a concept graph is dynamically constructed for the context of each dialogue. Each aspect phrase in the context is treated as a node and initialized with the corresponding augmented aspect phrase vector. Next, edges are constructed in the graph, connecting the nodes according to the following rules: (1) two aspect phrases from the same sentence form an edge; (2) an aspect phrase is connected to another aspect phrase in the preceding two sentences. Furthermore, if the last word pair of one aspect phrase is the first word of another, the last word pair is added as a node and connected to the first word pair. These edges connecting the nodes in the graph (Appended Nodes, ANs) are initialized using the BERT decoder and used to detect the next aspect phrase.

[0029] In order to obtain representations of each aspect phrase from the concept map , ( o (This refers to the node index.) Nodes are updated according to a multi-head graph attention mechanism. This mechanism not only enables the model to capture the relationships between nodes, but also manages the influence of each edge connecting nodes in the graph through an attention architecture.

[0030] ; ; in Each of these represents a node, the connection point of the MH attention head, and a node in the adjacency matrix A. The neighbors and self-attention weights, where All are weight matrices.

[0031] By using a fully connected layer of size d This involves merging the contextual representation and the aspect term representation: This allows us to obtain the contextual representation of the fusion. .

[0032] S4. Empathic Dialogue Generation Module: This module uses the encoded contextual features to predict emotions and generate highly empathetic responses. Specifically, it includes: Empathic dialogue generation module uses Activation function, aggregation network and emotional words to embed The next sentiment distribution can be predicted: Among them, the most frequently used sentiment word pairs Generate appropriate emotions.

[0033] Predict each using binary classification. AN Does the word belong to the next aspect phrase? ,in and the probability Words with a value >=0.8 are considered relevant phrases. Generate.

[0034] A response generator with a BERT six-layer decoder as its backbone is used to generate sentiment word pairs. and aspect phrases As input, the probability distribution of the generated response is obtained: The response with the highest probability is selected as the reply to the dialogue. For the generated response, con For the context of the dialogue, eps For pairs of emotional words, apsFor aspect pairs, a For aspect phrases, For the next mark, yes Previously generated subsequences, t Indicates the first in the response t One position.

[0035] The empathic dialogue generation system and method based on aspect-emotion triple extraction provided by this invention can accurately extract triples composed of aspect words, emotion words, and emotion polarity from the text input by the user, and accurately identify the specific aspects and corresponding emotional tendencies in the user's discourse based on these triples, thereby generating empathetic responses to improve the quality of dialogue and user experience.

[0036] Based on the same inventive concept, this invention also proposes an empathic dialogue generation system, comprising: The data acquisition module is used to acquire dialogue data between users; it uses sentiment triples to extract dialogue data and generates aspect word combinations composed of aspect words and sentiment word pairs composed of sentiment words and sentiment polarities.

[0037] The context encoding module is used to obtain the sentence-level meaning vector, concatenated aspect phrase vector, and sentiment word pair vector of the context text in the dialogue data by transforming each sentence in the dialogue data into an output sequence of hidden states. It then performs element-wise multiplication of the sentence-level meaning vector, concatenated aspect phrase vector, and sentiment word pair vector of the current sentence and the previous two sentences to obtain sentence-level meaning transformation information, aspect phrase transformation information, and sentiment transformation information. Finally, it concatenates the sentence-level meaning vector, sentiment transformation information, and sentence-level meaning transformation information to obtain the enhanced sentence vector for each sentence. Finally, it concatenates the aspect phrase vector and aspect phrase transformation information to obtain the enhanced aspect phrase vector for each aspect phrase.

[0038] The concept graph construction module is used to construct a concept graph for the context of each dialogue based on the augmented statement vector of each statement and the augmented aspect phrase vector of each aspect phrase; and to extract the semantic features of the context based on the concept graph.

[0039] The empathic dialogue generation module is used to predict emotions based on the semantic features of the context and generate responses that are empathetic to the user.

[0040] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.

Claims

1. A method for generating empathic dialogue, characterized in that, Includes the following steps: Obtain data from conversations between users; The dialogue data is extracted using sentiment triads to generate aspect word combinations composed of aspect words and sentiment word pairs composed of sentiment words and sentiment polarities; By transforming each statement in the dialogue data into a hidden state output sequence, the sentence-level meaning vector, concatenated aspect phrase vector, and sentiment word pair vector of the context text in the dialogue data are obtained; the sentence-level meaning vector, concatenated aspect phrase vector, and sentiment word pair vector of the current statement and the previous two statements are multiplied element-wise to obtain sentence-level meaning transformation information, aspect phrase transformation information, and sentiment transformation information; by concatenating the sentence-level meaning vector, sentiment transformation information, and sentence-level meaning transformation information, the enhanced sentence vector of each statement is obtained. By concatenating aspect phrase vectors and aspect phrase transformation information, we obtain the enhanced aspect phrase vector for each aspect phrase; A concept map is constructed for the context of each dialogue based on the augmented statement vector of each statement and the augmented aspect phrase vector of each aspect phrase. The semantic features of the context are then extracted from the concept map. Based on the semantic features of the context, the system predicts sentiment and generates responses that resonate with the user.

2. The method for generating empathic dialogue according to claim 1, characterized in that, The process of extracting dialogue data using sentiment triples to generate aspect word combinations composed of aspect words and sentiment word pairs composed of sentiment words and sentiment polarities specifically includes the following steps: Sentiment triples are extracted from the dialogue data, and sentiment words and sentiment polarities are combined to form a sentiment word pair. And each paragraph Emotional word pairs From each sentence The sentiment word pairs obtained are composed of sentiment triples, and then sentiment word pairs in the context of the dialogue data are obtained. ; Each paragraph aspect phrases From each sentence The aspect words in the obtained sentiment triples are composed of aspect words, which are then used to obtain aspect word groups in the context of the dialogue data. i This indicates the first word spoken by the speaker or listener within the context of the dialogue. i This passage, n This indicates the total number of statements in the dialogue context.

3. The method for generating empathic dialogue according to claim 2, characterized in that, The process of converting each statement in the dialogue data into a hidden state output sequence to obtain the statement-level meaning vector, concatenated aspect phrase vector, and sentiment word pair vector of the context text in the dialogue data specifically includes the following steps: Use a label Add a prefix to each sentence to get , For each sentence, a prefix is ​​used; each tag is embedded via aspect terms. Location embedding Character embedding and emotional words to embed The sum of four embeddings; where For the number of emotion types, d The dimension size in the hidden state; Through an embedding layer Mapping to continuous space: ; Employing a speech-level encoder Transform each statement into a hidden state output sequence: For each statement able to from the label Obtaining statement-level meaning vectors From the perspective of words Corresponding tags To obtain the concatenated aspect phrase vectors And sentiment word pair vectors , p This is an index of terms related to the topic.

4. The method for generating empathic dialogue according to claim 3, characterized in that, The step of multiplying the sentence-level meaning vectors, concatenated aspect phrase vectors, and sentiment word pair vectors of the current sentence and the previous two sentences element-wise to obtain sentence-level meaning transformation information, aspect phrase transformation information, and sentiment transformation information specifically includes the following steps: Emotion word pair vectors Input Emotion Converter Calculate the emotional shift information : ; in: ; ; sentence-level meaning vectors Input Emotion Converter Calculate statement-level meaning transformation information : ; in, , Both are weight matrices; By using a size of d Fully connected layer This integrates sentence-level meaning vectors, sentiment, and sentence-level meaning transformation information to obtain an enhanced sentence vector for each sentence. ; Connecting aspect phrase vectors and cross-coding vector Input Emotion Converter Calculation-related phrase conversion information , : ; ; ; in, , Both are weight matrices; By using a size of d Fully connected layer By integrating aspect phrase vectors and aspect phrase transformation information, we obtain the enhanced aspect phrase vector for each aspect phrase: .

5. The method for generating empathic dialogue according to claim 4, characterized in that, It also includes employing a six-layer encoder with BERT after obtaining the enhanced statement vector for each statement. This transforms the enhanced statement vector into a contextual representation, used to capture the relationships between statements, as follows: ; in, An enhanced statement vector for each statement. A context representation for each statement.

6. The method for generating empathic dialogue according to claim 5, characterized in that, The process of constructing a concept map for the context of each dialogue based on the enhanced statement vector of each statement and the enhanced aspect phrase vector of each aspect phrase, and extracting the semantic features of the context based on the concept map, specifically includes the following steps: Each aspect phrase in the context is treated as a node and initialized with the corresponding enhanced aspect phrase vector; where, if the last word of one aspect phrase is the first word of another aspect phrase, then the last word is also a node and is connected to the first word. Edges are constructed in the concept graph by connecting the nodes; where an edge is formed between two aspect phrases from the same sentence, or between an aspect phrase and another aspect phrase in the previous two sentences. The nodes in the concept graph are updated using a multi-head graph attention mechanism, and the impact of each edge connecting the nodes in the concept graph is obtained: ; ; in Represents a node. This indicates the connection point of the MH attention head. Represents the nodes in adjacency matrix A Neighbors Represents the self-attention weights. Both are weight matrices; ; By using a size of d Fully connected layer This involves merging the sum of contextual representations and aspect term representations: Obtain the context representation of the fusion. .

7. The method for generating empathic dialogue according to claim 6, characterized in that, The process of predicting sentiment based on the semantic features of the context and generating an empathetic response specifically includes the following steps: By using Activation function, aggregation network and emotional words to embed Predicting the next sentiment distribution: Among them, the most frequently used sentiment word pairs Generate the term; predict whether each word in the aggregation network belongs to the next aspect phrase using binary classification: ; in The weight matrix is ​​given, and... Words with a value >=0.8 are considered as aspect phrases. Generate; The generated sentiment word pairs and aspect phrases The probability distribution of generated responses is as follows, when inputting into a response generator with a BERT six-layer decoder as its backbone: ; in, For the generated response, con For the context of the dialogue, eps For pairs of emotion words, aps For aspect pairs, a For aspect phrases, For the next mark, yes Previously generated subsequences, t Indicates the first in the response t One location; The response generated with the highest probability is selected as the reply to the dialogue.

8. An empathic dialogue generation system, characterized in that, include: The data acquisition module is used to acquire dialogue data between users; The dialogue data is extracted using sentiment triads to generate aspect word combinations composed of aspect words and sentiment word pairs composed of sentiment words and sentiment polarities; The context encoding module is used to obtain the sentence-level meaning vector, concatenated aspect phrase vector, and sentiment word pair vector of the context text in the dialogue data by transforming each sentence in the dialogue data into an output sequence of hidden states; it multiplies the sentence-level meaning vector, concatenated aspect phrase vector, and sentiment word pair vector of the current sentence and the previous two sentences element-wise to obtain sentence-level meaning transformation information, aspect phrase transformation information, and sentiment transformation information; and it concatenates the sentence-level meaning vector, sentiment transformation information, and sentence-level meaning transformation information to obtain the enhanced sentence vector of each sentence. By concatenating aspect phrase vectors and aspect phrase transformation information, we obtain the enhanced aspect phrase vector for each aspect phrase; The concept map construction module is used to construct a concept map for the context of each dialogue based on the augmented statement vector of each statement and the augmented aspect phrase vector of each aspect phrase; and to extract the semantic features of the context based on the concept map. The empathic dialogue generation module is used to predict emotions based on the semantic features of the context and generate responses that are empathetic to the user.

Citation Information

Patent Citations

  • A method and system for generating empathic dialogues

    CN116680369B