Emotion-reason pair extraction method, device, equipment and readable storage medium

Through multi-layer fusion of Gaussian prior attention module and joint loss gradient update mechanism, the problem of insufficient utilization of position information between clauses in the existing technology is solved, efficient emotion-reason pair extraction is achieved, and emotion-reason pairs are improved. Capture accuracy and usefulness.

CN114357164BActive Publication Date: 2024-09-10WUHAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111639867.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-29
Publication Date
2024-09-10
Estimated Expiration
2041-12-29

AI Technical Summary

Technical Problem

Existing sentiment-reason pair extraction methods fail to fully utilize the relative position information between clauses in chapter-level documents, resulting in poor sentiment-reason pair capturing capabilities.

Method used

It uses a multi-layer fusion Gaussian prior attention module to generate a vectorized representation of the clause through self-attention and cross-attention mechanisms, and extracts emotion-reason pairs through the Cartesian product sum prediction formula, combined with the joint loss gradient update model parameters until convergence.

Benefits of technology

It effectively captures the relative position information between clauses in the document, automatically extracts potential emotion-reason pairs, and improves the accuracy and practical value of emotion-reason pair extraction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114357164B
    Figure CN114357164B
Patent Text Reader

Abstract

The present invention provides a sentiment-cause pair extraction method, device, equipment and readable storage medium, wherein the sentiment-cause pair extraction method comprises: after obtaining a document to be predicted of a natural language text, using a pre-trained language model to obtain the semantic representation of clauses in the document, and using a trained sentiment-cause pair extraction model to extract the sentiment-cause pairs in the document. The sentiment-cause pair extraction model comprises multiple layers of attention modules fused with Gaussian priors. During the training process of the sentiment-cause pair extraction model, the joint loss value when predicting the clause type and predicting the sentiment-cause pair is calculated, and the parameters of the sentiment-cause pair extraction model are updated with the gradient of the joint loss value until the joint loss value converges, and the training is terminated to obtain a trained sentiment-cause pair extraction model. The present invention fully captures the relative position information between clauses in the document, and can automatically extract potential sentiment-cause pairs in the document.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of natural language processing, and in particular to a method, device, equipment and readable storage medium for extracting emotion-cause pairs. Background Art

[0002] Sentiment-reason pair extraction is a task in the field of natural language processing, which aims to automatically extract sentiment clauses and their corresponding reason clauses from paragraph-level documents. A document consists of several clauses, which are defined as short sentences separated by symbols such as commas, as opposed to full sentences separated by periods. Sentiment-reason pair extraction has a wide range of application scenarios, including social media mining and product review analysis. Given its importance, more and more researchers have begun to pay attention to sentiment-reason pair extraction.

[0003] In a document, the sentiment clause and its corresponding reason clause contain a lot of speech information and have high research value. Existing sentiment-reason pair extraction algorithms do not fully consider the importance of the relative position between the sentiment clause and the reason clause, or only use simple position embedding to capture position information. Summary of the invention

[0004] The main purpose of the present invention is to provide a sentiment-cause pair extraction method, device, equipment and readable storage medium, aiming to solve the technical problems in the prior art that the paragraph-level sentiment-cause pair extraction method requires manual construction of a large number of text features and insufficient utilization of the relative position information between clauses, resulting in poor sentiment-cause pair capture ability.

[0005] In a first aspect, the present invention provides a method for extracting emotion-cause pairs, the method comprising the following steps:

[0006] Inputting the document to be predicted into the language model to obtain a vectorized representation of each clause in the document to be predicted;

[0007] Inputting the vectorized representation of each clause into the trained emotion-reason pair extraction model, and obtaining the emotion-reason pair in the document to be predicted based on the trained emotion-reason pair extraction model;

[0008] The step of obtaining the emotion-cause pairs in the document to be predicted based on the trained emotion-cause pair extraction model comprises:

[0009] Based on the self-attention module with the first fused Gaussian prior, the first vectorized representation of each clause is obtained;

[0010] Predicting the type of each clause based on the first vectorized representation of each clause, and dividing the clauses into a set of sentiment clauses and a set of reason clauses based on the type prediction value;

[0011] Based on the cross-attention module fused with Gaussian prior, the second vectorized representation of each clause in the emotion clause set and the reason clause set is obtained;

[0012] Applying Cartesian product to the sentiment clause set and the cause clause set, performing one-to-one concatenation operation on the second vectorized representation of each clause in the sentiment clause set and the second vectorized representation of each clause in the cause clause set, to obtain a vectorized representation of each candidate clause pair;

[0013] Based on the second self-attention module fused with Gaussian prior, a new vectorized representation of each candidate clause pair is obtained;

[0014] The sentiment-reason pair is predicted according to the new vectorized representation of each candidate clause pair, and the sentiment-reason pair in the to-be-predicted document is extracted based on the predicted value of the sentiment-reason pair.

[0015] Optionally, the step of obtaining a first vectorized representation of each clause based on the self-attention module fused with the first Gaussian prior includes:

[0016] The vectorized representation of each clause is input into the first self-attention module fused with Gaussian prior to obtain the first vectorized representation of each clause, where the formula of the first self-attention module fused with Gaussian prior is expressed as:

[0017]

[0018] Among them, s i is the first vectorized representation of clause i, c i is the vectorized representation of clause i, c j is the vectorized representation of any clause other than clause i in the document to be predicted, d i,j c i With c j The distance is a Gaussian prior, ∝1 and b1 are training parameters.

[0019] Optionally, the step of predicting the type of each clause based on the first vectorized representation of each clause includes:

[0020] The first vectorized representation of each clause is input into the first prediction formula, which is:

[0021]

[0022] in, Predict the type of clause i, s i is the first vectorized representation of clause i, W s and b sis the training parameter.

[0023] Optionally, the step of obtaining the second vectorized representation of each clause in the emotion clause set and the cause clause set based on the cross attention module fused with Gaussian prior includes:

[0024] The first vectorized representation of each clause in the sentiment clause set and the cause clause set is input into the cross-attention module fused with Gaussian prior to obtain the second vectorized representation of each clause in the sentiment clause set and the cause clause set, wherein the formula of the cross-attention module fused with Gaussian prior is expressed as:

[0025]

[0026]

[0027] in, is the second vectorized representation of clause i in the sentiment clause set, is the first vectorized representation of clause i in the sentiment clause set, is the second vectorized representation of clause j in the cause clause set, is the first vectorized representation of clause j in the cause clause set, d i,j d j,i for and The distance is a Gaussian prior, ∝2 and b2, ∝3 and b3 are training parameters.

[0028] Optionally, the step of obtaining a new vectorized representation of each candidate clause pair based on the self-attention module fused with the second Gaussian prior includes:

[0029] The vectorized representation of each candidate clause pair is input into the second self-attention module fused with Gaussian prior to obtain a new vectorized representation of each candidate clause pair, where the formula of the second self-attention module fused with Gaussian prior is expressed as:

[0030]

[0031] in, is the new vectorized representation of the candidate clause pair, h i,j is the vectorized representation of the candidate clause pair consisting of sentiment clause i and reason clause j, n is the number of clauses in the document to be predicted, and h i,m is the vectorized representation of the candidate clause pair consisting of the sentiment clause i and any clause in the cause clause set, d j,m is the distance between cause clause j and any clause in the cause clause set, is a Gaussian prior, ∝4 and b4 are training parameters.

[0032] Optionally, the step of predicting a sentiment-reason pair according to the new vectorized representation of each candidate clause pair includes:

[0033] The new vectorized representation of the candidate clause pair is input into the second prediction formula, which is:

[0034]

[0035] in, is the predicted value of the new vectorized representation of the candidate clause pair consisting of clause i and clause j, is the new vectorized representation of the candidate clause pair, W h and b h is the training parameter.

[0036] Optionally, the emotion-reason pair extraction method further includes:

[0037] Inputting the training document into the language model to obtain a vectorized representation of each clause in the training document;

[0038] Inputting the vectorized representation of each clause into a sentiment-reason pair extraction model, and obtaining a joint loss based on the sentiment-reason pair extraction model;

[0039] Updating the training parameters of the emotion-cause pair extraction model according to the joint loss gradient;

[0040] Check whether the joint loss converges;

[0041] If the joint loss does not converge, a new training document is used as the training document, and the step of inputting the training document into the language model to obtain a vectorized representation of each clause in the training document is returned;

[0042] If the joint loss converges, the latest emotion-cause pair extraction model is used as the trained emotion-cause pair extraction model;

[0043] The step of obtaining a joint loss based on the emotion-reason pair extraction model comprises:

[0044] Based on the self-attention module with the first fused Gaussian prior, the first vectorized representation of each clause is obtained;

[0045] Predicting the type of each clause based on the first vectorized representation of each clause, and dividing the clauses into a set of sentiment clauses and a set of reason clauses based on the type prediction value;

[0046] The type prediction value and type label value of each clause are input into the first loss function formula to obtain the first loss. The first loss function formula is:

[0047]

[0048] Among them, L clause is the first loss, n is the number of clauses in the training document, is the sentiment clause type label value of clause i, is the predicted value of the sentiment clause type of clause i, is the value of the cause clause type label of clause i, Predict the value of the cause clause type for clause i;

[0049] Based on the cross-attention module fused with Gaussian prior, the second vectorized representation of each clause in the updated emotion clause set and reason clause set is obtained;

[0050] Applying Cartesian product to the sentiment clause set and the cause clause set, performing one-to-one concatenation operation on the second vectorized representation of each clause in the sentiment clause set and the second vectorized representation of each clause in the cause clause set, to obtain a vectorized representation of each candidate clause pair;

[0051] Based on the second self-attention module fused with Gaussian prior, a new vectorized representation of each candidate clause pair is obtained;

[0052] Predicting sentiment-reason pairs according to the new vectorized representation of each candidate clause pair, and extracting sentiment-reason pairs in the training document based on the predicted values ​​of the sentiment-reason pairs;

[0053] The predicted value of the emotion-reason pair and the label value of the emotion-reason pair of each candidate clause pair are input into the second loss function formula to obtain the second loss. The second loss function formula is:

[0054]

[0055] Among them, L pair is the second loss, n is the number of clauses in the training document, is the label value of the sentiment-reason pair of the candidate clause pair, u i,j is the predicted value of the sentiment-reason pair for the candidate clause pair;

[0056] The first loss and the second loss are combined to obtain a joint loss.

[0057] In a second aspect, the present invention further provides a device for extracting emotion-cause pairs, the device comprising:

[0058] A clause vectorization representation module, used to input the document to be predicted into the language model to obtain a vectorization representation of each clause in the document to be predicted;

[0059] A sentiment-reason pair prediction module, used for inputting the vectorized representation of each clause into the trained sentiment-reason pair extraction model, and obtaining the sentiment-reason pair in the document to be predicted based on the trained sentiment-reason pair extraction model;

[0060] The step of obtaining the emotion-cause pairs in the document to be predicted based on the trained emotion-cause pair extraction model comprises:

[0061] Based on the self-attention module with the first fused Gaussian prior, the first vectorized representation of each clause is obtained;

[0062] Predicting the type of each clause based on the first vectorized representation of each clause, and dividing the clauses into a set of sentiment clauses and a set of reason clauses based on the type prediction value;

[0063] Based on the cross-attention module fused with Gaussian prior, the second vectorized representation of each clause in the emotion clause set and the reason clause set is obtained;

[0064] Applying Cartesian product to the sentiment clause set and the cause clause set, performing one-to-one concatenation operation on the second vectorized representation of each clause in the sentiment clause set and the second vectorized representation of each clause in the cause clause set, to obtain a vectorized representation of each candidate clause pair;

[0065] Based on the second self-attention module fused with Gaussian prior, a new vectorized representation of each candidate clause pair is obtained;

[0066] The sentiment-reason pair is predicted according to the new vectorized representation of each candidate clause pair, and the sentiment-reason pair in the to-be-predicted document is extracted based on the predicted value of the sentiment-reason pair.

[0067] Optionally, the emotion-reason pair prediction module is specifically used to:

[0068] The vectorized representation of each clause is input into the first self-attention module fused with Gaussian prior to obtain the first vectorized representation of each clause, where the formula of the first self-attention module fused with Gaussian prior is expressed as:

[0069]

[0070] Among them, s i is the first vectorized representation of clause i, c i is the vectorized representation of clause i, c j is the vectorized representation of any clause other than clause i in the document to be predicted, d i,j c i With c j The distance is a Gaussian prior, ∝1 and b1 are training parameters.

[0071] Optionally, the emotion-reason pair prediction module is specifically used to:

[0072] The first vectorized representation of each clause is input into the first prediction formula, which is:

[0073]

[0074] in, Predict the type of clause i, s i is the first vectorized representation of clause i, W s and b s is the training parameter.

[0075] Optionally, the emotion-reason pair prediction module is specifically used to:

[0076] The first vectorized representation of each clause in the sentiment clause set and the cause clause set is input into the cross-attention module fused with Gaussian prior to obtain the second vectorized representation of each clause in the sentiment clause set and the cause clause set, wherein the formula of the cross-attention module fused with Gaussian prior is expressed as:

[0077]

[0078]

[0079] in, is the second vectorized representation of clause i in the sentiment clause set, is the first vectorized representation of clause i in the sentiment clause set, is the second vectorized representation of clause j in the cause clause set, is the first vectorized representation of clause j in the cause clause set, d i,j ,d j,i for and The distance is a Gaussian prior, ∝2 and b2, ∝3 and b3 are training parameters.

[0080] Optionally, the emotion-reason pair prediction module is specifically used to:

[0081] The vectorized representation of each candidate clause pair is input into the second self-attention module fused with Gaussian prior to obtain a new vectorized representation of each candidate clause pair, where the formula of the second self-attention module fused with Gaussian prior is expressed as:

[0082]

[0083] in, is the new vectorized representation of the candidate clause pair, h i,j is the vectorized representation of the candidate clause pair consisting of sentiment clause i and reason clause j, n is the number of clauses in the document to be predicted, and h i,m is the vectorized representation of the candidate clause pair consisting of the sentiment clause i and any clause in the cause clause set, d j,m is the distance between cause clause j and any clause in the cause clause set, is a Gaussian prior, ∝4 and b4 are training parameters.

[0084] Optionally, the emotion-reason pair prediction module is specifically used to:

[0085] The new vectorized representation of the candidate clause pair is input into the second prediction formula, which is:

[0086]

[0087] in, is the predicted value of the new vectorized representation of the candidate clause pair consisting of clause i and clause j, is the new vectorized representation of the candidate clause pair, W h and b h is the training parameter.

[0088] Optionally, the emotion-reason pair extraction device further includes a training module, which is specifically used to:

[0089] Inputting the training document into the language model to obtain a vectorized representation of each clause in the training document;

[0090] Inputting the vectorized representation of each clause into a sentiment-reason pair extraction model, and obtaining a joint loss based on the sentiment-reason pair extraction model;

[0091] Updating the training parameters of the emotion-cause pair extraction model according to the joint loss gradient;

[0092] Check whether the joint loss converges;

[0093] If the joint loss does not converge, a new training document is used as the training document, and the step of inputting the training document into the language model to obtain a vectorized representation of each clause in the training document is returned;

[0094] If the joint loss converges, the latest emotion-cause pair extraction model is used as the trained emotion-cause pair extraction model;

[0095] The step of obtaining a joint loss based on the emotion-reason pair extraction model comprises:

[0096] Based on the self-attention module with the first fused Gaussian prior, the first vectorized representation of each clause is obtained;

[0097] Predicting the type of each clause based on the first vectorized representation of each clause, and dividing the clauses into a set of sentiment clauses and a set of reason clauses based on the type prediction value;

[0098] The type prediction value and type label value of each clause are input into the first loss function formula to obtain the first loss. The first loss function formula is:

[0099]

[0100] Among them, L clause is the first loss, n is the number of clauses in the training document, is the sentiment clause type label value of clause i, is the predicted value of the sentiment clause type of clause i, is the value of the cause clause type label of clause i, Predict the value of the cause clause type for clause i;

[0101] Based on the cross-attention module fused with Gaussian prior, the second vectorized representation of each clause in the updated emotion clause set and reason clause set is obtained;

[0102] Applying Cartesian product to the sentiment clause set and the cause clause set, performing one-to-one concatenation operation on the second vectorized representation of each clause in the sentiment clause set and the second vectorized representation of each clause in the cause clause set, to obtain a vectorized representation of each candidate clause pair;

[0103] Based on the second self-attention module fused with Gaussian prior, a new vectorized representation of each candidate clause pair is obtained;

[0104] Predicting sentiment-reason pairs according to the new vectorized representation of each candidate clause pair, and extracting sentiment-reason pairs in the training document based on the predicted values ​​of the sentiment-reason pairs;

[0105] The predicted value of the emotion-reason pair and the label value of the emotion-reason pair of each candidate clause pair are input into the second loss function formula to obtain the second loss. The second loss function formula is:

[0106]

[0107] Among them, L pair is the second loss, n is the number of clauses in the training document, is the label value of the sentiment-reason pair of the candidate clause pair, u i,j is the predicted value of the sentiment-reason pair for the candidate clause pair;

[0108] The first loss and the second loss are combined to obtain a joint loss.

[0109] In the third aspect, the present invention also provides an emotion-cause pair extraction device, which includes a processor, a memory, and an emotion-cause pair extraction program stored in the memory and executable by the processor, wherein when the emotion-cause pair extraction program is executed by the processor, the steps of the emotion-cause pair extraction method described above are implemented.

[0110] In a fourth aspect, the present invention also provides a readable storage medium, on which a program for extracting emotion-cause pairs is stored, wherein when the program for extracting emotion-cause pairs is executed by a processor, the steps of the method for extracting emotion-cause pairs as described above are implemented.

[0111] In the present invention, after obtaining the document to be predicted of the natural language text, the pre-trained language model is used to obtain the semantic representation of the clauses in the document, and the trained sentiment-cause pair extraction model is used to extract the sentiment-cause pairs in the document. Among them, the sentiment-cause pair extraction model includes multiple layers of attention modules that integrate Gaussian priors. During the training process of the sentiment-cause pair extraction model, the joint loss value when predicting the clause type and predicting the sentiment-cause pair is calculated, and the parameters of the sentiment-cause pair extraction model are updated with the joint loss value gradient until the joint loss value converges, and the training is terminated to obtain the trained sentiment-cause pair extraction model. The present invention fully captures the relative position information between clauses in the document, and can automatically extract potential sentiment-cause pairs in the document. BRIEF DESCRIPTION OF THE DRAWINGS

[0112] Figure 1 A schematic diagram of the hardware structure of an emotion-reason pair extraction device involved in an embodiment of the present invention;

[0113] Figure 2 It is a flow chart of an embodiment of a method for extracting emotion-reason pairs of the present invention;

[0114] Figure 3 A flow chart of another embodiment of the emotion-reason pair extraction method of the present invention;

[0115] Figure 4 A flowchart of another embodiment of the emotion-reason pair extraction method of the present invention;

[0116] Figure 5 This is a functional module diagram of an embodiment of an emotion-cause pair extraction device of the present invention.

[0117] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0118] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0119] In a first aspect, an embodiment of the present invention provides an emotion-cause pair extraction device.

[0120] Reference Figure 1 , Figure 1 The figure is a schematic diagram of the hardware structure of the emotion-cause pair extraction device involved in the embodiment of the present invention. In the embodiment of the present invention, the emotion-cause pair extraction device may include a processor 1001 (such as a central processing unit, CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components; the user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard); the network interface 1004 may optionally include a standard wired interface, a wireless interface (such as a wireless fidelity WIreless-FIdelity, WI-FI interface); the memory 1005 may be a high-speed random access memory (random access memory, RAM), or a stable memory (non-volatile memory), such as a disk storage, and the memory 1005 may optionally be a storage device independent of the aforementioned processor 1001. Those skilled in the art will understand that Figure 1 The hardware structure shown in the figure does not constitute a limitation of the present invention, and may include more or less components than those shown in the figure, or combine certain components, or arrange the components differently.

[0121] Continue to refer to Figure 1 , Figure 1 The memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and an emotion-cause pair extraction program. The processor 1001 may call the emotion-cause pair extraction program stored in the memory 1005 and execute the emotion-cause pair extraction method provided in the embodiment of the present invention.

[0122] In the second aspect, an embodiment of the present invention provides a method for extracting emotion-cause pairs.

[0123] Reference Figure 2 , Figure 2 Schematic diagram of a flow chart of an embodiment of the emotion-cause pair extraction method of the present invention.

[0124] In an embodiment of the emotion-cause pair extraction method of the present invention, the emotion-cause pair extraction method includes:

[0125] Step S10, inputting the document to be predicted into the language model to obtain a vectorized representation of each clause in the document to be predicted;

[0126] In this embodiment, the public data set contributed by the proposer of the ECPE task is selected, and the chapter documents and each clause are parsed from the text format file, and the text format files in the public data set are divided into training set, verification set, and test set in units of chapters. Before being input into the corresponding language model, the natural language text in the documents of the training set, verification set, and test set is constructed into the input format required by the language model, and the [CLS] tag is added to the beginning of the clause in the text, and the [SEP] tag is added to the end of the clause in the text. The BERT language model is instantiated, and the model parameters pre-trained using a large scale are loaded to obtain a pre-trained BERT language model. The word segmenter of the pre-trained BERT language model is used to segment the clauses, and the vectorization of each word in the clause in the document to be predicted is obtained. The vectorization of each word in the clause in the document to be predicted in the verification set is input into the pre-trained BERT language model to obtain the vectorized representation of each clause in the document to be predicted.

[0127] Step S20, inputting the vectorized representation of each clause into the trained emotion-reason pair extraction model, and obtaining the emotion-reason pair in the document to be predicted based on the trained emotion-reason pair extraction model;

[0128] Specifically, obtaining the emotion-reason pair in the document to be predicted based on the trained emotion-reason pair extraction model is implemented by the following steps:

[0129] Step S201, obtaining a first vectorized representation of each clause based on a self-attention module fused with a first Gaussian prior;

[0130] In this embodiment, refer to Figure 3 , Figure 3 The flowchart of another embodiment of the emotion-cause pair extraction method of the present invention is shown in FIG. The vectorized representation of each clause in the document to be predicted obtained in step S10 is input into the trained emotion-cause pair extraction model, wherein the self-attention module based on the first fused Gaussian prior in the emotion-cause pair extraction model enables each clause to integrate the information of other clauses in the document, and performs self-attention calculation on the clause to obtain the first updated vectorized representation of the clause, that is, the first vectorized representation of each clause.

[0131] Furthermore, in one embodiment, step S201 includes:

[0132] The vectorized representation of each clause is input into the first self-attention module fused with Gaussian prior to obtain the first vectorized representation of each clause, where the formula of the first self-attention module fused with Gaussian prior is expressed as:

[0133]

[0134] Among them, s i is the first vectorized representation of clause i, c i is the vectorized representation of clause i, c j is the vectorized representation of any clause other than clause i in the document to be predicted, d i,j c i With c j The distance is a Gaussian prior, ∝1 and b1 are training parameters.

[0135] In this embodiment, the vectorized representation of each clause is input into the first self-attention module fused with Gaussian prior to obtain the first vectorized representation of each clause, wherein the formula of the first self-attention module fused with Gaussian prior is expressed as: Among them, s i is the first vectorized representation of clause i, c i is the vectorized representation of clause i, c j is the vectorized representation of any clause other than clause i in the document to be predicted, d i,j c i With c j The distance is a Gaussian prior, ∝1 and b1 are training parameters.

[0136] Step S202, predicting the type of each clause based on the first vectorized representation of each clause, and dividing the clause into a set of sentiment clauses and a set of reason clauses based on the type prediction value;

[0137] In this embodiment, the first vectorized representation obtained in step S201 is obtained, and the type of each clause is predicted based on the first vectorized representation of each clause, and the clause types include cause clauses and sentiment clauses. Based on the obtained type prediction values, the clauses in the document to be predicted are divided to obtain a plurality of sentiment clauses and a plurality of cause clauses, wherein the plurality of sentiment clauses form a sentiment clause set, and the plurality of cause clauses form a cause clause set.

[0138] Furthermore, in one embodiment, the step of predicting the type of each clause based on the first vectorized representation of each clause includes:

[0139] The first vectorized representation of each clause is input into the first prediction formula, which is:

[0140]

[0141] in, Predict the type of clause i, s i is the first vectorized representation of clause i, W s and b s is the training parameter.

[0142] In this embodiment, the type of each clause is predicted based on the first vectorized representation of each clause, and the type prediction value can be calculated by inputting the first vectorized representation of each clause into a first prediction formula, where the first prediction formula is: in, Predict the type of clause i, s i is the first vectorized representation of clause i, W s and b s is the training parameter.

[0143] Step S203, based on the cross attention module fused with Gaussian prior, obtain the second vectorized representation of each clause in the emotion clause set and the cause clause set;

[0144] In this embodiment, based on step S202, the sentiment clause set and the cause clause set in the document to be predicted can be obtained, and based on the cross-attention module integrated with Gaussian prior, each sentiment clause in the sentiment clause set is obtained, the distance information between the sentiment clause and the cause clause is captured, and the sentiment clause in the sentiment clause set is integrated with the clause information of each cause clause in the cause clause set, and the second vectorized representation of each clause in the sentiment clause set is obtained. Based on the cross-attention module integrated with Gaussian prior, each cause clause in the cause clause set is obtained, the distance information between the cause clause and the sentiment clause is captured, and the cause clause in the cause clause set is integrated with the clause information of each sentiment clause in the sentiment clause set, and the second vectorized representation of each clause in the cause clause set is obtained.

[0145] Furthermore, in one embodiment, step S203 includes:

[0146] The first vectorized representation of each clause in the sentiment clause set and the cause clause set is input into the cross-attention module fused with Gaussian prior to obtain the second vectorized representation of each clause in the sentiment clause set and the cause clause set, wherein the formula of the cross-attention module fused with Gaussian prior is expressed as:

[0147]

[0148]

[0149] in, is the second vectorized representation of clause i in the sentiment clause set, is the first vectorized representation of clause i in the sentiment clause set, is the second vectorized representation of clause j in the cause clause set, is the first vectorized representation of clause j in the cause clause set, d i,j d j,i for and The distance is a Gaussian prior, ∝2 and b2, ∝3 and b3 are training parameters.

[0150] In this embodiment, the first vectorized representation of each clause in the emotion clause set and the cause clause set is input into the cross-attention module fused with Gaussian prior to obtain the second vectorized representation of each clause in the emotion clause set and the cause clause set, wherein the formula of the cross-attention module fused with Gaussian prior for the emotion clause is expressed as: The formula of the cross-attention module with Gaussian prior for the reason clause is expressed as: in, is the second vectorized representation of clause i in the sentiment clause set, is the first vectorized representation of clause i in the sentiment clause set, is the second vectorized representation of clause j in the cause clause set, is the first vectorized representation of clause j in the cause clause set, d i,j d j,i for and The distance is a Gaussian prior, ∝2 and b2, ∝3 and b3 are training parameters.

[0151] Step S204, applying a Cartesian product to the sentiment clause set and the cause clause set, performing a one-to-one concatenation operation on the second vectorized representation of each clause in the sentiment clause set and the second vectorized representation of each clause in the cause clause set, to obtain a vectorized representation of each candidate clause pair;

[0152] In this embodiment, the second vectorized representation of each clause in the emotion clause set and the reason clause set obtained in step S203 after the second update is obtained, and the Cartesian product is applied to the emotion clause set and the reason clause set, and the second vectorized representation of each clause in the emotion clause set and the second vectorized representation of each clause in the reason clause set are concatenated one by one to obtain the vectorized representation of each candidate clause pair. The calculation formula of the Cartesian product is: Among them, h i,j The vectorized representation of the candidate clause pairs obtained by one-to-one concatenation operation is: is the second vectorized representation of each clause in the sentiment clause set, is the second vectorized representation of each clause in the set of reason clauses.

[0153] Step S205, obtaining a new vectorized representation of each candidate clause pair based on the self-attention module fused with the second Gaussian prior;

[0154] In this embodiment, the vectorized representation of each candidate clause pair obtained in step S205 is obtained, and based on the self-attention module fused with the second Gaussian prior, each candidate clause pair is integrated with the information of other candidate clause pairs in the document, and self-attention calculation is performed on the candidate clause pair to obtain a new vectorized representation of each candidate clause pair.

[0155] Furthermore, in one embodiment, step S205 includes:

[0156] The vectorized representation of each candidate clause pair is input into the second self-attention module fused with Gaussian prior to obtain a new vectorized representation of each candidate clause pair, where the formula of the second self-attention module fused with Gaussian prior is expressed as:

[0157]

[0158] in, is the new vectorized representation of the candidate clause pair, h i,j is the vectorized representation of the candidate clause pair consisting of sentiment clause i and reason clause j, n is the number of clauses in the document to be predicted, and h i,m is the vectorized representation of the candidate clause pair consisting of the sentiment clause i and any clause in the cause clause set, d j,m is the distance between cause clause j and any clause in the cause clause set, is a Gaussian prior, ∝4 and b4 are training parameters.

[0159] In this embodiment, the vectorized representation of each candidate clause pair is input into the second self-attention module fused with Gaussian prior to obtain a new vectorized representation of each candidate clause pair, wherein the formula of the second self-attention module fused with Gaussian prior is expressed as: in, is the new vectorized representation of the candidate clause pair, h i,j is the vectorized representation of the candidate clause pair consisting of sentiment clause i and reason clause j, n is the number of clauses in the document to be predicted, and h i,m is the vectorized representation of the candidate clause pair consisting of the sentiment clause i and any clause in the cause clause set, d j,m is the distance between cause clause j and any clause in the cause clause set, is a Gaussian prior, ∝4 and b4 are training parameters.

[0160] Step S206, predicting the sentiment-reason pair according to the new vectorized representation of each candidate clause pair, and extracting the sentiment-reason pair in the document to be predicted based on the predicted value of the sentiment-reason pair.

[0161] In this embodiment, a new vectorized representation of the candidate clause pairs obtained in step S205 is obtained, and a sentiment-reason pair is predicted based on the new vectorized representation of each candidate clause pair. The types of candidate clause pairs include sentiment-reason pairs and non-sentiment-reason pairs. Based on the predicted values ​​of the sentiment-reason pairs, the sentiment-reason pairs in the document to be predicted are extracted.

[0162] Furthermore, in one embodiment, the step of predicting the emotion-reason pair according to the new vectorized representation of each candidate clause pair includes:

[0163] The new vectorized representation of the candidate clause pair is input into the second prediction formula, which is:

[0164]

[0165] in, is the predicted value of the new vectorized representation of the candidate clause pair consisting of clause i and clause j, is the new vectorized representation of the candidate clause pair, W h and b h is the training parameter.

[0166] In this embodiment, the new vectorized representation of the candidate clause pair is input into the second prediction formula, and the second prediction formula is: in, is the predicted value of the new vectorized representation of the candidate clause pair consisting of clause i and clause j, is the new vectorized representation of the candidate clause pair, W h and b h is the training parameter.

[0167] Furthermore, in one embodiment, the emotion-reason pair extraction method further includes:

[0168] Step S1, inputting a training document into a language model to obtain a vectorized representation of each clause in the training document;

[0169] Step S2, inputting the vectorized representation of each clause into a sentiment-reason pair extraction model, and obtaining a joint loss based on the sentiment-reason pair extraction model;

[0170] Step S3, updating the training parameters of the emotion-cause pair extraction model according to the joint loss gradient;

[0171] Step S4, detecting whether the joint loss converges;

[0172] If the joint loss does not converge, a new training document is used as the training document, and the process returns to step S1;

[0173] Step S5: if the joint loss converges, the latest emotion-cause pair extraction model is used as the trained emotion-cause pair extraction model;

[0174] Specifically, the joint loss obtained based on the emotion-reason pair extraction model is implemented by the following steps:

[0175] Based on the self-attention module with the first fused Gaussian prior, the first vectorized representation of each clause is obtained;

[0176] Predicting the type of each clause based on the first vectorized representation of each clause, and dividing the clauses into a set of sentiment clauses and a set of reason clauses based on the type prediction value;

[0177] The type prediction value and type label value of each clause are input into the first loss function formula to obtain the first loss. The first loss function formula is:

[0178]

[0179] Among them, L clause is the first loss, n is the number of clauses in the training document, is the sentiment clause type label value of clause i, is the predicted value of the sentiment clause type of clause i, is the value of the cause clause type label of clause i, Predict the value of the cause clause type for clause i;

[0180] Based on the cross-attention module fused with Gaussian prior, the second vectorized representation of each clause in the updated emotion clause set and reason clause set is obtained;

[0181] Applying Cartesian product to the sentiment clause set and the cause clause set, performing one-to-one concatenation operation on the second vectorized representation of each clause in the sentiment clause set and the second vectorized representation of each clause in the cause clause set, to obtain a vectorized representation of each candidate clause pair;

[0182] Based on the second self-attention module fused with Gaussian prior, a new vectorized representation of each candidate clause pair is obtained;

[0183] Predicting sentiment-reason pairs according to the new vectorized representation of each candidate clause pair, and extracting sentiment-reason pairs in the training document based on the predicted values ​​of the sentiment-reason pairs;

[0184] The predicted value of the emotion-reason pair and the label value of the emotion-reason pair of each candidate clause pair are input into the second loss function formula to obtain the second loss. The second loss function formula is:

[0185]

[0186] Among them, L pair is the second loss, n is the number of clauses in the training document, is the label value of the sentiment-reason pair of the candidate clause pair, u i,j is the predicted value of the sentiment-reason pair for the candidate clause pair;

[0187] The first loss and the second loss are combined to obtain a joint loss.

[0188] In this embodiment, refer to Figure 4 , Figure 4 The flowchart of another embodiment of the emotion-cause pair extraction method of the present invention is as follows. The training document is input into the language model to obtain the vectorized representation of each clause in the training document. The vectorized representation of each clause is input into the emotion-cause pair extraction model, and the joint loss is obtained based on the emotion-cause pair extraction model. Specifically, the joint loss obtained based on the emotion-cause pair extraction model is implemented by the following steps:

[0189] Based on the self-attention module of the first fused Gaussian prior, a first vectorized representation of each clause is obtained. The type of each clause is predicted based on the first vectorized representation of each clause, and a set of sentiment clauses and a set of reason clauses are obtained based on the type prediction value. The type prediction value and type label value of each clause are input into the first loss function formula to obtain the first loss, and the first loss function formula is: Among them, L clause is the first loss, n is the number of clauses in the training document, is the sentiment clause type label value of clause i, is the predicted value of the sentiment clause type of clause i, is the value of the cause clause type label of clause i, Predict the value of the cause clause type for clause i.

[0190] Based on the cross-attention module fused with Gaussian prior, the second vectorized representation of each clause in the updated sentiment clause set and the cause clause set is obtained. Cartesian product is applied to the sentiment clause set and the cause clause set, and the second vectorized representation of each clause in the sentiment clause set and the second vectorized representation of each clause in the cause clause set are concatenated one by one to obtain the vectorized representation of each candidate clause pair. Based on the second self-attention module fused with Gaussian prior, a new vectorized representation of each candidate clause pair is obtained. According to the new vectorized representation of each candidate clause pair, the sentiment-reason pair is predicted, and based on the predicted value of the sentiment-reason pair, the sentiment-reason pair in the training document is extracted. The predicted value of the sentiment-reason pair of each candidate clause pair and the label value of the sentiment-reason pair are input into the second loss function formula to obtain the second loss. The second loss function formula is: Among them, L pair is the second loss, n is the number of clauses in the training document, is the label value of the sentiment-reason pair of the candidate clause pair, u i,j is the predicted value of the sentiment-reason pair of the candidate clause pair. Combining the first loss and the second loss gives the joint loss.

[0191] The training parameters of the emotion-reason pair extraction model are updated according to the joint loss gradient. The training parameters include the training parameters of the first self-attention module fused with Gaussian prior: ∝1 and b1, the training parameters of the cross-attention module fused with Gaussian prior: ∝2 and b2, ∝3 and b3, the training parameters of the second self-attention module fused with Gaussian prior: ∝4 and b4, and the training parameters for clause type prediction: W s and b s , training parameters for sentiment-reason pair prediction: W h and b h . Check whether the joint loss converges. If the joint loss does not converge, use the new training document as the training document, and return to execute the step of inputting the training document into the language model to obtain the vectorized representation of each clause in the training document; if the joint loss converges, use the latest emotion-cause pair extraction model as the trained emotion-cause pair extraction model.

[0192] In this embodiment, after obtaining the document to be predicted of the natural language text, the pre-trained language model is used to obtain the semantic representation of the clauses in the document, and the trained emotion-cause pair extraction model is used to extract the emotion-cause pairs in the document. Among them, the emotion-cause pair extraction model includes multiple layers of attention modules that integrate Gaussian priors. During the training process of the emotion-cause pair extraction model, the joint loss value when predicting the clause type and predicting the emotion-cause pair is calculated, and the parameters of the emotion-cause pair extraction model are updated with the joint loss value gradient until the joint loss value converges, and the training is terminated to obtain the trained emotion-cause pair extraction model. The present invention fully captures the relative position information between clauses in the document, and can automatically extract potential emotion-cause pairs in the document. Compared with previous methods, the present invention is an end-to-end model rather than a step-by-step model, which avoids problems such as error propagation, and can extract implicit emotion-cause pairs in text documents at the chapter level, which is closer to actual application scenarios and has more practical value.

[0193] In a third aspect, an embodiment of the present invention also provides an emotion-cause pair extraction device.

[0194] Reference Figure 5 , a schematic diagram of the functional modules of an embodiment of an emotion-cause pair extraction device.

[0195] In this embodiment, the emotion-reason pair extraction device includes:

[0196] A clause vectorization representation module 10, used for inputting a document to be predicted into a language model to obtain a vectorization representation of each clause in the document to be predicted;

[0197] A sentiment-reason pair prediction module 20, used for inputting the vectorized representation of each clause into the trained sentiment-reason pair extraction model, and obtaining the sentiment-reason pair in the document to be predicted based on the trained sentiment-reason pair extraction model;

[0198] The step of obtaining the emotion-cause pairs in the document to be predicted based on the trained emotion-cause pair extraction model comprises:

[0199] Based on the self-attention module with the first fused Gaussian prior, the first vectorized representation of each clause is obtained;

[0200] Predicting the type of each clause based on the first vectorized representation of each clause, and dividing the clauses into a set of sentiment clauses and a set of reason clauses based on the type prediction value;

[0201] Based on the cross-attention module fused with Gaussian prior, the second vectorized representation of each clause in the emotion clause set and the reason clause set is obtained;

[0202] Applying Cartesian product to the sentiment clause set and the cause clause set, performing one-to-one concatenation operation on the second vectorized representation of each clause in the sentiment clause set and the second vectorized representation of each clause in the cause clause set, to obtain a vectorized representation of each candidate clause pair;

[0203] Based on the second self-attention module fused with Gaussian prior, a new vectorized representation of each candidate clause pair is obtained;

[0204] The sentiment-reason pair is predicted according to the new vectorized representation of each candidate clause pair, and the sentiment-reason pair in the to-be-predicted document is extracted based on the predicted value of the sentiment-reason pair.

[0205] Further, in one embodiment, the emotion-reason pair prediction module 20 is specifically used for:

[0206] The vectorized representation of each clause is input into the first self-attention module fused with Gaussian prior to obtain the first vectorized representation of each clause, where the formula of the first self-attention module fused with Gaussian prior is expressed as:

[0207]

[0208] Among them, s i is the first vectorized representation of clause i, c i is the vectorized representation of clause i, c j is the vectorized representation of any clause other than clause i in the document to be predicted, d i,j c i With c j The distance is a Gaussian prior, ∝1 and b1 are training parameters.

[0209] Further, in one embodiment, the emotion-reason pair prediction module 20 is specifically used for:

[0210] The first vectorized representation of each clause is input into the first prediction formula, which is:

[0211]

[0212] in, Predict the type of clause i, s i is the first vectorized representation of clause i, W s and b s is the training parameter.

[0213] Further, in one embodiment, the emotion-reason pair prediction module 20 is specifically used for:

[0214] The first vectorized representation of each clause in the sentiment clause set and the cause clause set is input into the cross-attention module fused with Gaussian prior to obtain the second vectorized representation of each clause in the sentiment clause set and the cause clause set, wherein the formula of the cross-attention module fused with Gaussian prior is expressed as:

[0215]

[0216]

[0217] in, is the second vectorized representation of clause i in the sentiment clause set, is the first vectorized representation of clause i in the sentiment clause set, is the second vectorized representation of clause j in the cause clause set, is the first vectorized representation of clause j in the cause clause set, d i,j ,d j,i for and The distance is a Gaussian prior, ∝2 and b2, ∝3 and b3 are training parameters.

[0218] Further, in one embodiment, the emotion-reason pair prediction module 20 is specifically used for:

[0219] The vectorized representation of each candidate clause pair is input into the second self-attention module fused with Gaussian prior to obtain a new vectorized representation of each candidate clause pair, where the formula of the second self-attention module fused with Gaussian prior is expressed as:

[0220]

[0221] in, is the new vectorized representation of the candidate clause pair, h i,j is the vectorized representation of the candidate clause pair consisting of sentiment clause i and reason clause j, n is the number of clauses in the document to be predicted, and h i,m is the vectorized representation of the candidate clause pair consisting of the sentiment clause i and any clause in the cause clause set, d j,m is the distance between cause clause j and any clause in the cause clause set, is a Gaussian prior, ∝4 and b4 are training parameters.

[0222] Further, in one embodiment, the emotion-reason pair prediction module 20 is specifically used for:

[0223] The new vectorized representation of the candidate clause pair is input into the second prediction formula, which is:

[0224]

[0225] in, is the predicted value of the new vectorized representation of the candidate clause pair consisting of clause i and clause j, is the new vectorized representation of the candidate clause pair, W h and b h is the training parameter.

[0226] Furthermore, in one embodiment, the emotion-reason pair extraction device further includes a training module, which is specifically used to:

[0227] Inputting the training document into the language model to obtain a vectorized representation of each clause in the training document;

[0228] Inputting the vectorized representation of each clause into a sentiment-reason pair extraction model, and obtaining a joint loss based on the sentiment-reason pair extraction model;

[0229] Updating the training parameters of the emotion-cause pair extraction model according to the joint loss gradient;

[0230] Check whether the joint loss converges;

[0231] If the joint loss does not converge, a new training document is used as the training document, and the step of inputting the training document into the language model to obtain a vectorized representation of each clause in the training document is returned;

[0232] If the joint loss converges, the latest emotion-cause pair extraction model is used as the trained emotion-cause pair extraction model;

[0233] The step of obtaining a joint loss based on the emotion-reason pair extraction model comprises:

[0234] Based on the self-attention module with the first fused Gaussian prior, the first vectorized representation of each clause is obtained;

[0235] Predicting the type of each clause based on the first vectorized representation of each clause, and dividing the clauses into a set of sentiment clauses and a set of reason clauses based on the type prediction value;

[0236] The type prediction value and type label value of each clause are input into the first loss function formula to obtain the first loss. The first loss function formula is:

[0237]

[0238] Among them, L clause is the first loss, n is the number of clauses in the training document, is the sentiment clause type label value of clause i, is the predicted value of the sentiment clause type of clause i, is the value of the cause clause type label of clause i, Predict the value of the cause clause type for clause i;

[0239] Based on the cross-attention module fused with Gaussian prior, the second vectorized representation of each clause in the updated emotion clause set and reason clause set is obtained;

[0240] Applying Cartesian product to the sentiment clause set and the cause clause set, performing one-to-one concatenation operation on the second vectorized representation of each clause in the sentiment clause set and the second vectorized representation of each clause in the cause clause set, to obtain a vectorized representation of each candidate clause pair;

[0241] Based on the second self-attention module fused with Gaussian prior, a new vectorized representation of each candidate clause pair is obtained;

[0242] Predicting sentiment-reason pairs according to the new vectorized representation of each candidate clause pair, and extracting sentiment-reason pairs in the training document based on the predicted values ​​of the sentiment-reason pairs;

[0243] The predicted value of the emotion-reason pair and the label value of the emotion-reason pair of each candidate clause pair are input into the second loss function formula to obtain the second loss. The second loss function formula is:

[0244]

[0245] Among them, L pair is the second loss, n is the number of clauses in the training document, is the label value of the sentiment-reason pair of the candidate clause pair, u i,j is the predicted value of the sentiment-reason pair for the candidate clause pair;

[0246] The first loss and the second loss are combined to obtain a joint loss.

[0247] Among them, the functional implementation of each module in the above-mentioned emotion-cause pair extraction device corresponds to the various steps in the above-mentioned emotion-cause pair extraction method embodiment, and its functions and implementation processes will not be repeated here one by one.

[0248] In a fourth aspect, an embodiment of the present invention further provides a readable storage medium.

[0249] The readable storage medium of the present invention stores an emotion-cause pair extraction program, wherein when the emotion-cause pair extraction program is executed by a processor, the steps of the emotion-cause pair extraction method as described above are implemented.

[0250] Among them, the method implemented when the emotion-cause pair extraction program is executed can refer to the various embodiments of the emotion-cause pair extraction method of the present invention, and will not be repeated here.

[0251] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.

[0252] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0253] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device to execute the methods described in each embodiment of the present invention.

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

Claims

1. A method for extracting emotion-reason pairs, characterized in that: The emotion-reason pair extraction method includes: Inputting the document to be predicted into the language model to obtain a vectorized representation of each clause in the document to be predicted; Inputting the vectorized representation of each clause into the trained emotion-reason pair extraction model, and obtaining the emotion-reason pair in the document to be predicted based on the trained emotion-reason pair extraction model; The step of obtaining the emotion-cause pairs in the document to be predicted based on the trained emotion-cause pair extraction model comprises: Based on the self-attention module with the first fused Gaussian prior, the first vectorized representation of each clause is obtained; Predicting the type of each clause based on the first vectorized representation of each clause, and dividing the clauses into a set of sentiment clauses and a set of reason clauses based on the type prediction value; Based on the cross-attention module fused with Gaussian prior, the second vectorized representation of each clause in the emotion clause set and the reason clause set is obtained; Applying Cartesian product to the sentiment clause set and the cause clause set, performing one-to-one concatenation operation on the second vectorized representation of each clause in the sentiment clause set and the second vectorized representation of each clause in the cause clause set, to obtain a vectorized representation of each candidate clause pair; Based on the second self-attention module fused with Gaussian prior, a new vectorized representation of each candidate clause pair is obtained; The sentiment-reason pair is predicted according to the new vectorized representation of each candidate clause pair, and the sentiment-reason pair in the to-be-predicted document is extracted based on the predicted value of the sentiment-reason pair.

2. The emotion-cause pair extraction method as claimed in claim 1, characterized in that: The step of obtaining a first vectorized representation of each clause based on the self-attention module of the first fused Gaussian prior comprises: The vectorized representation of each clause is input into the first self-attention module fused with Gaussian prior to obtain the first vectorized representation of each clause, where the formula of the first self-attention module fused with Gaussian prior is expressed as: Among them, s i is the first vectorized representation of clause i, c i is the vectorized representation of clause i, c j is the vectorized representation of any clause other than clause i in the document to be predicted, d i,j c i With c j The distance is a Gaussian prior, ∝1 and b1 are training parameters.

3. The emotion-cause pair extraction method according to claim 1, characterized in that: The step of predicting the type of each clause based on the first vectorized representation of each clause comprises: The first vectorized representation of each clause is input into the first prediction formula, which is: in, Predict the value of the type of clause i, s i is the first vectorized representation of clause i, W s and b s is the training parameter.

4. The emotion-cause pair extraction method according to claim 1, characterized in that: The step of obtaining the second vectorized representation of each clause in the emotion clause set and the cause clause set based on the cross attention module fused with Gaussian prior comprises: The first vectorized representation of each clause in the sentiment clause set and the cause clause set is input into the cross-attention module fused with Gaussian prior to obtain the second vectorized representation of each clause in the sentiment clause set and the cause clause set, wherein the formula of the cross-attention module fused with Gaussian prior is expressed as: in, is the second vectorized representation of clause i in the sentiment clause set, is the first vectorized representation of clause i in the sentiment clause set, is the second vectorized representation of clause j in the cause clause set, is the first vectorized representation of clause j in the cause clause set, d i,j d j,i for and The distance is a Gaussian prior, ∝2 and b2, ∝3 and b3 are training parameters.

5. The emotion-cause pair extraction method as claimed in claim 1, characterized in that: The step of obtaining a new vectorized representation of each candidate clause pair based on the self-attention module fused with the second Gaussian prior comprises: The vectorized representation of each candidate clause pair is input into the second self-attention module fused with Gaussian prior to obtain a new vectorized representation of each candidate clause pair, where the formula of the second self-attention module fused with Gaussian prior is expressed as: in, is the new vectorized representation of the candidate clause pair, h i,j is the vectorized representation of the candidate clause pair consisting of sentiment clause i and reason clause j, n is the number of clauses in the document to be predicted, and h i,m is the vectorized representation of the candidate clause pair consisting of the sentiment clause i and any clause in the cause clause set, d j,m is the distance between cause clause j and any clause in the cause clause set, is a Gaussian prior, ∝4 and b4 are training parameters.

6. The emotion-cause pair extraction method according to claim 1, characterized in that: The step of predicting the emotion-reason pair according to the new vectorized representation of each candidate clause pair includes: The new vectorized representation of the candidate clause pair is input into the second prediction formula, which is: in, is the predicted value of the new vectorized representation of the candidate clause pair consisting of clause i and clause j, is the new vectorized representation of the candidate clause pair, W h and b h is the training parameter.

7. The emotion-cause pair extraction method according to claim 1, characterized in that: The emotion-reason pair extraction method also includes: Inputting the training document into the language model to obtain a vectorized representation of each clause in the training document; Inputting the vectorized representation of each clause into a sentiment-reason pair extraction model, and obtaining a joint loss based on the sentiment-reason pair extraction model; Updating the training parameters of the emotion-cause pair extraction model according to the joint loss gradient; Check whether the joint loss converges; If the joint loss does not converge, a new training document is used as the training document, and the step of inputting the training document into the language model to obtain a vectorized representation of each clause in the training document is returned; If the joint loss converges, the latest emotion-cause pair extraction model is used as the trained emotion-cause pair extraction model; The step of obtaining a joint loss based on the emotion-reason pair extraction model comprises: Based on the self-attention module with the first fused Gaussian prior, the first vectorized representation of each clause is obtained; Predicting the type of each clause based on the first vectorized representation of each clause, and dividing the clauses into a set of sentiment clauses and a set of reason clauses based on the type prediction value; The type prediction value and type label value of each clause are input into the first loss function formula to obtain the first loss. The first loss function formula is: Among them, L clause is the first loss, n is the number of clauses in the training document, is the sentiment clause type label value of clause i, is the predicted value of the sentiment clause type of clause i, is the value of the cause clause type label of clause i, Predict the value of the cause clause type for clause i; Based on the cross-attention module fused with Gaussian prior, the second vectorized representation of each clause in the updated emotion clause set and reason clause set is obtained; Applying Cartesian product to the sentiment clause set and the cause clause set, performing one-to-one concatenation operation on the second vectorized representation of each clause in the sentiment clause set and the second vectorized representation of each clause in the cause clause set, to obtain a vectorized representation of each candidate clause pair; Based on the second self-attention module fused with Gaussian prior, a new vectorized representation of each candidate clause pair is obtained; Predicting sentiment-reason pairs according to the new vectorized representation of each candidate clause pair, and extracting sentiment-reason pairs in the training document based on the predicted values ​​of the sentiment-reason pairs; The predicted value of the emotion-reason pair and the label value of the emotion-reason pair of each candidate clause pair are input into the second loss function formula to obtain the second loss. The second loss function formula is: Among them, L pair is the second loss, n is the number of clauses in the training document, is the label value of the sentiment-reason pair of the candidate clause pair, u i,j is the predicted value of the sentiment-reason pair for the candidate clause pair; The first loss and the second loss are combined to obtain a joint loss.

8. An emotion-cause pair extraction device, characterized in that: The emotion-reason pair extraction device comprises: A clause vectorization representation module, used to input the document to be predicted into the language model to obtain a vectorization representation of each clause in the document to be predicted; A sentiment-reason pair prediction module, used for inputting the vectorized representation of each clause into the trained sentiment-reason pair extraction model, and obtaining the sentiment-reason pair in the document to be predicted based on the trained sentiment-reason pair extraction model; The step of obtaining the emotion-cause pairs in the document to be predicted based on the trained emotion-cause pair extraction model comprises: Based on the self-attention module with the first fused Gaussian prior, the first vectorized representation of each clause is obtained; Predicting the type of each clause based on the first vectorized representation of each clause, and dividing the clauses into a set of sentiment clauses and a set of reason clauses based on the type prediction value; Based on the cross-attention module fused with Gaussian prior, the second vectorized representation of each clause in the emotion clause set and the reason clause set is obtained; Applying Cartesian product to the sentiment clause set and the cause clause set, performing one-to-one concatenation operation on the second vectorized representation of each clause in the sentiment clause set and the second vectorized representation of each clause in the cause clause set, to obtain a vectorized representation of each candidate clause pair; Based on the second self-attention module fused with Gaussian prior, a new vectorized representation of each candidate clause pair is obtained; The sentiment-reason pair is predicted according to the new vectorized representation of each candidate clause pair, and the sentiment-reason pair in the to-be-predicted document is extracted based on the predicted value of the sentiment-reason pair.

9. An emotion-reason pair extraction device, characterized in that The emotion-cause pair extraction device includes a processor, a memory, and an emotion-cause pair extraction program stored in the memory and executable by the processor, wherein when the emotion-cause pair extraction program is executed by the processor, the steps of the emotion-cause pair extraction method as described in any one of claims 1 to 7 are implemented.

10. A readable storage medium, characterized in that: The readable storage medium stores an emotion-cause pair extraction program, wherein when the emotion-cause pair extraction program is executed by a processor, the steps of the emotion-cause pair extraction method as described in any one of claims 1 to 7 are implemented.