Text sentiment reason identification method, system, device and storage medium

By modeling causal narrative information using deep neural networks and attention mechanisms, this study addresses the problem of unutilized causal narrative information in existing text sentiment recognition, achieving more accurate identification of sentiment causes.

CN115391534BActive Publication Date: 2026-05-29UNIV OF SCI & TECH OF CHINA

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
UNIV OF SCI & TECH OF CHINA
Filing Date
2022-08-26
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing text sentiment recognition methods ignore causal narrative information, resulting in insufficient recognition performance.

Method used

By using deep neural networks and attention mechanisms, causal narrative information is modeled, causal relationships are learned, and the emotional causes of texts are identified.

Benefits of technology

Accurate prediction of sentiment cause clauses compensates for the lack of consideration of causal narrative information and improves the performance of text sentiment cause recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115391534B_ABST
    Figure CN115391534B_ABST
Patent Text Reader

Abstract

The application discloses a text sentiment reason recognition method, system, device and storage medium, aiming at the cause-effect narrative information contained in the sentiment cause-effect text, using a semantic modeling technology of a deep neural network, and fusing an attention mechanism, modeling the cause-effect narrative information of the document and learning the cause-effect correlation between the reasons and the results under the cause-effect narrative, so that the sentiment cause-effect semantics of the sentiment cause-effect text is accurately recognized, and the sentiment reasons of the text are recognized, and the deficiency that the cause-effect narrative information of the text is not considered in the existing text reason recognition research is made up.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of text sentiment cause recognition technology in the field of artificial intelligence, and in particular to a method, system, device and storage medium for text sentiment cause recognition. Background Technology

[0002] With the development of social media technology, social media platforms have accumulated a vast amount of text data, which contains rich emotional information. Emotional recognition of this data can help businesses better understand user needs and adjust business decisions, greatly contributing to the emotional intelligence of social media. It is worth noting that text sentiment recognition is only about "knowing what" the emotions in a text; it is also necessary to delve deeper into the emotions and understand their underlying causes. Tracing the causes of emotions from their surface appearance to their deeper meaning, and understanding the profound mechanisms of emotional expression, is also an important research area in social media text sentiment computing.

[0003] Currently, text sentiment cause identification tasks focus on semantic understanding at the lexical and sentence levels and have made significant progress. However, these methods often overlook the causal narrative information inherent in sentiment texts, thus their recognition performance needs further improvement. From a narratological perspective, causal narrative refers to statements about causal relationships in the evolution of events. It influences how humans conceptualize events and contributes to the representation and understanding of long texts. For example, in the ECE (Emotion Cause Extraction) sentiment text presented in this paper, the narrative contains sentiment phrase expressions and corresponding result expressions. The clause sequences corresponding to these expressions (e.g., clauses containing sentiment phrase expressions are sentiment cause clauses, and clauses containing corresponding result information are sentiment result clauses) together constitute the causal narrative of the text and are presented in the form of semantic structure, which is very helpful for understanding emotional causes at the structural level. Therefore, it is necessary to fully recognize and utilize the causal narrative information in social media texts to better promote the performance improvement of text sentiment cause tasks. Summary of the Invention

[0004] The purpose of this invention is to provide a method, system, device, and storage medium for identifying the cause of sentiment in text, which takes into account the causal narrative information contained in the sentiment text and can accurately predict the sentiment cause clause.

[0005] The objective of this invention is achieved through the following technical solution:

[0006] A method for identifying the causes of sentiment in text includes:

[0007] Based on the known sentiment phrases in the document, the sentiment result clauses are labeled, and the pre-trained language model is used to vectorize each clause of the document to obtain a set of vectorized semantic representations of the document;

[0008] By using result-aware emotional attention units and combining the vectorized semantic representation set of the document, we can mine the emotional causal relationship between the emotional result clause and other clauses, gain a preliminary understanding of the emotional causal relationship of the text, and obtain the text representation set of the document containing emotional causal relationship information.

[0009] By using the causal association units of narrative perception, the semantic coherence of causal narratives is utilized to learn the causal narratives in documents. Based on the text representation set of the documents containing emotional causal association information, the causal narrative representation set of the documents is obtained.

[0010] By using the result-aware emotional attention unit, combined with the document's causal narrative representation set, we can re-cognize the emotional causal relationship between the emotional result clause and other clauses, and obtain a re-cognized text representation set.

[0011] Based on the re-cognized text representation set, sentiment reason clause prediction is performed.

[0012] A text sentiment reasoning identification system, comprising:

[0013] The vectorized semantic representation set acquisition unit is used to tag sentiment result clauses based on known sentiment phrases in the document, and to vectorize each clause of the document using a pre-trained language model to obtain the vectorized semantic representation set of the document;

[0014] The text representation set acquisition unit is used to mine the emotional causal relationship between the emotional result clause and other clauses by combining the result-aware emotion attention unit with the vectorized semantic representation set of the document, thereby gaining a preliminary understanding of the emotional causal relationship of the text and obtaining the text representation set of the document containing the emotional causal relationship information.

[0015] The causal narrative representation set acquisition unit is used to learn the causal narrative in the document by using the semantic coherence of causal narrative through the causal association unit of narrative perception, and obtain the causal narrative representation set of the document based on the text representation set of the document containing emotional causal association information.

[0016] The re-cognized text representation set acquisition unit is used to re-cognize the emotional causal relationship between the emotional result clause and other clauses through the result-aware emotional attention unit, combined with the causal narrative representation set of the document, and obtain the re-cognized text representation set.

[0017] The prediction unit is used to predict sentiment reason clauses based on the re-cognized set of text representations.

[0018] A processing device includes: one or more processors; and a memory for storing one or more programs;

[0019] When the one or more programs are executed by the one or more processors, the one or more processors implement the aforementioned method.

[0020] A readable storage medium storing a computer program that, when executed by a processor, implements the aforementioned method.

[0021] As can be seen from the technical solution provided by the present invention, for the causal narrative information contained in emotional causal text, the semantic modeling technology of deep neural networks is used and the attention mechanism is integrated to model the causal narrative information of the document and learn the causal relationship between the cause and the result under the causal narrative, so as to accurately recognize the emotional causal semantics of emotional causal text, identify the emotional cause of the text, and make up for the lack of consideration of the causal narrative information of the text in the existing text cause identification research. Attached Figure Description

[0022] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0023] Figure 1 A flowchart illustrating a text sentiment reasoning recognition method provided in an embodiment of the present invention;

[0024] Figure 2 This is a schematic diagram of two candidate cause regions provided in an embodiment of the present invention;

[0025] Figure 3 This is a schematic diagram of a text sentiment reasoning recognition system provided in an embodiment of the present invention;

[0026] Figure 4 A schematic diagram of a processing device provided in an embodiment of the present invention; Detailed Implementation

[0027] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the protection scope of the present invention.

[0028] First, the following explanations are provided for the terms that may be used in this article:

[0029] The terms “including,” “comprising,” “containing,” “having,” or other similar semantic descriptions should be interpreted as non-exclusive inclusion. For example, “including a technical feature element (such as raw material, component, ingredient, carrier, dosage form, material, size, part, component, mechanism, device, step, process, method, reaction conditions, processing conditions, parameter, algorithm, signal, data, product or article of manufacture, etc.)” should be interpreted as including not only the expressly listed technical feature element, but also other technical feature elements that are not expressly listed and are well-known in the art.

[0030] The following provides a detailed description of a text sentiment reasoning recognition method, system, device, and storage medium provided by the present invention. Contents not described in detail in the embodiments of the present invention are prior art known to those skilled in the art. Where specific conditions are not specified in the embodiments of the present invention, they should be performed according to conventional conditions in the art or conditions recommended by the manufacturer.

[0031] Example 1

[0032] This invention provides a method for identifying the cause of sentiment in text. It aims to utilize causal narrative information to assist in the identification of sentiment cause clauses in text. This method fully utilizes known sentiment tags in causal text to perceive the causal structure of the text, thereby inferring candidate regions for sentiment cause clauses. Then, guided by the causal structure, it predicts sentiment cause clauses by modeling the strong causal correlation between candidate regions of sentiment cause in the causal narrative and known sentiment result clauses. The main principle can be described as follows: based on narrative common sense, the phrase representing the overall sentiment tag of the causal text (referred to as the document) is the sentiment phrase of the document. Correspondingly, the only clause in the sentiment text that is sentimentally consistent with this sentiment phrase can be regarded as the sentiment result clause of the sentiment text. Moreover, in causal narrative research, scholars have noted that causal narratives and result narratives not only have strong semantic consistency but also a definite temporal relationship, namely: causal narratives are sequential causal narratives (the sentiment cause clause in the causal narrative precedes the sentiment result clause), or causal narratives are reverse causal narratives (the sentiment cause clause in the causal narrative follows the sentiment result clause). Based on this, this invention focuses on the cognitive understanding of causal narratives in emotional causal texts, and identifies emotional cause clauses based on the emotional semantic relevance of the causal narrative in the document. For example... Figure 1 The diagram shown is a flowchart of a text sentiment reasoning recognition method provided by an embodiment of the present invention, which mainly includes the following steps:

[0033] Step 1: Tag sentiment result clauses based on known sentiment phrases in the document, and use a pre-trained language model to vectorize each clause of the document to obtain a set of vectorized semantic representations of the document.

[0034] In this embodiment of the invention, given a document D and an emotional phrase ep Among them, the emotional phrase e p The overall sentiment label for document D can be considered as the sentiment outcome of this causal text. This takes into account the sentiment outcome phrase e. p The clause that is emotionally consistent with the only clause in document D is designated as the emotional outcome clause. Based on this, relevant clauses are marked as emotional outcome clauses to understand the causal narrative of document D and facilitate narrative comprehension in subsequent stages. Specifically, in this embodiment of the invention, the phrase 'e' in document D can be located through string matching operations. p The position of the clause is used to mark the emotional outcome clause.

[0035] In this embodiment of the invention, the number of clauses in document D is denoted as n, and the sentiment result clause is the k-th clause. Then, document D takes the following form:

[0036]

[0037] Where 'c' represents a clause, and the subscript is the clause number. The clause representing the sentiment result, k∈(1,n).

[0038] Next, document D is input into a pre-trained language model to obtain its vector representation. Considering the excellent performance of the pre-trained language model BERT in semantic representation, especially the superior performance of its evolved model BERT-wwm based on whole-word masking technology on a large-scale Chinese corpus, this embodiment of the invention selects the BERT-wwm model to vectorize document D, obtaining a set of vectorized semantic representations of the document:

[0039]

[0040] Among them, E b Let x represent the set of vectorized semantic representations of a document, where x is the vectorized semantic representation of a clause. For emotional result clause Vectorized semantic representation.

[0041] Step 2: By using the result-aware emotional attention unit and combining it with the vectorized semantic representation set of the document, we can mine the emotional causal relationship between the emotional result clause and other clauses, gain a preliminary understanding of the emotional causal relationship of the text, and obtain the text representation set of the document that contains emotional causal relationship information.

[0042] This step aims to utilize known sentiment outcome clauses. This invention designs an outcome-aware emotion attention unit (REA) to model and learn emotional causal relationships in emotional text, in order to initially recognize the emotional causal relationships in the document. Considering the crucial role of clause representation quality in causal relationship modeling, this invention first focuses on the accurate representation of clauses, and then implements emotional causal relationship modeling between clauses.

[0043] Because BiLSTM (Bidirectional Long Short-Term Memory) excels at modeling longer texts and capturing their contextual information, in this embodiment of the invention, BiLSTM is used to process document D, ensuring that the semantics of each clause do not deviate from the document's context:

[0044] E h =BiLSTM(E b )

[0045] in, The hidden state of each clause in document D processed by BiLSTM, i.e., the set of text representations of the document containing emotional and causal information, d h Let be the dimension of the hidden state in BiLSTM, and h represent the contextual representation of a clause. This is the hidden state of the sentiment result clause; in this case, it is the sentiment result clause. The representation with document context is obtained by incorporating the context information of document D into the representation of each clause in the manner described above.

[0046] After obtaining a good representation of each clause of document D by integrating the document context, this embodiment of the invention models emotional causal relationships based on known emotional outcome clauses. According to narrative common sense, clauses in a causal narrative differ in the degree of their causal relationship. Specifically, in this invention, the stronger the semantic relevance between each clause of document D and the emotional outcome clause, the more likely that clause is an emotional cause clause. Given that the attention mechanism in deep learning models can simulate human attention, distinguishing differences in received information and focusing on more critical information, this invention employs an attention mechanism to capture the different causal relationships between the emotional outcome clause of document D and other clauses, obtaining the attention weight score between each other clause and the emotional outcome clause, expressed as:

[0047]

[0048]

[0049] Where W1, W2 and W3 represent the trainable parameters in the emotional attention unit of result perception, and matrix M is an intermediate variable; This represents the attention weight score vector, containing the attention weight scores for each other clause and the sentiment outcome clause. The attention weight scores represent the representations of the clause and the sentiment outcome clause. Emotional causal relationship.

[0050] Next, the attention weight score vector With the set of contextualized representations E of all clauses h This prompts the model of this invention (i.e., the model constituted by the entire scheme of this invention) to pay more attention to information with higher semantic relevance to the emotional outcome:

[0051]

[0052] in, Let be the set of textual representations of a document containing information about emotional causal relationships, representing a preliminary understanding of the emotional causal relationships in document D.

[0053] Step 3: By using the causal relationship units of narrative perception, learn the causal narrative in the document by utilizing the semantic coherence of causal narrative, and obtain the causal narrative representation set of the document based on the text representation set of the document containing emotional causal relationship information.

[0054] This step utilizes the causal narrative characteristics of narratology to model the causal narrative information of document D. According to research, existing narratological research mainly focuses on the sequential semantic modeling of document clauses. However, these sequential semantic-based narrative models are not suitable for modeling causal narrative relationships in causal texts. This is because affective cause clauses and affective result clauses in causal texts are not always narrated sequentially. According to the causal narrative characteristics of narratology, causal narratives typically include sequential narratives (affective cause clauses precede affective result clauses) and reverse narratives (affective cause clauses follow affective result clauses). This means that the region before or after the affective result clause in a causal text can be considered as a candidate causal region of the text.

[0055] Therefore, in this embodiment of the invention, based on the characteristics of causal narrative, the document is divided into two candidate cause regions according to the location of the emotional result clause. The two candidate cause regions include: the region from the first clause to the kth clause, referred to as the first candidate cause region; and the region from the kth clause to the nth clause, referred to as the second candidate cause region; where the kth clause is the emotional result clause, and n is the number of clauses in the document. Based on the two candidate cause regions, the corresponding text representation is obtained from the text representation of the document containing emotional causal association information, and is denoted as the first sequence. With the second sequence 's' represents a text representation of a clause containing emotional causal relationship information, derived from the document, with the subscript indicating the clause number. A textual representation of an emotional outcome clause that implies a causal relationship between emotions. For example... Figure 2 As shown, the two candidate cause regions and their related sequences are presented.

[0056] The above discussion indicates that document D may contain two candidate causal relationships: one that may exist in the first candidate cause region and the sentiment outcome clause. Between, another possibility exists in the second candidate cause region and between.

[0057] Based on the role of causality in narrative comprehension, the aforementioned causal narrative cognition of document D helps to pinpoint the exact regions of its causal clauses. Building upon this, this invention designs a narrative-aware causal association unit (NCA) to address the emotional outcome clauses of document D. Modeling two possible causal narratives for two candidate cause regions yields two causal narrative associations. These two associations are then integrated to obtain the document's causal narrative association vector *r*. Subsequently, *r* is integrated into the document's textual representation set containing implied emotional causal associations, resulting in the document's causal narrative representation set, expressed as:

[0058] E c =r·W4E u

[0059] Among them, E u W4 represents the set of text representations of a document that contain causal information about emotions, and W4 represents the trainable parameters in the causal unit of narrative perception. The causal narrative representation of document D, d m This is the dimension of the hidden layer of causal association units in narrative perception. Guided by causal narrative representation, this invention can capture the causal narrative information of emotional causal documents, which is beneficial for the identification of emotional cause clauses.

[0060] The following section introduces a preferred implementation method for modeling the causal narrative information of the sentiment outcome clause and the two candidate cause regions mentioned in the above scheme to obtain two causal narrative association information, and integrating the two causal narrative association information to obtain the causal narrative association vector of the document.

[0061] (1) Remove the last element of the first sequence to obtain the first subsequence, remove the first element of the second sequence to obtain the second subsequence, use the Long Short-Term Memory Network to process the first subsequence and the second subsequence respectively, and use the output of the last time step of the Long Short-Term Memory Network as the overall semantic representation of each subsequence.

[0062] Taking the first candidate cause region as an example, the corresponding first sequence is: Considering the textual representation of sentiment outcome clauses This refers to the known sentiment outcome of the first candidate cause region, which may contain a causal statement. That is, the textual representation of the sentiment outcome clause. With the first subsequence {s1,...,s k-1 There may be a causal relationship between the first sequence (i.e., the first sequence minus the last element). Inspired by the semantic coherence of cause and effect in causal narratives, the textual representation of affective result clauses... With the first subsequence {s1,...,s k-1 The potential causal relationship between them is manifested in the strong semantic coherence between them. Therefore, this invention models the textual representation of sentiment outcome clauses. With the first subsequence {s1,...,s k-1 The semantic association between} is used to measure the possible causal relationship between the two, thereby realizing the causal narrative modeling of the first candidate cause region.

[0063] Specifically, based on the semantic consistency within the discourse, in the first candidate cause region, the first subsequence {s1,...,s...} k-1} and its adjacent clause (i.e., the sentiment outcome clause) The semantics of the text representation of the sequence {s1,...,s} are consistent. That is, the semantics of the sequence {s1,...,s} are consistent. k-1 The overall semantic representation of} and the textual representation of adjacent clauses Semantically, they are very similar. Considering the excellent performance of LSTM in processing and understanding sequence semantics, this invention utilizes LSTM to process the first subsequence {s1,...,s...}. k-1 The output of the last time step of the LSTM is used as the overall semantic representation of this sequence.

[0064] f r1 =LSTM([s1,s2,...,s k-1 ])

[0065] in, For the sequence {s1,s2,...,s} k-1 The overall semantic representation of}.

[0066] Similarly, removing the first element of the second sequence yields the second subsequence {s}. k+1 ,...,s n}, and input them into an LSTM to obtain the corresponding overall semantic representation f. r2 :f r2 =LSTM([s k+1 ,...,s n]).

[0067] (2) For each subsequence, calculate the similarity between the corresponding overall semantic representation and the text representation containing the emotional causal association information of the emotional result clause. Use the similarity as the causal narrative association information of the sequence to which the subsequence belongs. The length of the causal narrative association information corresponding to each sequence is equal to the sequence length. Each element in the causal narrative association information is equal to the corresponding similarity.

[0068] This invention references the modeling methods for narrative information in story continuation research, and uses cosine similarity to measure the first subsequence {s1,...,s...} k-1 The overall semantic representation of f r1 The text representation of its actual adjacent clauses The semantic similarity β1 between them is calculated using the following formula:

[0069]

[0070] Similarly, substituting the semantic representation f r2 Calculate the second subsequence {s k+1 ,...,s n The overall semantic representation of f r2 Text representation of its adjacent clauses The semantic similarity β2 between them:

[0071]

[0072] (3) The causal narrative association information corresponding to the two sequences is converted into a vector form of the same dimension by copying and filling operations, and then integrated by taking the average value to obtain the causal narrative association vector of the document.

[0073] As mentioned earlier, the length of the causal narrative association information corresponding to each sequence (i.e., the first sequence and the second sequence) is equal to the sequence length, and each element in the causal narrative association information is equal to the corresponding similarity. Therefore, there may be cases where the lengths of the two sequences are inconsistent. For ease of calculation, this invention converts β1 and β2 into vector forms of the same dimension through copying and padding operations:

[0074]

[0075] Where, vector Let r represent the causal narrative association information of the t-th candidate cause region. The number of clauses in the first candidate cause region is k, and the number of clauses in the second candidate cause region is n-k+1. Furthermore, considering the global and local relationships between document D and the two candidate cause regions, r... u1 and r u2This only concerns the possible local causal narratives of document D. Therefore, it is necessary to include r u1 and r u2 Integrate these elements to express the global causal narrative relationships of document D. Furthermore, given r u1 and r u2 Each clause contains causal narrative information located in the k-th clause (i.e., the sentiment outcome clause). This invention achieves r by taking the average value. u1 and r u2 The integration is represented as:

[0076] r = (r u1 +r u2 ) / 2

[0077] in, Let be the causal narrative association vector of document D.

[0078] Step 4: By using the emotional attention unit of result perception, combined with the causal narrative representation set of the document, re-cognize the emotional causal relationship between the emotional result clause and other clauses, and obtain the re-cognized text representation set.

[0079] Considering the multiple comprehension processes people go through when reading long texts, this step again uses the REA unit to understand the causal relationships in document D. Specifically, this invention uses the causal narrative representation set E of the document obtained in step 3 above. c The input is fed into the REA unit for secondary causal modeling, represented as:

[0080] E ru =REA(E c )

[0081] in, It is a collection of textual representations after a re-cognition of emotional causal relationships.

[0082] In this step, guided by causal narrative information, we can more accurately perceive the emotional causal relationship in document D. The specific details of this step are basically similar to step 2, the only difference being that previously we were using the vectorized semantic representation set E of the document. b At this point, we are introducing E, which contains information representing a causal narrative. c The semantic representation of document D is not elaborated here.

[0083] Step 5: Predict sentiment reason clauses based on the re-cognized text representation set.

[0084] In this embodiment of the invention, the re-cognized text representation corresponding to each clause in the re-cognized text representation set is sequentially input into a fully connected network and an activation function layer for processing to predict the probability that each clause in the document is a sentiment reason clause. The prediction process is represented as follows:

[0085] p = Sigmoid(FC(E) ru ))

[0086] Where FC represents a fully connected layer, and Sigmoid represents the Sigmoid activation function. This is the probability vector for prediction, where each element represents the probability that each clause is a sentiment cause clause.

[0087] Then, the clause with the highest probability is selected as the sentiment reason clause, and the selected sentiment reason clause is the result of text sentiment reason identification.

[0088] The above describes the main process of a text sentiment cause recognition method provided by an embodiment of the present invention. It should be noted that the result-aware sentiment attention unit and the narrative-aware causal association unit involved in the above method need to be trained. During the training phase, a loss function is constructed based on the predicted probability that each clause in the document is a sentiment cause clause and the true label, expressed as:

[0089]

[0090] Where m represents the number of documents in the training corpus, and n represents the number of clauses in a document. Let be the true label of the j-th clause in the i-th document of the corpus. This represents the probability that the j-th clause of the i-th document is a sentiment reason clause.

[0091] The parameters in the emotional attention unit for result perception and the causal association unit for narrative perception, namely the four trainable parameters W1 to W4 mentioned above, are updated using a loss function. The parameter update method involved here can refer to conventional techniques, and will not be elaborated upon in this invention.

[0092] Example 2

[0093] This invention also provides a text sentiment reasoning recognition system, which is mainly based on the method provided in the foregoing embodiments, such as... Figure 3 As shown, the system mainly includes:

[0094] The vectorized semantic representation set acquisition unit is used to tag sentiment result clauses based on known sentiment phrases in the document, and to vectorize each clause of the document using a pre-trained language model to obtain the vectorized semantic representation set of the document;

[0095] The text representation set acquisition unit is used to mine the emotional causal relationship between the emotional result clause and other clauses by combining the result-aware emotion attention unit with the vectorized semantic representation set of the document, thereby gaining a preliminary understanding of the emotional causal relationship of the text and obtaining the text representation set of the document containing the emotional causal relationship information.

[0096] The causal narrative representation set acquisition unit is used to learn the causal narrative in the document by using the semantic coherence of causal narrative through the causal association unit of narrative perception, and obtain the causal narrative representation set of the document based on the text representation set of the document containing emotional causal association information.

[0097] The re-cognized text representation set acquisition unit is used to re-cognize the emotional causal relationship between the emotional result clause and other clauses through the result-aware emotional attention unit, combined with the causal narrative representation set of the document, and obtain the re-cognized text representation set.

[0098] The prediction unit is used to predict sentiment reason clauses based on the re-cognized set of text representations.

[0099] Those skilled in the art will understand that, for the sake of convenience and brevity, the above-described division of functional modules is used as an example. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the system can be divided into different functional modules to complete all or part of the functions described above.

[0100] Example 3

[0101] The present invention also provides a processing device, such as Figure 4 As shown, it mainly includes: one or more processors; a memory for storing one or more programs; wherein, when the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in the foregoing embodiments.

[0102] Furthermore, the processing device also includes at least one input device and at least one output device; in the processing device, the processor, memory, input device, and output device are connected via a bus.

[0103] In this embodiment of the invention, the specific types of the memory, input device, and output device are not limited; for example:

[0104] Input devices can be touchscreens, image acquisition devices, physical buttons, or mice, etc.

[0105] The output device can be a display terminal;

[0106] The memory can be random access memory (RAM) or non-volatile memory, such as disk storage.

[0107] Example 4

[0108] The present invention also provides a readable storage medium storing a computer program that, when executed by a processor, implements the method provided in the foregoing embodiments.

[0109] In this embodiment of the invention, the readable storage medium is a computer-readable storage medium and can be disposed in the aforementioned processing device, for example, as a memory in the processing device. Furthermore, the readable storage medium can also be any medium capable of storing program code, such as a USB flash drive, portable hard drive, read-only memory (ROM), magnetic disk, or optical disk.

[0110] The above description is merely a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for identifying the causes of sentiment in text, characterized in that, include: Based on the known sentiment phrases in the document, the sentiment result clauses are labeled, and the pre-trained language model is used to vectorize each clause of the document to obtain a set of vectorized semantic representations of the document; By using result-aware emotional attention units and combining the vectorized semantic representation set of the document, we can mine the emotional causal relationship between the emotional result clause and other clauses, gain a preliminary understanding of the emotional causal relationship of the text, and obtain the text representation set of the document containing emotional causal relationship information. By using narrative perception causal association units and leveraging the semantic coherence of causal narratives to learn causal narratives in documents, and based on the text representation set containing emotional causal association information of the document, a causal narrative representation set of the document is obtained. This includes: dividing the document into two candidate cause regions according to the location of the emotional result clause, based on the characteristics of causal narratives; modeling the causal narrative information of the emotional result clause and the two candidate cause regions respectively to obtain two causal narrative association information; and integrating the two causal narrative association information to obtain the causal narrative association vector of the document. ; causal narrative correlation vector By integrating these textual representations into the document's set of implied emotional and causal information, a set of causal narrative representations of the document is obtained. , is represented as: ;in, W4 represents the set of text representations that contain emotional causal information of a document, and W4 represents the trainable parameters in the causal unit of narrative perception. By using the result-aware emotional attention unit, combined with the document's causal narrative representation set, we can re-cognize the emotional causal relationship between the emotional result clause and other clauses, and obtain a re-cognized text representation set. Based on the re-cognized text representation set, predict sentiment reason clauses; Specifically, the process of modeling the causal narrative information of the sentiment outcome clause and the two candidate cause regions before and after it to obtain two causal narrative association information, and integrating the two causal narrative association information to obtain the causal narrative association vector of the document includes: The two candidate reason regions are: the region from the first clause to the kth clause, called the first candidate reason region; and the region from the kth clause to the nth clause, called the second candidate reason region; where the kth clause is the sentiment result clause, and n is the number of clauses in the document; Based on the two candidate cause regions, the corresponding text representations are obtained from the text representation of the document containing emotional causal relationship information, and this is denoted as the first sequence. With the second sequence s represents a text representation of a clause containing emotional causal relationship information, which is a text representation of the emotional causal relationship information from the document, and the subscript is the clause number. The textual representation of emotional outcome clauses that imply causal relationships of emotions; The first subsequence is obtained by removing the last element of the first sequence, and the second subsequence is obtained by removing the first element of the second sequence. The first subsequence and the second subsequence are processed by the Long Short-Term Memory Network respectively, and the output of the last time step of the Long Short-Term Memory Network is used as the overall semantic representation of each subsequence. For each subsequence, the similarity between the corresponding overall semantic representation and the text representation containing the emotional causal relationship information of the sentiment result clause is calculated. The similarity is used as the causal narrative relationship information of the sequence to which the subsequence belongs. The length of the causal narrative relationship information corresponding to each sequence is equal to the length of the sequence. Each element in the causal narrative relationship information is equal to the corresponding similarity. By copying and padding operations, the causal narrative information corresponding to the two sequences is converted into vectors of the same dimension. Then, the vectors are integrated by taking the average value to obtain the causal narrative vector of the document.

2. The text sentiment reasoning identification method according to claim 1, characterized in that, The step of tagging sentiment result clauses based on known sentiment phrases in the document and vectorizing each clause of the document using a pre-trained language model to obtain a set of vectorized semantic representations of the document includes: Given a document and emotional phrases Among them, emotional phrases For document The overall sentiment label in the document In Chinese, with emotional phrases Clauses that are emotionally consistent are called emotional outcome clauses; [The document] Let n be the number of clauses, and let the sentiment result clause be the k-th clause. Then the document... The form is: ; Where 'c' represents a clause, and the subscript is the clause number. Clauses indicating emotional results, ; Document Inputting the data into a pre-trained language model yields a set of vectorized semantic representations of the document: ; in, The set of vectorized semantic representations of a document. A vectorized semantic representation of a clause. For emotional result clause Vectorized semantic representation.

3. The text sentiment reasoning identification method according to claim 1, characterized in that, The steps of using a result-aware emotional attention unit, combined with the document's vectorized semantic representation set, to mine the emotional causal relationships between emotional result clauses and other clauses, to preliminarily understand the emotional causal relationships in the text, and to obtain a text representation set containing emotional causal relationship information of the document include: A bidirectional long short-term memory network is used to process the vectorized semantic representation set of the document to obtain a set of representations of all clauses with contextual information. , , This indicates a clause that carries contextual information; the subscript is the clause number. A contextual representation of the emotional outcome clause; We use an attention mechanism to mine the causal relationships between the sentiment outcome clause and other clauses, and obtain the attention weight score between each other clause and the sentiment outcome clause, which is represented as: ; ; Where W1, W2, and W3 represent the trainable parameters in the outcome-aware emotion attention unit, matrix As an intermediate variable; This represents the attention weight score vector, which contains the attention weight scores for each of the other clauses and the sentiment outcome clause; attention weight score vector With the set of contextualized representations of all clauses This yields a set of textual representations of a document that contain information about emotional causal relationships.

4. The text sentiment reasoning identification method according to claim 1, characterized in that, The prediction of sentiment cause clauses based on the re-cognized text representation set includes: The re-cognized text representations of each clause in the re-cognized text representation set are sequentially input into a fully connected network and an activation function layer for processing. The probability of each clause in the document being a sentiment cause clause is predicted, and the clause with the highest probability is selected as the sentiment cause clause.

5. The text sentiment reasoning identification method according to claim 4, characterized in that, The method also includes: a training phase, in which a loss function is constructed based on the probability that each clause in the predicted document is a sentiment-causing clause and the true label, expressed as: ; Where m represents the number of documents in the training corpus, and n represents the number of clauses in a document. Let be the true label of the j-th clause in the i-th document of the corpus. This represents the probability that the j-th clause of the i-th document is a sentiment reason clause. The parameters in the emotional attention unit of the result perception and the causal association unit of the narrative perception are updated using a loss function.

6. A text sentiment reasoning recognition system, characterized in that, Based on the method described in any one of claims 1 to 5, the system comprises: The vectorized semantic representation set acquisition unit is used to tag sentiment result clauses based on known sentiment phrases in the document, and to vectorize each clause of the document using a pre-trained language model to obtain the vectorized semantic representation set of the document; The text representation set acquisition unit is used to mine the emotional causal relationship between the emotional result clause and other clauses by combining the result-aware emotion attention unit with the vectorized semantic representation set of the document, thereby gaining a preliminary understanding of the emotional causal relationship of the text and obtaining the text representation set of the document containing the emotional causal relationship information. The causal narrative representation set acquisition unit is used to learn the causal narrative in the document by using the semantic coherence of causal narrative through the causal association unit of narrative perception, and obtain the causal narrative representation set of the document based on the text representation set of the document containing emotional causal association information. The re-cognized text representation set acquisition unit is used to re-cognize the emotional causal relationship between the emotional result clause and other clauses through the result-aware emotional attention unit, combined with the causal narrative representation set of the document, and obtain the re-cognized text representation set. The prediction unit is used to predict sentiment reason clauses based on the re-cognized set of text representations.

7. A processing device, characterized in that, include: One or more processors; Memory, used to store one or more programs; Wherein, when the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1 to 5.

8. A readable storage medium storing a computer program, characterized in that, When a computer program is executed by a processor, it implements the method as described in any one of claims 1 to 5.