Aspect-level Sentiment Classification Method Based on Enhanced Semantic and Syntactic Information
By using BERT pre-trained models and graph attention layer in aspect-level emotion classification, combined with attention networks in specific aspects, the problem of ignoring noise information and semantic information is solved, and higher classification accuracy and comprehensiveness are achieved.
Patent Information
- Application Number
- CN202210398610.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-15
- Publication Date
- 2025-05-23
- Estimated Expiration
- 2042-04-15
AI Technical Summary
The existing aspect-level emotion classification methods tend to contain noisy information when dealing with syntactic dependency trees, resulting in low classification accuracy and ignoring the semantic information between target aspects, affecting the comprehensiveness of the classification.
Using the method based on BERT pre-trained model and graph attention layer, the word vector representation is adjusted, context syntax information is extracted, and word vectors are updated through the attention network in specific aspects, and multi-grained information is fused for emotional classification.
Effectively overcome the influence of noise, enhance semantic and syntactic information, and improve the accuracy and comprehensiveness of aspect-level emotional classification.
Smart Images

Figure CN114676687B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of Internet big data, and in particular to an aspect-level sentiment classification method based on enhanced semantic syntactic information. Background Art
[0002] Aspect-level sentiment classification (ABSA) is a fine-grained sentiment classification that mainly classifies aspect words in the context into three categories: positive, negative, and neutral. Taking "The performance of this laptop is excellent, but the screen is terrible" as an example, the aspect word laptop is positive and the aspect word screen is negative. Because a sentence may contain multiple aspect words, it is crucial to determine the sentiment polarity of each aspect word.
[0003] At present, the graph neural network (GNN) based on dependency tree has achieved good results in aspect-level sentiment classification tasks. For example, the Chinese patent with publication number CN112347248A discloses "A method and system for aspect-level text sentiment classification", which includes: extracting the long-distance dependency features of the sentence text according to the local feature vector of the acquired sentence text to obtain the context feature representation of the sentence text; constructing the syntactic dependency relationship between words in the sentence text according to the context feature representation of the sentence text to obtain the aspect-level feature representation of the sentence text; constructing a graph attention neural network based on the dependency tree, and obtaining the aspect-level sentiment category of the text according to the aspect-level feature representation of the sentence text.
[0004] The aspect-level text sentiment classification method in the above-mentioned existing scheme uses a convolutional neural network to extract local feature information in the sentence, and uses a bidirectional long short-term memory network to learn the features after the convolutional neural network pooling value, which can improve the performance of sentiment classification to a certain extent. However, the syntactic dependency tree will inevitably contain noise information that is irrelevant to the aspect sentiment classification, and the existing scheme does not consider the instability caused by the dependency tree noise information, resulting in low accuracy of aspect-level sentiment classification. At the same time, the above-mentioned existing scheme ignores the semantic information between the target aspects, which makes the model insufficiently aware of the sentence information and aspect word information, and thus leads to poor comprehensiveness of aspect-level sentiment classification. Therefore, how to design a sentiment classification method that can overcome the influence of noise and enhance semantic syntactic information to improve the accuracy and comprehensiveness of aspect-level sentiment classification is a technical problem that needs to be solved urgently. Summary of the invention
[0005] In view of the above-mentioned deficiencies of the prior art, the technical problem to be solved by the present invention is: how to provide an aspect-level sentiment classification method based on enhanced semantic and syntactic information, so as to effectively overcome the influence of noise and enhance semantic and syntactic information, thereby improving the accuracy and comprehensiveness of aspect-level sentiment classification.
[0006] In order to solve the above technical problems, the present invention adopts the following technical solutions:
[0007] The aspect-level sentiment classification method based on enhanced semantic syntactic information includes the following steps:
[0008] S1: Get the text to be tested;
[0009] S2: Input the text to be tested into the pre-trained sentiment classification model and output the corresponding classification prediction result;
[0010] Among them, the sentiment classification model first adjusts the word vector representation of the test text through the BERT pre-training model to generate a primary context representation; then extracts the context syntactic information in the initial context representation through the graph attention layer to generate a secondary context representation; further updates the word vectors in the primary context representation and the secondary context representation through the aspect-specific attention network to generate a primary word embedding representation and a secondary word embedding representation, and average pools to generate a coarse-grained representation of the primary word embedding representation and the secondary word embedding representation; then the aspect words in the primary context representation and the secondary context representation are max-pooled as a fine-grained representation; then the coarse-grained representation of the primary word embedding representation and the secondary word embedding representation and the same granularity information in the fine-grained representation of the aspect words in the primary context representation and the secondary context representation are fused to generate multi-granularity fusion information; finally, the classifier is used to perform sentiment classification based on the multi-granularity fusion information to obtain the classification prediction result;
[0011] S3: The classification prediction results output by the sentiment classification model are used as the aspect-level sentiment classification results of the text to be tested.
[0012] Preferably, in step S2, the primary context representation is generated by the following steps:
[0013] S201: Convert the text to be tested into a context sequence and aspect words where w a Yes c subsequence;
[0014] S202: Convert the context sequence and aspect word representation into the following form w and input it into the BERT pre-trained model;
[0015]
[0016] S203: Output the following primary context representation h through the BERT pre-training model se ;
[0017] h se ={h cls ,h 1 ,…,h n ,h n+1 ,h n+2 ,…,h n+m+1 ,h n+m+2};
[0018] Where: h cls Indicates that the BERT pre-training model obtains sentiment classification information through pooling values; h 1 ,…,h n Word vector representation that represents context.
[0019] Preferably, in step S2, the secondary context representation is generated by the following steps:
[0020] S211: Aggregate the information of neighboring nodes of each node in the primary context representation through a multi-head self-attention network to obtain a context representation with syntactic information;
[0021]
[0022]
[0023]
[0024] Where: Represents the i-word vectors of the l+1 layer in the multi-head self-attention network; represents the update weight; represents the learning parameters of the K heads in the lth layer; N(i) represents the neighboring node domain of the i-th node; Represents the information of K heads of the spliced multi-head self-attention network; represents the context representation of the lth layer. If l = 1, it is the output of the last layer of the BERT pre-training model. represents the learning parameters; and represents the learnable transformation matrix; They represent the word vectors of the i-th and j-th words in the K-th head of layer l respectively; d represents the dimension size;
[0025] S212: Transform the syntactic information through point-by-point convolution transformation to generate a secondary context representation h sy ;
[0026]
[0027] Where: h l represents the output of the graph attention calculation in the lth graph attention layer; σ represents the RELU activation function; * represents the convolution operation; and represents the learning parameters of the convolution operation; and represents the residual parameter.
[0028] Preferably, in step S2, when updating the primary context representation and the secondary context representation, the influence of the aspect words is shielded by a Mask vector;
[0029] Let A be the index set of aspect words and generate the following Mask vector;
[0030]
[0031] Preferably, in step S2, the primary context representation h is updated by the aspect-specific attention network se The formula is as follows:
[0032]
[0033]
[0034]
[0035] Where: Represents the primary word embedding representation updated by the aspect-specific attention network; Representation of primary context The maximum pooling value of aspect words; represents the attention update weight; W se Represents the attention learning matrix.
[0036] Preferably, in step S2, the secondary context representation is updated by an aspect-specific attention network The formula is as follows:
[0037]
[0038]
[0039]
[0040] Where: Represents the updated secondary word embedding representation through the aspect-specific attention network; represents the updated weight; Represents secondary context representation The maximum pooling value of aspect words; W sy Represents the attention learning matrix.
[0041] Preferably, in step S2, the maximum pooling values of the aspect words of the primary context representation and the secondary context representation are calculated respectively. and And the average pooling value of the primary word embedding representation and the secondary word embedding representation and Then, the corresponding multi-granularity fusion information h is calculated by combining the multi-granularity gate mechanism with the following formula g ;
[0042]
[0043]
[0044] g=σ(W g [x1;x2]+b g );
[0045] Where: σ represents the Sigmod activation function, which is located in [0,1] to control the fusion weight; W g represents a learnable parameter; b g Represents the deviation term.
[0046] Preferably, in step S2, the multi-granularity fusion information h is converted into g With the primary context representation h se The sentiment classification information h in cls Fusion, get the corresponding final text representation h f , and then through the final text representation h f Perform sentiment classification;
[0047] h f =W f [h g ;h cls ]+b f ;
[0048] Where: W f and b f represents the learning parameters.
[0049] Preferably, in step S2, the classifier performs sentiment classification using the following formula:
[0050] y=Softmax(h f );
[0051] Where: y represents the classification prediction result.
[0052] Preferably, in step S2, the sentiment classification model is trained by the following training loss function;
[0053]
[0054] Where: λ represents the regularization hyperparameter; Θ represents all training parameters in the model; y c represents the prediction sample; represents the real sample; c represents the sentiment classification category.
[0055] Compared with the prior art, the aspect-level sentiment classification method in the present invention has the following beneficial effects:
[0056] The present invention adjusts the word vector representation of the text to be tested through the BERT pre-training model, so that the pre-training knowledge of the BERT pre-training model can be used to make up for the lost semantic information and alleviate the noise brought by the dependency tree to the syntactic information, that is, it can effectively overcome the influence of noise, thereby improving the accuracy of aspect-level sentiment classification.
[0057] The present invention extracts contextual syntactic information in the initial context representation through the graph attention layer, and then can be combined with the BERT pre-training model to jointly enhance the semantic and syntactic information, thereby improving the comprehensiveness of aspect-level sentiment classification.
[0058] The present invention updates the word vectors in the primary context representation and the secondary context representation through an aspect-specific attention network, and then fuses the coarse-grained representation of the primary word embedding representation and the secondary word embedding representation and the same granularity information in the fine-grained representation of the aspect words in the primary context representation and the secondary context representation. On the one hand, the aspect-specific attention network can use the maximum pooling of each aspect word to interact with the context to calculate the attention weight, and then increase the weight of the target aspect word to obtain the optimal weight; on the other hand, by fusing the same granularity information, it can consider information at multiple granularity levels, and then increase the model's perception of sentence information and aspect word information, thereby further improving the accuracy and comprehensiveness of aspect-level sentiment classification to obtain the sentiment tendency of the text to be tested. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] In order to make the purpose, technical solution and advantages of the invention more clear, the present invention will be further described in detail below with reference to the accompanying drawings, in which:
[0060] Figure 1 It is a logical block diagram of the aspect-level sentiment classification method based on enhanced semantic and syntactic information;
[0061] Figure 2 This is the operation logic diagram of the sentiment classification model;
[0062] Figure 3 This is the operation logic diagram of the graph attention layer. DETAILED DESCRIPTION
[0063] The following is a further detailed description through specific implementation methods:
[0064] Example:
[0065] This embodiment discloses an aspect-level sentiment classification method based on enhanced semantic syntactic information.
[0066] like Figure 1 As shown in FIG, the aspect-level sentiment classification method based on enhanced semantic syntactic information includes the following steps:
[0067] S1: Get the text to be tested;
[0068] S2: Input the text to be tested into the pre-trained sentiment classification model and output the corresponding classification prediction result;
[0069] like Figure 2 As shown in the figure, the sentiment classification model first adjusts the word vector representation of the test text through the BERT pre-training model to generate a primary context representation; then extracts the context syntactic information in the initial context representation through the graph attention layer to generate a secondary context representation; further updates the word vectors in the primary context representation and the secondary context representation through the aspect-specific attention network to generate a primary word embedding representation and a secondary word embedding representation, and average pools to generate a coarse-grained representation of the primary word embedding representation and the secondary word embedding representation; then the aspect words in the primary context representation and the secondary context representation are pooled as a fine-grained representation; then the coarse-grained representation of the primary word embedding representation and the secondary word embedding representation and the same granularity information in the fine-grained representation of the aspect words in the primary context representation and the secondary context representation are fused to generate multi-granularity fusion information; finally, the classifier is used to perform sentiment classification based on the multi-granularity fusion information to obtain the classification prediction result;
[0070] S3: The classification prediction results output by the sentiment classification model are used as the aspect-level sentiment classification results of the text to be tested.
[0071] The present invention adjusts the word vector representation of the text to be tested through the BERT pre-training model, so that the pre-training knowledge of the BERT pre-training model can be used to make up for the lost semantic information and alleviate the noise brought by the dependency tree to the syntactic information, that is, it can effectively overcome the influence of noise, thereby improving the accuracy of aspect-level sentiment classification. Secondly, the present invention extracts the contextual syntactic information in the initial context representation through the graph attention layer, and then can combine the BERT pre-training model to jointly enhance the semantic and syntactic information, thereby improving the comprehensiveness of aspect-level sentiment classification. Finally, the present invention updates the word vectors in the primary context representation and the secondary context representation through an aspect-specific attention network, and then by fusing the coarse-grained representation of the primary word embedding representation and the secondary word embedding representation and the same granularity information in the fine-grained representation of the aspect words in the primary context representation and the secondary context representation, on the one hand, the aspect-specific attention network can utilize the maximum pooling of each aspect word to interact with the context to calculate the attention weight, and then increase the weight of the target aspect word to obtain the optimal weight; on the other hand, by fusing the same granularity information, it can consider information at multiple granularity levels, and then increase the model's perception of sentence information and aspect word information, thereby further improving the accuracy and comprehensiveness of aspect-level sentiment classification to obtain the sentiment tendency of the text to be tested.
[0072] In the specific implementation process, the primary context representation is generated through the following steps:
[0073] S201: Convert the text to be tested into a context sequence of length n and length m aspect words where w a Yes c subsequence;
[0074] S202: Convert the context sequence and aspect word representation into the following form w and input it into the BERT pre-trained model;
[0075]
[0076] Among them, [CLS]+Context+[SEP]+Aspect+[SEP] is the input condition of the BERT pre-training model.
[0077] S203: Output the following primary context representation h through the BERT pre-training model se ;
[0078] h se ={h cls ,h 1 ,…,h n ,h n+1 ,h n+2 ,…,h n+m+1,h n+m+2};
[0079] Where: h cls Indicates that the BERT pre-training model obtains sentiment classification information through pooling values; h 1 ,…,h n Word vector representation that represents context.
[0080] It should be noted that the BERT pre-trained model used in the present invention is an existing model, whose full name is Bidirectional Encoder Representation from Transformers, which is a pre-trained language representation model. The present invention only utilizes the existing BERT pre-trained model without improving it, so the specific process of the operation of the BERT pre-trained model will not be repeated here.
[0081] The BERT pre-training model emphasizes that it no longer uses the traditional unidirectional language model or the shallow concatenation of two unidirectional language models for pre-training as in the past, but instead uses a new masked language model (MLM) to generate deep bidirectional language representations.
[0082] The present invention adjusts the word vector representation of the text to be tested through the BERT pre-training model, so that the pre-training knowledge of the BERT pre-training model can be used to make up for the lost semantic information and alleviate the noise brought by the dependency tree to the syntactic information, thereby effectively overcoming the influence of noise.
[0083] In the specific implementation process, Figure 3 As shown, the graph attention layer (GAT) consists of graph attention calculation and point-by-point convolutional transformation (PCT). The graph attention layer is used to extract word vector representations with contextual syntactic information. It is a variant of graph neural network and calculates attention weights based on the distance of the syntactic dependency tree. The dependency tree can be represented by a grammatical graph of N nodes, where each word represents a node in the graph and the edges in the graph represent the dependencies between words. In the graph attention layer, a normal dependency graph is first generated for each input sentence on the dependency tree. For example, G(V, A) represents a dependency graph, where V represents all nodes and A represents the adjacency matrix. If two nodes have a dependency relationship A i,j =1, otherwise A i,j =0.
[0084] The secondary context representation is generated by the following steps:
[0085] S211: Aggregate the information of neighboring nodes of each node in the primary context representation through a multi-head self-attention network to obtain a context representation with syntactic information;
[0086]
[0087]
[0088]
[0089] Where: Represents the i-word vectors of the l+1 layer in the multi-head self-attention network; represents the updated weight; represents the learning parameters of the K heads in the lth layer; N(i) represents the neighboring node domain of the i-th node; Represents the information of K heads of the spliced multi-head self-attention network; represents the context representation of the lth layer. If l = 1, it is the output of the last layer of the BERT pre-training model. represents the learning parameters; and represents the learnable transformation matrix; They represent the word vectors of the i-th and j-th words in the K-th head of layer l respectively; d represents the dimension size;
[0090] S212: Transform the syntactic information through point-by-point convolution transformation to generate a secondary context representation h sy ;
[0091]
[0092] Where: h l represents the output of the graph attention calculation in the lth graph attention layer; σ represents the RELU activation function; * represents the convolution operation; and represents the learning parameters of the convolution operation; and represents the residual parameter.
[0093] The present invention extracts contextual syntactic information in the initial context representation through a graph attention layer, which can then be combined to jointly enhance semantic and syntactic information, thereby improving the comprehensiveness of aspect-level sentiment classification.
[0094] In the specific implementation process, the most important aspect of aspect-level sentiment analysis is to capture the opinions (i.e., weights) of the target aspects. In order to increase the weights of the target aspects, the present invention uses the maximum pooling of each aspect word to interact with the context to calculate the attention weights to obtain the optimal weights.
[0095] When updating the primary context representation and the secondary context representation, the influence of the aspect words is shielded by the Mask vector, that is, in order to ignore the influence of the aspect words themselves in the context.
[0096] Let A be the index set of aspect words, whose value in the aspect word position is 1 and the other positions are 0; generate the following Mask vector;
[0097]
[0098] Update the primary context representation h via an aspect-specific attention network se The formula is as follows:
[0099]
[0100]
[0101]
[0102] Where: Represents the primary word embedding representation updated by the aspect-specific attention network; Representation of primary context The maximum pooling value of aspect words; represents the attention update weight; W se Represents the attention learning matrix.
[0103] Updating secondary context representations via aspect-specific attention networks The formula is as follows:
[0104]
[0105]
[0106]
[0107] Where: Represents the updated secondary word embedding representation through the aspect-specific attention network; represents the update weight; Represents secondary context representation The maximum pooling value of aspect words; W sy Represents the attention learning matrix.
[0108] The present invention updates the word vectors in the primary context representation and the secondary context representation through a specific aspect attention network, and can use the maximum pooling of each aspect word to interact with the context to calculate the attention weight, thereby increasing the weight of the target aspect word to obtain the optimal weight.
[0109] In the specific implementation process, the maximum pooling value of the aspect words of the primary context representation and the secondary context representation is calculated respectively. and And the average pooling value of the primary word embedding representation and the secondary word embedding representation and Then, the corresponding multi-granularity fusion information h is calculated by combining the multi-granularity gate mechanism with the following formula g ;
[0110]
[0111]
[0112] g=σ(W g [x1;x2]+b g );
[0113] Where: σ represents the Sigmod activation function, which is located in [0,1] to control the fusion weight; W g represents a learnable parameter; b g Represents the deviation term.
[0114] In the specific implementation process, the multi-granularity fusion information h is converted into g With the primary context representation h se The sentiment classification information h in cls Fusion, get the corresponding final text representation h f , and then through the final text representation h f Perform sentiment classification;
[0115] h f =W f [h g ;h 0 ]+b f ;
[0116] Where: W f and b f represents the learning parameters.
[0117] By fusing the same granularity information in the primary context representation, the secondary context representation, the primary word embedding representation and the secondary word embedding representation, and the text understanding in the primary context representation, the present invention can consider information at multiple granularity levels, thereby increasing the model's perception of sentence information and aspect word information, thereby further improving the accuracy and comprehensiveness of aspect-level sentiment classification.
[0118] During the specific implementation, the classifier performs sentiment classification through the following formula;
[0119] y=Softmax(h f );
[0120] Where: y represents the classification prediction result.
[0121] During the specific implementation, the sentiment classification model is trained through the following training loss function;
[0122]
[0123] Where: λ represents the regularization hyperparameter; Θ represents all training parameters in the model; y c represents the prediction sample; represents the real sample; c represents the sentiment classification category.
[0124] The present invention can ensure the training efficiency and classification accuracy of the sentiment classification model through the above-mentioned training loss function, thereby further improving the accuracy of aspect-level sentiment classification.
[0125] In order to better illustrate the advantages of the technical solution of the present invention, the following experiments are disclosed in this embodiment.
[0126] This experiment is conducted on three existing benchmark datasets, namely the Laptop, Restaurant, and Twitter datasets of SemEval 2014. The datasets are labeled as positive, negative, and neutral. Table 1 lists the specific information of each dataset.
[0127] Table 1
[0128]
[0129] This experiment uses accuracy and F1 to judge the performance of the present invention (wherein, higher accuracy and F1 values represent better performance). The experimental results are shown in Table 2.
[0130] Combined with Table 2, it can be seen that the model of the present invention achieves better performance on the Restaurant and Laptop and twitter datasets of the Semeval2014 task. The compared models are mainly divided into three categories: attention-based models, external syntactic knowledge embedding models, and BERT pre-training models.
[0131] Both external dependency trees and BERT can effectively improve the performance of the models, and the simplest BERT-SPC model outperforms the model without BERT. This well illustrates the application capabilities of BERT in sentiment analysis, and combining BERT with syntactic dependencies can further improve the performance of the model. However, all models that combine BERT and dependency trees at the same time cannot fully extract and utilize BERT and syntactic information. As a result, they lose some semantic and syntactic information, resulting in performance lower than the sentiment classification model of the present invention.
[0132] Compared with the attention models (ATAE-LSTM, IAN, TNet, MGAN, AEN), they lack the introduction of syntactic information and cannot accurately capture opinion words. Therefore, the sentiment classification model of the present invention has a clear leading advantage.
[0133] In addition, on Restaurant, laptop, and twitter, the sentiment classification model of the present invention has a more significant lead than the models with external syntactic information (ASGCN, GAT, TD-GAT, SAGAT, RGAT). Compared with the above BERT pre-trained model, the sentiment classification model of the present invention leads all models on the Restaurant and laptop datasets, but is slightly lower than RGAT-BERT on Twitter.
[0134] Table 2
[0135]
[0136] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit the technical solution. Those skilled in the art should understand that those modifications or equivalent substitutions of the technical solution of the present invention that do not depart from the purpose and scope of the technical solution should be included in the scope of the claims of the present invention.
Claims
1. Aspect-level sentiment classification method based on enhanced semantic syntactic information, It is characterized in that The following steps are involved: S1: Get the text to be tested; S2: Input the text to be tested into the pre-trained sentiment classification model and output the corresponding classification prediction result; Among them, the sentiment classification model first adjusts the word vector representation of the test text through the BERT pre-training model to generate a primary context representation; then extracts the context syntactic information in the initial context representation through the graph attention layer to generate a secondary context representation; further updates the word vectors in the primary context representation and the secondary context representation through the aspect-specific attention network to generate a primary word embedding representation and a secondary word embedding representation, and average pools to generate a coarse-grained representation of the primary word embedding representation and the secondary word embedding representation; then the aspect words in the primary context representation and the secondary context representation are max-pooled as a fine-grained representation; then the coarse-grained representation of the primary word embedding representation and the secondary word embedding representation and the same granularity information in the fine-grained representation of the aspect words in the primary context representation and the secondary context representation are fused to generate multi-granularity fusion information; finally, the classifier is used to perform sentiment classification based on the multi-granularity fusion information to obtain the classification prediction result; In step S2, the primary context representation is generated by the following steps: S201: Convert the text to be tested into a context sequence and aspect words where w a Yes c subsequence; S202: Convert the context sequence and aspect word representation into the following form w and input it into the BERT pre-trained model; S203: Output the following primary context representation h through the BERT pre-training model se ; h se ={h cls ,h 1 ,…,h n ,h n+1 ,h n+2 ,…,h n+m+1 ,h n+m+2 }; Where: h cls Indicates that the BERT pre-training model obtains sentiment classification information through pooling values; h 1 ,…,h n Word vector representation that represents context; The secondary context representation is generated by the following steps: S211: Aggregate the information of neighboring nodes of each node in the primary context representation through a multi-head self-attention network to obtain a context representation with syntactic information; In the formula: represents the i-th word vector of the l+1 layer in the multi-head self-attention network; represents the updated weight; represents the learning parameters of K heads in the l-th layer; N(i) represents the adjacent node domain of the i-th node; represents the information concatenating the K heads of the multi-head self-attention network; represents the context representation of the l-th layer, and if l = 1, it is the output of the last layer of the BERT pre-trained model; represents the learning parameter; and represent learnable transformation matrices; respectively represent the word vectors of the i-th and j-th words of the K-th head in the l-th layer; d represents the dimension size; S212: Transform the syntactic information through point-by-point convolution transformation to generate a secondary context representation h sy ; Where: h 1 represents the output of the graph attention calculation in the lth graph attention layer; σ represents the RELU activation function; * represents the convolution operation; and represents the learning parameters of the convolution operation; and represents the residual parameter; S3: The classification prediction results output by the sentiment classification model are used as the aspect-level sentiment classification results of the text to be tested.
2. The aspect-level sentiment classification method based on enhanced semantic syntactic information as claimed in claim 1, Features: In step S2, when updating the primary context representation and the secondary context representation, the influence of the aspect words is shielded by the Mask vector; Let A be the index set of aspect words and generate the following Mask vector; 3. The aspect-level sentiment classification method based on enhanced semantic syntactic information as claimed in claim 2, Features: In step S2, the primary context representation h is updated through an attention network in a specific aspect se The formula at this time is as follows; Where: Represents the primary word embedding representation updated by the aspect-specific attention network; Representation of primary context The maximum pooling value of aspect words; represents the attention update weight; W se Represents the attention learning matrix.
4. The aspect-level sentiment classification method based on enhanced semantic syntactic information as claimed in claim 1, Features: In step S2, the secondary context representation is updated through the aspect-specific attention network The formula is as follows: Where: Represents the updated secondary word embedding representation through the aspect-specific attention network; represents the updated weight; Represents secondary context representation The maximum pooling value of aspect words; W sy Represents the attention learning matrix.
5. The aspect-level sentiment classification method based on enhanced semantic syntactic information as claimed in claim 1, Features: In step S2, the maximum pooling value of the aspect words of the primary context representation and the secondary context representation is calculated respectively and And the average pooling value of the primary word embedding representation and the secondary word embedding representation and Then, the corresponding multi-granularity fusion information h is calculated by combining the multi-granularity gate mechanism with the following formula g ; G(x1,x2)=g°x1+(1-g)°x2; g=σ(W g [x1;x2]+b g ); Where: σ represents the Sigmod activation function, which is located in [0,1] to control the fusion weight; W g represents a learnable parameter; b g Represents the deviation term.
6. The aspect-level sentiment classification method based on enhanced semantic syntactic information as claimed in claim 5, Features: In step S2, the multi-granularity fusion information h is converted into g With the primary context representation h se The sentiment classification information h in cls Fusion, get the corresponding final text representation h f , and then through the final text representation h f Perform sentiment classification; h f =W f [h g ;h cls ]+b f ; Where: W f and b f represents the learning parameters.
7. The aspect-level sentiment classification method based on enhanced semantic syntactic information as claimed in claim 6, Features: In step S2, the classifier performs sentiment classification using the following formula; and=Softmax(h f ); Where: y represents the classification prediction result.
8. The aspect-level sentiment classification method based on enhanced semantic syntactic information as claimed in claim 1, Features: In step S2, the sentiment classification model is trained by the following training loss function; Where: λ represents the regularization hyperparameter; Θ represents all training parameters in the model; y c represents the prediction sample; represents the real sample; c represents the sentiment classification category.
Citation Information
Patent Citations
Aspect-level text sentiment classification method and system
CN112347248A
Statement text aspect level sentiment classification method and system
CN113157919A
Fine-grained sentiment analysis method based on position enhancement
CN113705197A