Sentiment Extraction Methods Based on Multi-Turn Machine Reading Comprehension

By decomposing the sentiment cause pair extraction task using a multi-turn machine reading comprehension method, and utilizing explicit semantic information and a reflective mechanism, the problem of label sparsity and relation construction in sentiment cause pair extraction is solved, thereby improving extraction efficiency and accuracy. This method is applicable to multiple application scenarios in the fields of natural language processing and machine learning.

CN113988048BActive Publication Date: 2025-11-14BEIJING INST OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111192610.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-13
Publication Date
2025-11-14
Estimated Expiration
2041-10-13

AI Technical Summary

Technical Problem

Existing sentiment reason extraction methods suffer from label sparsity and the inability to construct complex relationships between sentiment clauses and reason clauses, resulting in low extraction efficiency and poor performance.

Method used

A multi-turn machine reading comprehension approach is adopted, which decomposes the emotion-cause pair extraction task into a static emotion extraction task and a dynamic cause extraction task. By constructing the interaction between questions and clauses at the clause level, and utilizing explicit emotion and cause semantic information, combined with a reflection mechanism for verification, the extraction efficiency and accuracy are improved.

Benefits of technology

It alleviates the sparsity problem of clause pair labels, improves the efficiency and accuracy of sentiment reason extraction, and has a wider range of applications. It can be applied to tasks such as intelligent text mining, social network information mining, sentiment guidance and public opinion monitoring in the fields of natural language processing and machine learning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113988048B_ABST
    Figure CN113988048B_ABST
Patent Text Reader

Abstract

This invention discloses a sentiment cause pair extraction method based on multi-turn machine reading comprehension, belonging to the fields of natural language processing and machine learning. This invention decomposes the sentiment cause pair extraction task using a multi-turn structure, mitigating the label sparsity problem at the clause level rather than the clause pair level by processing the task at the clause level, thus improving the efficiency of document sentiment cause pair extraction. Furthermore, by utilizing question design and the interaction between questions and clauses in machine reading comprehension methods, the relationship between sentiment clauses and cause clauses is fully established. This established relationship enables the extraction of sentiment cause pairs under various complex relationships, broadening its applicability. The extracted candidate document sentiment cause pairs are verified using a multi-turn machine reading comprehension method with a reflective mechanism, and explicit causal semantic information is used to improve the F1 score of the sentiment cause pair extraction task. This invention is applied to the fields of natural language processing and machine learning, solving related technical problems.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a method for extracting sentiment reason pairs based on multi-turn machine reading comprehension, belonging to the field of natural language processing and machine learning. Background Technology

[0002] The Emotion Cause-Effect Extraction (ECPE) task is a fine-grained task in the field of sentiment analysis that has become very popular in recent years. It aims to extract all emotion cause-effect pairs from a document, with each emotion cause-effect pair consisting of an emotion clause and a corresponding cause clause.

[0003] For the ECPE task, the mainstream solution is to use an end-to-end deep learning model to model and extract clause pairs. First, all clauses in a document are arranged and combined into a clause pair matrix. Then, it is determined whether these pairs are correct sentiment reason pairs. If a document has N sentences, then N... 2 Of the 3 clause pairs, only a few are sentiment reason pairs (most documents will not have more than 3 sentiment reason pairs). Therefore, this method suffers from a serious label sparsity problem, and the larger N is, the more severe the label sparsity problem becomes.

[0004] Another solution is the end-to-end sequence labeling method. This method models and predicts at the clause level by designing a joint sequence labeling pattern. Because it does not generate a clause pair matrix, it avoids the label sparsity problem mentioned above. However, due to the complex one-to-one, one-to-many, and many-to-one relationships between sentiment clauses and cause clauses, and the fact that sentiment clauses and their corresponding cause clauses may be far apart in a document, the joint sequence labeling pattern cannot construct these complex correspondences, thus its performance is not ideal.

[0005] In summary, existing methods for solving ECPE tasks mainly suffer from the following problems: (1) sparsity of labels; (2) inability to construct complex relationships between sentiment and cause. Summary of the Invention

[0006] The technical problem addressed by the sentiment cause pair extraction method based on multi-turn machine reading comprehension disclosed in this invention is: to extract sentiment cause pairs from documents using a multi-turn machine reading comprehension approach; to decompose the sentiment cause pair extraction task using a multi-turn structure; and to alleviate the label sparsity problem at the clause level by processing the sentiment cause pair extraction task at the clause level rather than the clause pair level, thereby improving the efficiency of sentiment cause pair extraction. Furthermore, by utilizing the question design and interaction between questions and clauses in machine reading comprehension methods, the relationship between sentiment clauses and cause clauses is fully established. This established relationship between sentiment and cause enables the extraction of sentiment cause pairs under various complex relationships, thus broadening its applicability. Finally, the extracted candidate document sentiment cause pairs are validated using a multi-turn machine reading comprehension method with a reflective mechanism, and explicit causal semantic information is used to further improve the F1 score of the sentiment cause pair extraction task. This invention is applied to the fields of natural language processing and machine learning, solving related technical problems.

[0007] The various complex relationships include one-to-one, one-to-many, and many-to-one relationships between sentiment clauses and cause clauses, as well as cases where the sentiment clause and cause clause are far apart.

[0008] The objective of this invention is achieved through the following technical solution.

[0009] The present invention discloses a method for extracting sentiment reason pairs based on multi-turn machine reading comprehension, comprising the following steps:

[0010] Step 1: Extract sentiment cause pairs from documents using a multi-turn machine reading comprehension method. The task of extracting sentiment cause pairs is decomposed using a multi-turn structure. The interaction between questions and clauses is constructed at the clause level. Explicit sentiment and cause semantic information is fully utilized. By processing the sentiment cause pair extraction task at the clause level, the label sparsity problem at the clause level is alleviated, the efficiency of extracting sentiment cause pairs from documents is improved, and the initially extracted sentiment cause pairs and the probabilities of the corresponding sentiment cause pairs are output.

[0011] The corresponding document sentiment cause pair probability refers to the probability that the clause pair is a correct sentiment cause pair, which is usually the product of the probability that the first clause in the pair is a sentiment clause and the probability that the second clause is the cause clause corresponding to the first clause.

[0012] Step 1.1: Extract sentiment cause pairs from documents based on a multi-turn machine reading comprehension method. The sentiment cause pair extraction task is decomposed into a static sentiment extraction task and a dynamic cause extraction task using a multi-turn structure.

[0013] The static sentiment extraction task refers to extracting all sentiment clauses in a document, while the dynamic cause extraction task refers to extracting the cause clauses corresponding to each sentiment clause based on the results of the static sentiment extraction task and with the help of explicit sentiment semantic information.

[0014] Step 1.2: Static Sentiment Extraction Task. A static sentiment question is designed to encode document clauses. Sentiment clauses are extracted by predicting their corresponding encodings. The document clause encoding method is as follows: A pre-trained BERT model is used to encode the static sentiment question and document clauses at the word level, obtaining word vectors for the sentiment question and each word in each clause; a self-attention mechanism is used to aggregate word vectors for sentence-level encoding, obtaining sentence vectors for the sentiment question and each clause; a graph attention network is used to model document-level relationships and update the sentence vectors of the clauses; the sentence vectors of the clauses are updated again by concatenating the sentence vectors of the sentiment question and each clause, realizing the interaction between the question and clauses, so that the sentence vectors of the clauses carry sentiment semantic information, thus achieving document clause encoding. After encoding, a linear classifier is used to predict the clause encodings, extracting sentiment clauses, and calculating the static sentiment extraction task loss.

[0015] The static sentiment question refers to a pre-designed question used for static sentiment extraction tasks.

[0016] The specific implementation method of document clause encoding in step 1.2 is as follows:

[0017] Constructing the input to the pre-trained BERT model:

[0018]

[0019] The input contains two special markers, [CLS] and [SEP], as well as one question and N clauses. The i-th word representing the static sentiment question, w i,j This represents the j-th word in the i-th clause of the document. Feed this input into BERT to obtain the BERT output:

[0020]

[0021] in h represents the vector representation of the i-th word in a static sentiment question. i,j This represents the vector representation of the j-th word in the i-th clause of the document. The sentence vector representations of each clause and question are obtained by aggregating the word vector representations using a self-attention mechanism.

[0022] H C ={h c1 ,h c2 ,...},

[0023] The vector representation of the clauses is modeled using a graph attention network (GAT) to model document-level information, and the clause vector representation is updated accordingly:

[0024] H C ={h′ c1 ,h′ c2 ,...}, where h′ ci =GAT(h ci )

[0025] Concatenate the vector representation of each clause with the vector representation of the problem, and update the clause vector representation:

[0026] H C ={h″ c1 ,h″ c2 ,...},in

[0027] The specific implementation method of the linear classifier predicting clause codes in step 1.2 is as follows:

[0028] Output H from the encoder C ={h″ c1 ,h″ c2 ...} is fed into a single-layer perceptron:

[0029]

[0030] Where w S ,b S These are the learnable parameters of a single-layer perceptron, and σ() is the logistic activation function. This represents the probability that the answer is True.

[0031] The specific implementation method of the static sentiment extraction task loss described in step 1.2 is as follows:

[0032]

[0033] in c represents the j-th clause in the i-th document. i,j It is the kth static emotion problem The true probability value of the answer is either 0 or 1. c represents the j-th clause in the i-th document. i,j It is the kth static emotion problem The predicted probability value of the answer is determined only if it is greater than 0.5, and the j-th clause is considered to be the answer to the k-th static sentiment question.

[0034] Step 1.3: Dynamic Cause Extraction Task. A dynamic cause problem is designed to encode document clauses. Based on the corresponding encodings of document clauses, predictions are made to extract the cause clauses corresponding to sentiment clauses. The document clause encoding method is as follows: BERT is used to perform word-level encoding on the dynamic cause problem and document clauses, obtaining word vectors for the cause problem and each word in each clause; a self-attention mechanism is used to aggregate word vectors for sentence-level encoding, obtaining sentence vectors for the cause problem and each clause; a graph attention network is used to model document-level relationships and update the sentence vectors of clauses; the sentence vectors of clauses are updated again by concatenating the sentence vectors of the cause problem and each clause, realizing the interaction between the problem and clauses, so that the sentence vectors of clauses carry cause semantic information, i.e., realizing the encoding of document clauses. After encoding, a linear classifier is used to predict the clause encodings, extracting the cause clauses corresponding to sentiment clauses, and calculating the loss of the dynamic cause extraction task.

[0035] The dynamic cause problem refers to using a problem template, in which the sentiment clauses extracted in step 1.2 are included to construct a problem for the dynamic cause extraction task.

[0036] The specific implementation method of document clause encoding in step 1.3 is as follows:

[0037] Constructing the input to the pre-trained BERT model:

[0038]

[0039] The input contains two special markers, [CLS] and [SEP], as well as one question and N clauses. The i-th word representing the dynamic cause problem, w i,j This represents the j-th word in the i-th clause of the document. This input is fed into the BERT pre-trained model to obtain the BERT output:

[0040]

[0041] in h represents the hidden layer vector representation of the i-th word in the dynamic cause problem. i,j This represents the hidden layer vector representation of the j-th word in the i-th clause of the document. Then, a self-attention mechanism is used to aggregate the word vector representations to obtain the sentence vector representation of each clause and question.

[0042] H C ={h c1 ,h c2 ,...},

[0043] The vector representation of the clause is modeled using a graph attention network (GAT) to model document-level information, and the vector representation of the clause is updated accordingly.

[0044] H C ={h′ c1 ,h′ c2 ,...}, where h′ ci =GAT(h ci )

[0045] Concatenate the vector representation of each clause with the vector representation of the problem, and then update the clause vector representation:

[0046] H C ={h″ c1 ,h″ c2 ,...},in

[0047] The specific implementation method for the linear classifier to predict clause codes in step 1.3 is as follows:

[0048] Output H from the encoder C ={h″ c1 ,h″ c2 ...} is fed into a single-layer perceptron:

[0049]

[0050] Where w S ,b S These are the learnable parameters of a single-layer perceptron, and σ() is the logistic activation function. This represents the probability that the answer is True.

[0051] The specific implementation method of the dynamic cause extraction task loss described in step 1.3 is as follows:

[0052]

[0053] in c represents the j-th clause in the i-th document. i,j It is the kth dynamic cause problem. The true probability value of the answer is either 0 or 1. c represents the j-th clause in the i-th document. i,j It is the kth dynamic cause problem. The predicted probability value of the answer is determined only if it is greater than 0.5, and the j-th clause is considered to be the answer to the k-th dynamic cause problem.

[0054] Step 1.4: Based on steps 1.1, 1.2, and 1.3, the sentiment cause pair extraction task is decomposed using a multi-round structure. The interaction between questions and clauses is constructed at the clause level. The explicit sentiment and cause semantic information is fully utilized. By processing the sentiment cause pair extraction task at the clause level, the sparsity problem of sentiment cause pair labels is alleviated, and the efficiency of sentiment cause pair extraction from documents is improved.

[0055] Step 2: Validate the extracted document sentiment cause pairs using a multi-round machine reading comprehension method with a reflective mechanism. Building upon Step 1, a dynamic sentiment extraction task is added as the final round to extract the sentiment clause corresponding to each cause clause. This fully utilizes explicit causal semantic information to improve the F1 score of the sentiment cause pair extraction task.

[0056] The dynamic sentiment extraction task refers to extracting the sentiment clause corresponding to each cause clause based on the results of the dynamic cause extraction task and with the help of explicit cause semantic information.

[0057] Step 2.1: Dynamic Sentiment Extraction Task. A dynamic sentiment question is designed to encode document clauses. Based on the corresponding encodings of document clauses, a sentiment clause corresponding to the cause clause is extracted. The document clause encoding method is as follows: A pre-trained model BERT is used to encode the dynamic sentiment question and document clauses at the word level, obtaining word vectors for the sentiment question and each word in each clause; a self-attention mechanism is used to aggregate word vectors for sentence-level encoding, obtaining sentence vectors for the sentiment question and each clause; a graph attention network is used to model document-level relationships and update the sentence vectors of the clauses; by concatenating the sentence vectors of the sentiment question and the sentence vectors of each clause, the sentence vectors of the clauses are updated again, realizing the interaction between the question and clauses, so that the sentence vectors of the clauses carry sentiment semantic information, i.e., the document clauses are encoded. After encoding, a linear classifier is used to predict the clause encodings and extract the sentiment clause corresponding to the cause clause. The loss of the dynamic sentiment extraction task is calculated.

[0058] The dynamic sentiment question refers to the question template in which the reason clauses extracted in step 1.3 are included to construct a question for the dynamic sentiment extraction task.

[0059] The specific implementation method of document clause encoding in step 2.1 is as follows:

[0060] Constructing the input to the pre-trained BERT model:

[0061]

[0062] The input contains two special markers, [CLS] and [SEP], as well as one question and N clauses. The i-th word representing the dynamic sentiment issue, w i,jThis represents the j-th word in the i-th clause of the document. This input is fed into the BERT pre-trained model to obtain the BERT output:

[0063]

[0064] in h represents the hidden layer vector representation of the i-th word in the dynamic sentiment problem. i,j This represents the hidden layer vector representation of the j-th word in the i-th clause of the document. Then, a self-attention mechanism is used to aggregate the word vector representations to obtain the sentence vector representation of each clause and question.

[0065] H C ={h c1 ,h c2 ,...},

[0066] The vector representation of the clause is modeled using a graph attention network (GAT) to model document-level information, and the vector representation of the clause is updated accordingly.

[0067] H C ={h c '1,h c '2,...}, where h c ' i =GAT(h ci )

[0068] Concatenate the vector representation of each clause with the vector representation of the problem, and then update the clause vector representation:

[0069] H C ={h″ c1 ,h″ c2 ,...},in

[0070] The specific implementation method for the linear classifier to predict clause codes in step 2.1 is as follows:

[0071] Output H from the encoder C ={h″ c1 ,h″ c2 ...} is fed into a single-layer perceptron:

[0072]

[0073] Where w S ,b S These are the learnable parameters of a single-layer perceptron, and σ() is the logistic activation function. This represents the probability that the answer is True.

[0074] The specific implementation method of the dynamic emotion extraction task loss described in step 2.1 is as follows:

[0075]

[0076] in c represents the j-th clause in the i-th document. i,j It is the kth dynamic sentiment problem The true probability value of the answer is either 0 or 1. c represents the j-th clause in the i-th document. i,j It is the kth dynamic sentiment problem The predicted probability value of the answer is determined only if it is greater than 0.5, and the j-th clause is considered to be the answer to the k-th dynamic sentiment question.

[0077] Step 2.2: Based on Step 1, add a dynamic sentiment extraction task as the final round to extract the sentiment clause corresponding to each cause clause, making full use of explicit cause semantic information to improve the F1 score of the sentiment cause extraction task.

[0078] Step 3: Calculate the three losses L from steps 1.2, 1.3, and 2.1. e ,L c ,L r The total loss is obtained by summing the results. This loss is then used to train the sentiment cause pair extraction model until it converges. The model parameters are then recorded for use in the document sentiment cause pair extraction task.

[0079] Step 4: Input the sentiment cause pair extraction model trained in Step 3 into the document, and use the model to extract all sentiment cause pairs, that is, realize sentiment cause pair extraction based on multi-turn machine reading comprehension with a reflection mechanism.

[0080] Step four uses the sentiment reasoning extraction model trained in step three to extract all sentiment reasoning pairs. The implementation method is as follows:

[0081] Step 4.1: Static Sentiment Extraction Task. Construct a static sentiment question, and feed the static sentiment question and document clauses as input into the trained sentiment cause pair extraction model. Extract all sentiment clauses from the document and obtain the probabilities corresponding to the sentiment clauses:

[0082] E = {e1, e2, ...}, P E ={p e1 ,p e2 ,...}

[0083] Where e i p represents the i-th sentiment clause in the document. ei This represents the probability of the i-th sentiment clause.

[0084] The probability of the sentiment clause refers to the probability value that the clause is considered a correct sentiment clause.

[0085] Step 4.2: Dynamic Cause Extraction Task. Based on the sentiment clauses extracted in Step 4.1, construct a dynamic cause question. Input the dynamic cause question and document clauses into the trained model to extract the cause clause and its probability for each sentiment clause in the document. This yields all candidate sentiment cause pairs and their probabilities.

[0086] Pair = {(e1,c1),(e2,c2),...}

[0087] Among them (e) i ,c i () represents the emotional reason pair of the i-th candidate. This represents the probability of a candidate's emotional cause being correct.

[0088] The probability of the cause clause refers to the probability value that the clause is the cause clause corresponding to the sentiment clause. The probability of the candidate sentiment cause pair is the product of the probability that the first clause is the sentiment clause and the probability that the second clause is the cause clause corresponding to the first clause.

[0089] Step 4.3: Reflection and Validation Mechanism, i.e., Dynamic Sentiment Extraction Task. Based on the causal clauses extracted in Step 4.2, construct a dynamic sentiment question. Input the dynamic sentiment question and document clauses into the trained model. For each candidate sentiment cause pair, extract the sentiment clause corresponding to the causal clause. Adjust the probability value of the candidate sentiment cause pair using parameter α based on the extraction results. If the extracted sentiment clause matches the sentiment clause in the candidate sentiment cause pair, the validation is correct, and α = 1; otherwise, decrease the value of α. The updated probability values ​​of the candidate sentiment cause pairs are as follows:

[0090] in

[0091] Use a threshold δ to filter out the correct sentiment reason pairs:

[0092]

[0093] Pair f This represents the set of filtered emotional reason pairs.

[0094] That is, to achieve the extraction of emotional cause pairs through multi-round machine reading comprehension based on a reflection mechanism.

[0095] Step 5: Apply the model obtained in the first four steps to the fields of natural language processing and machine learning to solve related technical problems.

[0096] The related technical issues include intelligent text mining and services, social network information mining, emotion guidance, public opinion monitoring, and work efficiency prediction.

[0097] By applying the model to emotional intervention, the emotional state of the target group and the reasons for this emotional state are analyzed based on the emotional cause pairs extracted by the model. For the emotional cause pairs that affect the mental health of the target group, emotional intervention strategies are selected to eliminate the corresponding causes and improve the mental health of the target group.

[0098] The model is applied to online public opinion monitoring. Based on the emotional reasons extracted by the model, the emotional state of the target public opinion is analyzed. For the emotional reasons in public opinion that affect social stability, the corresponding reasons are eliminated to maintain a positive online public opinion and social stability.

[0099] The model is applied to predict work efficiency. Based on the emotional factors extracted by the model, the work status of the target work group is analyzed. The corresponding emotional factors affecting the work status are eliminated to improve the work status of the target work group and thus improve the work efficiency of the target work group.

[0100] Beneficial effects:

[0101] 1. Compared with end-to-end methods for generating clause pairs, the sentiment cause pair extraction method based on multi-turn machine reading comprehension disclosed in this invention decomposes the sentiment cause pair extraction task using a multi-turn structure. By processing the sentiment cause pair extraction task at the clause level rather than the clause pair level, it alleviates the label sparsity problem at the clause pair level and improves the efficiency of extracting sentiment cause pairs from documents.

[0102] 2. Compared with sequence labeling methods, the sentiment cause pair extraction method based on multi-turn machine reading comprehension disclosed in this invention fully establishes the relationship between sentiment clauses and cause clauses by utilizing the question design and the interaction between questions and clauses in machine reading comprehension methods. The established relationship between sentiment and cause can extract sentiment cause pairs under various complex relationships, and has wider applicability.

[0103] 3. The sentiment cause pair extraction method based on multi-turn machine reading comprehension disclosed in this invention verifies the extracted candidate document sentiment cause pairs based on a multi-turn machine reading comprehension method with a reflective mechanism, and makes full use of explicit causal semantic information to improve the F1 score of the sentiment cause pair extraction task.

[0104] 4. The sentiment reasoning extraction method based on multi-turn machine reading comprehension disclosed in this invention is applied to the fields of natural language processing and machine learning to solve related technical problems, such as intelligent text mining and services, social network information mining, sentiment guidance, public opinion monitoring, and work efficiency prediction.

[0105] 5. The sentiment cause pair extraction method based on multi-turn machine reading comprehension disclosed in this invention pre-trains a multi-turn machine reading comprehension sentiment cause pair extraction model based on a reflection mechanism. The trained model is used to extract all sentiment cause pairs, which can significantly improve extraction efficiency while ensuring the matching accuracy of sentiment cause pair extraction. This facilitates the real-time resolution of the above-mentioned engineering and technical problems for the target group. Attached Figure Description

[0106] Figure 1 This is a flowchart of the sentiment reason pair extraction based on multi-turn machine reading comprehension in this invention.

[0107] Figure 2 This is a structural diagram of the model for an example embodiment;

[0108] Figure 3 This is a diagram of the coding layer structure of the present invention; Detailed Implementation

[0109] To better illustrate the purpose and advantages of the present invention, the embodiments of the method of the present invention will be further described in detail below with reference to the accompanying drawings and examples.

[0110] Example 1:

[0111] This example uses a microblog corpus. The statistical information of the corpus after processing is shown in Table 1:

[0112] Table 1. The impact of emotional reasons on the extraction of experimental data.

[0113]

[0114] The experiment used precision (P), recall (R), and F1-measure (F1) to evaluate the results, and employed 10-fold cross-validation to determine the optimal parameters of the model based on the experimental performance.

[0115] This experiment was conducted on one computer and one server. The computer's specific configuration was: Intel(R) i5-1135G7, CPU 2.40GHz, 16GB memory, and Windows 10 64-bit operating system. The server's specific configuration was: Intel(R) Xeon(R) Gold6240, CPU 2.60GHz, GPU V100 32GB, and Debian GNU / Linux 11 64-bit operating system.

[0116] The specific settings of the embodiment model are as follows: Figure 2 As shown, the model uses three rounds of machine reading comprehension to extract sentiment reason pairs from documents.

[0117] Step 1: Extract sentiment cause pairs from documents using a multi-turn machine reading comprehension method. The task of extracting sentiment cause pairs is decomposed using a multi-turn structure. The interaction between questions and clauses is constructed at the clause level. Explicit sentiment and cause semantic information is fully utilized. By processing the sentiment cause pair extraction task at the clause level, the label sparsity problem at the clause level is alleviated, the efficiency of extracting sentiment cause pairs from documents is improved, and the initially extracted sentiment cause pairs and the probabilities of the corresponding sentiment cause pairs are output.

[0118] Step 1.1: Extract sentiment cause pairs from documents based on a multi-turn machine reading comprehension method. The sentiment cause pair extraction task is decomposed into a static sentiment extraction task and a dynamic cause extraction task using a multi-turn structure.

[0119] Step 1.2: Static Sentiment Extraction Task. A static sentiment question, "Is this a sentiment clause?", is designed. Document clauses are encoded, and sentiment clauses are extracted based on their corresponding encodings. The document clause encoding method is as follows: A pre-trained model, BERT, is used to encode the static sentiment question and document clauses at the word level, obtaining word vectors for the sentiment question and each word in each clause; a self-attention mechanism is used to aggregate word vectors for sentence-level encoding, obtaining sentence vectors for the sentiment question and each clause; a graph attention network is used to model document-level relationships and update the sentence vectors of the clauses; the sentence vectors of the clauses are updated again by concatenating the sentence vectors of the sentiment question and each clause, realizing the interaction between the question and clauses, so that the sentence vectors of the clauses carry sentiment semantic information, thus achieving document clause encoding. After encoding, a linear classifier is used to predict the clause encodings, extracting sentiment clauses, and calculating the static sentiment extraction task loss.

[0120] The specific implementation method of document clause encoding in step 1.2 is as follows:

[0121] Constructing the input to the pre-trained BERT model:

[0122]

[0123] The input contains two special markers, [CLS] and [SEP], as well as one question and N clauses. The i-th word representing the static sentiment question, w i,j This represents the j-th word in the i-th clause of the document. Feed this input into BERT to obtain the BERT output:

[0124]

[0125] in h represents the vector representation of the i-th word in a static sentiment question. i,jThis represents the vector representation of the j-th word in the i-th clause of the document. The sentence vector representations of each clause and question are obtained by aggregating the word vector representations using a self-attention mechanism.

[0126] H C ={h c1 ,h c2 ,...},

[0127] The vector representation of the clauses is modeled using a graph attention network (GAT) to model document-level information, and the clause vector representation is updated accordingly:

[0128] H C ={h′ c1 ,h′ c2 ,...}, where h c ' i =GAT(h ci )

[0129] Concatenate the vector representation of each clause with the vector representation of the problem, and update the clause vector representation:

[0130] H C ={h″ c1 ,h″ c2 ,...},in

[0131] The specific implementation method of the linear classifier predicting clause codes in step 1.2 is as follows:

[0132] Output H from the encoder C ={h″ c1 ,h″ c2 ...} is fed into a single-layer perceptron:

[0133]

[0134] Where w S ,b S These are the learnable parameters of a single-layer perceptron, and σ() is the logistic activation function. This represents the probability that the answer is True.

[0135] The specific implementation method of the static sentiment extraction task loss described in step 1.2 is as follows:

[0136]

[0137] in c represents the j-th clause in the i-th document. i,j It is the kth static emotion problem The true probability value of the answer is either 0 or 1. c represents the j-th clause in the i-th document. i,j It is the kth static emotion problem The predicted probability value of the answer is determined only if it is greater than 0.5, and the j-th clause is considered to be the answer to the k-th static sentiment question.

[0138] Step 1.3: Dynamic Cause Extraction Task. Design a dynamic cause question template, "Is this the cause clause corresponding to ____?", encode document clauses, and extract the cause clauses corresponding to sentiment clauses based on the document clause encoding. The document clause encoding method is as follows: Use BERT to perform word-level encoding on the dynamic cause question and document clauses to obtain word vectors for the cause question and each word in each clause; use a self-attention mechanism to aggregate word vectors for sentence-level encoding to obtain sentence vectors for the cause question and each clause; use a graph attention network to model document-level relationships and update the sentence vectors of the clauses; by concatenating the sentence vectors of the cause question and the sentence vectors of each clause, update the sentence vectors of the clauses again, realizing the interaction between the question and clauses, so that the sentence vectors of the clauses carry cause semantic information, i.e., realizing the encoding of document clauses. After encoding, use a linear classifier to predict the clause encoding, extract the cause clauses corresponding to sentiment clauses, and calculate the loss of the dynamic cause extraction task.

[0139] The dynamic cause problem refers to using a problem template, in which the sentiment clauses extracted in step 1.2 are included to construct a problem for the dynamic cause extraction task.

[0140] The specific implementation method of document clause encoding in step 1.3 is as follows:

[0141] Constructing the input to the pre-trained BERT model:

[0142]

[0143] The input contains two special markers, [CLS] and [SEP], as well as one question and N clauses. The i-th word representing the dynamic cause problem, w i,j This represents the j-th word in the i-th clause of the document. This input is fed into the BERT pre-trained model to obtain the BERT output:

[0144]

[0145] in h represents the hidden layer vector representation of the i-th word in the dynamic cause problem. i,j This represents the hidden layer vector representation of the j-th word in the i-th clause of the document. Then, a self-attention mechanism is used to aggregate the word vector representations to obtain the vector representations of each clause and the question:

[0146] HC ={h c1 ,h c2 ,...},

[0147] The vector representation of the clause is modeled using a graph attention network (GAT) to model document-level information, and the vector representation of the clause is updated accordingly.

[0148] H C ={h′ c1 ,h′ c2 ,...}, where h′ ci =GAT(h ci )

[0149] Concatenate the vector representation of each clause with the vector representation of the problem, and then update the clause vector representation:

[0150] H C ={h″ c1 ,h″ c2 ,...},in

[0151] The specific implementation method for the linear classifier to predict clause codes in step 1.3 is as follows:

[0152] Output H from the encoder C ={h″ c1 ,h″ c2 ...} is fed into a single-layer perceptron:

[0153]

[0154] Where w S ,b S These are the learnable parameters of a single-layer perceptron, and σ() is the logistic activation function. This represents the probability that the answer is True.

[0155] The specific implementation method of the dynamic cause extraction task loss described in step 1.3 is as follows:

[0156]

[0157] in c represents the j-th clause in the i-th document. i,j It is the kth dynamic cause problem. The true probability value of the answer is either 0 or 1. c represents the j-th clause in the i-th document. i,j It is the kth dynamic cause problem. The predicted probability value of the answer is determined only if it is greater than 0.5, and the j-th clause is considered to be the answer to the k-th dynamic cause problem.

[0158] Step 1.4: Based on steps 1.1, 1.2, and 1.3, the sentiment cause pair extraction task is decomposed using a multi-round structure. The interaction between questions and clauses is constructed at the clause level. The explicit sentiment and cause semantic information is fully utilized. By processing the sentiment cause pair extraction task at the clause level, the sparsity problem of sentiment cause pair labels is alleviated, and the efficiency of sentiment cause pair extraction from documents is improved.

[0159] Step 2: Validate the extracted document sentiment cause pairs using a multi-round machine reading comprehension method with a reflective mechanism. Building upon Step 1, a dynamic sentiment extraction task is added as the final round to extract the sentiment clause corresponding to each cause clause. This fully utilizes explicit causal semantic information to improve the F1 score of the sentiment cause pair extraction task.

[0160] Step 2.1: Dynamic Sentiment Extraction Task. Design a dynamic sentiment question template, "Is this the sentiment clause corresponding to ____?", encode document clauses, and extract the sentiment clause corresponding to the cause clause based on the document clause's encoding. The document clause encoding method is as follows: Use the pre-trained model BERT to perform word-level encoding on the dynamic sentiment question and document clauses, obtaining word vectors for the sentiment question and each word in each clause; use a self-attention mechanism to aggregate word vectors for sentence-level encoding, obtaining sentence vectors for the sentiment question and each clause; use a graph attention network to model document-level relationships and update the sentence vectors of the clauses; by concatenating the sentence vectors of the sentiment question and the sentence vectors of each clause, update the sentence vectors of the clauses again, realizing the interaction between the question and clauses, so that the sentence vectors of the clauses carry sentiment semantic information, i.e., realizing the encoding of document clauses. After encoding, use a linear classifier to predict the clause encoding and extract the sentiment clause corresponding to the cause clause. Calculate the dynamic sentiment extraction task loss.

[0161] The specific implementation method of document clause encoding in step 2.1 is as follows:

[0162] Constructing the input to the pre-trained BERT model:

[0163]

[0164] The input contains two special markers, [CLS] and [SEP], as well as one question and N clauses. The i-th word representing the dynamic sentiment issue, w i,j This represents the j-th word in the i-th clause of the document. This input is fed into the BERT pre-trained model to obtain the BERT output:

[0165]

[0166] in h represents the hidden layer vector representation of the i-th word in the dynamic sentiment problem. i,j This represents the hidden layer vector representation of the j-th word in the i-th clause of the document. Then, a self-attention mechanism is used to aggregate the word vector representations to obtain the sentence vector representation of each clause and question.

[0167] H C ={h c1 ,h c2 ,...},

[0168] The vector representation of the clause is modeled using a graph attention network (GAT) to model document-level information, and the vector representation of the clause is updated accordingly.

[0169] H C ={h′ c1 ,h′ c2 ,...}, where h′ ci =GAT(h ci )

[0170] Concatenate the vector representation of each clause with the vector representation of the problem, and then update the clause vector representation:

[0171] H C ={h″ c1 ,h″ c2 ,...},in

[0172] The specific implementation method for the linear classifier to predict clause codes in step 2.1 is as follows:

[0173] Output H from the encoder C ={h″ c1 ,h″ c2 ...} is fed into a single-layer perceptron:

[0174]

[0175] Where w S ,b S These are the learnable parameters of a single-layer perceptron, and σ() is the logistic activation function. This represents the probability that the answer is True.

[0176] The specific implementation method of the dynamic emotion extraction task loss described in step 2.1 is as follows:

[0177]

[0178] in c represents the j-th clause in the i-th document. i,j It is the kth dynamic sentiment problem The true probability value of the answer is either 0 or 1. c represents the j-th clause in the i-th document. i,j It is the kth dynamic sentiment problem The predicted probability value of the answer is determined only if it is greater than 0.5, and the j-th clause is considered to be the answer to the k-th dynamic sentiment question.

[0179] Step 2.2: Based on Step 1, add a dynamic sentiment extraction task as the final round to extract the sentiment clause corresponding to each cause clause, making full use of explicit cause semantic information to improve the F1 score of the sentiment cause extraction task.

[0180] Step 3: Calculate the three losses L from steps 1.2, 1.3, and 2.1. e ,L c ,L r The total loss is obtained by summing the results. This loss is then used to train the sentiment cause pair extraction model until it converges. The model parameters are then recorded for use in the document sentiment cause pair extraction task.

[0181] Step 4: Input the sentiment cause pair extraction model trained in Step 3 into the document, and use the model to extract all sentiment cause pairs, that is, realize sentiment cause pair extraction based on multi-turn machine reading comprehension with a reflection mechanism.

[0182] Step four uses the sentiment reasoning extraction model trained in step three to extract all sentiment reasoning pairs. The implementation method is as follows:

[0183] Step 4.1: Static Sentiment Extraction Task. Construct a static sentiment question "Is this a sentiment clause?", and feed the static sentiment question and document clauses as input into the trained sentiment cause pair extraction model to extract all sentiment clauses in the document and obtain the probabilities corresponding to the sentiment clauses:

[0184] E = {e1, e2, ...}, P E ={p e1 ,p e2 ,...}

[0185] Where e i p represents the i-th sentiment clause in the document; ei This represents the probability of the i-th sentiment clause. A clause is considered a sentiment clause when this value is greater than 0.5.

[0186] Step 4.2: Dynamic Cause Extraction Task. Based on the sentiment clauses extracted in Step 4.1, construct a dynamic cause question template, "Is this the cause clause corresponding to ____?". Input the dynamic cause question and document clauses into the trained model to extract the cause clause and its probability for each sentiment clause in the document. This yields all candidate sentiment cause pairs and their probabilities.

[0187] Pair = {(e1,c1),(e2,c2),...}

[0188] Among them (e) i ,c i ) represents the emotional reason pair of the i-th candidate; This represents the probability of a candidate's emotional cause being correct.

[0189] The probability of the cause clause refers to the probability value that the clause is the cause clause corresponding to the sentiment clause. When the probability value is >0.5, the clause is considered a cause clause. The probability of the candidate sentiment cause pair is the product of the probability that the first clause is a sentiment clause and the probability that the second clause is the cause clause corresponding to the first clause.

[0190] Step 4.3: Reflection and Validation Mechanism, i.e., Dynamic Sentiment Extraction Task. Based on the causal clauses extracted in Step 4.2, construct a dynamic sentiment question template: "Is this the sentiment clause corresponding to ____?". Input the dynamic sentiment question and document clauses into the trained model. For each candidate sentiment cause pair, extract the sentiment clause corresponding to the causal clause. Adjust the probability value of the candidate sentiment cause pair using parameter α based on the extraction results. If the extracted sentiment clause matches the sentiment clause in the candidate sentiment cause pair, the validation is correct, and α = 1; otherwise, set α = 0.8. The updated probability values ​​of the candidate sentiment cause pairs are as follows:

[0191] in Use a threshold δ to filter out the correct sentiment reason pairs:

[0192]

[0193] Pair f Let δ represent the set of filtered emotional reason pairs, where δ = 0.8.

[0194] That is, to achieve the extraction of emotional cause pairs through multi-round machine reading comprehension based on a reflection mechanism.

[0195] Step 5: Apply the model obtained in the first four steps to public opinion monitoring and solve related technical problems.

[0196] The model is applied to online public opinion monitoring. Based on the emotional reasons extracted by the model, the emotional state of the target public opinion is analyzed. For the emotional reasons in public opinion that affect social stability, the corresponding reasons are eliminated to maintain a positive online public opinion and social stability.

[0197] This embodiment demonstrates the performance on a Weibo corpus. The multi-turn machine reading comprehension model of this invention is used to extract sentiment cause pairs from documents. Table 2 below compares the performance of this invention with other methods on this corpus. It can be seen that this invention is comprehensively superior to other methods, and can extract sentiment cause pairs more accurately. Based on the extracted sentiment cause pairs, it eliminates negative emotions and causes that have a negative impact on social stability, thereby achieving the effect of public opinion control.

[0198] Table 2 Comparison of the effects of different methods

[0199] method Accuracy (%) Recall rate (%) F1 score (%) ECPE-2D 72.92 65.44 68.89 PairGCN 76.92 67.91 72.02 RANKCP 71.19 76.30 73.60 ECPE-MLL 77.00 72.35 74.52 SL-NTS 72.43 63.66 67.76 IE 71.49 62.79 66.86 This invention 81.21 79.31 80.20

[0200] In summary, the sentiment reasoning pair extraction method based on multi-turn machine reading comprehension disclosed in this invention has achieved excellent results in analyzing public opinion on a Weibo corpus. The F1 score of the extracted document sentiment reasoning pairs exceeds 80%. Applying the extracted sentiment reasoning pairs can effectively eliminate public opinion reasons that affect social stability, and has high engineering application value.

[0201] The above detailed description further illustrates the purpose, technical solution, and beneficial effects of the invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A sentiment reasoning extraction method based on multi-turn machine reading comprehension, characterized by: Includes the following steps, Step 1: Extract sentiment reason pairs from documents based on a multi-turn machine reading comprehension method, and decompose the sentiment reason pair extraction task using a multi-turn structure; Step 2: Validate the extracted document sentiment cause pairs using a multi-round machine reading comprehension method with a reflective mechanism; Based on Step 1, add a dynamic sentiment extraction task as the final round to extract the sentiment clause corresponding to each cause clause. The dynamic sentiment extraction task refers to extracting the sentiment clause corresponding to each cause clause based on the results of the dynamic cause extraction task and with the help of explicit cause semantic information. Step one includes, Step 1.1: Decompose the emotional cause extraction task into a static emotional extraction task and a dynamic cause extraction task; The static sentiment extraction task refers to extracting all sentiment clauses in a document, while the dynamic cause extraction task refers to extracting the cause clauses corresponding to each sentiment clause based on the results of the static sentiment extraction task and with the help of explicit sentiment semantic information. Step 1.2: Static Sentiment Extraction Task; Design a static sentiment question, encode document clauses, and extract sentiment clauses based on the corresponding encodings of document clauses; The document clause encoding method is as follows: Use the pre-trained model BERT to perform word-level encoding on the static sentiment question and document clauses to obtain word vectors for the sentiment question and each word in each clause; Use a self-attention mechanism to aggregate word vectors for sentence-level encoding to obtain sentence vectors for the sentiment question and each clause; Use a graph attention network to model document-level relationships and update the sentence vectors of clauses; By concatenating the sentence vectors of the sentiment question and the sentence vectors of each clause, update the sentence vectors of the clauses again to realize the interaction between the question and clauses, so that the sentence vectors of the clauses carry sentiment semantic information, that is, to achieve the encoding of document clauses; After encoding, use a linear classifier to predict the clause encodings, extract sentiment clauses, and calculate the static sentiment extraction task loss; The static sentiment question refers to a pre-designed question used for static sentiment extraction tasks; Step 1.3: Dynamic Cause Extraction Task; Design a dynamic cause problem, encode document clauses, and extract the cause clauses corresponding to sentiment clauses based on the corresponding codes of document clauses; Calculate the loss of the dynamic cause extraction task based on the same encoding and prediction methods as in Step 1.2; The dynamic cause problem refers to using a problem template, in which the sentiment clauses extracted in step 1.2 are included to construct a problem for the dynamic cause extraction task; Step two includes: Step 2.1: Dynamic Emotion Extraction Task; Design a dynamic sentiment problem, encode document clauses, and extract sentiment clauses corresponding to cause clauses based on the corresponding codes of document clauses; calculate the dynamic sentiment extraction task loss based on the same encoding and prediction methods as in step 1.

2. The dynamic sentiment question refers to using a question template, in which the reason clauses extracted in step 1.3 are included, to construct a question for the dynamic sentiment extraction task; Step 3: Calculate the three losses L from steps 1.2, 1.3, and 2.

1. e ,L c ,L r The total loss is obtained by summing the results. The loss is then used to train the sentiment reason pair extraction model until it converges. The model parameters are recorded for use in the document sentiment reason pair extraction task. Step 4: Input the sentiment cause pair extraction model trained in Step 3 into the document, and use the model to extract all sentiment cause pairs, that is, realize sentiment cause pair extraction based on multi-turn machine reading comprehension with a reflection mechanism.

2. The sentiment reasoning extraction method based on multi-turn machine reading comprehension as described in claim 1, characterized in that: It also includes step five, which applies the sentiment reasons extracted in step four to the fields of natural language processing and machine learning to solve related technical problems; The related technical issues include intelligent text mining and services, social network information mining, emotion guidance, public opinion monitoring, and work efficiency prediction.

3. The sentiment reasoning extraction method based on multi-turn machine reading comprehension as described in claim 2, characterized in that: The model is applied to emotional intervention. Based on the emotional cause pairs extracted by the model, the emotional state of the target group and the reasons for the occurrence of such emotional state are analyzed. For the emotional cause pairs that affect the mental health of the target group, emotional intervention strategies are selected to eliminate the corresponding causes. The model is applied to online public opinion monitoring. Based on the emotional cause pairs extracted by the model, the emotional state of the target public opinion is analyzed. For the emotional cause pairs in public opinion that affect social stability, the corresponding causes are eliminated. The model is applied to predict work efficiency. Based on the emotional reasons extracted by the model, the work status of the target work group is analyzed, and the corresponding reasons affecting the work status are eliminated.

4. The sentiment reasoning extraction method based on multi-turn machine reading comprehension as described in claim 1, characterized in that: The specific implementation method of document clause encoding in step 2.1 is as follows: Constructing the input to the pre-trained BERT model: The input contains two special markers, [CLS] and [SEP], as well as one question and N clauses; The i-th word representing the dynamic sentiment issue, w i,j This represents the j-th word in the i-th clause of the document; this input is fed into the BERT pre-trained model to obtain the BERT output: in h represents the hidden layer vector representation of the i-th word in the dynamic sentiment problem. i,j The hidden layer vector representation represents the j-th word of the i-th clause in the document; then, a self-attention mechanism is used to aggregate the word vector representations to obtain the sentence vector representation of each clause and question: H C ={h c1 ,h c2 ,...}, The vector representation of the clause is modeled using a graph attention network (GAT) to model document-level information, and the vector representation of the clause is updated accordingly. H C ={h' c1 ,h' c2 ,...}, where h' ci =GAT(h ci ) Concatenate the vector representation of each clause with the vector representation of the problem, and then update the clause vector representation: H C ={h” c1 ,h” c2 ,...},in The specific implementation method for the linear classifier to predict clause codes in step 2.1 is as follows: Output H from the encoder C ={h” c1 ,h” c2 ...} is fed into a single-layer perceptron: Where w S ,b S These are the learnable parameters of a single-layer perceptron, and σ() is the logistic activation function. This represents the probability that the answer is True. The specific implementation method of the dynamic emotion extraction task loss described in step 2.1 is as follows: in c represents the j-th clause in the i-th document. i,j It is the kth dynamic sentiment problem The true probability value of the answer is either 0 or 1. c represents the j-th clause in the i-th document. i,j It is the kth dynamic sentiment problem The predicted probability value of the answer is used to determine whether the j-th clause is the answer to the k-th dynamic sentiment question. Only when the probability value is greater than 0.5 is the j-th clause considered to be the answer to the k-th dynamic sentiment question. Step 2.2: Based on Step 1, add a dynamic sentiment extraction task as the final round to extract the sentiment clause corresponding to each cause clause, making full use of explicit cause semantic information to improve the F1 score of the sentiment cause extraction task.

5. The sentiment reasoning extraction method based on multi-turn machine reading comprehension as described in claim 4, characterized in that: The specific implementation method of document clause encoding in step 1.2 is as follows: Constructing the input to the pre-trained BERT model: The input contains two special markers, [CLS] and [SEP], as well as one question and N clauses; The i-th word representing the static sentiment question, w i,j This represents the j-th word in the i-th clause of the document; the input is fed into BERT to obtain the BERT output: in h represents the vector representation of the i-th word in a static sentiment question. i,j The vector representation of the j-th word in the i-th clause of the document; the sentence vector representation of each clause and question is obtained by aggregating the word vector representations using a self-attention mechanism: H C ={h c1 ,h c2 ,...}, For the vector representation of the clause, a graph attention network (GAT) is used to model document-level information and update the clause vector representation: H C ={h' c1 ,h' c2 ,...}, where h' ci =GAT(h ci ) Concatenate the vector representation of each clause with the vector representation of the problem, and update the clause vector representation: H C ={h” c1 ,h” c2 ,...},in The specific implementation method of the linear classifier predicting clause codes in step 1.2 is as follows: Output H from the encoder C ={h” c1 ,h” c2 ...} is fed into a single-layer perceptron: Where w S ,b S These are the learnable parameters of a single-layer perceptron, and σ() is the logistic activation function. This represents the probability that the answer is True. The specific implementation method of the static sentiment extraction task loss described in step 1.2 is as follows: in c represents the j-th clause in the i-th document. i,j It is the kth static emotion problem The true probability value of the answer is either 0 or 1. c represents the j-th clause in the i-th document. i,j It is the kth static emotion problem The predicted probability value of the answer is determined only if it is greater than 0.5, and the j-th clause is considered to be the answer to the k-th static sentiment question.

6. The sentiment reasoning extraction method based on multi-turn machine reading comprehension as described in claim 5, characterized in that: The specific implementation method of document clause encoding in step 1.3 is as follows: Constructing the input to the pre-trained BERT model: The input contains two special markers, [CLS] and [SEP], as well as one question and N clauses; The i-th word representing the dynamic cause problem, w i,j This represents the j-th word in the i-th clause of the document; this input is fed into the BERT pre-trained model to obtain the BERT output: in h represents the hidden layer vector representation of the i-th word in the dynamic cause problem. i,j The hidden layer vector representation represents the j-th word of the i-th clause in the document; then, a self-attention mechanism is used to aggregate the word vector representations to obtain the sentence vector representation of each clause and question: H C ={h c1 ,h c2 ,...}, The vector representation of the clause is modeled using a graph attention network (GAT) to model document-level information, and the vector representation of the clause is updated accordingly. H C ={h' c1 ,h' c2 ,...}, where h' ci =GAT(h ci ) Concatenate the vector representation of each clause with the vector representation of the problem, and then update the clause vector representation: H C ={h” c1 ,h” c2 ,...},in The specific implementation method for the linear classifier to predict clause codes in step 1.3 is as follows: Output H from the encoder C ={h” c1 ,h” c2 ...} is fed into a single-layer perceptron: Where w S ,b S These are the learnable parameters of a single-layer perceptron, and σ() is the logistic activation function. This represents the probability that the answer is True. The specific implementation method of the dynamic cause extraction task loss described in step 1.3 is as follows: in c represents the j-th clause in the i-th document. i,j It is the kth dynamic cause problem. The true probability value of the answer is either 0 or 1. c represents the j-th clause in the i-th document. i,j It is the kth dynamic cause problem. The predicted probability value of the answer is determined only if it is greater than 0.5, and the j-th clause is considered to be the answer to the k-th dynamic cause problem.

7. The sentiment reasoning extraction method based on multi-turn machine reading comprehension as described in claim 6, characterized in that: The following is the implementation method for extracting all sentiment reason pairs using the sentiment reason pair extraction model trained in step three in step four. Step 4.1: Static sentiment extraction task; Construct a static sentiment question, and feed the static sentiment question and document clauses as input into the trained sentiment cause pair extraction model to extract all sentiment clauses in the document and obtain the probabilities corresponding to the sentiment clauses: E = {e1,e2,...}, P E ={p e1 ,p e2 ,...} Where e i p represents the i-th sentiment clause in the document. ei This represents the probability of the i-th sentiment clause; The probability of the sentiment clause refers to the probability value that the clause is considered a correct sentiment clause; Step 4.2: Dynamic Cause Extraction Task; Construct a dynamic cause question based on the sentiment clauses extracted in Step 4.

1. Input the dynamic cause question and document clauses into the trained model to extract the cause clauses and their probabilities for each sentiment clause in the document, thus obtaining all candidate sentiment cause pairs and their probabilities: Pair={(e1,c1),(e2,c2),...}, Among them (e) i ,c i () represents the emotional reason pair of the i-th candidate. This represents the probability of a candidate's emotional cause being correct; The probability of the cause clause refers to the probability value that the clause is the cause clause corresponding to the sentiment clause; the probability of the candidate sentiment cause pair refers to the product of the probability that the first clause is the sentiment clause and the probability that the second clause is the cause clause corresponding to the first clause; Step 4.3: Reflection and verification mechanism, i.e. dynamic sentiment extraction task; construct dynamic sentiment questions based on the causal clauses extracted in Step 4.2, and feed the dynamic sentiment questions and document clauses as inputs into the trained model. For each candidate sentiment cause pair, extract the sentiment clause corresponding to the causal clause; adjust the probability value of the candidate sentiment cause pair using parameter α based on the extraction results. If the extracted sentiment clause matches the sentiment clause in the candidate sentiment cause pair, the verification is correct, and α = 1; otherwise, the value of α is decreased. The updated probability values ​​of the candidate sentiment cause pairs are as follows: in Use a threshold δ to filter out the correct sentiment reason pairs: Pair f This represents the set of filtered emotional reason pairs; That is, to achieve the extraction of emotional cause pairs through multi-round machine reading comprehension based on a reflection mechanism.

Citation Information

Patent Citations

  • Comment sentiment analysis method and system, electronic equipment and storage medium

    CN113449519A

  • Knowledge assistance-based emotion-reason pair extraction system

    CN113486657A