Aspect-level sentiment triple extraction method and system based on bidirectional generation
By introducing a bidirectional generation framework and syntactic encoder into the generative model, combining the hidden state characteristics of the semantic encoder, using a dynamic gate mechanism to process and fuse semantic syntactic information to extract aspects and opinions, the problem of error matching and complex structure processing of emotional triple extraction in the existing technology is solved, and a more efficient triple extraction effect is achieved.
Patent Information
- Application Number
- CN202510104820.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-23
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2045-01-23
AI Technical Summary
In the aspect emotion triple extraction task, the existing generative model considers that the mutual information cues between aspect terms and opinion terms are not comprehensive, which is prone to mismatched triples, and it is difficult to deal with complex structures such as multi-word terms and multiple triple sentences.
A method of aspect-level affective triple extraction based on bidirectional generation is proposed. Through a bidirectional generation framework, the model helps decode disordered multitudes, uses a syntactic encoder to introduce syntactic dependency type, tree-based distance and relative position distance information, combines the hidden state characteristics output by the semantic encoder, and uses a dynamic gate mechanism to process and fuse semantic syntactic information, and finally extracts aspects and opinion features through linear transformation.
Effectively capture mutual information clues between terms and opinions, reduce the impact of generation order, improve the accuracy of emotional triple extraction, and especially when dealing with complex structures.
Smart Images

Figure CN119538938B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of aspect-level sentiment analysis, and in particular to a method and system for extracting aspect-level sentiment triples based on bidirectional generation. Background Art
[0002] Aspect-level sentiment triple extraction requires extracting all aspect terms, opinion terms, and sentiment polarities in a sentence and exploring the corresponding relationships between them. Aspect-level sentiment analysis can provide a more detailed basis for decision-making and has certain application needs in areas such as social media, online shopping reviews, and public opinion monitoring.
[0003] At present, the generative model has achieved great success in the task of extracting aspect sentiment triples. However, there are still two problems to be solved:
[0004] The generative model does not fully consider the mutual information clues between aspect terms and opinion terms, which may produce incorrectly matched triplets. Although some researchers have introduced bidirectional generation and achieved good results, they only consider the dependency between aspect terms and opinion terms in the target sequence, while ignoring the impact of the order in the input text on the target sequence results; some researchers have also introduced syntactic information to establish mutual information clues between aspect terms and opinion terms, but have not considered the impact of different syntactic dependency types on the extraction of aspect-level sentiment triplets.
[0005] Since the generative model requires token-by-token decoding and simple structured prompts, the model cannot handle complex structures, especially multi-word terms and multi-triplet sentences. To address this problem, some researchers decode aspect-level sentiment triplets using non-autoregressive methods, but this method cannot utilize the rich world knowledge of the pre-trained generative model. Some researchers also consider that the position information of words can help locate boundaries, and use a method that simultaneously generates span positions and semantic representations to decode aspect-level sentiment triplets, but due to the structure of semi-autoregressive decoding, this method is still prone to incorrectly locating opinion terms. Summary of the invention
[0006] In view of the above situation, the main purpose of the present invention is to propose an aspect-level sentiment triple extraction method and system based on bidirectional generation to solve the above technical problems.
[0007] The present invention proposes an aspect-level sentiment triple extraction method based on bidirectional generation, and the method comprises the following steps:
[0008] Step 1: Input a sentence into a term output template, sort the triples in the sentence in ascending order according to the end index of the aspect term and the end index of the opinion term, and output the adjusted sentence, wherein the term output template includes an aspect term output template and an opinion term output template;
[0009] Step 2: Use the term output template to model the adjusted sentence through the semantic encoder to obtain the hidden state features output by the semantic encoder;
[0010] Step 3, input the adjusted sentence into the syntax editor to obtain the word embedding matrix of the syntax editor, and analyze the adjusted sentence through dependency syntax to obtain the dependency relationship representation between words, the tree-based distance representation, and the relative position distance representation; then obtain the hidden state features of the relationship graph attention network through the word embedding matrix of the syntax editor, the dependency relationship representation between words, the tree-based distance representation, and the relative position distance representation;
[0011] Step 4: The hidden state features output by the semantic encoder and the hidden state features of the relationship graph attention network are processed using a dynamic gate mechanism, and the syntactic weights are dynamically adjusted according to the output of the semantic channel, and finally the hidden state features of semantic and syntactic information fusion are obtained;
[0012] Step 5: Based on the semantic and syntactic information, hidden state features are fused, and aspect features and opinion features are extracted and obtained through linear transformation, and then aspect mark feature vectors and opinion mark feature vectors are further obtained through aspect features and opinion features;
[0013] Based on the aspect marking feature vector and the opinion marking feature vector, the probability of the aspect marking feature vector and the probability of the opinion marking feature vector are obtained respectively;
[0014] Step 6: The semantic and syntactic information is fused with the hidden state features and input into the prediction decoder to obtain the output hidden state vector;
[0015] Based on the output hidden state vector and the semantic and syntactic information, the hidden state features are fused to further obtain the predicted distribution of candidate indexes;
[0016] The prediction results are obtained through the predicted distribution of candidate indexes.
[0017] The present invention also proposes an aspect-level sentiment triple extraction system based on bidirectional generation, the system comprising:
[0018] Encoder modules for:
[0019] Inputting a sentence into a term output template, sorting the triples in the sentence in ascending order according to the end index of the aspect term and the end index of the opinion term, and outputting the adjusted sentence, wherein the term output template includes an aspect term output template and an opinion term output template;
[0020] Using the term output template, the adjusted sentence is modeled to obtain the hidden state features output by the semantic encoder;
[0021] The word embedding matrix of the syntax editor is obtained by using the adjusted sentence, and the adjusted sentence is analyzed by dependency syntax to obtain the dependency relationship representation between words, the tree-based distance representation, and the relative position distance representation; the hidden state characteristics of the relationship graph attention network are obtained by using the word embedding matrix of the syntax editor, the dependency relationship representation between words, the tree-based distance representation, and the relative position distance representation;
[0022] Feature fusion module, used for:
[0023] The hidden state features output by the semantic encoder and the hidden state features of the graph attention network are processed using a dynamic gate mechanism, and the syntactic weights are dynamically adjusted according to the output of the semantic channel, ultimately obtaining the hidden state features that fuse semantic and syntactic information.
[0024] Predictive decoder module for:
[0025] Based on the fusion of semantic and syntactic information, hidden state features are extracted and obtained through linear transformation, and then aspect features and opinion features are further obtained through aspect features and opinion features to obtain aspect labeling feature vectors and opinion labeling feature vectors.
[0026] Based on the aspect marking feature vector and the opinion marking feature vector, the probability of the aspect marking feature vector and the probability of the opinion marking feature vector are obtained respectively;
[0027] The hidden state features are fused through semantic and syntactic information to obtain the output hidden state vector;
[0028] Based on the output hidden state vector and the semantic and syntactic information, the hidden state features are fused to further obtain the predicted distribution of candidate indexes;
[0029] The prediction results are obtained through the predicted distribution of candidate indexes.
[0030] Compared with the prior art, the present invention has the following beneficial effects:
[0031] 1. The present invention proposes an aspect-level sentiment triple extraction method based on bidirectional generation, which uses a bidirectional generation framework to help the model decode unordered tuples. The order between sentiment tuples does not exist naturally, and the generation of the current tuple should not be conditioned on the previous tuple. The generation from aspect terms to opinion terms and from opinion terms to aspect terms can help the model capture the mutual information clues between aspect terms and opinion terms on the one hand, and reduce the influence of the generation order on the other hand, so as to better decode sentiment triples;
[0032] 2. The present invention uses the syntactic encoder to introduce syntactic dependency types, tree-based distances and relative position distance information to enhance the mutual information clues between aspect terms and opinion terms. Specifically, by constructing a word pair relationship matrix to obtain the word pair relationship representation of the sentence, and combining the relationship graph attention network to integrate the word unit's part-of-speech features and word pair relationship representation, the model can explore deeper interactions between sentiment elements, and use a feature fusion module to fuse semantic encoding information and syntactic encoding information;
[0033] 3. The present invention improves the ability of the generative model to handle complex structures by adding a sequence labeling subtask, guiding the generative model to capture the boundary information of aspect / opinion spans, and providing hints for decoding multiple triplets using shared tags.
[0034] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description or learned through embodiments of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 A flowchart of the aspect-level sentiment triple extraction method based on bidirectional generation proposed by the present invention;
[0036] Figure 2 A schematic diagram of a bidirectional generation framework of the aspect-level sentiment triple extraction method based on bidirectional generation proposed in the present invention;
[0037] Figure 3 This is the overall structure diagram of the aspect-level sentiment triple extraction method based on bidirectional generation proposed by the present invention;
[0038] Figure 4 A schematic diagram of a dependency tree of the aspect-level sentiment triple extraction method based on bidirectional generation proposed in the present invention;
[0039] Figure 5 Schematic diagram of the overall framework of the aspect-level sentiment triple extraction system based on bidirectional generation proposed in the present invention. DETAILED DESCRIPTION
[0040] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.
[0041] These and other aspects of the embodiments of the present invention will be apparent with reference to the following description and accompanying drawings. In these descriptions and accompanying drawings, some specific implementations of the embodiments of the present invention are specifically disclosed to represent some ways of implementing the principles of the embodiments of the present invention, but it should be understood that the scope of the embodiments of the present invention is not limited thereto.
[0042] See also Figure 1 , Figure 2 and Figure 3 The embodiment of the present invention proposes a method for extracting aspect-level sentiment triples based on bidirectional generation, and the method comprises the following steps:
[0043] Step 1: Input a sentence into a term output template, sort the triples in the sentence in ascending order according to the end index of the aspect term and the end index of the opinion term, and output the adjusted sentence, wherein the term output template includes an aspect term output template and an opinion term output template;
[0044] In step 1, the sentence is input into the term output template, and the triples in the sentence are sorted in ascending order according to the end index of the aspect term and the end index of the opinion term. The corresponding relationship in the process is:
[0045] ;
[0046] in, The output template represents the triples of aspect terms that are prioritized according to the input sentence. Indicates aspect term hints, and denote the start index and end index of the opinion term, respectively. Expression of opinion term tips, and denote the start index and end index of the opinion term, respectively. Indicates emotional polarity prompts, Indicates emotional polarity.
[0047] Step 2: Use the term output template to model the adjusted sentence through the semantic encoder to obtain the hidden state features output by the semantic encoder;
[0048] In step 2, the adjusted sentence is modeled through the semantic encoder using the term output template to obtain the hidden state features output by the semantic encoder. The corresponding process has the following relationship:
[0049] ;
[0050] in, represents the hidden state features output by the semantic encoder, represents the word embedding matrix of the semantic encoder, A marker indicating the start of A marker indicating the end. represents the input sentence, represents the word embedding layer processing of the pre-trained language model, represents the encoder layer processing of the pre-trained language model, Both represent word embedding vectors.
[0051] Step 3, input the adjusted sentence into the syntax editor to obtain the word embedding matrix of the syntax editor, and analyze the adjusted sentence through dependency syntax to obtain the dependency relationship representation between words, the tree-based distance representation, and the relative position distance representation; then obtain the hidden state features of the relationship graph attention network through the word embedding matrix of the syntax editor, the dependency relationship representation between words, the tree-based distance representation, and the relative position distance representation;
[0052] See also Figure 4 In step 3, the adjusted sentence is input into the syntax editor to obtain the word embedding matrix of the syntax editor, and the adjusted sentence is analyzed by dependency syntax to obtain the dependency relationship representation between words, the tree-based distance representation, and the relative position distance representation; then the hidden state features of the relationship graph attention network are obtained by the word embedding matrix of the syntax editor, the dependency relationship representation between words, the tree-based distance representation, and the relative position distance representation. The specific steps are as follows:
[0053] Based on the part-of-speech tag sequence, the word embedding matrix of the syntax editor is obtained using the syntax editor. The relationship between the corresponding process is:
[0054] ;
[0055] in, represents the word embedding matrix of the syntax editor, represents a randomly initialized learnable embedding layer process, Represents the part-of-speech tag sequence corresponding to the adjusted sentence, Both represent the embedding vectors corresponding to the part-of-speech tag sequence;
[0056] Analyze the adjusted sentences through dependency syntax to obtain the dependency relationship representation between words, the tree-based distance representation, and the relative position distance representation;
[0057] Construct a word pair relationship graph, and concatenate the dependency representation, tree-based distance representation, and relative position distance representation to obtain the word pair relationship embedding representation. Then, the word pair relationship vector is obtained through the word pair relationship embedding representation. The relationship between the corresponding process is:
[0058] ;
[0059] in, Represents the word pair relationship embedding representation, Dependency type embedding representation, represents the tree-based distance embedding representation, Represents the relative position distance embedding representation;
[0060] Based on the word embedding matrix and word pair relationship vector of the syntactic editor, the word pair relationship graph is updated through the relationship graph attention network, and the hidden state features of the relationship graph attention network are output at the same time. The relationship between the corresponding process is:
[0061] ;
[0062] in, Represents the relationship graph attention network The output of the layer hidden state vector, represents the total number of attention heads, represents the number of attention heads, Indicates that it has been processed by the SELU activation function. Representation Node The neighbor set of Representation Node No. neighbor nodes, Indicates Layer The normalization coefficient of the attention head, Indicates Layer The parameter matrix of the attention head for the graph node is, Represents the relationship graph attention network The output of the layer The hidden state vector of the neighboring nodes, Indicates The parameter matrix of the layer for the graph edge, Represents the word pair relationship vector.
[0063] Step 4: The hidden state features output by the semantic encoder and the hidden state features of the relationship graph attention network are processed using a dynamic gate mechanism, and the syntactic weights are dynamically adjusted according to the output of the semantic channel, and finally the hidden state features of semantic and syntactic information fusion are obtained;
[0064] In step 4, the hidden state features output by the semantic encoder and the hidden state features of the relationship graph attention network are processed using a dynamic gate mechanism, and the syntactic weights are dynamically adjusted according to the output of the semantic channel, and finally the hidden state features of semantic and syntactic information fusion are obtained. The corresponding process has the following relationship:
[0065] ;
[0066] in, Represents semantic syntactic information fused with hidden state features, represents the sigmoid activation function, means that after the linear layer processing, the vector is reshaped into one dimension, represents the Hadamard product, Representation of the hidden state features of the graph attention network.
[0067] Step 5: Based on the semantic and syntactic information, hidden state features are fused, and aspect features and opinion features are extracted and obtained through linear transformation, and then aspect mark feature vectors and opinion mark feature vectors are further obtained through aspect features and opinion features;
[0068] Based on the aspect marking feature vector and the opinion marking feature vector, the probability of the aspect marking feature vector and the probability of the opinion marking feature vector are obtained respectively;
[0069] In step 5, based on the semantic syntactic information fusion hidden state features, the aspect features and opinion features are extracted and obtained through linear transformation, and then the aspect marking feature vector and opinion marking feature vector are further obtained through the aspect features and opinion features. The relationship between the corresponding process is:
[0070] ;
[0071] in, and All represent aspect characteristics. and All of them expressed the characteristics of opinions. It means that it has been processed by multi-layer perceptron with aspect-oriented labeling. It means that it has been processed by the opinion-oriented multi-layer perceptron. represents the transformation matrix, represents the bias, Indicates The first aspect A feature vector labeled with aspects, Indicates The first aspect feature vector of opinion labels;
[0072] Based on the aspect labeling feature vector and the opinion labeling feature vector, the probability of the aspect labeling feature vector and the probability of the opinion labeling feature vector are obtained respectively. The relationship between the corresponding processes is:
[0073] ;
[0074] in, Indicates The first aspect The probability of the feature vector labeled by each aspect, Indicates The first aspect The probability of the feature vector of opinion labels, represents the transformation matrix, Indicates bias.
[0075] Furthermore, in this step, the training loss is constructed by the probability of the aspect labeling feature vector and the probability of the opinion labeling feature vector, and the training loss is the cross entropy loss. The relationship between the corresponding process is:
[0076] ;
[0077] in, represents the indicator function, and Both represent sequence tags. represents the sequence label set, represents a sequence tag, represents the training loss of the prediction constraint module in the aspect priority direction, represents the training loss of the prediction constraint module in the opinion priority direction, Indicates The first aspect The probability of the feature vector labeled by each aspect in the sequence label, Indicates The first aspect The probability that the feature vector of the opinion label is in the sequence label.
[0078] Step 6: The semantic and syntactic information is fused with the hidden state features and input into the prediction decoder to obtain the output hidden state vector;
[0079] Based on the output hidden state vector and the semantic and syntactic information, the hidden state features are fused to further obtain the predicted distribution of candidate indexes;
[0080] Get the prediction result through the predicted distribution of candidate indexes;
[0081] In step 6, the semantic syntactic information is fused with the hidden state features and input into the prediction decoder to obtain the output hidden state vector. The corresponding process has the following relationship:
[0082] ;
[0083] in, represents the output hidden state vector, Indicates The word index generated before step, Indicates The word index of the step output, Indicates The sentence corresponding to the word index output in step 1, Indicates The word in the sentiment tag set corresponding to the word index output by the step;
[0084] Based on the output hidden state vector and the semantic syntactic information fusion hidden state features, the predicted distribution of the candidate index is further obtained. The relationship between the corresponding process is:
[0085] ;
[0086] in, It represents the semantic syntactic information fused with hidden state features processed by multi-layer perceptron. represents the hidden state features of the fused word embedding, It means that it has been processed by a multi-layer perceptron. represents the proportionality coefficient, represents the set of sentiment labels, word embeddings representing sentiment labels, Indicates The predicted distribution of the word index output in the candidate index.
[0087] Furthermore, in this step, the cross entropy loss constructed by the predicted distribution of the candidate index is used as the loss function of the training phase, and the relationship between the corresponding process is:
[0088] ;
[0089] in, represents the loss between the decoder output and the true label in the aspect term priority direction, It means that after probability calculation, Indicates the 1st to The prediction results of the step Indicates the total number of steps;
[0090] The loss between the decoder output and the true label in the opinion term priority direction is constructed in the same way by the predicted distribution of candidate indices;
[0091] Total loss:
[0092] ;
[0093] in, represents the total loss function, represents the hyperparameter, Represents the cross entropy loss between the decoder output and the true label in the preferred direction of the opinion term.
[0094] See also Figure 5 The embodiment of the present invention further provides an aspect-level sentiment triple extraction system based on bidirectional generation, the system comprising:
[0095] Encoder modules for:
[0096] Inputting a sentence into a term output template, sorting the triples in the sentence in ascending order according to the end index of the aspect term and the end index of the opinion term, and outputting the adjusted sentence, wherein the term output template includes an aspect term output template and an opinion term output template;
[0097] Using the term output template, the adjusted sentence is modeled to obtain the hidden state features output by the semantic encoder;
[0098] The word embedding matrix of the syntax editor is obtained by using the adjusted sentence, and the adjusted sentence is analyzed by dependency syntax to obtain the dependency relationship representation between words, the tree-based distance representation, and the relative position distance representation; the hidden state characteristics of the relationship graph attention network are obtained by using the word embedding matrix of the syntax editor, the dependency relationship representation between words, the tree-based distance representation, and the relative position distance representation;
[0099] Feature fusion module, used for:
[0100] The hidden state features output by the semantic encoder and the hidden state features of the graph attention network are processed using a dynamic gate mechanism, and the syntactic weights are dynamically adjusted according to the output of the semantic channel, ultimately obtaining the hidden state features that fuse semantic and syntactic information.
[0101] Predictive decoder module for:
[0102] Based on the fusion of semantic and syntactic information, hidden state features are extracted and obtained through linear transformation, and then aspect features and opinion features are further obtained through aspect features and opinion features to obtain aspect labeling feature vectors and opinion labeling feature vectors.
[0103] Based on the aspect marking feature vector and the opinion marking feature vector, the probability of the aspect marking feature vector and the probability of the opinion marking feature vector are obtained respectively;
[0104] The hidden state features are fused through semantic and syntactic information to obtain the output hidden state vector;
[0105] Based on the output hidden state vector and the semantic and syntactic information, the hidden state features are fused to further obtain the predicted distribution of candidate indexes;
[0106] The prediction results are obtained through the predicted distribution of candidate indexes.
[0107] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0108] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0109] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.
Claims
1. A method for extracting aspect-level sentiment triples based on bidirectional generation, the method is implemented based on a prediction model, the prediction model consists of an encoder module, a feature fusion module and a prediction decoder module, characterized in that: The method comprises the following steps: Step 1: Input a sentence into a term output template, sort the triples in the sentence in ascending order according to the end index of the aspect term and the end index of the opinion term, and output the adjusted sentence, wherein the term output template includes an aspect term output template and an opinion term output template; Step 2: Use the term output template to model the adjusted sentence through the semantic encoder to obtain the hidden state features output by the semantic encoder; Step 3, input the adjusted sentence into the syntax editor to obtain the word embedding matrix of the syntax editor, and analyze the adjusted sentence through dependency syntax to obtain the dependency relationship representation between words, the tree-based distance representation, and the relative position distance representation; then obtain the hidden state features of the relationship graph attention network through the word embedding matrix of the syntax editor, the dependency relationship representation between words, the tree-based distance representation, and the relative position distance representation; Step 4: The hidden state features output by the semantic encoder and the hidden state features of the relationship graph attention network are processed using a dynamic gate mechanism, and the syntactic weights are dynamically adjusted according to the output of the semantic channel, and finally the hidden state features of semantic and syntactic information fusion are obtained; Step 5: Based on the semantic and syntactic information, hidden state features are fused, and aspect features and opinion features are extracted and obtained through linear transformation, and then aspect mark feature vectors and opinion mark feature vectors are further obtained through aspect features and opinion features; Based on the aspect marking feature vector and the opinion marking feature vector, the probability of the aspect marking feature vector and the probability of the opinion marking feature vector are obtained respectively; Step 6: The semantic and syntactic information is fused with the hidden state features and input into the prediction decoder to obtain the output hidden state vector; Based on the output hidden state vector and the semantic and syntactic information, the hidden state features are fused to further obtain the predicted distribution of candidate indexes; The prediction results are obtained through the predicted distribution of candidate indexes.
2. According to the aspect-level sentiment triple extraction method based on bidirectional generation according to claim 1, it is characterized in that: In step 1, the sentence is input into the term output template, and the triples in the sentence are sorted in ascending order according to the end index of the aspect term and the end index of the opinion term. The corresponding process has the following relation: ; in, The output template represents the triples of aspect terms that are prioritized according to the input sentence. Indicates aspect term hints, and denote the start index and end index of the opinion term, respectively. Expression of opinion term tips, and denote the start index and end index of the opinion term, respectively. Indicates emotional polarity prompts, Indicates emotional polarity.
3. The aspect-level sentiment triple extraction method based on bidirectional generation according to claim 2 is characterized in that: In step 2, the adjusted sentence is modeled by using the term output template through the semantic encoder to obtain the hidden state features output by the semantic encoder. The relationship between the corresponding process is: ; in, represents the hidden state features output by the semantic encoder, represents the word embedding matrix of the semantic encoder, A marker indicating the start of A marker indicating the end. represents the input sentence, represents the word embedding layer processing of the pre-trained language model, represents the encoder layer processing of the pre-trained language model, Both represent word embedding vectors.
4. The aspect-level sentiment triple extraction method based on bidirectional generation according to claim 3 is characterized in that: In the step 3, the adjusted sentence is input into the syntax editor to obtain the word embedding matrix of the syntax editor, and the adjusted sentence is analyzed by dependency syntax to obtain the dependency relationship representation between words, the tree-based distance representation and the relative position distance representation; and then the hidden state features of the relationship graph attention network are obtained by the word embedding matrix of the syntax editor, the dependency relationship representation between words, the tree-based distance representation and the relative position distance representation. The specific steps are as follows: Based on the part-of-speech tag sequence, the word embedding matrix of the syntax editor is obtained using the syntax editor. The relationship between the corresponding process is: ; in, represents the word embedding matrix of the syntax editor, represents a randomly initialized learnable embedding layer process, Represents the part-of-speech tag sequence corresponding to the adjusted sentence, Both represent the embedding vectors corresponding to the part-of-speech tag sequence; Analyze the adjusted sentences through dependency syntax to obtain the dependency relationship representation between words, the tree-based distance representation, and the relative position distance representation; Construct a word pair relationship graph, and concatenate the dependency representation, tree-based distance representation, and relative position distance representation to obtain the word pair relationship embedding representation. Then, the word pair relationship vector is obtained through the word pair relationship embedding representation. The relationship between the corresponding process is: ; in, Represents word pair relationship embedding representation, Dependency type embedding representation, represents the tree-based distance embedding representation, Represents the relative position distance embedding representation; Based on the word embedding matrix and word pair relationship vector of the syntax editor, the word pair relationship graph is updated through the relationship graph attention network, and the hidden state features of the relationship graph attention network are output at the same time. The relationship between the corresponding process is: ; in, Represents the relationship graph attention network The output of the layer hidden state vector, represents the total number of attention heads, represents the number of attention heads, Indicates that it has been processed by the SELU activation function. Representation Node The neighbor set of Representation Node No. neighbor nodes, Indicates Layer The normalization coefficient of the attention head, Indicates Layer The parameter matrix of the attention head for the graph node is, Represents the relationship graph attention network The output of the layer The hidden state vector of the neighboring nodes, Indicates The parameter matrix of the layer for the graph edge, Represents the word pair relationship vector.
5. The aspect-level sentiment triple extraction method based on bidirectional generation according to claim 4 is characterized in that: In step 4, the hidden state features output by the semantic encoder and the hidden state features of the relationship graph attention network are processed using a dynamic gate mechanism, and the syntactic weights are dynamically adjusted according to the output of the semantic channel, and finally the hidden state features of semantic and syntactic information fusion are obtained. The relationship between the corresponding process is: ; in, Represents semantic syntactic information fused with hidden state features, represents the sigmoid activation function, means that after the linear layer processing, the vector is reshaped into one dimension, represents the Hadamard product, Representation of the hidden state features of the graph attention network.
6. The aspect-level sentiment triple extraction method based on bidirectional generation according to claim 5 is characterized in that: In step 5, based on the semantic syntactic information fusion hidden state features, the aspect features and opinion features are extracted and obtained through linear transformation, and then the aspect marking feature vector and the opinion marking feature vector are further obtained through the aspect features and opinion features. The relationship between the corresponding processes is: ; in, and All represent aspect characteristics. and All of them expressed the characteristics of opinions. It means that it has been processed by multi-layer perceptron with aspect-oriented labeling. It means that it has been processed by the opinion-oriented multi-layer perceptron. represents the transformation matrix, Indicates bias, Indicates The first aspect A feature vector labeled with aspects, Indicates The first aspect The feature vector of opinion labels.
7. The aspect-level sentiment triple extraction method based on bidirectional generation according to claim 6 is characterized in that: In step 5, the probability of the aspect marking feature vector and the probability of the opinion marking feature vector are obtained based on the aspect marking feature vector and the opinion marking feature vector, respectively. The relationship between the corresponding processes is: ; in, Indicates The first aspect The probability of the feature vector labeled by each aspect, Indicates The first aspect The probability of the feature vector of opinion labels, represents the transformation matrix, Indicates bias.
8. The aspect-level sentiment triple extraction method based on bidirectional generation according to claim 7 is characterized in that: In step 6, the semantic syntactic information is fused with the hidden state feature and input into the prediction decoder to obtain the output hidden state vector. The corresponding process has the following relationship: ; in, represents the output hidden state vector, Indicates The word index generated before step, Indicates The word index of the step output, Indicates The sentence corresponding to the word index output in step 1, Indicates The word index output by the first step corresponds to the word in the sentiment tag set.
9. The aspect-level sentiment triple extraction method based on bidirectional generation according to claim 8 is characterized in that: In step 6, the output hidden state vector and the semantic syntactic information are combined to further obtain the predicted distribution of the candidate indexes. The corresponding process has the following relationship: ; in, It represents the semantic syntactic information fused with hidden state features processed by multi-layer perceptron. represents the hidden state features of the fused word embedding, It means that it has been processed by a multi-layer perceptron. represents the proportionality coefficient, represents the set of sentiment labels, word embeddings representing sentiment labels, Indicates The predicted distribution of the word index output in the candidate index.
10. A bidirectionally generated aspect-level sentiment triple extraction system, characterized in that: The system applies the aspect-level sentiment triple extraction method based on bidirectional generation as described in any one of claims 1 to 9 above, and the system comprises: Encoder modules for: Inputting a sentence into a term output template, sorting the triples in the sentence in ascending order according to the end index of the aspect term and the end index of the opinion term, and outputting the adjusted sentence, wherein the term output template includes an aspect term output template and an opinion term output template; Using the term output template, the adjusted sentence is modeled to obtain the hidden state features output by the semantic encoder; The word embedding matrix of the syntax editor is obtained by using the adjusted sentence, and the adjusted sentence is analyzed by dependency syntax to obtain the dependency relationship representation between words, the tree-based distance representation, and the relative position distance representation; the hidden state characteristics of the relationship graph attention network are obtained by using the word embedding matrix of the syntax editor, the dependency relationship representation between words, the tree-based distance representation, and the relative position distance representation; Feature fusion module, used for: The hidden state features output by the semantic encoder and the hidden state features of the graph attention network are processed using a dynamic gate mechanism, and the syntactic weights are dynamically adjusted according to the output of the semantic channel, ultimately obtaining the hidden state features that fuse semantic and syntactic information. Predictive decoder module for: Based on the fusion of semantic and syntactic information, hidden state features are extracted and obtained through linear transformation, and then aspect features and opinion features are further obtained through aspect features and opinion features to obtain aspect labeling feature vectors and opinion labeling feature vectors. Based on the aspect marking feature vector and the opinion marking feature vector, the probability of the aspect marking feature vector and the probability of the opinion marking feature vector are obtained respectively; The hidden state features are fused through semantic and syntactic information to obtain the output hidden state vector; Based on the output hidden state vector and the semantic and syntactic information, the hidden state features are fused to further obtain the predicted distribution of candidate indexes; The prediction results are obtained through the predicted distribution of candidate indexes.
Citation Information
Patent Citations
Aspect-level emotion triple extraction method and system based on semantic enhancement double encoders
CN116663567A
Triple extraction method based on double-gating mechanism and dependence-oriented attention network
CN117787253A