Dialogue scene-oriented aspect emotion tetrad prediction method and system
By combining dialogue line segmentation and sequence generation models with cloze prompt templates and beam search decoding strategies, the semantic discontinuity and implicit emotion recognition problems caused by the tree-like dialogue structure are solved, and the accuracy of quadruple extraction is improved, especially the performance on the DiaASQ dataset is significantly improved.
Patent Information
- Application Number
- CN202511133807.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-14
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2045-08-14
AI Technical Summary
When performing quadruple extraction tasks, existing technologies encounter semantic discontinuities caused by the tree-like dialogue structure, which leads to interference between information across dialogue lines. In addition, the discriminative grid sequence labeling scheme misses recognition due to the lack of processing of implicit emotions, resulting in insufficient accuracy in predicting quadruple.
A preset dialogue line segmentation algorithm is used to split the dialogue set and the semantic labels corresponding to the dialogue set according to different dialogue lines to generate a dialogue line set. The trained sequence generation model is then used to encode and decode the input sequence. The designed cloze prompt template is input into the model together with the dialogue line text, so that the model can associate the emotional elements into correct quadruplets in the context of the prompt.
It effectively alleviates the limitation of the model input text length and improves the accuracy of quadruple generation. Through the designed cloze prompt template and beam search decoding strategy, the overall performance of the model is improved, especially the F1 value on the DiaASQ dataset is improved by 1.88%.
Smart Images

Figure CN120653756A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of deep learning technology, and in particular to a method and system for predicting aspect emotion quadruple for dialogue scenarios. Background Art
[0002] Dialogue-level Aspect-based Sentiment Quadruple analysis task (DiaASQ) is an emerging task in the field of affective computing, which aims to extract all ( t , a , o , s )Emotional quadruple. Among them, ( t , a , o , s The four elements in the quaternary group are the target word (i.e., product), aspect word (i.e., a certain aspect or attribute of the product), opinion word (i.e., evaluation or attitude towards the product or product aspect), and sentiment polarity (i.e., sentiment tendency, with values of positive, negative, or other).
[0003] Existing techniques break down DiaASQ into multiple simple subtasks (such as word extraction, word pairing, and sentiment polarity classification), each of which is completed based on grid sequence annotation. To address the challenge of complex dialogue structures, existing techniques help models understand dialogue structure by masking the speaker, reply, and dialogue line, and by considering the relative position of tokens in the dialogue structure tree. Alternatively, they directly encode the entire dialogue in pre-trained models (PTMs); use two graph attention networks (GATs) to model the speaker and reply relationships separately; construct heterogeneous attention graphs containing speaker and reply relationships to understand discourse structure; or model speaker and reply information using graph convolutional networks (GCNs).
[0004] The above works model the discourse structure in different ways. Although they achieve good performance, they still have the following problems: (1) The discriminative grid sequence labeling scheme regards the label as a numerical index and ignores the semantic information of the label; (2) The implicit sentiment problem is not handled; (3) The information between dialogue lines interferes with each other: Although modeling the dialogue structure helps the model understand the dialogue text with incoherent semantic context, other dialogue line information may still interfere with it when extracting the quadruple within the dialogue line.
[0005] Therefore, based on the above background technology, when performing quadruple extraction tasks, the existing technology encounters the semantic discontinuity problem caused by the tree-like dialogue structure, which leads to interference between information across dialogue lines. In addition, the discriminative grid sequence labeling scheme misses recognition due to the failure to process implicit emotions, resulting in insufficient accuracy in predicting quadruple. Summary of the Invention
[0006] Based on this, it is necessary to provide an aspect emotion quadruple prediction method and system for dialogue scenarios to address the above technical problems.
[0007] This manual adopts the following technical solutions: This specification provides a method for predicting aspect emotion quadruple in a conversation scenario, including: A conversation set is obtained, where the conversation set includes at least two conversation lines.
[0008] A preset dialogue line segmentation algorithm is used to split the dialogue set and its corresponding semantic tags according to different dialogue lines to generate dialogue line sets; each dialogue line set includes the context text of each dialogue line and the tags of the context text; a cloze prompt template is constructed; the cloze prompt template and the concatenated text are connected via a delimiter to obtain an input sequence; the concatenated text is generated by concatenating the context text of each dialogue line using preset special tokens.
[0009] The input sequence is encoded and decoded using a trained sequence generation model to generate a target sequence; wherein the trained sequence generation model is obtained by training on a positive and negative four-tuple sample dataset.
[0010] The target sequence is converted into emotion quadruple to obtain a set of candidate quadruple. The candidate quadruple sets are merged to generate a set of emotion quadruple predicted at the dialogue level.
[0011] Preferably, the conversation set is obtained based on the conversation text; the conversation set includes a discourse set, a speaker set and a reply set; Among them, the first Utterances are used to indicate speakers Dialogue The dialogue line is composed of the speech data of the same question in the speech set arranged in order of response time; The semantic tag represents a predefined emotion polarity tag of the speech data included in the dialogue line; wherein the predefined emotion polarity tag includes positive emotion and negative emotion.
[0012] Preferably, the arrangement of the cloze prompt template is as follows: Target word placeholder + sentiment polarity placeholder + aspect word placeholder + opinion word placeholder + discriminant placeholder.
[0013] Preferably, before merging the candidate quadruple sets to generate the predicted emotion quadruple set at the dialogue level, the method further includes: Perform pruning operations through the discriminator to retain the correct quadruple in the candidate quadruple set; The candidate quadruple sets are merged to generate the predicted emotion quadruple set at the dialogue level, which includes: The correct quadruple predicted at the dialogue line level in the candidate quadruple set is merged according to the dialogue to which it belongs to generate a set of emotion quadruple predicted at the dialogue level.
[0014] Preferably, the pruning operation specifically includes: When two quadruple groups differ only in the discriminant, the quadruple group with a probability greater than a preset value is retained; When the discriminators of the two quadruple are both valid and there are overlapping words in the aspect words of the two quadruple, the path with the higher probability in the two quadruple is retained; When the discriminators of the two quadruple groups are both valid and there are overlapping words in the opinion words of the two quadruple groups, the path with the higher probability in the two quadruple groups is retained; Delete the quads that the discriminator determines to be invalid.
[0015] Preferably, the training method of the sequence generation model is: Get the quadruple dataset; The labeled emotion quadruple in the quadruple dataset is used as a positive sample, and the same type of emotion elements in multiple emotion quadruple in the same dialogue line are exchanged to generate the first type of negative samples; The sequence generation model is insufficiently trained using a four-tuple dataset. Sentiment four-tuples that the insufficiently trained sequence generation model judges to be correct but are actually incorrect are used as the second type of negative samples. Combined with the first type of negative samples, the sequence generation model is trained using a greedy strategy with the goal of generating a single four-tuple. During the model inference phase, beam search combined with a constrained decoding strategy is used for decoding to obtain a trained sequence generation model. The beam search has a beam search width greater than 1 and supports the simultaneous generation of all candidate four-tuples in a dialogue line.
[0016] Preferably, the loss function used when training the sequence generation model is for: ; in, Represents the total enhanced data set, which includes positive quadruple samples and two types of enhanced negative quadruple samples. Indicates a conversation line The average loss, Indicates a conversation line The corresponding set of four-tuple target sequences, Indicates a conversation line The input sequence, Indicates that the model is in the conversation line The set of generated sequences on .
[0017] This specification provides a conversation-based sentiment quadruple prediction system, including: The data acquisition module is used to acquire a conversation set, where the conversation set includes at least two conversation lines.
[0018] The data processing module is configured to use a preset dialogue line segmentation algorithm to split a dialogue set and its corresponding semantic tags according to different dialogue lines to generate dialogue line sets, wherein each dialogue line set includes the context text of each dialogue line and the tags of the context text; construct a cloze prompt template; and connect the cloze prompt template and the concatenated text via a delimiter to obtain an input sequence; wherein the concatenated text is generated by concatenating the context text of each dialogue line using preset special words.
[0019] The model application module is used to encode and decode the input sequence using the trained sequence generation model to generate the target sequence; wherein the trained sequence generation model is trained on the positive and negative four-tuple sample data set.
[0020] The data prediction module is used to convert the target sequence into emotion quadruple to obtain a set of candidate quadruple; the candidate quadruple sets are merged to generate a set of emotion quadruple predicted at the dialogue level.
[0021] This specification provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the above-mentioned aspect emotion quadruple prediction method for dialogue scenarios.
[0022] This specification provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the method for predicting aspect emotion quadruplets for dialogue scenarios is implemented.
[0023] At least one of the above technical solutions adopted in this specification can achieve the following beneficial effects: When performing quadruple extraction tasks, existing technologies encounter semantic discontinuities caused by the tree-like dialogue structure, which leads to interference between information across dialogue lines. In addition, the discriminative grid sequence labeling scheme misses recognition due to the lack of processing of implicit emotions, resulting in insufficient accuracy in predicting quadruple.
[0024] To address this issue, a pre-defined dialogue line segmentation algorithm is used to split the conversation set and its corresponding labels into different dialogue lines. This generates dialogue line sets, ensuring semantic context continuity and effectively alleviating the model's input text length limitations. A trained sequence generation model is used to encode and decode the input sequence. A designed cloze prompt template is fed into the model along with the dialogue line text, enabling the model to associate emotional elements into correct quadruple pairs within the context of the prompt, thereby improving the accuracy of generated quadruple pairs. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings: Figure 1 This is a flow chart of a method for predicting aspect emotion quadruple in a conversation scenario according to an embodiment of the present invention; Figure 2 This is an example diagram of a conversation-based aspect emotion quadruple extraction task according to an embodiment of the present invention; Figure 3 This is a diagram of the DTSG-DiaASQ model architecture according to an embodiment of the present invention; Figure 4 Schematic diagram of a conversation scenario-oriented aspect emotion quadruple prediction system according to an embodiment of the present invention; Figure 5 A schematic diagram of a computer device for implementing a method for predicting aspect emotion quadruple for dialogue scenarios according to an embodiment of the present invention. DETAILED DESCRIPTION
[0026] To make the purpose, technical solutions, and advantages of this specification more clear, the technical solutions of this application will be clearly and completely described below in conjunction with the specific embodiments of this specification and the corresponding drawings. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0027] Statistics from the public dataset of the DiaASQ task show that quads within pairs of lines account for as much as 95% of all quads. Therefore, this paper proposes a strategy for segmenting conversations into pairs of lines, i.e., based on conversation lines. The advantage of this segmentation approach is that it extracts quads based on conversation lines, without any interference between conversation lines.
[0028] The following describes in detail the technical solutions provided by various embodiments of the present application in conjunction with the accompanying drawings.
[0029] Figure 1 This is a flow chart of a method for predicting aspect emotion quadruple for dialogue scenarios in this specification, which specifically includes the following steps: S101: Acquire a conversation set, where the conversation set includes at least two conversation lines.
[0030] For example, an example of a conversation-based aspect sentiment quadruple extraction task may be: the utterance “iPhone7 Plus power consumption is high.” contains 1 ( t , a , o , s ) quadruple, target word t 、Aspect words a and opinion words o They are "iPhone 7 Plus", "power consumption" and "high", and their corresponding user sentiment tendencies s is "negative".
[0031] like Figure 2 As shown, Figure 2 This is an example diagram of the dialogue-based aspect sentiment quadruple extraction task. Figure 2 Middle, the upper left part is the dialogue D The upper right part is the tree-like dialogue structure obtained based on the reply relationship, and the bottom part is all the ( t , a , o , s )Emotional quadruple. Among them, the speech u i Indicates a user's speech. i is the sequence number of the discourse in the entire dialogue; dialogue line dt j Refers to the root node of the tree (that is, the root discourse u 1) The first derived j subtrees; Q k Indicates dialogue D Middle k Emotion quadruple ( t k , a k , o k , s k ).
[0032] For example, the DiaASQ task sets the dialogue D Expressed as D = , that is, dialogue D Including discourse collection u = , speakers gathered s = and reply collection r = .in u i ={ w 1,…, w m} indicates the first i A speech, a speaker s i Dialogue (i.e. r i utterances) of the reply, n is the total number of utterances in a conversation. The conversation-based aspect sentiment quadruple extraction task aims to predict the conversation set D All sentiment quadruples in: Q 1, Q 2,…, Q k ,….in, Q k =( t k , a k , o k , s k ) ; target word t k 、Aspect words a k and opinion words o k It's a dialogue D The text span in the text field, can be empty. s k It is a set of predefined sentiment polarity labels, including "positive", "negative" and "other" (referring to other emotions, including neutral, doubt and ambiguous).
[0033] The conversation set is obtained based on the conversation text; the conversation set includes the discourse set, the speaker set and the reply set; among them, the first Utterances are used to indicate speakers Dialogue ; a dialogue line represents the data consisting of discourse data in a discourse set that responds to the same question in chronological order according to the response time; a semantic label represents the predefined sentiment polarity label of the discourse data included in the dialogue line; wherein the predefined sentiment polarity label includes positive sentiment, negative sentiment, and other sentiments.
[0034] Based on this, in one or more embodiments of this specification, the execution entity can be a hardware device or system with the ability to collect, process and analyze text data, including a server, edge computing device, etc.
[0035] The server mentioned in this specification can be a server set up on a business platform, or a device such as a desktop computer or a laptop computer that can execute the solution of this specification. For the sake of convenience, the following description will only take the server as the execution subject.
[0036] S102: Using a preset dialogue line segmentation algorithm, the dialogue set and the semantic tags corresponding to the dialogue set are split according to different dialogue lines to generate dialogue line sets; wherein each dialogue line set includes the context text of each dialogue line and the tags of the context text.
[0037] For example, the preset dialogue thread segmentation algorithm may be a dialogue thread segmentation (DTS) algorithm. D and its label Y Split by different dialogue lines, and get lines of dialogue and their labels .
[0038] The pseudo code of the Dialogue Thread Segmentation (DTS) algorithm can be shown as Algorithm 1 below: Algorithm 1: DTS( D , Y ) Input: Dialogue D and its four-tuple label Y Output: A collection of dialogue lines and their labels
[0039] dt={dt j |j =0,1,…] / / dt j Structure and D Consistent, value is empty j =-1 / / Record conversation line ID chatgid2lid={-1:(-2, -1),} / / Element format: gid:( j,lid), where gid is the word in D The subscript in lid is dt j The initialization element "-1:(-2, -1)" is used to process Y Implicit sentiment elements (i.e. null elements, starting with -1) FOR( i in range(len( D . u 0 .split(' '))) chatgid2lid[ i ]=(-1,i) / / -1 flag u 0 Shared total_lens = len( D . u 0 .split(' ')) FOR( i in range(len( D . r ))) / / D . r For dialogue D Reply list IF( r i == 0) / / Reply u 0 means opening a new conversation line IF(len(dt j . u )!=0) / / Previous dt j dt.append(dt j ) j +=1 dt j . u .append( D . u 0 ) / / Dialogue line sharing u 0 dt j . s .append( D . s 0 ) dt_rid= -1 / / u 0There is no reply, so r 0 is -1 dt j . r .append( dt_rid ) cur_lens = len( D . u 0 .split(' ')) ELSE / / r i == -1 or other dt j . u .append( D . u i ) dt j . s .append( D . s i ) dt_rid+=1 / / Each word in the dialogue line replies to the previous one dt j . r .append(dt_rid) FOR(m in range(len( D . u i . split(' '))) chatgid2lid[m+totao_lens]=( j , m+cur_lens) cur_lens+=len( D . u i .split(' ')) total_lens+=len( D . u i . split(' ')) dt.append(dt j ) / / The last one dt j M =len(dt) / / At this time Empty list FOR(t_s, t_e, a_s, a_e, o_s, o_e, s , t , a , o in Y ) nts,nas,nos= [char2char[w] for w in [t_s, a_s, o_s]] nte, nae, noe = [char2char[w-1] for w in [t_e, a_e, o_e]] / / The index at the end of span should be -1 j =nts[0] IF(j==-1) / / u The quads in 0 belong to all dialogue lines FOR( in ) .append((nts, nte,nas, nae,nos, noe, s , t , a , o )) ELSE: .append((nts, nte,nas, nae,nos, noe, s , t , a , o )) RETURN zip(dt, ) / / Right now
[0040] S103: Constructing a cloze prompt template.
[0041] In this embodiment, the arrangement of the cloze prompt template is: target word placeholder + sentiment polarity placeholder + aspect word placeholder + opinion word placeholder + discriminant placeholder.
[0042] For example, the present invention can pre-construct a Dialogue Thread Segmentation-based Generative DiaASQ model (DTSG-DiaASQ). Through DTSG-DiaASQ, DiaASQ is modeled as a seq2path sequence generation task. By adding a cloze prompt template (i.e., prompt) containing 5 blank placeholders (i.e., 5 sentinel words, corresponding to 4 emotional elements and 1 discriminant element) to the input sequence, the generative PTM is guided to understand the cloze prompt template through the cloze prompt template. t 、 a 、 o 、 s The relationship between these four emotional elements is finally determined by the word element v Determine whether the four sentiment elements in the prompt form a valid quadruple. The DTSG-DiaASQ model uses an autoregressive approach to concurrently generate sentiment quadruple elements for all aspects of the dialogue line. It treats the prompt as a cloze test and the blank placeholders (i.e., sentinel tokens) as the items to be filled. Therefore, the cloze answer (i.e., the target sequence) consists of five blank placeholders and the specific values to be filled in.
[0043] And, record the prompt in the input sequence as T , its construction should follow the following principles: (1) The prompt should contain 5 blank placeholders, corresponding to 4 emotional elements and 1 discriminant element. The order of the placeholders corresponding to the 4 emotional elements in the prompt is fixed, and the discriminant element placeholder is placed last; (2) The prompt should construct a context for understanding the semantic relationship between the four emotional elements.
[0044] Optionally, the order of the placeholders corresponding to the four emotional elements in the prompt can also be adjusted.
[0045] S104: Connecting the cloze prompt template and the spliced text via a separator to obtain an input sequence; wherein the spliced text is generated by splicing the context text of each dialogue line using preset special words.
[0046] For example, the input sequence of the generative model in this embodiment is Z The format can be: T : X ".in, X For a dialogue line text sequence, by inserting preset special words between each utterance of the dialogue line <usep>Generate splicing.
[0047] Continue to refer Figure 2 ,by Figure 2 Middle dialogue line dt 1 For example, dt 1 . u ={ u 1, u 2, u 3} corresponding for" u 1 <usep> u 2 <usep> u 3 ", fill in the corresponding discourse text to get for "iPhone 7 Plus power consumption ishigh. <usep>Really? I don’t want to buy it. <usep>Buy it. Still very smooth.”。Take the prompt T It is " <t>< / t> is <s>< / s> <s>because is <o>< / o> ,whichis <v>< / v> ",but for" <t>< / t> is <s>< / s> <s>because < / s> <s> is <o> ,< / o> which is <v>< / v> :iPhone 7 Plus power consumption is high. <usep>Really? I don’twant to buy it. <usep>Buy it. Still very smooth.”
[0048] For example, each line of dialogue enters the sequence Z It can contain multiple quadruples, each quadruple corresponds to a target sequence. Z The corresponding target sequence set is recorded as Y .For example, Middle k quadruples =( , , ) corresponding to the target sequence ="< t > < s > < a > < o > < v > ”( When it is a positive sample The value is "true" otherwise, "false"). Note that the order of the five blank placeholders in the target sequence should be consistent with the order in which these five blank placeholders appear in prompt.
[0049] S105: Encode and decode the input sequence using the trained sequence generation model to generate a target sequence; wherein the trained sequence generation model is obtained by training on a positive and negative four-tuple sample dataset.
[0050] In this embodiment, the training method of the trained sequence generation model is: obtaining a four-tuple data set; taking the labeled emotion quadruple in the four-tuple data set as a positive sample, and exchanging the same type of emotion elements in multiple emotion quadruples in the same dialogue line to generate a first type of negative sample; using the four-tuple data set to insufficiently train the sequence generation model, and taking the emotion quadruple that the insufficiently trained sequence generation model judges to be correct but is actually wrong as a second type of negative sample, combined with the first type of negative sample, using a greedy strategy to train the sequence generation model with the goal of generating a single quadruple, and using a beam search combined with a constrained decoding strategy for decoding in the model inference stage to obtain a trained sequence generation model, the beam search width is greater than 1, and supports the one-time concurrent generation of all candidate quadruples in the dialogue line.
[0051] In this embodiment, the loss function of the trained sequence generation model is for: ; in, Represents the total enhanced data set, which includes positive quadruple samples and two types of enhanced negative quadruple samples. Indicates a conversation line The average loss, ,in, represents the loss of the masked sequence generation model, Represents the predicted target sequence When t The word unit generated before the time step, that is, ( , ,…, ), For each time step t The loss of generating tokens, represents the indicator function, when hour, is 1, otherwise, is 0, Indicates a conversation line The corresponding set of four-tuple target sequences, Indicates the collection The number of elements, Indicates a conversation line Middle The target sequence corresponding to the quadruple is Indicates a conversation line Input sequence, Indicates that the model is in the conversation line The set of generated sequences on , express The sequence corresponding to the k-th candidate quadruple in .
[0052] For example,< / usep> < / usep> Figure 3 As shown, Figure 3 This is the DTSG-DiaASQ model architecture diagram. Figure 3 In this embodiment, the labeled quadruple in the data set is directly used as the positive sample, and the corresponding v Set to "true", recorded as R p In order to construct the discriminant element v Negative sample set of "false" R n , used at the conversation level R 1 and R 2 Two negative sample generation methods are used for data enhancement, as follows: R 1: Swap the same emotional elements in multiple tuples contained in the same dialogue line as negative samples of the dialogue line. R Class 1 negative samples help the model prune quadruple groups with incorrect associations between sentiment elements.
[0053] R 2: Insufficiently train the model for a small number of epochs on the original training dataset, and then predict the quadruple of each dialogue line with a beam search decoding strategy, which will lead the model to predict the quadruple that is correct but not in the label (i.e., incorrectly predict v = "true" as the negative sample of the dialogue line. R The 2-category negative samples help the model prune incorrectly generated quadruplets.
[0054] Therefore, the negative sample set R q = R 1 ∪ R 2 , the total enhanced dataset is recorded as R = R p ∪ R q .
[0055] During model training, the seq2path (i.e., sequence generation model) model adopts a greedy strategy (i.e., the num_beams of the beam search is set to 1, which is equivalent to the ordinary seq2seq), treats each four-tuple target sequence as an independent target, and calculates the average loss at the dialogue line level.
[0056] Total dataset R is a A collection of . After data enhancement, the dialogue line dt j The corresponding set of four-tuple target sequences can be expressed as follows: ; in, Indicates combining The number of elements, which is equal to the dialogue line dt j The total number of quadruplets after data augmentation. Indicates the conversation line dt j Middle k The target sequence corresponding to the quadruple.
[0057] The target sequence corresponding to all positive and negative samples of the dialogue line dtj is included. However, the introduction of negative samples is intended to allow the generative model to judge whether the generated quadruple is correct by discriminating the word v, but it is not expected that the generative model will imitate the negative samples to generate. Therefore, the negative samples need to be masked when calculating the loss. The target output sequence is =( , ,…, ,…) as an example, if is a negative sample, that is The corresponding discriminant v value is "false", so the following masking scheme is used: ; if is a positive sample, that is If the discriminant word is "true", the loss of the entire target sequence is calculated directly, that is, no masking is required: ; Contains A four-tuple target sequence. For the dialogue line dt j ,predict The loss can be equivalent to the prediction The average loss of the target sequence of four tuples. Since the masked word does not participate in the loss calculation, that is, only The corresponding word unit participates in the calculation of loss. Therefore, we can get the dialogue line dt j Average loss with mask and the total dataset R The total loss is .
[0058] Optionally, during the generative model inference phase, beam search can be combined with constrained decoding. The beam search algorithm selects multiple alternatives for an input sequence according to conditional probability at each time step. Through beam search, the generative model outputs the previous solution with decreasing probability. k paths, where the probability value reflects the possibility that the corresponding path is valid.
[0059] The generative model applies a constrained decoding strategy during decoding, which means that the generated word can only be within the given candidate word, rather than searching the entire vocabulary space. The candidate word comes from either the input sequence x , or some additional tokens specific to the task dataset, such as the "NULL" token used to handle implicit aspect words and implicit opinion words, all tokens in the candidate aspect category set and sentiment polarity set, and the "true" and "false" tokens used to determine whether the tuple is valid.
[0060] Optionally, the generative model may be a part of DTSG-DiaASQ, and DTSG-DiaASQ may execute steps S103 to S107 , or the generative model may also execute steps S103 to S107 , which is not specifically limited here.
[0061] S106: Convert the target sequence into sentiment quadruple to obtain a set of candidate quadruple.
[0062] S107: Merge the candidate quadruple sets to generate a predicted emotion quadruple set at the dialogue level.
[0063] In this embodiment, before merging the candidate quadruple sets to generate the emotion quadruple set predicted at the dialogue level, the method also includes: performing a pruning operation through a discriminator to retain the correct quadruple in the candidate quadruple set; merging the candidate quadruple sets to generate the emotion quadruple set predicted at the dialogue level, specifically including: merging the correct quadruples predicted at the dialogue line level in the candidate quadruple set according to the dialogues to which they belong, to generate the emotion quadruple set predicted at the dialogue level.
[0064] In this embodiment, the pruning operation specifically includes: When two paths differ only in the discriminant, the sequence with the higher probability in the two paths is retained; When the discriminators of both paths are valid and there are overlapping words in the aspect words of the two paths, the path with the higher probability is retained; When the discriminators of both paths are valid and there are overlapping words in the opinion words of the two paths, the path with the higher probability is retained; Delete the path that the discriminator determines to be invalid.
[0065] For example, the pruning strategy is mainly used to filter the quads corresponding to invalid paths. First, delete some "overlapping" predictions: ① If the beam search returns both " <t> t <s>s a <o> o <v> true< / v> < / o> < / s> < / t> <s> "and" <t> t <s>s< / s> < / t> <s> a <o> o <v>< / v> < / o> < / s> <s> false ", at this time, retain the sequence with higher probability; ② If the beam search returns" <t> t <s>s< / s> < / t> <s> a < / s> <s> i <o> o <v> true< / v> < / o> "and" <t> t <s>s< / s> < / t> <s> a < / s> <s> j <o> o <v> true< / v> < / o> ", among which aspect words a i and a j If there are overlapping words, the sequence with higher probability is also retained; ③ If the beam search returns " <t> t <s>s< / s> < / t> <s> a <o> o< / o> < / s> <s> i <v> true< / v> "and" <t> t <s>s< / s> < / t> <s> a <o> o< / o> < / s> <s> j <v> true< / v> ", where opinion words o i and o j If there are overlapping words, the sequence with higher probability is also retained. Then, delete v i = "false" path, retain v i = The path of "true" is taken as the final effective prediction path. Finally, the corresponding emotional elements in the effective path are extracted to obtain the predicted aspect emotion quadruple ( t, s, a, o ).
[0066] Merging the sentiment quadruple in the candidate quadruple set can be performed by merging the prediction results (correct quadruple) of all dialogue lines in the same dialogue to obtain the prediction result of the dialogue.
[0067] based on Figure 1 The proposed method for predicting aspect-sentiment quadruples for conversational scenarios groups conversation text and its labels by different lines of dialogue, addressing the problem of inconsistent semantic context within the text. This approach, for the first time, provides a feasible generative solution for the DiaASQ task. This solution leverages label semantics and processes implicit sentiment, providing valuable insights for subsequent research.
[0068] The generative model DTSG-DiaASQ proposed in this paper effectively utilizes the semantic relationship between emotional elements and the shared features of emotional elements by combining the designed cloze-style prompt with the beam search decoding strategy, thereby improving the overall performance of the model.
[0069] Extensive experiments on the DiaASQ dataset validated the effectiveness of the generative modeling approach using the proposed model, DTSG-DiaASQ. On the DiaASQ English dataset, the model achieved a 1.88% improvement in F1 over the best baseline model. Ablation experiments further demonstrated the effectiveness of strategies such as line grouping and beam search decoding on the DiaASQ dataset.
[0070] When applying the aspect emotion quadruple prediction method for dialogue scenarios provided in this specification, it is not necessary to Figure 1 The steps are executed in the order shown. The specific execution order of the steps can be determined according to needs and this manual does not limit this.
[0071] The above is a method for predicting aspect emotion quadruple for dialogue scenarios provided by one or more embodiments of this specification. Based on the same idea, this specification also provides a corresponding aspect emotion quadruple prediction system for dialogue scenarios, such as Figure 4 shown.
[0072] Figure 4 A schematic diagram of a conversation-based aspect emotion quadruple prediction system provided in this specification includes: A data acquisition module, configured to acquire a conversation set, wherein the conversation set includes at least two conversation lines; The data processing module is configured to use a preset dialogue line segmentation algorithm to split the dialogue set and its corresponding semantic tags into different dialogue lines to generate dialogue line sets, wherein each dialogue line set includes the context text of each dialogue line and the tags of the context text; construct a cloze prompt template; and connect the cloze prompt template and the concatenated text via a delimiter to obtain an input sequence; wherein the concatenated text is generated by concatenating the context text of each dialogue line using preset special tokens; The model application module is used to encode and decode the input sequence using the trained sequence generation model to generate the target sequence; wherein the trained sequence generation model is trained on a positive and negative four-tuple sample dataset; The data prediction module is used to convert the target sequence into emotion quadruple to obtain a set of candidate quadruple; the candidate quadruple sets are merged to generate a set of emotion quadruple predicted at the dialogue level.
[0073] Regarding the specific limitations of the aspect emotion quadruple prediction system for dialogue scenarios, please refer to the limitations of the aspect emotion quadruple prediction method for dialogue scenarios above, which will not be repeated here. The various modules in the above-mentioned aspect emotion quadruple prediction system for dialogue scenarios can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0074] This specification also provides a computer-readable storage medium, which stores a computer program that can be used to execute the above Figure 1 The proposed aspect emotion quadruple prediction method for dialogue scenarios.
[0075] This manual also provides Figure 5 The structural diagram of the computer equipment shown in FIG. Figure 5 As shown in the figure, at the hardware level, the computer device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory. Of course, it may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to achieve the above Figure 1 The proposed aspect emotion quadruple prediction method for dialogue scenarios.
[0076] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the above-described method embodiments. Any reference to memory, storage, database, or other media used in the embodiments provided herein 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, or optical storage. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0077] 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.< / s> < / s> < / s> < / s> < / s> < / s> < / s> < / s> < / usep> < / usep> < / usep> < / usep> < / usep>
Claims
1. A method for predicting aspect emotion quadruple in dialogue scenarios, characterized by: The method comprises: Obtaining a dialogue set, the dialogue set including at least two dialogue lines; Using a preset dialogue line segmentation algorithm, the dialogue set and the semantic labels corresponding to the dialogue set are split according to different dialogue lines to generate dialogue line sets; wherein each dialogue line set includes the context text and the label of the context text of each dialogue line; Construct a cloze prompt template; Connect the cloze prompt template and the spliced text via a separator to obtain an input sequence; wherein the spliced text is generated by splicing the context text of each dialogue line using a preset special word unit; Use the trained sequence generation model to encode and decode the input sequence to generate the target sequence; the trained sequence generation model is trained on a dataset of positive and negative quadruple samples; Convert the target sequence into sentiment quadruple and obtain a set of candidate quadruple; The candidate quadruple sets are merged to generate the predicted emotion quadruple set at the dialogue level.
2. The method for predicting aspect emotion quadruple based on dialogue scenarios according to claim 1, wherein: The conversation set is obtained based on the conversation text; the conversation set includes a discourse set, a speaker set and a reply set; Among them, the first Utterances are used to indicate speakers Dialogue The dialogue line is composed of the speech data of the same question in the speech set arranged in order of response time; The semantic tag represents a predefined emotion polarity tag of the speech data included in the dialogue line; wherein the predefined emotion polarity tag includes positive emotion and negative emotion.
3. The method for predicting aspect emotion quadruple based on dialogue scenarios according to claim 1, wherein: The arrangement of the cloze prompt template is as follows: Target word placeholder + sentiment polarity placeholder + aspect word placeholder + opinion word placeholder + discriminant placeholder.
4. The method for predicting aspect emotion quadruple based on dialogue scenarios as claimed in claim 3, characterized in that: Before merging the candidate quadruple sets to generate the predicted emotion quadruple set at the dialogue level, the method further includes: Perform pruning operations through the discriminator to retain the correct quadruple in the candidate quadruple set; The candidate quadruple sets are merged to generate the predicted emotion quadruple set at the dialogue level, which includes: The correct quadruple predicted at the dialogue line level in the candidate quadruple set is merged according to the dialogue to which it belongs to generate a set of emotion quadruple predicted at the dialogue level.
5. The method for predicting aspect emotion quadruple based on dialogue scenarios according to claim 4, wherein: The pruning operation specifically includes: When two quadruple groups differ only in the discriminant, the quadruple group with a probability greater than a preset value is retained; When the discriminators of the two quadruple are both valid and there are overlapping words in the aspect words of the two quadruple, the path with the higher probability in the two quadruple is retained; When the discriminators of the two quadruple groups are both valid and there are overlapping words in the opinion words of the two quadruple groups, the path with the higher probability in the two quadruple groups is retained; Delete the quads that the discriminator determines to be invalid.
6. The method for predicting aspect emotion quadruple based on dialogue scenarios according to claim 1, wherein: The training method of the sequence generation model is: Get the quadruple dataset; The labeled emotion quadruple in the quadruple dataset is used as a positive sample, and the same type of emotion elements in multiple emotion quadruple in the same dialogue line are exchanged to generate the first type of negative samples; The sequence generation model is insufficiently trained using a four-tuple dataset. Sentiment four-tuples that the insufficiently trained sequence generation model judges to be correct but are actually incorrect are used as the second type of negative samples. Combined with the first type of negative samples, the sequence generation model is trained using a greedy strategy with the goal of generating a single four-tuple. During the model inference phase, beam search combined with a constrained decoding strategy is used for decoding to obtain a trained sequence generation model. The beam search has a beam search width greater than 1 and supports the simultaneous generation of all candidate four-tuples in a dialogue line.
7. The method for predicting aspect emotion quadruple based on dialogue scenarios according to claim 6, wherein: The loss function used when training the sequence generation model for: ; in, Represents the total enhanced data set, which includes positive quadruple samples and two types of enhanced negative quadruple samples. Indicates a conversation line The average loss, Indicates a conversation line The corresponding set of four-tuple target sequences, Indicates a conversation line The input sequence, Indicates that the model is in the conversation line The set of generated sequences on .
8. A dialogue scene-oriented aspect emotion quadruple prediction system, characterized by: include: A data acquisition module, configured to acquire a conversation set, wherein the conversation set includes at least two conversation lines; The data processing module is configured to use a preset dialogue line segmentation algorithm to split the dialogue set and its corresponding semantic tags into different dialogue lines to generate dialogue line sets, wherein each dialogue line set includes the context text of each dialogue line and the tags of the context text; construct a cloze prompt template; and connect the cloze prompt template and the concatenated text via a delimiter to obtain an input sequence; wherein the concatenated text is generated by concatenating the context text of each dialogue line using preset special tokens; The model application module is used to encode and decode the input sequence using the trained sequence generation model to generate the target sequence; wherein the trained sequence generation model is trained on a positive and negative four-tuple sample dataset; The data prediction module is used to convert the target sequence into emotion quadruple to obtain a set of candidate quadruple; the candidate quadruple sets are merged to generate a set of emotion quadruple predicted at the dialogue level.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory, wherein: The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is loaded into a processor, it is capable of executing the steps of the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Dialogue-based emotion adjustment method and system
CN110706785A
Dialogue emotion recognition network model based on double knowledge interaction and multi-task learning, construction method, electronic equipment and storage medium
CN113535957A
Construction method of unified generation framework for aspect-level sentiment analysis
CN115455976A
Aspect emotion tetrad prediction method and system
CN116562305A
Multi-turn dialogue emotion quadruple extraction method using large language model reasoning
CN118982030A