Aspect-level sentiment analysis method based on semantic and syntactic relationship graph convolution
By combining self-attention and aspect distance attention mechanisms, a novel dependency tree and multi-order syntactic relation matrix are designed. Utilizing graph convolutional neural networks, the problem of insufficient utilization of syntactic structure information in existing technologies is solved, thereby improving the accuracy of aspect-level sentiment analysis.
Patent Information
- Application Number
- CN202410790743.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-18
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2044-06-18
AI Technical Summary
Existing technologies struggle to effectively utilize syntactic structure information in aspect-level sentiment analysis, especially when sentiment items are separated from sentiment polarity. They fail to accurately capture relevant sentiment words and neglect long-distance dependencies and semantic information.
By combining self-attention and aspect distance attention mechanisms, an aspect distance matrix is constructed, a new dependency tree is designed, and a multi-order syntactic relation matrix is constructed. Feature vectors are extracted by combining graph convolutional neural networks, integrating semantic and syntactic information.
It improves the accuracy of aspect-level sentiment analysis, can better utilize syntactic structure and semantic information to classify the sentiment polarity of aspect items, and enhances the expressive power of the model.
Smart Images

Figure CN118643154B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of sentiment analysis technology, and in particular to an aspect-level sentiment analysis method based on semantic and syntactic relation graph convolution. Background Technology
[0002] Sentiment analysis (SA) is a very popular topic in Natural Language Processing (NLP) for predicting the sentiment polarity of sentences. However, in real-world scenarios, a sentence may have multiple aspects, which traditional sentence-level sentiment analysis struggles to handle. Therefore, aspect-based sentiment analysis (ABSA) was proposed. ABSA aims to determine the sentiment polarity of a given aspect in a sentence.
[0003] Aspect-level sentiment analysis determines the different sentiment polarities corresponding to different aspects in a sentence. For the ABSA task, current research uses recurrent neural networks (RNNs) to model the aspect words in a sentence and their corresponding sentiment polarities. However, due to the limitations of RNNs, they cannot capture long-range dependencies, and syntactic information may be lost.
[0004] Recent studies have found that attention-based neural networks can effectively address the semantic relevance between aspect terms and context in aspect-level sentiment analysis. For example, Wang et al. used attention-based LSTM to extract semantic information related to aspect terms and determine sentiment polarity. Ma et al. used an interactive attention mechanism to represent aspect words and context words. Furthermore, grammatical knowledge can also be used to improve the ABSA task. Dong et al. proposed an adaptive recurrent neural network that relies on dependency trees to propagate sentiment. He et al. combined dependency trees and attention mechanisms to calculate the weight information of context words. Zhang and Sun et al. used graph convolutional networks (GCNs) to extract rich node information from dependency trees for sentiment classification. To address the shortcomings of RNNs, attention and gating mechanisms have been proposed to alleviate long-distance dependencies. However, these methods still lack effective utilization of syntactic information. When sentiment terms are separated from sentiment polarity, it is difficult to correctly capture related sentiment words. They still lack utilization of syntactic structure information, mostly considering only the relevant node information near the current node, ignoring the semantic and syntactic structure information of other nodes related to aspect terms. Furthermore, some statements within a sentence vaguely express the emotions of the other party without a direct syntactic relationship. Therefore, considering only the semantic information and syntactic structure of the dependency tree is still insufficient. Summary of the Invention
[0005] To further expand syntactic structural information and integrate semantic information, this invention provides an aspect-level sentiment analysis method based on semantic and syntactic relation graph convolution. By fully considering the semantic and syntactic structural information related to different aspect terms, it can better utilize syntactic structure and semantic information to classify the sentiment polarity of aspect items.
[0006] The aspect-level sentiment analysis method based on semantic and syntactic relation graph convolution provided by this invention includes:
[0007] Step 1: Input the dataset to be analyzed into the encoding layer to obtain the sentence embedding and the corresponding aspect embedding for each sentence;
[0008] Step 2: Input the sentence embedding and aspect term embedding into the semantic information layer to obtain the overall semantic information; wherein, the semantic information layer includes a self-attention mechanism module and an aspect distance attention mechanism module;
[0009] Step 3: Input the dataset to be analyzed into a multi-order syntactic relation layer to obtain a multi-order syntactic relation matrix; wherein, the multi-order syntactic relation layer includes a dependency parser;
[0010] Step 4: After fusing the overall semantic information and the multi-order syntactic relation matrix, input the result into a graph convolutional neural network to extract feature vectors for sentences and aspect terms;
[0011] Step 5: Pass the feature vectors of sentences and aspects through an average pooling layer and a softmax activation function in sequence to obtain the sentiment polarity of each aspect.
[0012] Furthermore, step 1 specifically includes:
[0013] Step 1.1: For any sentence s = {s1, s2, ..., s...} in the dataset to be analyzed... n Extract the aspect terms a = {a1, a2, ..., a} from the sentence. m} and save the position of the sentiment word corresponding to the aspect item; where n represents the number of words in the sentence, and m represents the number of aspect words in the n words;
[0014] Step 1.2: Use the CoreNLP dependency parser to extract the dependency relationships between words in the sentence;
[0015] Step 1.3: Construct sentence aspect pairs based on dependency relations as the input sequence for the encoding layer to obtain sentence embeddings and aspect term embeddings.
[0016] Furthermore, step 2 specifically includes:
[0017] Step 2.1: Embed the sentence into the self-attention mechanism module to obtain an attention score. This allows us to obtain the global semantic information of the sentence; where j represents the j-th sentence in the dataset to be analyzed.
[0018]
[0019] Where Q and K represent any two word embeddings in the sentence embedding; W represents the learnable weights; and d represents the feature dimension of the word embedding.
[0020] Step 2.2: Input the sentence embedding and aspect term embedding into the aspect distance attention mechanism module to obtain global semantic information related to aspects. and local semantic information related to aspects This leads to the aspect distance matrix.
[0021]
[0022] Where tanh and softmax are both activation functions, H a W represents the hidden state vector of the aspect term. a Let P represent the learnable weights, P represent the hidden state vector of the sentence, b represent the bias term, T represent the transpose, and S represent the hidden state vector of the sentence. j R represents the shortest distance between the context word and the aspect word, and R represents the distance threshold between the context word and the aspect word.
[0023] Step 2.3: Combine the global semantic information of the sentence with the aspect distance matrix to obtain the overall semantic information D. j ;
[0024] Furthermore, step 3 specifically includes:
[0025] Step 3.1: For any sentence in the dataset to be analyzed, use the CoreNLP dependency parser to obtain the original dependency tree of the sentence;
[0026] Step 3.2: Take the aspect term as the root node, and take the word nodes in the original dependency tree that are directly related to the aspect term as the first level of the new dependency tree; establish new connections between the word nodes in the original dependency tree that are not directly related to the aspect term but are directly related to the word nodes in the first level and the aspect term, and take the new connections as the second level of the new dependency tree, and so on to obtain a new dependency tree containing n levels; n is an integer not less than 3.
[0027] Step 3.3: Convert the new dependency tree into an n-order syntactic relation matrix.
[0028] The beneficial effects of this invention are:
[0029] (1) By combining self-attention mechanism and aspect distance attention mechanism, an aspect distance matrix is constructed to integrate the semantic information of sentences, thereby providing more effective semantic information for aspect-level sentiment analysis.
[0030] (2) A new dependency tree was designed, in which direct dependencies between aspect words and context words at different levels were added, and a multi-level syntactic relation matrix was constructed based on the new dependency tree, thereby providing more effective syntactic information for aspect-level sentiment analysis.
[0031] (3) A graph neural convolutional network is used to integrate the features extracted from the aspect distance matrix and the multi-order syntactic relation matrix, thereby enriching the expressive power of the entire aspect-level sentiment analysis model. Attached Figure Description
[0032] Figure 1 This is a diagram illustrating the overall architecture of the aspect-level sentiment analysis method based on semantic and syntactic relation graph convolution provided in this embodiment of the invention.
[0033] Figure 2 This is a flowchart illustrating the aspect-level sentiment analysis method based on semantic and syntactic relation graph convolution provided in an embodiment of the present invention. Detailed Implementation
[0034] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of the embodiments of this invention will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0035] Combination Figure 1 and Figure 2 As shown, this embodiment of the invention provides an aspect-level sentiment analysis method based on semantic and syntactic relation graph convolution, including the following steps:
[0036] S101: Preprocess the dataset to be analyzed, and then input the preprocessed data into the encoding layer to obtain the sentence embedding and the corresponding aspect embedding for each sentence;
[0037] Specifically, taking any sentence s in the dataset to be analyzed as an example, this step includes the following sub-steps:
[0038] S1011: Suppose the sentence s = {s1, s2, ..., s...} n Extract the aspect terms a = {a1, a2, ..., a} from the sentence. m} and save the position of the sentiment word corresponding to the aspect item; where n represents the number of words in the sentence, and m represents the number of aspect words in the n words;
[0039] S1012: Use the CoreNLP dependency parser to extract the dependency relationships between words in a sentence;
[0040] S1013: Construct sentence aspect pairs (in the form of [CLS]+s+[SEP]+a+[SEP]) based on dependency relations as the input sequence of the encoding layer to obtain sentence embeddings and aspect term embeddings.
[0041] S102: Input the sentence embedding and aspect term embedding into the semantic information layer to obtain the overall semantic information; wherein, the semantic information layer includes a self-attention mechanism module and an aspect distance attention mechanism module;
[0042] Specifically, this step includes the following sub-steps:
[0043] S1021: Embed the sentence into the self-attention mechanism module to obtain an attention score. This allows us to obtain the global semantic information of the sentence; where j represents the j-th sentence in the dataset to be analyzed.
[0044]
[0045] Where Q and K represent any two word embeddings in the sentence embedding; W represents the learnable weights; and d represents the feature dimension of the word embedding.
[0046] S1022: Input the sentence embedding and aspect term embedding into the aspect distance attention mechanism module to obtain global semantic information related to aspects. and local semantic information related to aspects This leads to the aspect distance matrix.
[0047]
[0048] Where tanh and softmax are both activation functions, H a W represents the hidden state vector of the aspect term. a Let P represent the learnable weights, P represent the hidden state vector of the sentence, b represent the bias term, T represent the transpose, and S represent the hidden state vector of the sentence. j R represents the shortest distance between the context word and the aspect word, and R represents the distance threshold between the context word and the aspect word.
[0049] S1023: Combine the global semantic information of the sentence with the aspect distance matrix to obtain the overall semantic information D. j ;
[0050] S103: Input the preprocessed dataset to be analyzed into a multi-order syntactic relation layer to obtain a multi-order syntactic relation matrix; wherein, the multi-order syntactic relation layer includes a dependency parser;
[0051] Specifically, this step includes the following sub-steps:
[0052] S1031: For any sentence in the dataset to be analyzed, use the CoreNLP dependency parser to obtain the original dependency tree of the sentence;
[0053] S1032: Take the aspect term as the root node, and take the word nodes in the original dependency tree that are directly related to the aspect term as the first level of the new dependency tree; establish new connections between the word nodes in the original dependency tree that are not directly related to the aspect term but are directly related to the word nodes in the first level and the aspect term, and take the new connections as the second level of the new dependency tree, and so on to obtain a new dependency tree containing n levels; n is an integer not less than 3;
[0054] Specifically, the connections between first-level word nodes and aspect words are uniformly recorded as first-order relations, the connections between second-level word nodes and aspect words are uniformly recorded as second-order relations, and so on, with the connections between nth-level word nodes and aspect words being uniformly recorded as nth-order relations. In this embodiment, n=3, meaning that context words in the original dependency tree whose connections with aspect words exceed the third order are considered unrelated to aspect words and are discarded, thereby simplifying the dependency tree and removing interference.
[0055] S1033: Convert the new dependency tree into an n-order syntactic relation matrix using a dependency resolution tool (such as Stanford Parser), where n=3.
[0056] S104: The overall semantic information and the multi-order syntactic relation matrix are fused and then input into the graph convolutional neural network (GCN) to extract the feature vectors of sentences and aspect terms;
[0057] S105: The feature vectors of sentences and aspects are passed through an average pooling layer and a softmax activation function in sequence to obtain the sentiment polarity of each aspect.
[0058] Specifically, the feature vector output by the graph convolutional neural network and The input is fed into a pooling layer for average pooling, and then the output after average pooling is fed into the activation function softmax to obtain the relevant sentiment polarity.
[0059] It is understood that the aspect-level sentiment analysis model proposed in this invention mainly includes an encoding layer, a semantic information layer, a multi-order syntactic relation layer, a GCN, an average pooling layer, and a softmax layer. This model needs to be trained using training data to have the corresponding functions.
[0060] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. An aspect-level sentiment analysis method based on semantic and syntactic relation graph convolution, characterized in that, include: Step 1: Input the dataset to be analyzed into the encoding layer to obtain the sentence embedding and the corresponding aspect embedding for each sentence; Step 2: Input the sentence embedding and aspect term embedding into the semantic information layer to obtain the overall semantic information; wherein, the semantic information layer includes a self-attention mechanism module and an aspect distance attention mechanism module; specifically including: Step 2.1: Embed the sentence into the self-attention mechanism module to obtain an attention score. This allows us to obtain the global semantic information of the sentence; where j represents the j-th sentence in the dataset to be analyzed. Where Q and K represent any two word embeddings in the sentence embedding; W represents the learnable weights; and d represents the feature dimension of the word embedding. Step 2.2: Input the sentence embedding and aspect term embedding into the aspect distance attention mechanism module to obtain global semantic information related to aspects. and local semantic information related to aspects This leads to the aspect distance matrix. ; in, Both softmax and activation functions are activation functions. The hidden state vector representing the aspect term. Indicates learnable weights, Let represent the hidden state vector of the sentence, b represent the bias term, and T represent the transpose. R represents the shortest distance between the context word and the aspect word, and R represents the distance threshold between the context word and the aspect word. Step 2.3: Combine the global semantic information of the sentence with the aspect distance matrix to obtain the overall semantic information. ; ; Step 3: Input the dataset to be analyzed into a multi-order syntactic relation layer to obtain a multi-order syntactic relation matrix; wherein, the multi-order syntactic relation layer includes a dependency parser; specifically including: Step 3.1: For any sentence in the dataset to be analyzed, use the CoreNLP dependency parser to obtain the original dependency tree of the sentence; Step 3.2: Take the aspect term as the root node, and take the word nodes in the original dependency tree that are directly related to the aspect term as the first level of the new dependency tree; establish new connections between the word nodes in the original dependency tree that are not directly related to the aspect term but are directly related to the word nodes in the first level and the aspect term, and take the new connections as the second level of the new dependency tree, and so on to obtain a new dependency tree containing n levels; n is an integer not less than 3. Step 3.3: Convert the new dependency tree into an n-order syntactic relation matrix; Step 4: After fusing the overall semantic information and the multi-order syntactic relation matrix, input the result into a graph convolutional neural network to extract feature vectors for sentences and aspect terms; Step 5: Pass the feature vectors of sentences and aspects through an average pooling layer and a softmax activation function in sequence to obtain the sentiment polarity of each aspect.
2. The aspect-level sentiment analysis method based on semantic and syntactic relation graph convolution as described in claim 1, characterized in that, Step 1 specifically includes: Step 1.1: For any sentence in the dataset to be analyzed Extracting aspect terms from sentences And store the position of the sentiment word corresponding to the aspect item; where n represents the number of words in the sentence, and m represents the number of aspect words in the n words; Step 1.2: Use the CoreNLP dependency parser to extract the dependency relationships between words in the sentence; Step 1.3: Construct sentence aspect pairs based on dependency relations as the input sequence for the encoding layer to obtain sentence embeddings and aspect term embeddings.
Citation Information
Patent Citations
Aspect-level sentiment analysis method and device based on syntax and graph convolutional network
CN114417823A
Information classification extraction method, apparatus, computer device and storage medium
WO2021042503A1
