An emotional dialogue approach for recommendation

Through the recommendation-oriented emotional dialogue method, combining user portraits and knowledge graphs, emotional text classification and generation network are trained, the problem that intelligent dialogue system cannot perceive user emotions is solved, emotional perception and reply strategy adjustment is achieved, and user experience and The humanity of the dialogue system.

CN114168707BActive Publication Date: 2024-12-17SHANGHAI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111262140.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-28
Publication Date
2024-12-17
Estimated Expiration
2041-10-28

AI Technical Summary

Technical Problem

The existing intelligent dialogue recommendation system cannot perceive and adjust the response strategy based on the user's emotions, and lacks perception and feedback on the user's emotions.

Method used

Adopt a recommendation-oriented emotional dialogue method to generate a network by training emotional text classification model, recommended content model and emotional dialogue, combining user portraits, historical dialogues and knowledge graphs to capture user emotions without interfering with recommended content And generate emotionally-compatible conversation responses. The specific steps include preprocessing of the dialogue dataset, predicting recommended content, emotional dialogue model training and model call, and using the Sequence-to-Sequence model and emotion embedding module to perform emotion perception and reply generation at Decoder.

Benefits of technology

It effectively solved the problem of user emotion perception in the dialogue recommendation system, adjusted the reply strategy, improved the user experience, and achieved the goal of the dialogue system being more humane.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114168707B_ABST
    Figure CN114168707B_ABST
Patent Text Reader

Abstract

The present invention discloses an emotional dialogue method for recommendation. The method mainly comprises the following steps: (1) preprocessing of dialogue data set; (2) training of prediction recommendation content model; (3) based on Sequence‑to‑Sequence model, historical dialogue, recommendation target sequence, knowledge graph, current reply, etc. are used as input of Encoder, and encoded through bidirectional GRU model, and an emotion embedding module is added to Decoder to obtain the current emotion of the user from the historical dialogue, and generate dialogue reply that conforms to the current emotion of the user without interfering with the knowledge output; (4) calling the emotional dialogue model for recommendation, and obtaining the final dialogue reply output through Sequence‑to‑Sequence encoding and decoding. The method proves that the dialogue robot not only has the ability of single knowledge output or emotion output, but also can combine knowledge output with emotion output to make the dialogue generation more human-like, thereby improving the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to an emotional dialogue method oriented to recommendation, and belongs to the field of computer natural language processing. Background Art

[0002] With the advent of the digital information age, the amount of conversation data generated by a large number of social software is increasing at an alarming rate. This digital trend has created new opportunities for the application of deep learning and intelligent conversation technology in areas such as ticket booking assistants, intelligent recommendations, and intelligent customer service. As an important branch of artificial intelligence, intelligent conversation technology is no longer expected to have only IQ, that is, the acquisition and expression of knowledge, but also EQ, that is, the capture of user emotions and the generation of corresponding replies based on the user's current emotions. For the existing intelligent conversation recommendation system, it can extract relevant knowledge and complete the recommendation task well, but it cannot perceive the user's emotions and adjust the reply strategy based on the user's reply. How to use current computer technology to realize an emotional conversation robot with "double quotient" for recommendation is a problem worth studying.

[0003] The two basic modules for implementing a text-based conversational robot are the natural language understanding module (NLU) and the natural language generation module (NLG). Natural language generation is the core content of the conversational system and usually includes three solutions: rule-based, query-based, and deep learning-based sequence-to-sequence generation models. Each solution has its own advantages and disadvantages and applicable scenarios: (1) Rule-based: It can give accurate answers in a specific field, but its portability and scalability are poor. It is suitable for closed-domain chat applications such as ticket booking assistants. (2) Query-based: The knowledge base has good scalability and the output answers do not have grammatical errors, but the dialogue coherence is poor, and the answer may not be what is asked. It is suitable for applications such as question-answering systems. (3) Sequence-to-Sequence: It can directly realize natural language generation through data-driven, eliminating the process of natural language understanding, but it requires a large amount of corpus support and is suitable for most open-domain intelligent chat robots.

[0004] The basic framework for using deep learning to achieve intelligent dialogue is Encoder-Decoder. By rewriting its Encoder or Decoder, different dialogue applications can be realized: intelligent customer service, intelligent recommendation, chat robot, multi-round dialogue robot, question-and-answer robot, emotion-aware chat robot, etc.

[0005] In 1950, Alan Mathison Turing proposed the famous Turing test, which states that if a computer can communicate in natural language like a human, it can be considered to have artificial intelligence, which means that the computer must have human-like IQ, EQ and learning ability.

[0006] Zhou et al. first added emotional factors to large-scale Chinese dialogue generation and proposed an emotional chat machine (ECM). By adding an emotion embedding module, an internal memory module, and an external memory module to the Decoder, they achieved the generation of responses corresponding to five emotions from input sentences.

[0007] Song et al. proposed an emotional dialogue system based on two ways of expressing emotions: using stronger emotional words and implicitly combining different neutral words to increase the intensity of emotional experience. They extended the dictionary-based attention mechanism in the Sequence-to-Sequence framework to achieve explicit or implicit expression of desired emotions while successfully generating coherent and meaningful responses.

[0008] In response to the lack of public emotional dialogue datasets for training and evaluation, Rashkin et al. proposed a baseline method and dataset for English emotional dialogue. The model used Transformer as the encoder and decoder, and added auxiliary information of emotional labels during the encoding process.

[0009] Shen et al. proposed a curriculum dual learning (CDL) method, which regards the learning of emotional response and query generation as a dual task, and uses duality to model the relationship between them. Through reinforcement learning (RL), the forward and backward models are alternately trained to achieve emotionally controllable response generation. The reward design here is to encourage emotional expression and content consistency.

[0010] Wu et al. proposed an active dialogue system based on knowledge graph. The goal of this dialogue system is to guide the dialogue topic from A to B. The model encodes the context and the target topic together, as well as the knowledge and the current round response to achieve dialogue output.

[0011] Liu et al. proposed a new dialogue task: conversational recommendation that integrates multiple dialogue types. The dialogue system can actively and naturally guide any type of dialogue to the recommendation target. The model is mainly divided into two parts: dialogue goal planning and response generation. The goal planning part first predicts whether the current goal is completed, and then predicts the next dialogue type and target entity; the response generation part draws on the Sequence-to-Sequence model, using bidirectional GRU to encode the dialogue history, related knowledge, and dialogue goals respectively, and selects the knowledge information needed for the response through Attention, and introduces it into the Decoder to realize response generation. Summary of the invention

[0012] The purpose of the present invention is to provide an emotional dialogue method for recommendation to address the problems in the current intelligent dialogue recommendation field, such as lack of perception of user emotions and inability to adjust response strategies according to captured user emotions.

[0013] In order to achieve the above object, the present invention adopts the following technical scheme:

[0014] An emotional dialogue method for recommendation, which generates dialogue replies that match the user's current emotions without interfering with the recommended content; the specific operation steps are as follows:

[0015] (1) Preprocessing of Dialogue Dataset

[0016] By training a text classification model for five types of emotions, the sentences in the conversation dataset are predicted by the text classification network, and the prediction results are retained in the dataset. At the same time, the dataset also retains historical conversations and current replies, knowledge graph information in the form of triples, recommended target sequences, user portraits, etc.

[0017] (2) Predictive recommendation content model training

[0018] According to the recommended target sequence and historical conversation information in the dataset, the user preferences in the user portrait intervene in the final recommended target sequence, train and predict whether the current goal is completed and the next recommended target entity, and obtain the final recommended target sequence.

[0019] (3) Emotional dialogue model training

[0020] Based on the Sequence-to-Sequence model, the knowledge module, the recommended target sequence module, the historical dialogue module, the current reply module, etc. are used as encoders, and the emotion embedding module is added to the decoder for training. Without interfering with the knowledge output, the user's emotions are captured and used to improve the dialogue response, thereby enhancing the user experience.

[0021] (4) Calling the emotional dialogue model for recommendation

[0022] By calling the above training model, we first predict the final recommended target sequence based on the user portrait, then predict the sentiment label value of the current input sentence, add the historical dialogue as the context input, and obtain the final dialogue response output through Sequence-to-Sequence encoding and decoding.

[0023] Preferably, in step (1), an emotional text classification network is constructed by cascading ERNIE and TextCNN modules, and the text classification training data set contains six types of emotional text corpora, namely, like, sad, angry, disgust, happy, and other null; the loss function of the text classification network model is to perform cross entropy between the predicted value and the true value:

[0024]

[0025] Where n is the number of samples, q is the number of output categories, is the real value vector y (i) The elements that are either 0 or 1 in is the predicted value vector The elements in are either 0 or 1; i represents the i-th sample; j represents the j-th classification category;

[0026] After training, the classification model is obtained and applied to Baidu's open source DuRecDial dataset. The historical conversations and corresponding replies in the dataset are used to predict emotions through the text classification network model to obtain the corresponding emotion prediction label value for each sentence. The prediction results are retained in the dataset. At the same time, the dataset retains fields such as historical conversations, current replies, knowledge graph information in the form of triples, recommended target sequences, and user portraits.

[0027] Preferably, the step (2) constructs a recommendation target prediction network based on the recommendation target sequence and user portrait field in the DuRecDial dataset, and the network includes two modules: a module for judging the completion of the current target and a module for predicting the next recommended entity; wherein the network model used by the module for judging the completion of the current target is TextCNN, which takes the historical conversation and the current conversation progress as input, and outputs the probability of predicting the completion of the current target:

[0028] P GC (l=1|X,g t-1 ) (2)

[0029] Among them, X represents the historical dialogue, t represents the current dialogue round, and g t-1 Indicates the dialogue goal of the previous sentence, P GCIndicates the probability of goal completion; if the probability value is less than 0.5, it means that it is not completed, and the previous dialogue goal is returned as the next round of dialogue goal; if the probability value is greater than 0.5, it means that the current dialogue goal has been completed, and then enter the next stage, that is, the next recommended goal prediction;

[0030] The module for predicting the next recommended entity uses a multi-classification network based on CNN. At the same time, according to the user's preferences in the user portrait, the corresponding Attention mechanism is added to the network. The recommended target corresponding to the user's preferences will be assigned a higher weight value. Through the intervention of the Attention on the final recommended target sequence, it trains and predicts whether the current target is completed, and predicts the target entity of the next conversation, and obtains the final recommended target sequence. Its probability model is written as:

[0031]

[0032] Among them, P is the user portrait, representing the user's likes and dislikes, X is the historical conversation, G is the original recommendation target, and g tp Recommend a target for the next candidate dialogue, P GP represents the predicted probability of the dialogue target, and t represents the current dialogue turn.

[0033] Preferably, the step (3) constructs an emotional dialogue generation network for recommendation based on the Sequence-to-Sequence model and the historical dialogues, current replies, dialogue emotion labels, knowledge graphs, recommendation target sequences and other fields in the data set; the network comprises: a historical dialogue encoding module, a knowledge encoding module, a recommendation target encoding module, a knowledge selection module and an emotion embedding module; wherein the historical dialogues and the recommendation targets are respectively encoded using a bidirectional GRU model, the knowledge graph information and the current reply are used as input, a knowledge selection module is constructed using a bidirectional GRU encoding method and an Attention mechanism, the above modules are used as Encoders, and a concatenate operation is performed to generate a semantic encoding vector; at the Decoder, the user's current emotion value is first predicted based on the historical dialogues, and then the corresponding reply emotion classification is generated based on the current emotion value, that is, if the user's current emotion is positive, such as like or happy, the reply emotion is positive, so as to achieve the purpose of continuing the recommendation; if the user's current emotion is negative, such as sad or anger, the reply emotion is comforting; the temporal model GRU is also used for decoding, as follows:

[0034] s t =GRU(s t-1 ,[x t ;e t ]) (4)

[0035] Among them, t represents the current round of dialogue, st-1 Indicates the previous state code of the decoder, x t Indicates the historical conversation encoding, e t Indicates the current emotion code; without interfering with knowledge output, generates dialogue responses that match the user's current emotions, thereby improving user experience.

[0036] Preferably, the step (4) first calls the prediction recommendation content model according to the user portrait to predict the final recommendation target sequence, and then calls the text emotion classification model to predict the emotion label value of the current input sentence. The predicted target sequence, historical dialogue information, knowledge graph, and emotion label are used as input, and are encoded and decoded through the recommendation-oriented emotion-based dialogue model to obtain the final dialogue response output.

[0037] Compared with the prior art, the present invention has the following obvious outstanding substantive features and significant advantages:

[0038] 1. The present invention can more effectively avoid potential invalid recommendations based on the user's preferences in the user portrait; the emotional factor is introduced at the decoder, which not only effectively solves the perception of user emotions in the dialogue recommendation system, but also adjusts the dialogue reply strategy according to the user's current emotional value;

[0039] 2. For the entire dialogue system, the present invention not only completes the knowledge output of recommended content, but also takes into account the user's emotions, which is of great significance for achieving the goal of making the dialogue system more human-like. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 This is the overall flow chart of the emotional dialogue method for recommendation.

[0041] Figure 2 It is a sentiment text classification model.

[0042] Figure 3 It is a convolutional neural network.

[0043] Figure 4 It is the historical dialogue emotion classification prediction result.

[0044] Figure 5 It is the field data after DuRecDial preprocessing.

[0045] Figure 6 are the sentiment text classification model parameters. DETAILED DESCRIPTION

[0046] The preferred embodiments of the present invention are described as follows in conjunction with the accompanying drawings:

[0047] Embodiment 1

[0048] An emotional dialogue method for recommendation, which generates dialogue replies that match the user's current emotions without interfering with the recommended content; the specific operation steps are as follows:

[0049] (1) Preprocessing of the dialogue dataset: By training the sentiment text classification model, the sentiment label values ​​of the historical dialogues and reply sentences in the dialogue dataset are predicted, and the sentiment prediction label results are retained in the dataset;

[0050] (2) Predictive recommendation content model training: Based on the recommended target sequence and historical conversation information in the dataset, the model trains and predicts whether the current target is completed and the next recommended target entity through the intervention of user preferences in the user profile on the final recommended target sequence, and obtains the final recommended target sequence;

[0051] (3) Emotional dialogue model training: Based on the Sequence-to-Sequence model, the knowledge module, recommendation target sequence module, historical dialogue module, current response module, etc. are used as encoders, and the emotion embedding module is added to the decoder for training. Without interfering with knowledge output, the user's emotions are captured and used to improve dialogue responses.

[0052] (4) Calling the emotional dialogue model for recommendation: By calling the above-mentioned training model, the final recommendation target sequence is first predicted based on the user portrait, and then the emotional label value of the current input sentence is predicted. The historical dialogue is added as the context input, and the final dialogue response output is obtained through Sequence-to-Sequence encoding and decoding.

[0053] The method of this embodiment more effectively avoids potential invalid recommendation content based on the user's preferences in the user portrait; the introduction of emotional factors at the decoder not only effectively solves the perception of user emotions in the dialogue recommendation system, but also can adjust the dialogue response strategy according to the user's current emotional value.

[0054] Embodiment 2

[0055] This embodiment is basically the same as the first embodiment, except that:

[0056] An emotional dialogue method for recommendation, which generates dialogue replies that match the user's current emotions without interfering with the recommended content; the specific operation steps are as follows:

[0057] (1) Preprocessing of dialogue dataset:

[0058] ) By cascading ERNIE and TextCNN modules, an emotional text classification network is constructed. The text classification training data set contains six types of emotional text corpora: like, sad, angry, disgust, happiness, and other null. The loss function of the text classification network model is the cross entropy between the predicted value and the true value:

[0059]

[0060] Where n is the number of samples, q is the number of output categories, is the real value vector y (i) The elements that are either 0 or 1 in is the predicted value vector The elements in are either 0 or 1; i represents the i-th sample; j represents the j-th classification category;

[0061] After training, the classification model is obtained and applied to Baidu's open source DuRecDial dataset. The historical conversations and corresponding replies in the dataset are used to predict emotions through the text classification network model to obtain the corresponding emotion prediction label value for each sentence. The prediction results are retained in the dataset. At the same time, the dataset retains historical conversations, current replies, knowledge graph information in the form of triples, recommended target sequences, and user portrait fields.

[0062] (2) Predictive recommendation content model training:

[0063] The step (2) constructs a recommendation target prediction network based on the recommendation target sequence and user portrait field in the DuRecDial dataset. The network includes two modules: a module for judging the completion of the current target and a module for predicting the next recommended entity. The network model used in the module for judging the completion of the current target is TextCNN, which takes the historical conversation and the current conversation progress as input and outputs the predicted probability of the current target completion:

[0064] P GC (l=1|X,g t-1 ) (2)

[0065] Among them, X represents the historical dialogue, t represents the current dialogue round, and g t-1 Indicates the dialogue goal of the previous sentence, P GC Indicates the probability of goal completion; if the probability value is less than 0.5, it means that it is not completed, and the previous dialogue goal is returned as the next round of dialogue goal; if the probability value is greater than 0.5, it means that the current dialogue goal has been completed, and then enter the next stage, that is, the next recommended goal prediction;

[0066] The module for predicting the next recommended entity uses a multi-classification network based on CNN. At the same time, according to the user's preferences in the user portrait, the corresponding Attention mechanism is added to the network. The recommended target corresponding to the user's preferences will be assigned a higher weight value. Through the intervention of the Attention on the final recommended target sequence, it trains and predicts whether the current target is completed, and predicts the target entity of the next conversation, and obtains the final recommended target sequence. Its probability model is written as:

[0067]

[0068] Among them, P is the user portrait, representing the user's likes and dislikes, X is the historical conversation, G is the original recommendation target, and g tp Recommend a target for the next candidate dialogue, P GP represents the predicted probability of the dialogue target, and t represents the current dialogue turn.

[0069] (3) Emotional dialogue model training:

[0070] Based on the Sequence-to-Sequence model and the historical dialogues, current replies, dialogue emotion labels, knowledge graphs, recommendation target sequences and other fields in the dataset, an emotional dialogue generation network for recommendation is constructed. The network includes: historical dialogue encoding module, knowledge encoding module, recommendation target encoding module, knowledge selection module and emotion embedding module. Among them, the historical dialogues and recommendation targets are encoded using the bidirectional GRU model respectively. The knowledge graph information and the current reply are used as input. The bidirectional GRU encoding method is used and the Attention mechanism is added to construct the knowledge selection module. The above modules are used as Encoders and concatenated to generate semantic encoding vectors. At the Decoder, the user's current emotion value is first predicted based on the historical dialogue, and then the corresponding reply emotion classification is generated based on the current emotion value. That is, if the user's current emotion is positive, such as like or happy, the reply emotion is positive to achieve the purpose of continuing recommendation; if the user's current emotion is negative, such as sad or anger, the reply emotion is comforting. The temporal model GRU is also used for decoding, as follows:

[0071] s t =GRU(s t-1 ,[x t ;e t ]) (4)

[0072] Among them, t represents the current round of dialogue, s t-1 Indicates the previous state code of the decoder, x t Indicates the historical conversation encoding, e tIndicates the current emotion code; without interfering with knowledge output, generates dialogue responses that match the user's current emotions, thereby improving user experience;

[0073] (4) Calling the emotional dialogue model for recommendation:

[0074] First, based on the user portrait, the prediction recommendation content model is called to predict the final recommendation target sequence. Then the text sentiment classification model is called to predict the sentiment label value of the current input sentence. The predicted target sequence, historical conversation information, knowledge graph, and sentiment label are used as input, and encoded and decoded through the recommendation-oriented emotional conversation model to obtain the final conversation response output.

[0075] This embodiment is an emotional dialogue method for recommendation, preprocessing of dialogue data set; training of prediction recommendation content model; based on Sequence-to-Sequence model, historical dialogue, recommendation target sequence, knowledge graph, current reply, etc. are used as input of Encoder, and encoded through bidirectional GRU model, and emotion embedding module is added to Decoder to obtain the user's current emotion from historical dialogue, and generate dialogue reply that meets the user's current emotion without interfering with knowledge output; emotional dialogue model for recommendation is called, and Sequence-to-Sequence encoding and decoding is used to obtain the final dialogue reply output. The method of this embodiment proves that the dialogue robot not only has the ability of single knowledge output or emotion output, but also can combine knowledge output with emotion output to make dialogue generation more human-like, thereby improving user experience. The method of this embodiment not only completes the knowledge output of recommended content, but also takes into account the user's emotions, which is of great significance for achieving the goal of making the dialogue system more human-like.

[0076] Embodiment 3

[0077] This embodiment is basically the same as the above embodiment, with the following features:

[0078] In this embodiment, the overall process is shown in Figure 1 The example of the emotional dialogue method for recommendation uses the DuRecDial dataset proposed by Baidu and expands the emotion field. First, the final recommendation target sequence is predicted from the recommendation target sequence and user portrait in the dataset, and then the recommendation target sequence, historical dialogue, emotion label, knowledge graph, etc. are used as input. By training the emotional dialogue network for recommendation, the final recommendation dialogue that conforms to the user's current emotion is obtained.

[0079] The data used in this example is: based on the DuRecDial dataset proposed by Baidu in 2020, sentiment prediction is performed on each sentence of historical dialogue and current reply, and then saved. The basic data mainly includes: the time and place of the dialogue, the recommended target sequence, the user portrait, the knowledge graph in the form of triples, historical dialogues, etc.

[0080] 1) Preprocessing of dialogue dataset:

[0081] By integrating ERNIE and TextCNN modules, an emotional text classification network is constructed. The text classification training corpus contains six types of emotional text corpus: like, sad, angry, disgust, happiness, and other (null). After training, a classification model is obtained. The historical conversations and corresponding replies in the DuRecDial dataset are predicted by the text classification network model to obtain the corresponding emotional prediction label for each sentence. The prediction results are retained in the dataset. At the same time, the dataset retains historical conversations, current replies, knowledge graph information in the form of triples, recommended target sequences, user portraits and other fields.

[0082] 2) Predictive recommendation content model training

[0083] Based on the recommended target sequence and user portrait fields in the dataset, a recommended target prediction network is constructed. The network consists of two modules: a module for judging the completion of the current target and a module for predicting the next recommended entity. The network model used in the module for judging the completion of the current target is TextCNN. It takes the historical conversation and the progress of the current conversation as input, and outputs the probability of predicting the completion of the current target. If it is less than 0.5, it means it is not completed, and if it is greater than 0.5, it means it is completed. The module for predicting the next recommended entity uses a multi-classification network based on CNN. At the same time, according to the user's preferences in the user portrait, the corresponding Attention mechanism is added to the network. The recommended targets corresponding to the user's preferences will be assigned higher weight values. Through the intervention of the Attention on the final recommended target sequence, it is trained and predicted whether the current target is completed, and the target entity of the next conversation is predicted to obtain the final recommended target sequence.

[0084] 3) Emotional dialogue model training

[0085] Based on the Sequence-to-Sequence model and the historical dialogues, current replies, dialogue emotion labels, knowledge graphs, and recommendation target sequences in the dataset, an emotional dialogue generation network for recommendation is constructed. The network includes: historical dialogue encoding module, knowledge encoding module, recommendation target encoding module, knowledge selection module, and emotion embedding module. The historical dialogues and recommendation targets are encoded using the bidirectional GRU model respectively. The knowledge graph information and the current reply are used as input. The knowledge selection module is constructed using the bidirectional GRU encoding method and the Attention mechanism. The above modules are used as encoders and concatenated to generate semantic encoding vectors. At the decoder, the user's current emotion value is first predicted based on the historical dialogues, and then the corresponding reply emotion classification is generated based on the current emotion value. That is, if the user's current emotion is positive, such as like or happy, the reply emotion is positive to achieve the purpose of continuing recommendation; if the user's current emotion is negative, such as sad or anger, the reply emotion is comforting. The temporal model GRU is also used for decoding, and the input is the semantic encoding vector, the word vector of the previous generated word, and the emotion classification encoding vector. Without interfering with knowledge output, generate conversation responses that match the user's current emotions, thereby improving user experience.

[0086] 4) Calling the emotional dialogue model for recommendation

[0087] First, based on the user portrait, the prediction recommendation content model is called to predict the final recommendation target sequence. Then the text sentiment classification model is called to predict the sentiment label value of the current input sentence. The predicted target sequence, historical conversation information, knowledge graph, and sentiment label are used as input, and encoded and decoded through the recommendation-oriented emotional conversation model to obtain the final conversation response output.

[0088] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. An emotional dialogue method for recommendation, which generates dialogue replies that match the user's current emotions without interfering with the recommended content; characterized in that: The specific steps are as follows: (1) Preprocessing of the dialogue dataset: By training the sentiment text classification model, the sentiment label values ​​of the historical dialogues and reply sentences in the dialogue dataset are predicted, and the sentiment prediction label results are retained in the dataset; (2) Predictive recommendation content model training: Based on the recommended target sequence and historical conversation information in the dataset, the model trains and predicts whether the current target is completed and the next recommended target entity through the intervention of user preferences in the user profile on the final recommended target sequence, and obtains the final recommended target sequence; (3) Emotional dialogue model training: Based on the Sequence-to-Sequence model, the knowledge module, recommendation target sequence module, historical dialogue module, and current response module are used as encoders, and the emotion embedding module is added to the decoder for training. Without interfering with knowledge output, the user's emotions are captured and used to improve dialogue responses. (4) Calling the emotional dialogue model for recommendation: By calling the above-mentioned training model, the final recommendation target sequence is first predicted based on the user portrait, and then the emotional label value of the current input sentence is predicted. The historical dialogue is added as the context input, and the final dialogue response output is obtained through Sequence-to-Sequence encoding and decoding.

2. The recommendation-oriented emotional dialogue method according to claim 1, characterized in that: In the step (1), an emotional text classification network is constructed by cascading the ERNIE and TextCNN modules. The text classification training data set contains six types of emotional text corpora, namely, like, sad, angry, disgust, happiness, and other null. The loss function of the text classification network model is to perform cross entropy between the predicted value and the true value: Where n is the number of samples, q is the number of output categories, is the real value vector y (i) The elements that are either 0 or 1 in is the predicted value vector The elements in are either 0 or 1; i represents the i-th sample; j represents the j-th classification category; After training, the classification model is obtained and applied to Baidu's open source DuRecDial dataset. The historical conversations and corresponding replies in the dataset are used to predict emotions through the text classification network model to obtain the corresponding emotion prediction label value for each sentence. The prediction results are retained in the dataset. At the same time, the dataset retains historical conversations, current replies, knowledge graph information in the form of triples, recommended target sequences, and user portrait fields.

3. The recommendation-oriented emotional dialogue method according to claim 1, characterized in that: The step (2) constructs a recommendation target prediction network based on the recommendation target sequence and user portrait field in the DuRecDial dataset. The network includes two modules: a module for judging the completion of the current target and a module for predicting the next recommended entity. The network model used in the module for judging the completion of the current target is TextCNN, which takes the historical conversation and the current conversation progress as input and outputs the predicted probability of the current target completion: P GC (l=1|X,g t-1 ) (2) Among them, X represents the historical dialogue, t represents the current dialogue round, and g t-1 Indicates the dialogue goal of the previous sentence, P GC Indicates the probability of goal completion; if the probability value is less than 0.5, it means that it is not completed, and the previous dialogue goal is returned as the next round of dialogue goal; if the probability value is greater than 0.5, it means that the current dialogue goal has been completed, and then enter the next stage, that is, the next recommended goal prediction; The module for predicting the next recommended entity uses a multi-classification network based on CNN. At the same time, according to the user's preferences in the user portrait, the corresponding Attention mechanism is added to the network. The recommended target corresponding to the user's preferences will be assigned a higher weight value. Through the intervention of the Attention on the final recommended target sequence, it trains and predicts whether the current target is completed, and predicts the target entity of the next conversation, and obtains the final recommended target sequence. Its probability model is written as: Among them, P is the user portrait, representing the user's likes and dislikes, X is the historical conversation, G is the original recommendation target, and g tp Recommend a target for the next candidate dialogue, P GP represents the predicted probability of the dialogue target, and t represents the current dialogue turn.

4. The recommendation-oriented emotional dialogue method according to claim 1, characterized in that: The step (3) constructs an emotional dialogue generation network for recommendation based on the Sequence-to-Sequence model and the historical dialogues, current replies, dialogue emotion labels, knowledge graphs, and recommendation target sequence fields in the dataset; the network includes: a historical dialogue encoding module, a knowledge encoding module, a recommendation target encoding module, a knowledge selection module, and an emotion embedding module; wherein the historical dialogues and recommendation targets are encoded using a bidirectional GRU model respectively, the knowledge graph information and the current reply are used as input, the bidirectional GRU encoding method is used and the Attention mechanism is added to construct a knowledge selection module, the above modules are used as Encoders, and concatenate operations are performed to generate semantic encoding vectors; at the Decoder, the user's current emotion value is first predicted based on the historical dialogues, and then the corresponding reply emotion classification is generated based on the current emotion value, that is, if the user's current emotion is positive, such as like or happy, then the reply emotion is positive, so as to achieve the purpose of continuing to recommend; if the user's current emotion is negative, such as sad or anger, then the reply emotion is comforting; the time series model GRU is also used for decoding, as follows: s t =GRU(s t-1 ,[x t ;and t ]) (4) Among them, t represents the current dialogue turn, s t-1 Indicates the previous state code of the decoder, x t Indicates the historical conversation encoding, e t Indicates the current emotion code; without interfering with knowledge output, generates dialogue responses that match the user's current emotions, thereby improving user experience.

5. The recommendation-oriented emotional dialogue method according to claim 1, characterized in that: The step (4) first calls the prediction recommendation content model based on the user portrait to predict the final recommendation target sequence, and then calls the text emotion classification model to predict the emotion label value of the current input sentence. The predicted target sequence, historical dialogue information, knowledge graph, and emotion label are used as input, and are encoded and decoded through the recommendation-oriented emotion-based dialogue model to obtain the final dialogue response output.