Method, device and equipment for realizing emotion reason pairing in dialogue based on multiple prompts, medium and product

By using a multi-prompt method in the dialogue emotional cause pairing task, marking and constructing the mark prompt representation and problem template of the dialogue text, combining synonyms sequences, and using the emotion prediction model to pair emotional causes, the problems of high distribution density and subtle semantic implication of emotional causes in the dialogue corpus are solved, and the accuracy and model performance of emotional cause pairing are improved.

CN119740585APending Publication Date: 2025-04-01ZHEJIANG GONGSHANG UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411803871.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-10
Publication Date
2025-04-01

AI Technical Summary

Technical Problem

The prior art has problems of error accumulation and insufficient model performance in dialogue emotional cause pairing tasks, especially when affective cause is large for distribution density and semantic implicit in dialogue corpus.

Method used

A multi-tip-based method is adopted to identify and mark cause clauses and emotional clauses in the dialogue text, mark prompt representations and problem templates are constructed, combined with synonyms sequences, and emotional prediction models are used to pair emotional causes.

Benefits of technology

The accuracy of emotional reasons pairing in dialogue tasks is improved, error propagation is avoided, rapid convergence and efficient learning are achieved, and model training parameters are reduced and performance indicators are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119740585A_ABST
    Figure CN119740585A_ABST
Patent Text Reader

Abstract

The invention discloses a method, a device, equipment, a medium and a product for realizing emotion reason pairing in dialogues based on multiple prompts, and relates to the technical field of natural language processing. According to the method, the mark prompt is obviously added in front of the emotion clause and the reason clause in the dialogue text, so that the model can be conveniently positioned and the semantic information of the context can be conveniently obtained. By constructing a problem template, the model is simply nonjudged according to the existing problem. And semantics are deepened through synonyms of various emotions, so that the model can make more accurate judgment. According to the method, rich semantic information is injected into the model in a multi-prompt mode, the problems that dialogue corpus semantic implication and emotional reason pair distribution density is large and the like are well solved, and the accuracy of emotional reason pairing in the dialogue task is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of natural language processing technology, and in particular to a method, apparatus, device, medium, and product for achieving emotion-cause pairing in a conversation based on multiple prompts. Background Art

[0002] With the rapid development of artificial intelligence and natural language processing technologies, sentiment analysis has been widely used in a variety of fields, including social media monitoring, market analysis, and customer feedback systems. By analyzing the emotional information contained in text data, it provides valuable insights for users. However, sentiment classification results only indicate the emotional tendencies of text, but fail to reveal the specific reasons behind these emotions. Identifying the underlying reasons behind emotions has been a research area that has attracted considerable attention in the field of sentiment analysis in recent years. With the widespread adoption of dialogue systems in various applications, such as intelligent customer service and virtual assistants, understanding user emotions and the underlying reasons is crucial for improving the interaction quality of dialogue systems.

[0003] The task of sentiment-cause pairing began in the document field. Early sentiment-cause pairing tasks adopted a two-step approach, first identifying sentiment clauses or reason clauses, and then identifying sentiment-cause pairs for the positive samples identified in the first step. However, this two-step structure has limitations because the error cannot be effectively propagated to the entire model, which will cause the accumulation of errors and affect the overall performance of the model. Subsequent work explored end-to-end models such as 2D Transformer, sliding window, and graph neural network. These end-to-end models can improve the ability to pair sentiment-cause in documents. In 2021, Pora et al. proposed a sentiment-cause pairing task in dialogues. Compared with document tasks, there are roughly three special features of sentiment-cause pairing tasks in dialogues. First, the subjects of dialogue tasks are diverse. Unlike the single-person narrative of documents, dialogues occur between at least two interlocutors, and interlocutor information needs to be incorporated into the modeling process to improve emotion recognition. Second, the emotional expression of dialogue tasks is more implicit. The corpus for document tasks explicitly expresses words like happy, sad, and angry, which deep learning models can more easily identify and categorize. However, emotions in conversation tasks require inference based on contextual semantics. Third, conversational corpus contains a higher density of emotion-related pairs.

[0004] According to statistics, in the ECPE-news dataset, which pairs sentiment-based cause pairs in documents, 89.77% of the texts have only one sentiment-based cause pair. In the ECPE-D dataset, which pairs sentiment-based cause pairs in conversations, only 0.8% of the texts have only one sentiment-based cause pair, while 97.5% of the texts have three or more sentiment-based cause pairs. This shows that extracting sentiment-based cause pairs in conversational data is more complex. End-to-end models such as 2D Transformer, sliding window, and graph neural networks fail to account for the specific characteristics of conversational data and therefore perform poorly for sentiment-based cause pairing in conversations. Summary of the Invention

[0005] The purpose of this application is to provide a method, device, equipment, medium and product for achieving emotion-cause pairing in dialogue based on multiple prompts, so as to improve the accuracy of emotion-cause pairing in dialogue tasks.

[0006] To achieve the above objectives, this application provides the following solutions.

[0007] In a first aspect, the present application provides a method for achieving emotional reason pairing in a conversation based on multiple prompts, comprising:

[0008] Identify reason clauses and sentiment clauses in the dialogue text, add marker prompts, and construct a marker prompt representation of the dialogue text;

[0009] Based on the question prompt template, construct the positive question representation and the reverse question representation of the dialogue text;

[0010] Construct synonym sequences based on sentiment categories;

[0011] Based on the tag hint representation and synonym sequence, the sentiment prediction model is used to obtain the sentiment prediction results;

[0012] Filling the positive question representation and the negative question representation based on the sentiment prediction result to obtain a complete positive question representation and a complete negative question representation;

[0013] Based on the complete positive question representation and the complete reverse question representation, the sentiment prediction model is used to obtain a sentiment-cause pairing result.

[0014] In a second aspect, the present application provides a device for implementing emotional reason pairing in a conversation based on multiple prompts, wherein the device for implementing emotional reason pairing in a conversation based on multiple prompts applies the above-mentioned method for implementing emotional reason pairing in a conversation based on multiple prompts, and the device for implementing emotional reason pairing in a conversation based on multiple prompts includes:

[0015] The tag prompt adding module is used to identify the reason clauses and emotion clauses in the dialogue text, add tag prompts, and construct the tag prompt representation of the dialogue text;

[0016] The template representation module is used to construct the positive question representation and the reverse question representation of the dialogue text based on the question prompt template;

[0017] Synonym sequence construction module, used to construct synonym sequences based on sentiment categories;

[0018] The sentiment prediction module is used to obtain sentiment prediction results based on the tag prompt representation and synonym sequence using the sentiment prediction model;

[0019] A filling module, configured to fill in the positive question representation and the negative question representation based on the sentiment prediction result to obtain a complete positive question representation and a complete negative question representation;

[0020] The emotion-cause pairing module is used to obtain the emotion-cause pairing result based on the complete positive question representation and the complete reverse question representation using the emotion prediction model.

[0021] In a third aspect, the present application provides a computer device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-mentioned method for pairing emotional reasons in a conversation based on multiple prompts.

[0022] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-mentioned method for matching emotional reasons in a conversation based on multiple prompts.

[0023] In a fifth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the above-mentioned method for pairing emotional reasons in a conversation based on multiple prompts.

[0024] According to the specific embodiments provided in this application, this application has the following technical effects.

[0025] The present application provides a method, apparatus, device, medium and product for achieving emotion-cause pairing in a conversation based on multiple prompts. The present application adds prominent marking prompts before the emotion clauses and reason clauses in the conversation text to facilitate model positioning and acquisition of semantic information of their context. By constructing a question template, the model can make simple yes or no judgments based on the existing questions. The semantics are deepened by synonyms of various emotions, allowing the model to make more accurate judgments. The present application injects rich semantic information into the model through multiple prompts, which better solves the problems of implicit semantics of the conversation material and high distribution density of emotion-cause pairs, and improves the accuracy of emotion-cause pairing in conversation tasks.

[0026] Through the joint learning of emotion category and emotion reason pairing, the model can avoid error propagation and achieve rapid convergence and efficient learning.

[0027] This application also fully integrates tag prompts and synonym prompts, as well as forward question semantic fusion features and reverse question semantic fusion features through the attention mechanism. Compared with existing methods, the method proposed in this application improves model performance indicators while reducing model training parameters.

[0028] In short, this application has good reference value and practical significance for exploring the reasons behind conversation emotions. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0030] Figure 1 A flowchart of a method for achieving emotional reason matching in a conversation based on multiple prompts provided in one embodiment of the present application;

[0031] Figure 2 An example diagram of a marking prompt provided in an embodiment of the present application;

[0032] Figure 3 A sample example diagram of a dialogue clause provided in an embodiment of the present application;

[0033] Figure 4 A schematic diagram of the structure of the emotion prediction model provided in one embodiment of the present application;

[0034] Figure 5 A flowchart of the training process of the emotion prediction model provided in one embodiment of the present application;

[0035] Figure 6A schematic diagram of the structure of a computer device provided in one embodiment of the present application. DETAILED DESCRIPTION

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

[0037] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.

[0038] In an exemplary embodiment, Figure 1 As shown, a method for achieving emotion-reason pairing in a conversation based on multiple prompts is provided, including the following steps 101 to 106.

[0039] Step 101: Identify the reason clause and the emotion clause in the dialogue text, add marker prompts, and construct a marker prompt representation of the dialogue text.

[0040] Step 102: construct a positive question representation and a negative question representation of the dialogue text based on the question prompt template.

[0041] Step 103: construct a synonym sequence based on the sentiment category.

[0042] Step 104 : Based on the tag prompt representation and the synonym sequence, a sentiment prediction model is used to obtain a sentiment prediction result.

[0043] Step 105 : Fill in the forward question representation and the reverse question representation based on the sentiment prediction result to obtain a complete forward question representation and a complete reverse question representation.

[0044] Step 106: Based on the complete forward question representation and the complete reverse question representation, the sentiment prediction model is used to obtain a sentiment-cause pairing result.

[0045] Implementing steps 101 to 106 above can improve the accuracy of emotion-cause pairing in the dialogue task.

[0046] Based on the above steps 101 to 106, it can be seen that in order to solve the problem of emotional reason pairing in dialogue materials, this application proposes a method for achieving emotional reason pairing in dialogue based on multiple prompts. Specifically, the prompt methods are divided into tag prompts, question prompts and synonym prompts. Figure 2As shown, tagging prompts prominently add the tags [EMO] and [CAU] before the emotion clause and reason clause to be judged, making it easier for the model to locate and obtain contextual semantic information. Question prompts construct question templates, allowing deep learning models to make simple yes-or-no judgments based on the given questions, similar to how humans perform passage comprehension. Synonym prompts use synonyms of various emotions to deepen the semantics when predicting the emotion category of the emotion clause to be judged, enabling the model to make more accurate judgments. This multi-prompt approach effectively enhances information related to emotional logic in conversations. Through example segmentation, it enables personalized identification of the numerous emotion-reason pairs in a conversation. This approach effectively addresses the aforementioned issues and has both practical and commercial value for the development of intelligent dialogue systems and conversational sentiment analysis systems.

[0047] In another exemplary embodiment, the above step 101 performs data processing and adds a tag prompt. For example, the original clause sample data is as follows Figure 3 As shown, there is only text information, and each group of candidate emotional reason clauses needs to be marked according to all possible situations. There are a total of, In this case, n represents the number of clauses in a text. Figure 3 For example, this sentence is both a sentiment clause and a cause clause. The model doesn't know the correct outcome before making a prediction. Therefore, we tag this sentence with both a cause and a sentiment tag, and also include the conversation turn and interlocutor information for subsequent model processing. After adding the tagging hints, the text becomes: "[CAU][EMO]Turn 1A: Hey, you wanna see a movie tomorrow?"

[0048] In another exemplary embodiment, the above step 102 constructs a question prompt template. For each candidate emotion-reason pair, different templates are constructed according to whether the emotion clause and the reason clause are the same clause. For a single sample, positive and negative questions are asked respectively. The so-called positive and negative refer to the difference in logical word order.

[0049] In another exemplary embodiment, in the above step 103, synonym prompts are constructed, and a synonym list is synthesized by combining the information of the synonym dictionary website Thesaurus, and a synonym prompt sequence is obtained by BERT model encoding for standby use. The encoding sequence is recorded as h syn .

[0050] In another exemplary embodiment, in the above steps 104 to 106, first, the encoding of the marking prompt and the question prompt is obtained. The Bert encoding module is used to input the text of the marking prompt and the forward and reverse question prompt into the Bert encoder to obtain the corresponding encoding vector, which is recorded as h tag 、hf and h b . Take [CLS] for semantic representation, denoted as and

[0051] Then, from h tag According to the position coding information, the position of the [EMO] mark is located and recorded as h emo Similarly, h can be obtained cau , standby. Then h is processed by the Attention mechanism emo and h syn The two sets of vectors interact and are output to the dimension of the number of emotional categories through the linear layer to classify the emotional attributes of the emotional clauses to be judged. If the reasoning process is completed, the prediction results are filled in <emotion>.

[0052] Then, the vector h cau and h emo Splice and then vector h cau and h emo Splicing, passing it through the self-attention mechanism and linear layer output to obtain the final pairing prediction result.

[0053] In another exemplary embodiment, a model is trained on a training set using a cross-entropy loss function to optimize network parameters. On a test set, predictions are made on samples to obtain sentiment and pairing predictions, for which metrics can be calculated separately. Specific metrics include precision, recall, and the F1 value. The F1 value serves as the core metric for evaluating model quality, and model performance is recorded and iterated repeatedly until optimality is achieved.

[0054] like Figure 4 As shown, the emotion prediction model includes: a first BERT encoding module, a second BERT encoding module, a third BERT encoding module, a first feature extraction module, a second feature extraction module, a third feature extraction module, a first splicing module, a second splicing module, a third splicing module, an emotion prediction module and an emotion reason pairing module; the first BERT encoding module is connected to the first feature extraction module, and the first BERT encoding module is used to encode the tag prompt representation to obtain the tag prompt representation encoding vector H tag The first feature extraction module is connected to the emotion prediction module and the first splicing module respectively, and the first feature extraction module is used to extract the cause tag vector h in the tag prompt representation encoding vector cau , sentiment label vector h emo and the marker hint [CLS] vector The emotion prediction module is used to compare the emotion tag vector with the emotion synonyms of different emotion categories in the synonym sequence to obtain the emotion prediction result; the first splicing module is connected to the second splicing module and the third splicing module respectively, and the first splicing module is used to splice the cause tag vector, the emotion tag vector and the tag prompt [CLS] vector to obtain the tag prompt splicing vector h fus The second BERT encoding module is connected to the second feature extraction module, and the second BERT encoding module is used to encode the complete positive question representation to obtain the positive question encoding vector h fq The second feature extraction module is connected to the second splicing module, and the second feature extraction module is used to extract the forward question [CLS] vector in the forward question code vector The second splicing module is connected to the emotion reason pairing module; the second splicing module is used to splice the tag prompt splicing vector with the positive question [CLS] vector to obtain the positive question splicing vector h fp The third BERT encoding module is connected to the third feature extraction module, and the third BERT encoding module is used to encode the complete reverse question representation to obtain the reverse question encoding vector h bq The third feature extraction module is connected to the third splicing module, and the third feature extraction module is used to extract the reverse question [CLS] vector in the reverse question coding vector The third splicing module is connected to the emotion reason pairing module; the third splicing module is used to splice the tag prompt splicing vector with the reverse question [CLS] vector to obtain the reverse question splicing vector h bp ; The emotion reason matching module is used to match emotion reasons based on the forward question splicing vector and the reverse question splicing vector to obtain the emotion reason matching result.

[0055] The emotion prediction module includes an attention mechanism layer, a first fully connected layer, and a first softmax activation function layer connected in sequence. emo contains a lot of semantic information about the context of the sentiment clause to be determined, which can be combined with the synonym sequence h syn After interaction through the Attention mechanism, the emotion probability prediction is obtained through the first fully connected layer. The process is as follows:

[0056] p emo =Softmax(FC(Attention(h emo ,h syn )))

[0057] Among them, p emo is the probability distribution of sentiment prediction results.

[0058] The emotional reason pairing module includes a self-attention mechanism layer, a second fully connected layer and a second softmax activation function layer connected in sequence. fp and h bp Through the self-attention mechanism and the linear layer (the second fully connected layer), the probability distribution of the pairing results is obtained. The process is as follows:

[0059] p pair =Softmax(FC(Self Attention(h fp ,h bp ))

[0060] Among them, p pair is the probability distribution of the pairing results.

[0061] like Figure 5 As shown in Figure 2, the training process of the above sentiment prediction model is as follows:

[0062] Step 201: In the dialogue emotion reason pairing dataset, the training process first splits the data into positive samples and negative samples, screens the negative samples according to a certain ratio, and represents the single sample as S = {U1, U2, ..., U m Since the conversation is conducted in real time, the reason clause only appears before the emotion clause, so m represents the position index of the emotion clause to be judged. Assume that in this sample, the index of the emotion clause to be judged is m, and the reason clause to be judged is 2. After data preprocessing, the sample is organized into S'={U1,[CAU]U2,…,[BMO]U m }.

[0063] Step 202: Construct a question prompt template, first distinguishing whether the emotion clause and the reason clause are the same clause. Formally, if they are not the same clause, the question sentence of the positive template is: <SPEAKER j >feels <emotion>and says <UTTERANCE j >because <SPEAKER i >said <UTTERANCE i >, the reverse template question sentence is: <SPEAKER i >said <UTTERANCE i >.It makes <SPEAKER j >feel <emotion>andsay <UTTERANCE j >. If the same clause, the positive template question sentence is: <speaker>feels <emotion>because <speaker>said <utterance>, the reverse template question sentence is: <speaker>said <utterance>.It makes <speaker>feel <emotion>,in, <speaker>Indicates the identity of the interlocutor, <emotion>Indicates the emotional words filled in. <utterance>Represents the clause text spoken by the interlocutor. The forward question is expressed as FQ = {w1,w2,…w k }, the reverse problem is expressed as BQ = {w1,w2,…w k }, k represents the maximum number of words in the question.

[0064] Step 203: Construct synonym prompts and encode them through the BERT encoder to obtain the synonym sequence h syn ={h1,h2,…h N }, N represents the emotion category. All synonyms of each emotion can be expressed as h n ={w1,w2,…w t }, t represents the number of preset synonyms, h n is the synonym sequence of the nth emotion.

[0065] Step 204: Obtain the encoding of the tag prompt and question prompt through the BERT encoder respectively. The tag prompt is encoded by BERT, and the output of its last hidden layer is expressed as:

[0066] h tag =BERT(S′)

[0067] The process of forward and reverse question prompts through BERT encoding is expressed as:

[0068] h fq =BERT(FQ)

[0069] h bq =BERT(BQ)

[0070] Take h respectively tag 、h fq and h bq The [CLS] vector is used as the overall semantic representation, denoted as and

[0071] Step 205: The positions of [EMO] and [CAU] in S' are recorded as emo_pos and cau_pos, respectively. tag Get the vector of the emo_pos position:

[0072]

[0073] Because h emo contains a lot of semantic information about the context of the sentiment clause to be determined, which can be combined with the synonym sequence h syn After interaction through the Attention mechanism, the emotion probability prediction is obtained through the fully connected layer. The process is as follows:

[0074] p emo =Softmax(FC(Attention(h emo ,h syn )))

[0075] Because during training <emotion>The source is real sample information, and the reasoning process <emotion>The position should be left blank, then you can emo Fill in the emotional words of the emotional category with the highest probability.

[0076] Step 206: Put h emo 、h cau and Splice into vector h fus , then h fus The process of splicing the positive and negative question prompts is as follows:

[0077]

[0078] h fp =[h fus ;h fq ]

[0079] h bp =[h fus ;h bq ]

[0080] After fusing these vector features, h fp and h bp Through the self-attention mechanism and linear layer, the probability distribution of the pairing results is obtained. The process is as follows:

[0081] p pair =Softmax(FC(SelfAttention(h fp ,h bp )))

[0082] Step 207: Compare the predicted results of the sentiment clause and the reason clause with the true labels, and calculate the loss between the predicted value and the true value using the cross entropy loss function:

[0083]

[0084] Subsequently, the calculation results of the two losses are added together to achieve joint learning.

[0085]

[0086] Step 208: The performance of the model in predicting sentiment categories and pairings is evaluated and analyzed using precision, recall, and F1 value. The formula for calculating the model indicators is as follows:

[0087] Precision = Number of correctly predicted results / Total number of predicted results Recall = Number of correctly predicted results / Total number of labels

[0088]

[0089] This application comprehensively considers the shortcomings of the two-step method and the traditional end-to-end model, and combines the particularity of the dialogue emotion-reason pairing task to propose a more efficient and convenient method based on multiple prompts. This application injects rich semantic information into the deep learning model in a multi-prompt manner, which effectively solves the problems of implicit semantics of dialogue materials and high distribution density of emotion-reason pairs. Through the joint learning of emotion categories and emotion-reason pairings, the model can avoid error propagation and achieve rapid convergence and efficient learning. This application also fully integrates labeling prompts and synonym prompts, forward question semantic fusion features and reverse question semantic fusion features through the attention mechanism. Compared with existing methods, the method proposed in this application is novel, which improves the model performance indicators while reducing the model training parameters. In short, this application has good reference value and practical significance for exploring the reasons behind the emotions of dialogues.

[0090] Based on the same inventive concept, an embodiment of the present application also provides a device for implementing the method for implementing the emotional reason pairing in a conversation based on multiple prompts. The solution to the problem provided by the device is similar to the solution described in the above method. Therefore, the specific limitations of one or more embodiments of the device for implementing the emotional reason pairing in a conversation based on multiple prompts provided below can be found in the above limitations of the method for implementing the emotional reason pairing in a conversation based on multiple prompts, and will not be repeated here.

[0091] In an exemplary embodiment, a device for implementing emotion-reason pairing in a conversation based on multiple prompts is provided, comprising:

[0092] The tag prompt adding module is used to identify the reason clauses and emotion clauses in the dialogue text, add tag prompts, and construct the tag prompt representation of the dialogue text.

[0093] The template representation module is used to construct the forward question representation and reverse question representation of the dialogue text based on the question prompt template.

[0094] The synonym sequence construction module is used to construct synonym sequences based on sentiment categories.

[0095] The sentiment prediction module is used to obtain sentiment prediction results based on the tag prompt representation and synonym sequence using the sentiment prediction model.

[0096] The filling module is used to fill in the positive question representation and the negative question representation based on the sentiment prediction result to obtain a complete positive question representation and a complete negative question representation.

[0097] The emotion-cause pairing module is used to obtain the emotion-cause pairing result based on the complete positive question representation and the complete reverse question representation using the emotion prediction model.

[0098] In an exemplary embodiment, a computer device is provided. The computer device may be a server or a terminal. The internal structure diagram thereof may be as follows: Figure 6 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O) and a communication interface. The processor, memory and input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a gallium oxide single crystal growth method or an automatic gallium oxide single crystal growth method based on active learning image recognition is realized.

[0099] Those skilled in the art will understand that Figure 6 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present application and does not constitute a limitation on the computer device to which the solution of the present application is applied. A specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement. In an exemplary embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps of the above-mentioned method embodiments when executing the computer program.

[0100] In an exemplary embodiment, a computer-readable storage medium is provided, storing a computer program. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0101] In an exemplary embodiment, a computer program product is provided, including a computer program. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0102] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0103] Those skilled in the art will understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0104] The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processors involved in the various embodiments provided herein may include, but are not limited to, general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic units, data processing logic units based on quantum computing, and the like.

[0105] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0106] This document uses specific examples to illustrate the principles and implementation methods of this application. The description of the above examples is only intended to help understand the method and core concept of this application. At the same time, for those skilled in the art, based on the concept of this application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.< / emotion> < / emotion> < / utterance> < / emotion> < / speaker> < / emotion> < / speaker> < / utterance> < / speaker> < / utterance> < / speaker> < / emotion> < / speaker> < / emotion> < / emotion> < / emotion>

Claims

1. A method for matching emotional reasons in a conversation based on multiple prompts, characterized in that: include: Identify reason clauses and sentiment clauses in the dialogue text, add marker prompts, and construct a marker prompt representation of the dialogue text; Based on the question prompt template, construct the positive question representation and reverse question representation of the dialogue text; Based on sentiment categories, construct synonym sequences; Based on the tag hint representation and synonym sequence, the sentiment prediction model is used to obtain the sentiment prediction results; Filling the positive question representation and the negative question representation based on the sentiment prediction result to obtain a complete positive question representation and a complete negative question representation; Based on the complete positive question representation and the complete reverse question representation, the sentiment prediction model is used to obtain a sentiment-cause pairing result.

2. The method for realizing emotional reason pairing in a conversation based on multiple prompts according to claim 1, characterized in that: The emotion prediction model comprises: a first BERT encoding module, a second BERT encoding module, a third BERT encoding module, a first feature extraction module, a second feature extraction module, a third feature extraction module, a first splicing module, a second splicing module, a third splicing module, an emotion prediction module and an emotion cause pairing module; The first BERT encoding module is connected to the first feature extraction module, and the first BERT encoding module is used to encode the mark prompt representation to obtain a mark prompt representation encoding vector; The first feature extraction module is connected to the emotion prediction module and the first splicing module respectively, and the first feature extraction module is used to extract the cause tag vector, the emotion tag vector and the tag prompt [CLS] vector in the tag prompt representation encoding vector; the emotion prediction module is used to compare the emotion synonyms of different emotion categories in the emotion tag vector and the synonym sequence to obtain the emotion prediction result; The first splicing module is connected to the second splicing module and the third splicing module respectively, and the first splicing module is used to splice the cause tag vector, the emotion tag vector and the tag prompt [CLS] vector to obtain the tag prompt splicing vector; The second BERT encoding module is connected to the second feature extraction module, and the second BERT encoding module is used to encode the complete positive question representation to obtain a positive question encoding vector; The second feature extraction module is connected to the second splicing module, and the second feature extraction module is used to extract the forward question [CLS] vector in the forward question encoding vector; The second splicing module is connected to the emotion reason pairing module; the second splicing module is used to splice the marking prompt splicing vector with the positive question [CLS] vector to obtain a positive question splicing vector; The third BERT encoding module is connected to the third feature extraction module, and the third BERT encoding module is used to encode the complete reverse question representation to obtain a reverse question encoding vector; The third feature extraction module is connected to the third splicing module, and the third feature extraction module is used to extract the reverse question [CLS] vector in the reverse question coding vector; The third splicing module is connected to the emotion reason pairing module; the third splicing module is used to splice the marking prompt splicing vector with the reverse question [CLS] vector to obtain a reverse question splicing vector; The emotion reason pairing module is used to pair emotion reasons based on the forward question splicing vector and the reverse question splicing vector to obtain an emotion reason pairing result.

3. The method for realizing emotional reason pairing in a conversation based on multiple prompts according to claim 2, characterized in that: The emotion prediction module includes an attention mechanism layer, a first fully connected layer and a first softmax activation function layer connected in sequence.

4. The method for realizing emotional reason pairing in a conversation based on multiple prompts according to claim 2, characterized in that: The emotion-cause pairing module includes a self-attention mechanism layer, a second fully connected layer, and a second softmax activation function layer connected in sequence.

5. The method for realizing emotional reason pairing in a conversation based on multiple prompts according to claim 1, characterized in that: The sentiment prediction model is obtained by training using the following loss function: in, represents the loss function, represents the sentiment prediction loss, Indicates the loss of pairing due to emotional reasons, represents the true emotion category of the i-th sample output by the emotion prediction model, represents the sentiment prediction result of the i-th sample, It represents the emotion reason pairing result of the i-th sample output by the emotion prediction model. represents the true emotion reason pairing result of the i-th sample, and |S| is the sample set.

6. The method for realizing emotional reason pairing in a conversation based on multiple prompts according to claim 5, characterized in that: After training the sentiment prediction model, it also includes: The performance of the sentiment prediction model was evaluated by precision, recall and F1 value.

7. A device for realizing emotional reason pairing in a conversation based on multiple prompts, characterized in that: The device for realizing emotional reason pairing in a conversation based on multiple prompts applies the method for realizing emotional reason pairing in a conversation based on multiple prompts according to any one of claims 1 to 6, and the device for realizing emotional reason pairing in a conversation based on multiple prompts includes: A marker prompt adding module is used to identify the cause clause and the emotion clause in the dialogue text, add marker prompts, and construct a marker prompt representation of the dialogue text; The template representation module is used to construct the positive question representation and the reverse question representation of the dialogue text based on the question prompt template; Synonym sequence construction module, used to construct synonym sequences based on sentiment categories; A sentiment prediction module is used to obtain sentiment prediction results based on the tag prompt representation and the synonym sequence using the sentiment prediction model; A filling module, used to fill in the positive question representation and the negative question representation based on the sentiment prediction result to obtain a complete positive question representation and a complete negative question representation; The emotion-cause pairing module is used to obtain the emotion-cause pairing result based on the complete positive question representation and the complete reverse question representation and using the emotion prediction model.

8. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method for pairing emotional reasons in a conversation based on multiple prompts as described in any one of claims 1-6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for achieving emotional reason pairing in a conversation based on multiple prompts as described in any one of claims 1-6 is implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method for achieving emotional reason pairing in a conversation based on multiple prompts as described in any one of claims 1-6 is implemented.