A method and device for aspect-level sentiment analysis based on syntax and graph convolutional network

By constructing a dependency tree and a dependency position graph based on syntactic dependencies and graph convolutional networks, and combining GloVe and a bidirectional long short-term memory network to calculate the dependency distance and relationship of context words, the problem of excessive dependence on grammatical relationships in the existing technology is solved. , achieving more accurate aspect-level sentiment analysis.

CN114417823BActive Publication Date: 2024-09-06DALIAN MARITIME UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210023639.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-10
Publication Date
2024-09-06
Estimated Expiration
2042-01-10

AI Technical Summary

Technical Problem

Existing aspect-level sentiment analysis methods over-rely on grammatical relationships, resulting in the inability to accurately identify the sentiment of aspect words, and ignore context-dependent distance relationships.

Method used

Using a method based on syntactic dependency and graph convolution network, by constructing a dependency tree and dependency position graph, combined with the GloVe pre-training model, bidirectional long short-term memory network, proximity weight convolution layer and dual graph convolution layer, the dependency of context words is calculated distances and relations, using an attention mechanism to fuse hidden state vectors, output aspect representations and sentiment polarity distributions.

Benefits of technology

It better captures the viewpoint characteristics and the correlation between aspect words and context within sentences, improves the accuracy of aspect word sentiment classification, and makes full use of the topological structure and dependence distance of the dependency tree.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114417823B
    Figure CN114417823B
Patent Text Reader

Abstract

The present invention discloses an aspect-level sentiment analysis method and device based on syntactic dependency and graph convolutional network, and relates to the technical field of natural language processing. The aspect-fusion graph convolutional network model used in the present invention can incorporate more semantic information, better utilize the syntactic information and word dependencies in sentences, and thus improve the training quality of the model. First, the syntactic dependency of each sentence instance is enhanced by introducing a dependency tree and a dependency position graph. Then, two graph convolutional networks are used to fuse the dependency tree and the dependency position graph to generate the interactive sentiment features of the aspect. Finally, the important features related to the aspect semantics in the state vectors of the convolutional layer and the masking layer are fully integrated through the attention mechanism. The present invention solves the problem that there is a close relationship between the dependency tree topology and the dependency distance, which is easily overlooked in the field of sentiment analysis. It not only enhances the effect of sentiment classification, but also helps other classification tasks involving graph convolution.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of natural language processing and relates to an aspect-level sentiment analysis method and device based on syntactic dependency and graph convolutional network. Background Art

[0002] To perform a more complete sentiment analysis, the system needs to discover all aspects of a text comment and determine the sentiment expressed for each aspect (a single comment may contain multiple aspect terms). This is the technique known as Aspect-level Sentiment Analysis (ABSA). ABSA is a fine-grained sentiment analysis task that has received increasing attention and research in recent years. With the rapid development of social media, the number of online comments has exploded, and more and more people are willing to express their attitudes and emotions online. At the same time, users are also paying more attention to fine-grained information when browsing comments. Aspect-level sentiment analysis of comments can help users make better decisions.

[0003] Some early ABSA work focused on using machine learning algorithms to capture sentiment polarity based on rich features of content and syntactic structure. With the gradual maturity of deep learning theory and methods, researchers began using deep learning neural network models for ABSA. Neural models that do not consider syntactic models can be divided into several types: LSTM (Long Short-Term Memory)-based models, CNN (Convolutional Neural Network)-based models, and memory-based methods. However, these models represent a sentence as a sequence of words, ignoring the syntactic relationships between words, making it difficult for them to find words that are far away from the expected word.

[0004] Grammatical information allows dependency information to be preserved in long sentences and helps to integrate information between aspect and opinion words. In recent years, some studies have used graph-based models to combine sentence syntactic structure. For example, GCN (Graph Convolutional Network) combined with syntactic dependency trees captures grammatical information and specific aspects of word dependencies, and its performance is better than models that do not consider syntactic relationships. However, these models also have significant shortcomings: they only consider the topological structure of the dependency tree, or the actual distance between words, fail to fully utilize the advantages of the dependency tree, and ignore the dependency distance relationship between contexts. Summary of the Invention

[0005] In order to solve the problem that previous aspect-level sentiment analysis methods overly rely on the grammatical relationship between aspects and contexts, resulting in the inability to more accurately identify the sentiment of aspect words through syntax, the present invention proposes an aspect-level sentiment analysis method and device based on syntactic dependency and graph convolutional network, which fully integrates the topological structure and dependency distance of the dependency tree, thereby giving full play to the advantages of the dependency tree and effectively utilizing the dependency distance relationship between contexts.

[0006] The technical solution of the present invention:

[0007] On the one hand, the present invention provides an aspect-level sentiment analysis method based on syntactic dependency and graph convolutional network, the specific steps of which are as follows:

[0008] Obtain a sentiment analysis dataset, and construct sentences in the sentiment analysis dataset into a dependency tree and a dependency position graph;

[0009] For the sentences in the sentiment analysis dataset, the word vectors are initialized using the GloVe pre-trained model, and the obtained word vectors are input into the bidirectional long short-term memory network to obtain the contextual representation of the sentence;

[0010] Input the context representation into the neighboring weight convolution layer and the dual graph convolution layer respectively;

[0011] In the neighbor weight convolution layer, the dependency distance of the context words is calculated through the dependency tree, the dependency neighbor weights of different words are calculated, and the hidden state vector is obtained based on the neighbor weight convolution; the neighbor weight convolution assigns the dependency neighbor weight before the convolution calculation;

[0012] In the dual graph convolution layer, two graph convolution networks are used to fuse the dependency tree and the dependency position graph respectively. Graph convolution with a normalization factor is used to calculate the representation of each node, and the representation of each node is updated based on the hidden representation of its neighborhood. The two matrices integrating different dependency relationships are used as two sets of graph convolution networks to capture the final representation of the graph convolution network layer from different inputs. The two final representations output by the dual graph convolution layer are combined to extract the interaction between the dependency position feature and the dependency feature. An aspect masking layer is then used to mask the non-aspect word representation and output a hidden state vector.

[0013] An attention mechanism is used to fuse the hidden state vectors output by the adjacent weighted convolutional layer and the masking layer to obtain an aspect-based representation, which is then passed to a fully connected softmax layer to obtain a probability distribution over different emotion polarities.

[0014] Furthermore, the sentences in the sentiment analysis dataset are constructed into a dependency tree and a dependency position graph, including:

[0015] Use a syntactic dependency parser to construct sentences in the sentiment analysis dataset into a directed dependency tree;

[0016] Constructing an adjacency matrix based on the directed dependency tree, setting all diagonal elements of the adjacency matrix to 1, and if there is a dependency relationship between two words, the corresponding position in the adjacency matrix is ​​recorded as 1;

[0017] Calculate the relative position weight of each element of the adjacency matrix according to the aspect words:

[0018]

[0019] where |·| is an absolute value function, p b is the starting position of the aspect, w i represents the i-th context word, {a s} is the word set of the aspect; It is an aspect word in the aspect word set;

[0020] The dependency graph obtained by symmetric diagonal alignment of the adjacency matrix of the directed dependency tree is combined with the relative position weights to obtain the adjacency matrix of the dependency position graph:

[0021]

[0022] in, is a normal dependency graph obtained by symmetric dependency tree along the diagonal line; For a normal dependency graph The relative position weight of .

[0023] Furthermore, the dependent neighbor weight is:

[0024]

[0025] where p i To rely on neighbor weights, d i is the dependency distance from a word to an aspect in a sentence, i is the position subscript of any word in the sentence, τ is the starting position value of the aspect word, m is the number of aspect words, and n is the total number of words in the sentence;

[0026] Accordingly, the neighbor weight convolution's dependent neighbor weight distribution is:

[0027]

[0028] Among them, r i =p i h i and represents the neighboring weighted representation of the i-th word in the sentence, h iRepresents the hidden vector representation of the i-th word, t is half the kernel length, l is the kernel length, d h is the dimension of the hidden state vector in the unidirectional LSTM, represents the feature representation obtained from the convolutional layer, and are the weight and bias of the convolution kernel respectively.

[0029] Furthermore, calculating the dependency distance of the context words through the dependency tree includes:

[0030] When an aspect contains multiple words, the dependency distance between the context and all aspect words is minimized.

[0031] Furthermore, the two final representations output by the dual graph convolutional layer are combined to extract the interaction between the position-dependent features and the dependent features, which is performed according to the following formula:

[0032]

[0033] Where γ is the dependency coefficient feature, h G 、h T They are the two final representations output by the dual graph convolutional layer.

[0034] Furthermore, the attention weight allocation process in the attention mechanism is as follows:

[0035]

[0036]

[0037] Among them, u it and α t are the intermediate calculation results of attention weight calculation, and q i are the final hidden state vectors output by the masking layer and the convolutional layer, W w and U w is the randomly initialized weight, b w is a trainable parameter, is u it The transpose of

[0038] Using the formula Get the corresponding attention weights.

[0039] In another aspect, the present invention further provides an aspect-level sentiment analysis device based on syntactic dependency and graph convolutional network, the device comprising:

[0040] A preprocessing unit, configured to obtain a sentiment analysis dataset and construct sentences in the sentiment analysis dataset into a dependency tree and a dependency position graph;

[0041] A context representation acquisition unit is used to initialize word vectors for sentences in the sentiment analysis dataset using the GloVe pre-trained model, and input the obtained word vectors into a bidirectional long short-term memory network to obtain a context representation of the sentence; and input the context representation into a neighboring weight convolution layer and a dual graph convolution layer respectively;

[0042] A neighbor weight convolution unit is used to calculate the dependency distance of context words through the dependency tree in the neighbor weight convolution layer, calculate the dependency neighbor weights of different words, and obtain a hidden state vector based on the neighbor weight convolution; the neighbor weight convolution assigns the dependency neighbor weight before convolution calculation;

[0043] A dual graph convolution unit, configured to use two graph convolutional networks to fuse the dependency tree and the dependency position graph in the dual graph convolutional layer, calculate the representation of each node using graph convolution with a normalization factor, and update the representation of each node based on the hidden representation of its neighborhood. The two matrices integrating different dependency relationships are used as two sets of graph convolutional networks to capture the final representation of the graph convolutional network layer from different inputs.

[0044] A masking unit is used to combine the two final representations output by the dual graph convolution unit to extract the position-dependent features and the interaction between the dependent features; then use the aspect masking layer to mask the non-aspect word representation and output a hidden state vector;

[0045] an attention unit, configured to fuse the hidden state vectors output by the neighboring weighted convolution unit and the masking unit using an attention mechanism to obtain an aspect-based representation;

[0046] The sentiment analysis unit is used to pass the aspect-based representation obtained by the attention unit to the fully connected softmax layer to obtain the probability distribution of different sentiment polarities.

[0047] On the other hand, the present invention also provides a computer-readable storage medium, which stores a computer instruction set. When the computer instruction set is executed by a processor, it implements the aspect-level sentiment analysis method based on syntactic dependencies and graph convolutional networks as described above.

[0048] Compared with the prior art, the present invention has the following beneficial effects:

[0049] This paper constructs a dependency tree and dependency position graph to enhance the grammatical dependencies of each instance. It then proposes an Aspect Fusion Graph Convolutional Network (AFGCN) model. This model incorporates an attention mechanism to fully integrate salient features related to aspect semantics in the hidden state vectors of the convolutional and masking layers, fully incorporating the topological structure of the dependency tree and dependency distances. Furthermore, the attention mechanism module in this paper fully integrates salient features related to aspect semantics in the hidden state vectors of the convolutional and masking layers.

[0050] The present invention can not only better capture the viewpoint features and fully combine the topological structure and dependency distance of the dependency tree, but also better capture the correlation between aspect words and context within the sentence, which is conducive to more accurate classification of the emotions corresponding to the aspect words. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0052] Figure 1 Schematic diagram of the framework of the AFGCN model in an embodiment of the present invention;

[0053] Figure 2 Schematic diagram of a process for aspect-level sentiment analysis based on syntactic dependency and graph convolutional network in an embodiment of the present invention;

[0054] Figure 3 for Figure 1 A partial enlargement of the dependency tree (left) and dependency location graph (right);

[0055] Figure 4 This is a schematic diagram of the Bi-LSTM principle in an embodiment of the present invention;

[0056] Figure 5 This is a syntactic dependency diagram in an embodiment of the present invention;

[0057] Figure 6 This is a schematic diagram of the graph convolutional network in an embodiment of the present invention. DETAILED DESCRIPTION

[0058] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.

[0059] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0060] The present invention discloses an aspect-level sentiment analysis method based on syntactic dependency and graph convolutional network, and performs aspect-level sentiment analysis using the AFGCN model.

[0061] like Figure 1 As shown, the AFGCN model proposed in the present invention fully integrates the topological structure and dependency distance of the dependency tree, and can better capture the characteristics of viewpoints. Inspired by the position mechanism, the AFGCN model can aggregate effective features in an architecture based on Bi-LSTM (Bi-directional Long Short-Term Memory, full name bidirectional long short-term memory network), and use the syntactic proximity of context words and aspects (the degree to which the dependency distances between different words in a sentence are similar) to determine the importance of different words in a sentence. At the same time, the present invention applies GCN (Graph Convolutional Network) to the dependency tree and dependency position graph respectively, and uses remote multi-word relations (GCN can establish topological associations for words that are far away) and syntactic information through GCN to associate syntactically related words with aspect words. The output of the GCN network passes through the aspect masking layer, which can filter out non-aspect words to obtain focused aspect word features. After that, aspect-specific features are input into the attention mechanism to better capture the correlation between aspect words and context within the sentence. After all the above operations, the context and aspect representations are collectively passed through a linear layer to obtain the final output, which can better accomplish the task of aspect-level sentiment analysis.

[0062] When using the AFGCN model for aspect-level sentiment analysis, first, the dataset is preprocessed, and dependency trees and dependency position graphs are introduced to enhance the grammatical dependencies of each instance. The GloVe pre-trained model is used in the embedding layer to generate word vectors. The GloVe pre-trained model is a new method for generating word vectors proposed by the Stanford NLP research group in 2014; the generated word vectors are input into the Bi-LSTM to learn the contextual information of the comment sentence; then, the output of the Bi-LSTM (the contextual representation of the sentence) is fed into the neighboring weight convolution layer and the dual graph convolution layer (two graph convolution networks are used to fuse the dependency tree and the dependency position graph to generate the interactive sentiment features of the aspect); the final representation of the GCN layer is then input into the aspect masking layer to highlight the key features of the aspect words; finally, a new attention mechanism is used to fully integrate the important features related to the aspect semantics in the hidden state vectors of the neighboring weight convolution layer and the aspect masking layer; then, a fully connected layer is passed through to extract the key features, and finally the probability distribution of different sentiment polarities is output.

[0063] Specifically, if Figure 2 , which shows a flowchart of an aspect-level sentiment analysis method based on syntactic dependency and graph convolutional network in an embodiment of the present invention, the method includes:

[0064] S1. Preprocess the sentiment analysis dataset to obtain the dependency tree and dependency position graph of the sentences in the sentiment analysis dataset:

[0065] In a specific implementation, the embodiment of the present invention uses the data set shown in Table 1.

[0066] Table 1

[0067]

[0068] Use the syntactic dependency parser spacy (Spacy is the world's fastest industrial-grade natural language processing tool that supports a variety of basic natural language processing functions.) to construct the sentences in the given dataset into a directed dependency tree (such as Figure 3 Then, an adjacency matrix is ​​constructed based on the directed dependency tree, and all diagonal elements of the matrix are set to 1. If there is a dependency relationship between two words, the corresponding position in the matrix is ​​recorded as 1, and the adjacency matrix is ​​obtained. In order to highlight the relationship between context and aspect, the present invention calculates the relative position weight of each element in the adjacency matrix according to the aspect words:

[0069]

[0070] in, is the relative position weight of the dependency tree, |·| is an absolute value function, and pb is the starting position of the aspect, {a s} is the word set of the aspect, Represents a specific aspect word in the aspect word set.

[0071] In order to establish a closer dependency relationship between context words, the present invention integrates the common dependency graph obtained by the dependency tree along the diagonal symmetry and the relative position weight of the general dependency graph Derived dependency graph (e.g. Figure 3 The adjacency matrix The formula is as follows:

[0072]

[0073] S2. Use the pre-trained GloVe model to initialize the word vectors for the sentences in the sentiment analysis dataset, and use the obtained word vectors for Bi-LSTM to generate the sentence hidden state vector (i.e., the context representation of the sentence):

[0074] First, assume that there is a sentence in the SemEval-2014 dataset that contains n words and m aspects, that is, s = {w0, w1, ..., w a ,w a+1 ,...,w a+m-1 ,...,w n-1}, where w i represents the i-th context word, w a Indicates the start token of the aspect word. Each word is embedded in a matrix with vector, where |N| is the size of the dictionary, and d i is the dimension of a word vector.

[0075] The present invention uses the pre-trained GloVe model to initialize word vectors and applies the obtained word embedding to Bi-LSTM to generate the sentence hidden state vector h t . Figure 4 As shown in Figure 1, Bi-LSTM builds on LSTM by combining information from the input sequence in both the forward and backward directions. This allows Bi-LSTM to better capture bidirectional semantic dependencies. Bi-LSTM is used because it is more powerful than RNNs and LSTMs, capable of learning contextual information and addressing issues such as exploding and vanishing gradients. Since the input representation already contains aspectual information, aspect-specific contextual representations can be obtained by concatenating hidden states in two directions: in is the hidden state of the forward LSTM, is the hidden state of the reverse LSTM. The new vector finally generated can better and more deeply reflect the semantic meaning of the sentence at a higher level.

[0076] S3. Introduce the weighted convolution module to assign neighboring weights before convolution calculation:

[0077] Previous models based on dependency trees mainly focus on the topology of dependency trees or the distance of dependency trees. However, few models apply them together, which limits the effectiveness of these models in identifying key context words. In the AFGCN model proposed in this paper, syntactic dependency information is formalized as a neighbor weight that describes the proximity between context and aspect. Figure 5 As shown in the example: "But the staff was so horrible to us.", the actual distance between the aspect word "staff" and the sentiment word "horrible" is 3, but the dependency distance is 1. Intuitively, the dependency distance is more conducive to aspect-based sentiment classification than the ordinary distance.

[0078] The dependency distance of the context words is calculated using the dependency tree obtained from S1: the length of the shortest dependency path between the aspect and the sentiment word. If the aspect contains multiple words, the dependency distance between the context and all aspect words will be minimized. The dependency proximity weight of a sentence is calculated using the following formula:

[0079]

[0080] The neighbor weight p i ∈R,d i is the dependency distance from words to aspects in a sentence, i is the position subscript of any word in the sentence, τ is the starting position value of the aspect word, m is the number of aspect words, and n is the total number of words in the sentence.

[0081] This invention also introduces neighbor weighted convolution. Unlike the original definition of convolution, neighbor weighted convolution assigns proximity weights before convolution calculation. It is essentially a one-dimensional convolution with a kernel length of l. The neighbor weighted convolution process is assigned as follows:

[0082]

[0083] where r i =p i h i and h i represents the hidden vector representation of the i-th word, represents the neighboring weighted representation of the i-th word in the sentence, t is half the kernel length, d h is the dimension of the hidden state vector in the unidirectional LSTM, represents the feature representation obtained from the convolutional layer, and are the weight and bias of the convolution kernel respectively.

[0084] S4. Use two graph convolutional networks to fuse the dependency tree and dependency position graph respectively:

[0085] In order to utilize syntactic dependencies, the present invention uses two graph convolutional networks to fuse dependency trees and dependency position graphs respectively to generate interactive emotion features in different aspects. Figure 6 The figure below shows the principle of a graph convolutional network, which connects the nodes in the graph in the spatial domain through linear and nonlinear transformations to form a hierarchical structure, and then performs convolution. The representation of each node is calculated using graph convolution with a normalization factor, and the representation of each node is updated based on the hidden representation of its neighborhood:

[0086]

[0087]

[0088] in, is the representation of the jth token evolved from the previous GCN layer. P(·) is a PairNorm function that integrates position-aware transformations. M ij Including M G and M T , these two matrices integrating different dependencies are used as the input of two groups of GCN respectively. i is the degree of the i-th token in the dependency tree. l and b l are trainable parameters respectively.

[0089] S5. Construct an aspect masking layer to mask non-aspect word representations:

[0090] Combining the two final representations in S4, a combination method that considers both syntactic dependencies and long-term multi-word relationships is used to extract the interaction between dependency position features and dependency features. The final representations of the GCN layer dependency position graph and dependency tree are captured from different inputs, namely h G and h T , where h G It's M G The expression of h T It's M T Therefore, in the embodiment of the present invention, these two representations are combined to extract the interactive relationship between the dependent position feature and the dependent feature:

[0091]

[0092] Where γ is the dependency coefficient feature. This combined method considers both syntactic dependencies and long-term multi-word relationships, using aspect masking to mask the representation of non-aspect words to highlight the key features of aspect words. In other words, the final representation of aspect words output by the GCN layer is retained, and the final representation of non-aspect words is set to 0.

[0093] S6. Using the attention mechanism, the hidden state vectors of the convolutional layer and the masking layer are fused and passed to the fully connected softmax layer to output the probability distribution of different sentiment polarities:

[0094] In this embodiment of the present invention, a new attention mechanism is used to integrate the significant features related to aspect semantics in the hidden state vectors of the convolutional layer and the masking layer, and to set accurate attention weights for each context word accordingly. The attention weight allocation process is described as follows:

[0095]

[0096]

[0097] in, and q i are the final hidden state vectors output by the masking layer and the convolutional layer respectively. w and U w is the randomly initialized weight, b w is a trainable parameter, is u it Then use the formula Get the corresponding attention weights.

[0098] Finally, the aspect-based representation r is passed to a fully connected Softmax layer, whose output is the probability distribution over different sentiment polarities:

[0099] p=softmaxW p r+b p ) (10)

[0100] Where W p and b p are the learnable parameters of the sentiment classifier layer.

[0101] The model is trained using a standard gradient descent algorithm to minimize the cross entropy loss over all training samples:

[0102]

[0103] Where J is the number of training samples, p i and are the true value and predicted label of the i-th sample, Θ represents all trainable parameters, and λ is the l2-regularization coefficient.

[0104] Table 2 shows the comparison results of the accuracy and F1 value (%) of the method (AFGCN) in the embodiment of the present invention and the baseline model. The best result on each dataset is indicated in bold.

[0105] Table 2

[0106]

[0107] The embodiment of the present invention was compared with nine current high-performance prediction models (SVM, ATAE-LSTM, Mem-Net, RAM, TNet-LF, TD-GAT, ASGCN, kumaGCN, BiGCN) in multiple rounds of experiments. The classification results are shown in Table 2. Table 2 shows the comparison of the results of the model of the present invention and the baseline model. It can be seen from Table 2 that the method of the present invention has better results in terms of accuracy and F1 value (calculated by precision and recall), and is more stable and has a smaller standard deviation. The calculation formula is as follows:

[0108]

[0109]

[0110]

[0111]

[0112] TP (True Positive) stands for true positive: the prediction is positive and the actual result is also positive; FP (False Positive) stands for false positive: the prediction is positive and the actual result is negative; FN (False Negative) stands for false negative: the prediction is negative and the actual result is positive; TN (True Negative) stands for true negative: the prediction is negative and the actual result is also negative.

[0113] Experimental results on five benchmark datasets demonstrate the effectiveness of the proposed model in aspect-level sentiment analysis.

[0114] Corresponding to the aspect-level sentiment analysis method based on syntactic dependency and graph convolutional network in the present invention, the present invention also provides an aspect-level sentiment analysis device based on syntactic dependency and graph convolutional network, which includes:

[0115] A preprocessing unit, configured to obtain a sentiment analysis dataset and construct sentences in the sentiment analysis dataset into a dependency tree and a dependency position graph;

[0116] A context representation acquisition unit is used to initialize word vectors for sentences in the sentiment analysis dataset using the GloVe pre-trained model, and input the obtained word vectors into a bidirectional long short-term memory network to obtain a context representation of the sentence; and input the context representation into a neighboring weight convolution layer and a dual graph convolution layer respectively;

[0117] A neighbor weight convolution unit is used to calculate the dependency distance of context words through the dependency tree in the neighbor weight convolution layer, calculate the dependency neighbor weights of different words, and obtain a hidden state vector based on the neighbor weight convolution; the neighbor weight convolution assigns the dependency neighbor weight before convolution calculation;

[0118] A dual graph convolution unit, configured to use two graph convolutional networks to fuse the dependency tree and the dependency position graph in the dual graph convolutional layer, calculate the representation of each node using graph convolution with a normalization factor, and update the representation of each node based on the hidden representation of its neighborhood. The two matrices integrating different dependency relationships are used as two sets of graph convolutional networks to capture the final representation of the graph convolutional network layer from different inputs.

[0119] A masking unit is used to combine the two final representations output by the dual graph convolution unit to extract the position-dependent features and the interaction between the dependent features; then use the aspect masking layer to mask the non-aspect word representation and output a hidden state vector;

[0120] an attention unit, configured to fuse the hidden state vectors output by the neighboring weighted convolution unit and the masking unit using an attention mechanism to obtain an aspect-based representation;

[0121] The sentiment analysis unit is used to pass the aspect-based representation obtained by the attention unit to the fully connected softmax layer to obtain the probability distribution of different sentiment polarities.

[0122] For an aspect-level sentiment analysis device based on syntactic dependency and graph convolutional network in an embodiment of the present invention, since it corresponds to an aspect-level sentiment analysis method based on syntactic dependency and graph convolutional network in the above embodiment, the description is relatively simple. For relevant similarities, please refer to the description of the aspect-level sentiment analysis method based on syntactic dependency and graph convolutional network in the above embodiment, which will not be described in detail here.

[0123] An embodiment of the present invention also discloses a computer-readable storage medium, which stores a computer instruction set. When the computer instruction set is executed by a processor, it implements the aspect-level sentiment analysis method based on syntactic dependency and graph convolutional network as provided in any of the above embodiments.

[0124] In the several embodiments provided by the present invention, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are merely illustrative. For example, the division of the units can be a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, and can be electrical or other forms.

[0125] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0126] In addition, the functional units in the various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0127] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk, etc. Various media that can store program codes.

[0128] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. An aspect-level sentiment analysis method based on syntactic dependency and graph convolutional network, characterized in that: The method comprises: Acquire a sentiment analysis data set, and construct sentences in the sentiment analysis data set into a dependency tree and a dependency position graph; For the sentences in the sentiment analysis dataset, the word vectors are initialized using the GloVe pre-trained model, and the obtained word vectors are input into a bidirectional long short-term memory network to obtain the context representation of the sentence; Input the context representation into the neighboring weight convolution layer and the dual graph convolution layer respectively; In the neighbor weight convolution layer, the dependency distance of the context words is calculated through the dependency tree, the dependency neighbor weights of different words are calculated, and the hidden state vector is obtained based on the neighbor weight convolution; the neighbor weight convolution allocates the dependency neighbor weight before the convolution calculation; In the dual graph convolution layer, two graph convolution networks are used to fuse the dependency tree and the dependency position graph respectively, and the representation of each node is calculated using graph convolution with a normalization factor, and the representation of each node is updated according to the hidden representation of its neighborhood. The two matrices integrating different dependency relationships are used as two groups of graph convolution networks to capture the final representation of the graph convolution network layer from different inputs; the two final representations output by the dual graph convolution layer are combined to extract the interaction between the dependency position feature and the dependency feature; and the aspect masking layer is used to mask the non-aspect word representation, and the hidden state vector is output; The attention mechanism is used to fuse the hidden state vectors output by the adjacent weighted convolution layer and the masking layer to obtain an aspect-based representation, and the aspect-based representation is passed to a fully connected softmax layer to obtain a probability distribution over different emotion polarities.

2. According to claim 1, the aspect-level sentiment analysis method based on syntactic dependency and graph convolutional network is characterized in that: The sentences in the sentiment analysis dataset are constructed into a dependency tree and a dependency position graph, including: Use a syntactic dependency parser to construct sentences in the sentiment analysis dataset into a directed dependency tree; Constructing an adjacency matrix based on the directed dependency tree, setting all diagonal elements of the adjacency matrix to 1, and if there is a dependency relationship between two words, recording the corresponding position in the adjacency matrix as 1; The relative position weight of each element of the adjacency matrix is ​​calculated according to the aspect words: where |·| is an absolute value function, p b is the starting position of the aspect, w i represents the i-th context word, {a s } is the word set of the aspect; It is an aspect word in the aspect word set; The dependency graph obtained by symmetrically combining the adjacency matrix of the directed dependency tree along the diagonal line with the relative position weights is combined to obtain the adjacency matrix of the dependency position graph: in, It is a normal dependency graph obtained by symmetric dependency tree along the diagonal line; For a normal dependency graph The relative position weight of .

3. The aspect-level sentiment analysis method based on syntactic dependency and graph convolutional network according to claim 1, characterized in that: The dependent neighbor weight is: where p i is dependent on neighbor weights, d i is the dependency distance from a word to an aspect in a sentence, i is the position subscript of any word in the sentence, τ is the starting position value of the aspect word, m is the number of aspect words, and n is the total number of words in the sentence; Accordingly, the dependent neighbor weight distribution of the neighbor weight convolution is: Among them, r i =p i h i and represents the neighboring weighted representation of the i-th word in the sentence, h i The hidden vector representation of the i-th word, t is half the kernel length, l is the kernel length, d h is the dimension of the hidden state vector in a unidirectional LSTM, represents the feature representation obtained from the convolutional layer, and are the weight and bias of the convolution kernel respectively.

4. The aspect-level sentiment analysis method based on syntactic dependency and graph convolutional network according to claim 1, characterized in that: Calculating the dependency distance of the context word through the dependency tree includes: When an aspect contains multiple words, the dependency distance between the context and all aspect words is minimized.

5. The aspect-level sentiment analysis method based on syntactic dependency and graph convolutional network according to claim 1, characterized in that: Combining the two final representations output by the dual graph convolutional layer, extracting the interaction between the dependent position features and the dependent features is performed as follows: Where γ is the dependency coefficient feature, h G 、h T They are the two final representations of the output of the dual graph convolutional layer.

6. The aspect-level sentiment analysis method based on syntactic dependency and graph convolutional network according to claim 1, characterized in that: The attention weight allocation process in the attention mechanism is as follows: Among them, u it and α t are the intermediate calculation results of attention weight calculation, and q i are the final hidden state vectors output by the masking layer and the convolutional layer, respectively, w and U w is the randomly initialized weight, b w is a trainable parameter, is u it The transpose of Using the formula Get the corresponding attention weights.

7. An aspect-level sentiment analysis device based on syntactic dependency and graph convolutional network, characterized in that: The device comprises: A preprocessing unit, used to obtain a sentiment analysis data set, and construct sentences in the sentiment analysis data set into a dependency tree and a dependency position graph; A context representation acquisition unit is used to initialize word vectors for sentences in the sentiment analysis dataset using a GloVe pre-trained model, and input the obtained word vectors into a bidirectional long short-term memory network to obtain context representations of the sentences; and input the context representations into a neighboring weight convolution layer and a dual graph convolution layer respectively; A neighbor weight convolution unit is used to calculate the dependency distance of the context words through the dependency tree in the neighbor weight convolution layer, calculate the dependency neighbor weights of different words, and obtain the hidden state vector based on the neighbor weight convolution; the neighbor weight convolution allocates the dependency neighbor weight before the convolution calculation; A dual graph convolution unit, used for, in the dual graph convolution layer, using two graph convolution networks to fuse the dependency tree and the dependency position graph respectively, using graph convolution with a normalization factor to calculate the representation of each node, and updating the representation of each node according to the hidden representation of its neighborhood, using the two matrices integrating different dependency relationships as two groups of graph convolution networks respectively, to capture the final representation of the graph convolution network layer from different inputs; A masking unit is used to combine the two final representations output by the dual graph convolution unit to extract the dependent position features and the interactive relationship between the dependent features; and then use the aspect masking layer to mask the non-aspect word representation and output a hidden state vector; An attention unit, configured to use an attention mechanism to fuse the hidden state vectors output by the neighboring weight convolution unit and the masking unit to obtain an aspect-based representation; The sentiment analysis unit is used to transfer the aspect-based representation obtained by the attention unit to the fully connected softmax layer to obtain the probability distribution of different sentiment polarities.

8. A computer-readable storage medium, which stores a computer instruction set. When the computer instruction set is executed by a processor, it implements the aspect-level sentiment analysis method based on syntactic dependency and graph convolutional network as described in any one of claims 1 to 7.