An aspect sentiment quadruple prediction method and system for a dialogue scene

By combining dialogue line segmentation and sequence generation models with cloze test prompt templates, this method solves the semantic fragmentation and implicit sentiment problems in the quadruple extraction task in existing technologies, and improves the prediction accuracy of quadruples in dialogue scenarios.

CN120653756BActive Publication Date: 2025-12-23JIANGXI UNIVERSITY OF FINANCE AND ECONOMICS
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202511133807.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-14
Publication Date
2025-12-23
Estimated Expiration
2045-08-14

AI Technical Summary

Technical Problem

Existing technologies suffer from semantic breaks caused by tree-like dialogue structures when performing quadruplet extraction tasks. This leads to mutual interference of information across dialogue lines, and discriminative grid sequence labeling schemes fail to identify implicit sentiments, resulting in insufficient accuracy in predicting quadruplets.

Method used

A pre-defined dialogue line segmentation algorithm is used to split the dialogue set and its corresponding labels according to different dialogue lines to generate a dialogue line set. A trained sequence generation model is used to encode and decode the input sequence. The designed cloze test prompt template is input into the model along with the dialogue line text, so that the model can associate the emotional elements into the correct quadruples in the context of the prompt.

Benefits of technology

It effectively alleviates the limitation of input text length in the model, improves the accuracy of quadruple generation, solves the semantic fragmentation problem, handles implicit sentiment, and improves prediction accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120653756B_ABST
    Figure CN120653756B_ABST
Patent Text Reader

Abstract

The application discloses a kind of aspect sentiment quadruple prediction methods and systems for dialogue scene, it is related to deep learning technical field.The method includes: obtaining dialogue set;Using the preset dialogue line segmentation algorithm, dialogue set and the semantic label corresponding to dialogue set are split according to different dialogue lines, generate dialogue line set;Constitute completion gap prompt template;The completion gap prompt template and splicing text are connected by separator, obtain input sequence;Using the sequence generation model trained to encode and decode input sequence, generate target sequence;Target sequence is converted into sentiment quadruple, obtain candidate quadruple set;Candidate quadruple set is merged, and the sentiment quadruple set predicted on dialogue level is generated.The application can guarantee the context continuity of dialogue text semantics, effectively alleviate the length limit of model input text, improve the accuracy of generating quadruple.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of deep learning technology, and in particular to an aspect sentiment quadruple prediction method and system for dialogue scenarios. Background Technology

[0002] The Dialogue-level Aspect-based Sentiment Quadruple Analysis (DIASQ) task is an emerging task in the field of sentiment computing, aiming to extract all aspects of sentiment quadruples from dialogue text. t , a , o , s The emotional quadruple. Among them, ( t , a , o , s The four elements in the quadruple are the target word (i.e., the product), the aspect word (i.e., a certain aspect or attribute of the product), the opinion word (i.e., the evaluation or attitude towards the product or aspects of the product), and the sentiment polarity (i.e., the sentiment tendency, which takes the value of positive, negative, or other).

[0003] In existing technologies, DiaASQ is decomposed into multiple simple sub-tasks (such as word extraction, word matching, and sentiment polarity classification), and each sub-task is completed based on grid sequence labeling. To address the challenge of complex dialogue structures, existing technologies help the model understand the dialogue structure by masking the speaker, response, and dialogue lines, and considering the relative position information of words in the dialogue structure tree; or by directly encoding the entire dialogue in the pre-trained model (PTM) layer; or by using two graph attention network (GAT) modules to model the speaker and response relationships separately; or by constructing heterogeneous attention maps containing speaker and response relationships to understand the discourse structure; or by modeling speaker and response information based on a graph convolutional network (GCN).

[0004] The above works model discourse structure in different ways. Although they have achieved good performance, they still have the following problems: (1) The discriminative grid sequence labeling scheme treats the labels as numerical indices and ignores the semantic information of the labels; (2) Implicit sentiment issues are not addressed; (3) Information between dialogue lines interferes with each other: Although modeling the dialogue structure helps the model understand the dialogue text with inconsistent semantic context, when extracting the quadruplets in the dialogue line, information from other dialogue lines may still interfere with it.

[0005] Therefore, based on the above background technology, the existing technology has problems with semantic breaks caused by the tree-like dialogue structure when performing the quadruplet extraction task. This leads to mutual interference of information across dialogue lines, and the discriminative grid sequence labeling scheme fails to identify implicit sentiments, resulting in insufficient accuracy in predicting quadruplets. Summary of the Invention

[0006] Therefore, it is necessary to provide a method and system for aspect sentiment quadruple prediction in dialogue scenarios to address the aforementioned technical problems.

[0007] The following technical solution is adopted in this specification:

[0008] This specification provides an aspect sentiment quadruple prediction method for dialogue scenarios, including:

[0009] Obtain a set of dialogues, which includes at least two dialogue lines.

[0010] The dialogue set and its corresponding semantic tags are split into different dialogue lines using a preset dialogue line segmentation algorithm to generate a dialogue line set. Each dialogue line set includes the context text and its tag for each dialogue line. A cloze test prompt template is constructed. The cloze test prompt template and the concatenated text are connected by a delimiter to obtain the input sequence. The concatenated text is generated by concatenating the context text of each dialogue line using preset special words.

[0011] The input sequence is encoded and decoded using a trained sequence generation model to generate the target sequence; the trained sequence generation model is obtained by training on a dataset of positive and negative quadruples.

[0012] The target sequence is transformed into sentiment quadruples to obtain a set of candidate quadruples; the candidate quadruples are then merged to generate a set of sentiment quadruples predicted at the dialogue level.

[0013] Preferably, the dialogue set is obtained based on the dialogue text; the dialogue set includes a utterance set, a speaker set, and a response set;

[0014] Among them, the first in the discourse set This phrase is used to indicate the speaker. Dialogue The response; the dialogue line is data composed of discourse data on the same question arranged in chronological order of response time in the discourse set;

[0015] Semantic labels represent predefined sentiment polarity labels for the discourse data included in the dialogue line; among them, predefined sentiment polarity labels include positive sentiment and negative sentiment.

[0016] Preferably, the arrangement of the cloze test prompt template is as follows:

[0017] Target word placeholder + sentiment polarity placeholder + aspect word placeholder + opinion word placeholder + discriminant placeholder.

[0018] Preferably, before merging the candidate quadruple set to generate the dialogue-level predicted sentiment quadruple set, the method further includes:

[0019] Pruning is performed using the discriminant to retain the correct quadruplets from the candidate quadruplet set;

[0020] The candidate quadruple sets are merged to generate a set of sentiment quadruples predicted at the dialogue level, specifically including:

[0021] The correctly predicted quadruples at the dialogue level in the candidate quadruples set are merged according to their respective dialogues to generate a set of predicted sentiment quadruples at the dialogue level.

[0022] Preferably, the pruning operation specifically includes:

[0023] When two quadruples differ only in their discriminants, retain the quadruple with a probability greater than a preset value.

[0024] If both discriminants of the two quadruples are valid and there are overlapping words in the aspect terms of the two quadruples, retain the path with the higher probability between the two quadruples.

[0025] If both discriminants of the two quadruples are valid and there are overlapping words in the opinion terms of the two quadruples, retain the path with the higher probability between the two quadruples.

[0026] Delete the quadruple that the discriminant determines is invalid.

[0027] Preferably, the training method for the sequence generation model is as follows:

[0028] Obtain the quadruple dataset;

[0029] The labeled sentiment quadruples in the quadruple dataset are used as positive samples, and the sentiment elements of the same type in multiple sentiment quadruples in the same dialogue line are interchanged to generate the first type of negative samples.

[0030] The sequence generation model is undertrained using a quadruple dataset. Sentiment quadruples that the undertrained sequence generation model judges as 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 quadruple. During the model inference stage, a bundle search combined with a constrained decoding strategy is used for decoding to obtain the trained sequence generation model. The bundle search width is greater than 1 and supports generating all candidate quadruples in the dialogue line at once.

[0031] Preferably, the loss function used when training the sequence generation model is... for:

[0032] ;

[0033] in, This represents the augmented total dataset, containing positive quadruplets and two classes of augmented negative quadruplets. Indicates dialogue line The average loss, Indicates dialogue line The corresponding set of target sequences of quadruplets, Indicates dialogue line The input sequence, The model represents the dialogue line. The set of generated sequences on.

[0034] This specification provides an aspect sentiment quadruple prediction system for dialogue scenarios, including:

[0035] The data acquisition module is used to acquire a set of dialogues, which includes at least two dialogue lines.

[0036] The data processing module is used to split the dialogue set and its corresponding semantic tags into different dialogue lines using a preset dialogue line segmentation algorithm, generating a dialogue line set. Each dialogue line set includes the context text and its tag for each dialogue line. The module also constructs a cloze test prompt template and connects the cloze test prompt template and the concatenated text using a delimiter to obtain the input sequence. The concatenated text is generated by concatenating the context text of each dialogue line using preset special words.

[0037] 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 obtained by training on the positive and negative quadruples sample dataset.

[0038] The data prediction module is used to transform the target sequence into sentiment quadruples to obtain a set of candidate quadruples; the set of candidate quadruples is then merged to generate a set of sentiment quadruples predicted at the dialogue level.

[0039] This specification provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the aforementioned aspect sentiment quadruple prediction method for dialogue scenarios.

[0040] 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, it implements the aforementioned aspect sentiment quadruple prediction method for dialogue scenarios.

[0041] The above-mentioned technical solutions adopted in this specification can achieve the following beneficial effects:

[0042] Existing technologies suffer from semantic breaks caused by tree-like dialogue structures when performing quadruplet extraction tasks. This leads to mutual interference of information across dialogue lines, and discriminative grid sequence labeling schemes fail to identify implicit sentiments, resulting in insufficient accuracy in predicting quadruplets.

[0043] To address the aforementioned issues, a pre-defined dialogue line segmentation algorithm is used to split the dialogue set and its corresponding labels according to different dialogue lines, generating a dialogue line set. This ensures semantic continuity of the text and effectively alleviates the limitation of the model's input text length. A trained sequence generation model is used to encode and decode the input sequence. The designed cloze test prompt template is input into the model along with the dialogue line text, enabling the model to associate sentiment elements with the correct four-tuples within the context of the prompts, thereby improving the accuracy of four-tuple generation. Attached Figure Description

[0044] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0045] Figure 1 This is a schematic diagram of an aspect sentiment quadruple prediction method for dialogue scenarios according to an embodiment of the present invention.

[0046] Figure 2 This is an example diagram of a dialogue-based aspect sentiment quadruple extraction task according to an embodiment of the present invention.

[0047] Figure 3 This is a diagram of the DTSG-DiaASQ model architecture according to an embodiment of the present invention;

[0048] Figure 4 This is a schematic diagram of an aspect sentiment quadruple prediction system for dialogue scenarios according to an embodiment of the present invention;

[0049] Figure 5 This is a schematic diagram of a computer device for implementing an aspect sentiment quadruple prediction method for dialogue scenarios, according to an embodiment of the present invention. Detailed Implementation

[0050] To make the objectives, technical solutions, and advantages of this specification clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments in this specification without creative effort are within the scope of protection of this application.

[0051] Statistical analysis of the publicly available DiaASQ dataset revealed that quadruples within the dialogue lines account for as much as 95% of the total quadruples. Therefore, this invention proposes a dialogue line-based segmentation strategy. The advantage of this segmentation method is that quadruples are extracted based on dialogue lines, ensuring complete non-interference between dialogue lines.

[0052] The technical solutions provided by the various embodiments of this application are described in detail below with reference to the accompanying drawings.

[0053] Figure 1 This is a flowchart illustrating an aspect sentiment quadruple prediction method for dialogue scenarios described in this specification, which specifically includes the following steps:

[0054] S101: Obtain a dialogue set, which includes at least two dialogue lines.

[0055] For example, an example of a dialogue-based aspect sentiment quadruple extraction task could be: the utterance “iPhone 7 Plus power consumption is high.” contains one ( t , a , o , s Quadruple, target word t Aspect words a and opinion words o The corresponding user sentiments are "iPhone 7 Plus", "power consumption", and "high". s The answer is "negative".

[0056] like Figure 2 As shown, Figure 2 This is an example diagram for a dialogue-based aspect sentiment quadruple extraction task. Figure 2 The upper left part is the dialogue. D The text, with the upper right part showing a tree-like dialogue structure based on the response relationships, and the bottom part showing all extracted from the dialogue text. t , a , o , s The emotional quadruple. Among them, discourse...u i This indicates that a user made one comment. i The sequence number of the utterances within the entire dialogue; the dialogue line dt j Refers to the root node of the tree (i.e., the root discourse). u 1) The first derived from the starting point j Subtree; Q k Indicates dialogue D The Middle k A four-tuple of emotions ( t k , a k , o k , s k ).

[0057] For example, the DiaASQ task will collect dialogue sets. D Represented as D = Dialogue D Including discourse collection u = Speakers gathered s = and reply collection r = .in u i ={ w 1,…, w m} indicates the first [number] in the dialogue. i This statement is from the spokesperson. s i Dialogue (i.e., the first) r i A reply (in words), n It represents the total number of utterances in a dialogue. The dialogue-based aspect-sentiment quadruple extraction task aims to predict the number of dialogue sets. D All emotional quadruple pairs: Q 1, Q 2,…, Q k ,….in, Q k =( t k , a k , o k , s k ); target words t k Aspect words ak and opinion words o k It is a dialogue D The text span within the range can be empty. Sentiment polarity. s k A predefined set of emotion polarity labels, including "positive", "negative" and "other" (referring to other emotions, including neutral, doubtful and ambiguous).

[0058] The dialogue set is obtained from the dialogue text; the dialogue set includes a discourse set, a speaker set, and a response set; among them, the discourse set contains the first... This phrase is used to indicate the speaker. Dialogue The dialogue line represents the data consisting of discourse data on the same question arranged chronologically according to the time of the response; the semantic label represents the predefined sentiment polarity label of the discourse data included in the dialogue line; among which, the predefined sentiment polarity label includes positive sentiment, negative sentiment and other sentiment.

[0059] Based on this, in one or more embodiments of this specification, the executing entity can be a hardware device or system with the ability to collect, process and analyze text data, including servers, edge computing devices, etc.

[0060] The server mentioned in this manual can be a server set up on a business platform, or a device such as a desktop computer or laptop computer capable of executing the solution described in this manual. For ease of explanation, the following description will only focus on the server as the execution subject.

[0061] S102: Use a preset dialogue line segmentation algorithm to split the dialogue set and the semantic tags corresponding to the dialogue set according to different dialogue lines to generate a dialogue line set; wherein, each dialogue line set includes the context text of each dialogue line and the tag of the context text.

[0062] For example, the preset dialogue thread segmentation algorithm can be the Dialogue Thread Segmentation (DTS) algorithm. The dialogue text is... D and its labels Y Split according to different dialogue lines to obtain A dialogue line and its label .

[0063] The pseudocode for the Dialogue Thread Segmentation (DTS) algorithm can be shown as Algorithm 1 below:

[0064] Algorithm 1: DTS (D , Y )

[0065] Input: Dialogue D and its quadruple tags Y

[0066] Output: Dialogue lines and their tag set

[0067] dt={dt j |j =0,1,…] / / dt j Structure and D Consistent, value is empty

[0068] j =-1 / / Record dialogue line ID

[0069] chatgid2lid={-1:(-2, -1),} / / Element format: gid:( j ,lid), where gid is the word in D The subscript in the text, where lid is its index. dt j Subscript; Initialize element "-1:(-2, -1)" for processing Y Implicit sentiment elements (i.e., null elements, all starting with an index of -1)

[0070] FOR( i in range(len( D . u 0 .split(' ')))

[0071] chatgid2lid[ i ]=(-1,i) / / -1 identifier u 0 Shared

[0072] total_lens = len( D . u 0 .split(' '))

[0073] FOR( i in range(len( D . r ))) / / D . r For dialogue D Reply list

[0074] IF( r i== 0) / / Reply u 0 indicates the start of a new dialogue line.

[0075] IF(len(dt j . u )!=0) / / Previous dt j

[0076] dt.append(dt j )

[0077] j +=1

[0078] dt j . u .append( D . u 0 / / Shared dialogue lines u 0

[0079] dt j . s .append( D . s 0 )

[0080] dt_rid= -1 / / u 0 There was no reply, therefore r 0 is -1

[0081] dt j . r .append( dt_rid )

[0082] cur_lens = len( D . u 0 .split(' '))

[0083] ELSE / / r i == -1 or other

[0084] dt j . u .append( D . u i )

[0085] dt j . s .append( D . s i )

[0086] dt_rid+=1 / / Reply to the previous utterance in the dialogue line

[0087] dt j . r .append(dt_rid)

[0088] FOR(m in range(len( D . u i . split(' ')))

[0089] chatgid2lid[m+totao_lens]=( j , m+cur_lens)

[0090] cur_lens += len( D . u i .split(' '))

[0091] total_lens += len( D . u i . split(' '))

[0092] dt.append(dt j / / The last one dt j

[0093] M =len(dt)

[0094] / / At this moment Empty list

[0095] FOR(t_s, t_e, a_s, a_e, o_s, o_e, s , t , a , o in Y )

[0096] nts,nas,nos= [char2char[w] for w in [t_s, a_s, o_s]]

[0097] 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

[0098] j =nts[0]

[0099] IF(j==-1) / / u The quadruple in 0 belongs to all dialogue lines

[0100] FOR( in )

[0101] .append((nts, nte,nas, nae,nos, noe, s , t , a , o ))

[0102] ELSE:

[0103] .append((nts, nte,nas, nae,nos, noe, s , t , a , o ))

[0104] RETURN zip(dt, ) / / Right now

[0105] S103: Construct a cloze test prompt template.

[0106] In this embodiment, the cloze test prompt template is arranged as follows: target word placeholder + emotional polarity placeholder + aspect word placeholder + opinion word placeholder + discriminant placeholder.

[0107] For example, in this invention, a Dialogue Thread Segmentation-based Generative DiaASQ model (DTSG-DiaASQ) can be pre-constructed. DTSG-DiaASQ models DiaASQ as a seq2path sequence generation task. A cloze test prompt template (i.e., a prompt containing 5 placeholders (i.e., 5 sentinel words, corresponding to 4 sentiment elements and 1 discriminant element)) is added to the input sequence to guide the generative PTM to understand the cloze test prompt template.t , a , o , s The relationships between these four emotional elements are ultimately determined by identifying word units. v The DTSG-DiaASQ model determines whether the four sentiment elements in the prompt constitute a valid quadruple. It uses an autoregressive approach to generate sentiment quadruples for all aspects of the dialogue. It treats the prompt as a cloze test question and blank placeholders (i.e., sentinel words) as blanks to be filled. Therefore, the answer to the cloze test (i.e., the target sequence) consists of five blank placeholders and the specific values ​​to be filled.

[0108] Furthermore, let's denote the prompt in the input sequence as... T Its construction should follow these principles:

[0109] (1) The prompt should contain 5 blank placeholders, corresponding to 4 sentiment elements and 1 discriminant element respectively. The order of the placeholders corresponding to the 4 sentiment elements in the prompt is fixed, and the placeholder for the discriminant element is placed last.

[0110] (2) The prompt should construct a context for understanding the semantic relationship between the four emotional elements.

[0111] Optionally, the order of the placeholders for the four emotion elements in the prompt can also be adjusted.

[0112] S104: Connect the cloze test prompt template and the concatenated text using a separator to obtain the input sequence; wherein, the concatenated text is generated by concatenating the context text of each dialogue line using preset special words.

[0113] For example, the input sequence of the generative model in this embodiment Z The format can be: T : X ".in, X This is a dialogue text sequence, achieved by inserting pre-defined special words between each utterance in the dialogue line. <usep>Generate by splicing.

[0114] Continue to refer to Figure 2 ,by Figure 2 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 By filling in the corresponding text, we can obtain... 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 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? Idon’t want to buy it. <usep>Buy it. Still very smooth.”

[0115] For example, each dialogue line input sequence Z It can contain multiple quadruples, each quadruple corresponding to a target sequence. Z The corresponding target sequence set is denoted as Y .For example, The Middle k Quadruples =( , , The target sequence corresponding to ) =="< 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 the five blank placeholders appear in the prompt.

[0116] S105: Encode and decode the input sequence using the trained sequence generation model to generate the target sequence; wherein, the trained sequence generation model is obtained by training on the positive and negative quadruples sample dataset.

[0117] In this embodiment, the training method of the trained sequence generation model is as follows: obtain a quadruple dataset; use the labeled sentiment quadruples in the quadruple dataset as positive samples, and swap the same type of sentiment elements in multiple sentiment quadruples in the same dialogue line to generate the first type of negative samples; use the quadruple dataset to perform insufficient training on the sequence generation model, and use the sentiment quadruples that the insufficiently trained sequence generation model judges as correct but are actually wrong 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 quadruple, and the bundle search combined with the constraint decoding strategy is used for decoding in the model inference stage to obtain the trained sequence generation model. The bundle search width is greater than 1, and it supports generating all candidate quadruples in the dialogue line at one time.

[0118] In this embodiment, the loss function of the trained sequence generation model for:

[0119] ;

[0120] in, This represents the augmented total dataset, containing positive quadruplets and two classes of augmented negative quadruplets. Indicates dialogue line The average loss, ,in, This represents the loss of the masked sequence generation model. Indicates the target sequence to be predicted At that time, t The lexical units generated before the time step, i.e. ( , ,…, ), For each time step t Loss of generating lexical units, Indicates an indicator function, when hour, If it is 1, otherwise, =0, Indicates dialogue line The corresponding set of target sequences of quadruplets, Indicates the set The number of elements, Indicates dialogue line The Middle The target sequence corresponding to each quadruple. Indicates dialogue line Input sequence, The model represents the dialogue line. The set of generated sequences on, express The sequence corresponding to the k-th candidate quadruple.

[0121] For example, such as< / usep> < / usep> Figure 3 As shown, Figure 3 This is a diagram of the DTSG-DiaASQ model architecture. Figure 3 In this embodiment, the labeled quadruples in the dataset are directly used as positive samples. v Set to "true", denoted as R p In order to construct the discriminant element v negative sample set that is "false" R n Use at the dialogue level R 1 and R 2. Two methods for generating negative samples for data augmentation are as follows:

[0122] R 1. Swap similar sentiment elements within multiple tuples in the same dialogue line to create a negative sample for that dialogue line. (Introduction) R Class 1 negative samples help the model prune incorrectly associated quadruples of sentiment elements.

[0123] R 2: Insufficiently train the model on the original training dataset for a small number of epochs, then use a bundle search decoding strategy to predict the quadruplets for each dialogue line. This results in the model predicting the correct quadruplets that are not actually in the label (i.e., incorrect predictions). v The quadruples that are "true" are used as negative samples for this dialogue line. (Introduction) R Two types of negative samples help the model prune the quadruplets generated by errors.

[0124] Therefore, negative sample set R q = R 1 ∪ R 2 The enhanced total dataset is denoted as R = R p ∪ R q .

[0125] During model training, the seq2path (i.e., sequence generation model) model adopts a greedy strategy (that is, setting num_beams of the beam search to 1, which is equivalent to ordinary seq2seq), treating each quadruple target sequence as an independent target, and calculating the average loss at the dialogue line level.

[0126] Total dataset R It is A set of. After data augmentation, the dialogue line dt j The corresponding set of target sequences of quadruplets can be represented as follows:

[0127] ;

[0128] in, Indicating combination The number of elements is equal to the number of dialogue lines dt. j The total number of quadruplets after data augmentation. Indicates the dialogue line dt j The Middle k The target sequence corresponding to each quadruple.

[0129] The target sequence contains all positive and negative samples corresponding to the dialogue line dtj. However, the introduction of negative samples aims to allow the generative model to determine the correctness of the generated quadruplets by discriminating the word 'v', but it is not intended for the generative model to mimic the negative samples. Therefore, negative samples need to be masked when calculating the loss. The target output sequence is... =( , ,…, For example, if... For negative samples, i.e. If the corresponding discriminant word v is "false", then the following masking scheme is used:

[0130] ;

[0131] if A positive sample, i.e. If the discriminant term is "true", then the loss of the entire target sequence is calculated directly, i.e., no masking is required.

[0132] ;

[0133] Contains A four-tuple target sequence. For 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 words do not participate in the loss calculation, only The corresponding lexical units are involved in the loss calculation. Therefore, the dialogue line dt can be obtained. j Average loss with mask and total dataset R The total loss is .

[0134] Optionally, during the generative model inference phase, beam search combined with constraint decoding can be used. The beam search algorithm selects multiple alternatives for an input sequence at each time step based on conditional probability. Through beam search, the generative model outputs the previous sequence with decreasing probability. k There are 10 paths, where the probability value reflects the likelihood that the corresponding path is valid.

[0135] Generative models employ a constrained decoding strategy during the decoding process, limiting the generated lexical units to a given pool of candidate lexical units, rather than searching the entire vocabulary space. Candidate lexical units either come from the input sequence... x These could be additional task-specific lexical units, such as the "NULL" lexical unit used to handle implicit aspect words and implicit opinion words, all lexical units in the candidate aspect category set and sentiment polarity set, and "true" and "false" lexical units used to determine whether a tuple is valid.

[0136] Optionally, the generative model can be part of DTSG-DiaASQ, which can perform steps S103-S107, or the generative model can also perform steps S103-S107, without any specific restrictions.

[0137] S106: Transform the target sequence into sentiment quadruplets to obtain a set of candidate quadruplets.

[0138] S107: Merge the candidate quadruple sets to generate the set of sentiment quadruples predicted at the dialogue level.

[0139] In this embodiment, before merging the candidate quadruples set to generate the dialogue-level predicted sentiment quadruples set, the method further includes: performing a pruning operation through a discriminator to retain the correct quadruples in the candidate quadruples set; merging the candidate quadruples set to generate the dialogue-level predicted sentiment quadruples set, specifically including: merging the dialogue-level predicted correct quadruples in the candidate quadruples set according to their respective dialogues to generate the dialogue-level predicted sentiment quadruples set.

[0140] In this embodiment, the pruning operation specifically includes:

[0141] When two paths differ only in their discriminants, retain the sequence with the higher probability from the two paths.

[0142] If both paths have valid discriminants and their aspect terms contain overlapping words, retain the path with the higher probability.

[0143] If both paths have valid discriminants and there are overlapping words in the opinion terms of the two paths, retain the path with the higher probability.

[0144] Delete paths that are determined to be invalid by the discriminant.

[0145] For example, pruning strategies are primarily used to filter quadruples corresponding to invalid paths. First, some "overlapping" predictions are removed: ① If the bundle search also returns " <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 "In this case, retain the sequence with the higher probability; ② If the beam search also 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 the higher probability is also retained; ③ If the beam search also 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> ", among which viewpoints o i and o j If there are overlapping words, the sequence with the higher probability is retained. Then, the words are deleted. v i = The path of "false" is reserved. v i = The path marked "true" is taken as the final valid prediction path. Finally, the sentiment elements corresponding to the valid paths are extracted to obtain the predicted aspect sentiment quadruple ( t, s, a, o ).

[0146] Merging sentiment quadruples in the candidate quadruple set can be used to merge the prediction results (correct quadruples) of all dialogue lines in the same dialogue to obtain the prediction result for the dialogue.

[0147] based on Figure 1 The aspect-sentiment quadruple prediction method for dialogue scenarios presented here groups the dialogue text and its labels according to different dialogue lines, thus solving the problem of semantic context incoherence in dialogue text. Based on this, this invention provides a feasible generative solution for the DiaASQ task for the first time. This solution has advantages such as the ability to utilize label semantics and process implicit sentiment, providing a valuable reference for subsequent research.

[0148] The generative model DTSG-DiaASQ proposed in this invention combines a designed cloze-style prompt with a bundle search decoding strategy, effectively utilizing the semantic relationships between sentiment elements and the shared features of sentiment elements, thereby improving the overall performance of the model.

[0149] The proposed model, DTSG-DiaASQ, was extensively tested on the DiaASQ dataset, validating the effectiveness of the generative modeling approach. On the English DiaASQ dataset, the model's F1 score improved by 1.88% compared to the best baseline model. This invention further demonstrates the effectiveness of strategies such as dialogue line grouping and bundle search decoding on the DiaASQ dataset through ablation experiments.

[0150] When applying the aspect-based sentiment quadruple prediction method for dialogue scenarios provided in this manual, it is not necessary to rely on... Figure 1 The steps shown are executed in sequence. The specific execution order of each step can be determined as needed, and this manual does not impose any restrictions on it.

[0151] The above describes one or more embodiments of the aspect sentiment quadruple prediction method for dialogue scenarios provided in this specification. Based on the same idea, this specification also provides a corresponding aspect sentiment quadruple prediction system for dialogue scenarios, such as... Figure 4 As shown.

[0152] Figure 4 This specification provides a schematic diagram of an aspect sentiment quadruple prediction system for dialogue scenarios, including:

[0153] The data acquisition module is used to acquire a dialogue set, which includes at least two dialogue lines;

[0154] The data processing module is used to split the dialogue set and its corresponding semantic tags according to different dialogue lines using a preset dialogue line segmentation algorithm, generating a dialogue line set. Each dialogue line set includes the context text and its tag for each dialogue line. A cloze test prompt template is constructed. The cloze test prompt template and the concatenated text are connected using a delimiter to obtain the input sequence. The concatenated text is generated by concatenating the context text of each dialogue line using preset special words.

[0155] 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 obtained by training on the positive and negative quadruples sample dataset;

[0156] The data prediction module is used to transform the target sequence into sentiment quadruples to obtain a set of candidate quadruples; the set of candidate quadruples is then merged to generate a set of sentiment quadruples predicted at the dialogue level.

[0157] Specific limitations regarding the aspect-sentiment quadruple prediction system for dialogue scenarios can be found in the limitations of the aspect-sentiment quadruple prediction method for dialogue scenarios described above, and will not be repeated here. Each module in the aforementioned aspect-sentiment quadruple prediction system for dialogue scenarios can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each module.

[0158] This specification also provides a computer-readable storage medium storing a computer program that can be used to execute the above-described... Figure 1 The provided aspect-based sentiment quadruple prediction method is designed for dialogue scenarios.

[0159] This instruction manual also provides Figure 5 The schematic diagram of the computer device shown is as follows: Figure 5 As shown, at the hardware level, this computer device includes a processor, internal bus, network interface, memory, and non-volatile memory, and may also include other hardware required for business operations. The processor reads the corresponding computer program from the non-volatile memory into memory and then executes it to achieve the above. Figure 1 The provided aspect-based sentiment quadruple prediction method is designed for dialogue scenarios.

[0160] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical storage, etc. Volatile memory can 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), etc.

[0161] The technical features of the above embodiments can be combined in any way. For the sake of brevity, 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 aspect sentiment quadruple prediction for dialogue scenarios, characterized in that, The method comprises: acquiring a dialogue set comprising at least two dialogue lines; splitting the dialogue set and the semantic label corresponding to the dialogue set according to different dialogue lines using a preset dialogue line splitting algorithm to generate a dialogue line set; wherein each dialogue line set comprises context text of each dialogue line and a label of the context text; constructing a fill-in-the-blank prompt template; connecting the fill-in-the-blank prompt template and a spliced text through 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 token; encoding and decoding the input sequence using a trained sequence generation model to generate a target sequence; wherein the trained sequence generation model is obtained by training on a positive-negative quadruple sample dataset; converting the target sequence into a sentiment quadruple to obtain a candidate quadruple set; merging the candidate quadruple set to generate a predicted sentiment quadruple set at the dialogue level; the arrangement form of the fill-in-the-blank prompt template is: target word placeholder + sentiment polarity placeholder + aspect word placeholder + opinion word placeholder + discriminator placeholder.

2. The aspect sentiment quadruple prediction method for dialogue scenario according to claim 1, wherein, The dialogue set is obtained according to dialogue text; the dialogue set comprises a speech set, a speaker set and a reply set; Among them, the first in the discourse set This phrase is used to indicate the speaker. Dialogue The response; the dialogue line is data composed of discourse data on the same question arranged in chronological order of response time in the discourse set; The semantic label represents a predefined sentiment polarity label of the speech data included in the dialogue line; wherein the predefined sentiment polarity label comprises positive sentiment and negative sentiment. 3.The aspect sentiment quadruple prediction method for dialogue scenario according to claim 1, wherein, Before merging the candidate quadruple set to generate a predicted sentiment quadruple set at the dialogue level, the method further comprises: performing a pruning operation through the discriminator to retain correct quadruples in the candidate quadruple set; merging the candidate quadruple set to generate a predicted sentiment quadruple set at the dialogue level, specifically comprising: merging dialogue line level predicted correct quadruples in the candidate quadruple set according to the dialogue to which they belong to generate a predicted sentiment quadruple set at the dialogue level.

4. The aspect sentiment quadruple prediction method for dialogue scenario according to claim 3, wherein, The pruning operation specifically comprises: when two quadruples only differ in the discriminator, retaining the quadruple with a probability greater than a preset value in the two quadruples; when the discriminators of two quadruples are both valid and there are overlapping words in the aspect words of the two quadruples, retaining the path with a greater probability in the two quadruples; when the discriminators of two quadruples are both valid and there are overlapping words in the opinion words of the two quadruples, retaining the path with a greater probability in the two quadruples; deleting quadruples determined as invalid by the discriminator.

5. The aspect sentiment quadruple prediction method for dialogue scenario according to claim 1, wherein, The training method of the sequence generation model is: acquiring a quadruple dataset; labeling sentiment quadruples in the quadruple dataset as positive samples, and generating a first type of negative sample by interchanging same type sentiment elements in multiple sentiment quadruples in the same dialogue line; The sequence generation model is insufficiently trained using a quadruple data set, and a sentiment quadruple that is determined as correct by the insufficiently trained sequence generation model but is actually incorrect is taken as a second-class negative sample, combined with a first-class negative sample, to train the sequence generation model using a greedy strategy with a single quadruple as a target, and to decode using beam search combined with a constraint decoding strategy in a model inference stage to obtain a trained sequence generation model; wherein the beam search of the beam search has a beam search width greater than 1 and supports concurrent generation of all candidate quadruples in a dialogue line at one time.

6. The aspect sentiment quadruple prediction method for dialogue scenario according to claim 5, wherein, a loss function employed when training the sequence generation model is: ; in, This represents the augmented total dataset, containing positive quadruplets and two classes of augmented negative quadruplets. Indicates dialogue line The average loss, Indicates dialogue line The corresponding set of target sequences of quadruplets, Indicates dialogue line Input sequence, The model represents the dialogue line. The set of generated sequences on.

7. An aspect-sentiment quadruple prediction system for dialogue scenarios, characterized in that, The method comprises the following steps: A data acquisition module is configured to acquire a dialogue set, wherein the dialogue set comprises at least two dialogue lines; A data processing module is configured to split the dialogue set and a semantic label corresponding to the dialogue set according to different dialogue lines by using a preset dialogue line splitting algorithm to generate a dialogue line set, wherein each dialogue line set comprises context text of each dialogue line and a label of the context text; a complete filling gap prompt template is constructed, and the arrangement form of the complete filling gap prompt template is: a target word placeholder + a sentiment polarity placeholder + an aspect word placeholder + a viewpoint word placeholder + a discriminator placeholder; the complete filling gap prompt template and a splicing text are connected by a separator to obtain an input sequence, wherein the splicing text is generated by splicing the context text of each dialogue line using a preset special word element; A model application module is configured to encode and decode the input sequence by 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 quadruple sample data set; A data prediction module is configured to convert the target sequence into a sentiment quadruple to obtain a candidate quadruple set; and the candidate quadruple set is merged to generate a dialogue-level predicted sentiment quadruple set.

8. A computer device comprising a memory, a processor, and a computer program stored on the memory, wherein the computer program comprises instructions that, when executed by the processor, cause the processor to perform the method of any one of claims 1-7. The processor executes the computer program to implement the steps of the method of any one of claims 1 to 6.

9. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program, when loaded by the processor, can execute the steps of the method of any one of claims 1 to 6. The computer program, when loaded by the processor, can execute the steps of the method of any one of claims 1 to 6.

Citation Information

Patent Citations

  • Multi-turn dialogue emotion quadruple extraction method using large language model reasoning

    CN118982030A