A text sentiment classification method based on syntactic dependency and attention mechanism

Through text emotion classification methods based on syntactic dependencies and attention mechanisms, text emotional features are extracted and fused, which solves the problem of information loss in the existing technology and improves the accuracy and performance of emotion classification.

CN117951304BActive Publication Date: 2024-08-23JIANGXI UNIVERSITY OF FINANCE AND ECONOMICS
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410358573.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-27
Publication Date
2024-08-23
Estimated Expiration
2044-03-27

AI Technical Summary

Technical Problem

It is difficult to extract rich semantic information of text in text emotion classification using existing technology, resulting in information loss during feature extraction and fusion, which affects emotion classification performance.

Method used

A text emotion classification method based on syntactic dependencies and attention mechanisms is used to extract attribute-opinion pair information through the key information extraction layer. The word embedding layer uses the dynamic word embedding model BERT. The feature extraction layer uses dual-channel feature extraction and attention mechanisms. The feature fusion layer performs feature fusion in multiple fusion methods, and the output layer performs classification based on comprehensive semantic features.

Benefits of technology

It improves the accuracy and performance of text emotion classification, reduces information loss during the feature fusion process, and enhances feature expression capabilities and model generalization capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117951304B
    Figure CN117951304B
Patent Text Reader

Abstract

The present invention provides a text sentiment classification method based on syntactic dependency and attention mechanism, which is applied to a text sentiment classification model. The model uses syntactic dependency to extract attribute-viewpoint pair information of text, and uses a dynamic word embedding model BERT to obtain dynamic features of text; based on a dual-channel feature extraction strategy, TextCNN and Att-BiLSTM are used to extract local and global semantic features of text respectively, and the dynamic features are further spliced ​​with the output of Att-BiLSTM, and the sentiment features are weighted in combination with the attention mechanism; finally, a feature fusion strategy based on the complementarity of multiple fusion modes is used to fuse local semantic features and global semantic features, and the advantages of feature splicing and attention fusion are combined to reduce the problem of key information loss in the feature fusion process, which is helpful to improve the final performance of sentiment classification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of natural language processing, and in particular to a text sentiment classification method based on syntactic dependency and attention mechanism. Background Art

[0002] Text sentiment classification refers to the classification of text into two or more types of praise or derogatory based on the meaning and emotional information expressed in the text. It is a classification of the author's inclination, views and attitudes, so it is also called opinion analysis. With the promotion and popularization of social media and online comments, the application prospects of text sentiment classification in business decision-making, public opinion monitoring and other fields are becoming more and more extensive. When it comes to text sentiment classification tasks, when extracting features from text, it is inevitable that a large amount of text information will be lost. Therefore, how to better extract the semantic information of the text and reduce the information loss in the feature extraction process plays a vital role in improving the performance of sentiment classification tasks.

[0003] At present, deep learning has made significant progress in sentiment classification tasks. Compared with traditional machine learning methods, deep learning models can better capture the semantic information of text and improve the accuracy of sentiment classification. However, the current deep learning models still have some limitations: First, it is difficult to extract rich semantic information of text in the process of text feature extraction, which will cause the loss of some information, and then lead to insufficient semantic information of the extracted text. Existing methods mostly use a single channel to extract text features, which can extract richer semantic information to a certain extent, but with the increase of the depth of the single channel model, the semantic information of the text will be lost to varying degrees, and a large amount of semantic information will still be lost. In addition, there is also a problem of a large amount of key information loss in the feature fusion process. Most of the existing methods only use attention mechanism or splicing method for feature fusion, which is easy to cause the loss of key information and affect the final performance of sentiment classification. Summary of the invention

[0004] To this end, an embodiment of the present invention proposes a text sentiment classification method based on syntactic dependency and attention mechanism to solve the problem that the prior art is difficult to extract rich semantic information from text and thus difficult to accurately extract text sentiment.

[0005] A text sentiment classification method based on syntactic dependency and attention mechanism according to an embodiment of the present invention is applied to a text sentiment classification model, wherein the text sentiment classification model includes a key information extraction layer, a word embedding layer, a feature extraction layer, a feature fusion layer and an output layer;

[0006] The method comprises:

[0007] The key information extraction layer extracts attribute-viewpoint pair information of the text based on syntactic dependency;

[0008] The word embedding layer uses the text as background information, the attribute-viewpoint pair information as key information, and uses the dynamic word embedding model BERT to obtain dynamic features of the text;

[0009] The feature extraction layer uses a convolutional neural network to extract local semantic features of the text, and the feature extraction layer uses a bidirectional long short-term memory network based on an attention mechanism and the dynamic features to extract global semantic features to obtain features weighted by the attention mechanism, and then splices the dynamic features with the features weighted by the attention mechanism to obtain spliced ​​features, and then performs attention mechanism weighting and average pooling dimensionality reduction on the spliced ​​features to obtain the final global semantic features;

[0010] The feature fusion layer performs feature splicing on the local semantic features and the final global semantic features to obtain spliced ​​features, and performs attention fusion on the local semantic features and the final global semantic features to obtain attention fused features, and then uses the attention mechanism to perform feature fusion on the spliced ​​features and the attention fused features to obtain secondary fused features, and then average pools the secondary fused features to obtain comprehensive semantic features;

[0011] The output layer outputs a text sentiment classification result based on the comprehensive semantic features.

[0012] According to the text sentiment classification method based on syntactic dependency and attention mechanism in the embodiment of the present invention, the key information extraction layer extracts attribute-opinion pair information of the text based on syntactic dependency analysis. The extraction of key information enables the model to better understand the sentiment tendency in the text, which helps to better identify and understand the sentiment information in the text and improve the accuracy of sentiment classification. The word embedding layer uses the text as background information and the attribute-opinion pair as key information, and uses the dynamic word embedding model BERT to obtain the dynamic features of the text, which can overcome the problem that the traditional static word embedding model cannot solve the polysemy problem of a word, and can better obtain the rich grammatical and semantic features of the text. The feature extraction layer adopts a dual-channel feature extraction strategy to extract local semantic features and global semantic features respectively, so as to extract richer semantic information, wherein the dynamic features are spliced ​​with the features weighted by the attention mechanism to obtain the spliced ​​features. The concatenated features are weighted by the attention mechanism and reduced in dimension by average pooling to obtain the final global semantic features, which enriches the semantic features and strengthens the important information of the features, thereby improving the expressiveness of the features. The feature fusion layer adopts a feature fusion strategy that complements multiple fusion methods, and concatenates and fuses the local semantic features and the global semantic features respectively. The concatenation operation combines the global and local semantic information, while the attention fusion operation gives greater weight to important features, focusing attention on features that are more helpful to the task. The concatenated and attention fused features are further fused using the attention mechanism, and average pooling is used to reduce model overfitting to obtain comprehensive semantic features. The fused comprehensive semantic features combine local and global information, strengthen important information, make feature expression richer, reduce the problem of key information loss in feature fusion, and help improve the final performance of sentiment classification. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] The above and / or additional aspects and advantages of the embodiments of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:

[0014] Figure 1 is a structural schematic diagram of a text sentiment classification model according to an embodiment of the present invention;

[0015] Figure 2 is a flow chart of a text sentiment classification method based on syntactic dependency and attention mechanism according to an embodiment of the present invention;

[0016] Figure 3 is an exemplary syntactic dependency diagram;

[0017] Figure 4 This is an exemplary diagram of the word embedding process. DETAILED DESCRIPTION

[0018] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution 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 described embodiments are 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 creative work are within the scope of protection of the present invention.

[0019] The embodiment of the present invention proposes a text sentiment classification method based on syntactic dependency and attention mechanism, which is applied to the text sentiment classification model. Figure 1 , the text sentiment classification model includes a key information extraction layer, a word embedding layer, a feature extraction layer, a feature fusion layer and an output layer.

[0020] See also Figure 2 , the method comprises steps 1 to 5:

[0021] Step 1: The key information extraction layer extracts attribute-viewpoint pair information of the text based on syntactic dependency.

[0022] Among them, attributes usually appear in the form of nouns in the text to describe the specific characteristics of an entity or thing. Opinions refer to the attitude, view or evaluation of an entity or thing. They usually appear in the form of adjectives or verbs in the text to express the attitude or evaluation of the attributes. For example, in the text "The service is good, the taste is good", the attributes are "service" and "taste", and the opinions are "good" and "good". The attribute-opinion pairs that can be extracted are "<service, good>" and "<taste, good>". As the key in the text content, the attribute-opinion pair information plays an important role in determining the sentiment polarity in the sentiment classification task. Accurately extracting the attribute-opinion pairs in the text can enable the sentiment classification model to clarify the key information in the text, which helps to improve the performance of the sentiment classification task.

[0023] Given a sentence , , , Separate sentences X The first word, the second word, the sth word, the sentence Contains a set of attribute-viewpoint pairs , , , , , They are the first attribute element, the second attribute element, the i-th attribute element, and the j-th attribute element, respectively. , , , They are the first viewpoint element, the second viewpoint element, the i-th viewpoint element, and the j-th viewpoint element, respectively. Two-tuple attribute element and viewpoint elements All sentences In the sentence "The service is good and the taste is good", the attribute element , , viewpoint elements , , the set of attribute-opinion pairs included is {(service, good), (taste, nice)}.

[0024] In this embodiment, step 1 specifically includes:

[0025] In the key information extraction layer, syntactic dependency information of the text is obtained based on the syntactic dependency;

[0026] Establish text attribute-opinion pair extraction rules through pre-built attribute-opinion pair templates;

[0027] The syntactic dependency information of the text is matched with the extraction rules to extract the attribute-opinion pair information in the text.

[0028] Among them, the role of syntactic dependency analysis is to identify the interdependence of words in a sentence, and further identify the syntactic structure of the sentence through the dependency of each word. For example, the syntactic dependency of "the service is good, the taste is good" is as follows: Figure 3 The HIT Language Technology Platform (LTP) can be used to analyze the part of speech and syntactic dependencies of each word in the text.

[0029] In this embodiment, an attribute-viewpoint pair extraction template as shown in Table 1 is constructed, where the dependency relationship represents the subject-predicate relationship (SBV), verb-object relationship (VOB), attributive-predicate relationship (ATT), adverbial-verb relationship (ADV), verb-complement relationship (CMP), parallel relationship (COO), preposition-object relationship (POB) and preposed object (FOB) that may exist between words.

[0030] Table 1 Attribute-viewpoint pair extraction template

[0031]

[0032] Then, according to the extraction template, the text attribute-opinion pair extraction rules are established, and the part of speech and syntactic dependency are matched with the extraction rules. If the rules of extraction templates 1-11 in Table 1 are met, the corresponding attribute-opinion pair extraction is performed to finally complete the extraction task.

[0033] In step 2, the word embedding layer uses the text as background information and the attribute-viewpoint pair information as key information, and uses the dynamic word embedding model BERT to obtain the dynamic features of the text.

[0034] Polysemy means that a word has different meanings or interpretations in different contexts, which may lead to ambiguity or misunderstanding. In order to preserve the semantics of the word in the current context and obtain richer text semantic features, this paper considers the contextual information of the text and uses the dynamic word embedding model BERT (Bidirectional Encoder Representations from Transformers) to obtain the dynamic feature vector representation of the text.

[0035] In view of the unidirectionality and insufficient context understanding of traditional language models, in this embodiment, the dynamic word embedding model BERT is used. The dynamic word embedding model BERT improves the encoder-decoder structure of Transformers, adopts a bidirectional encoder structure, and uses mask language modeling (MLM) and next sentence prediction tasks for pre-training, so that the model can learn more comprehensive semantic information and achieve outstanding performance in many tasks in the field of natural language processing. The encoder consists of input, multi-head self-attention mechanism (Multi-Head Self-Attention) and fully connected neural network (Feed Forward Network), and uses the multi-head self-attention mechanism to capture rich semantic information from multiple angles.

[0036] Figure 4 This shows the word embedding of the sentence "Good service, good taste", assuming the token embedding vector is , the fragment embedding vector is , the position embedding vector is , the input of BERT is a vector ,in:

[0037] .

[0038] In this embodiment, step 2 specifically includes:

[0039] In the word embedding layer, the attribute-viewpoint pair information is used as key information and the text is used as background information to construct the input text of the word embedding. , enter text The following conditions are met:

[0040] ;

[0041] in, represents the attribute-viewpoint pair information, represents the text, Represents a splicing operation;

[0042] Then use the dynamic word embedding model BERT to input the text Perform word embedding to obtain a vectorized representation of the text;

[0043] Finally, the dynamic word embedding model BERT is used to process the vectorized representation of the text to obtain the dynamic features of the text. .

[0044] Step 3, the feature extraction layer uses a convolutional neural network to extract local semantic features of the text, and the feature extraction layer uses a bidirectional long short-term memory network based on an attention mechanism and the dynamic features to extract global semantic features to obtain features weighted by the attention mechanism, and then splices the dynamic features with the features weighted by the attention mechanism to obtain spliced ​​features, and then performs attention mechanism weighting and average pooling dimensionality reduction on the spliced ​​features to obtain the final global semantic features.

[0045] In this embodiment, dual-channel feature extraction is performed based on the feature extraction strategy to extract local semantic features and global semantic features of the text respectively, and to extract text semantic information from multiple aspects. Among them, local semantic features refer to the semantic information of a smaller range of local fragments (such as a single word or phrase) in the text. These features can capture information at the lexical level of the text, such as part of speech, local context, and grammatical structure, etc. Global semantic features involve the semantic information of the entire sentence, and highlight the contextual information of the text. This information is helpful for helping the model understand the overall meaning of the text.

[0046] The local semantic feature extraction uses a convolutional neural network (TextCNN). The convolutional neural network is a deep feedforward neural network composed of an input layer, a convolutional layer, a pooling layer, and a fully connected layer. Its core idea is to use convolution to extract features from text. The text is input into the convolutional layer in the form of a word vector matrix, and features of different dimensions are extracted through convolution kernels of different sizes. Then, the maximum pooling operation is performed to discard weak features. Finally, features of different dimensions are concatenated to obtain the final feature vector.

[0047] The feature extraction layer uses a convolutional neural network to extract local semantic features of the text, specifically including:

[0048] In the feature extraction layer, a convolutional neural network is used to slide a fixed-size window at different positions of the text through a convolution operation to extract local features. Then, the maximum pooling method is adopted through the pooling layer to reduce the feature size of the local features, extract the target local features, and splice the target local features to finally obtain the local semantic features. .

[0049] In this embodiment, the global semantic feature extraction adopts the bidirectional long short-term memory network (Att-BiLSTM) based on the attention mechanism. The long short-term memory network (LSTM) is a type of recurrent neural network (RNN). The forget gate, input gate, and output gate mechanism are introduced in each structural unit of the RNN to improve the RNN. The long-term dependency problem is solved by introducing a gating mechanism, so that the network can more fully learn the long-distance dependency of text data. The bidirectional long short-term memory network (BiLSTM) consists of two LSTMs in different directions, so it can consider the forward and backward text information at the same time, so that the model can better capture the contextual information of the data and extract richer features.

[0050] In this embodiment, the feature extraction layer uses a bidirectional long short-term memory network based on an attention mechanism and the dynamic features to extract global semantic features, obtain features weighted by the attention mechanism, and then splice the dynamic features with the features weighted by the attention mechanism to obtain spliced ​​features, and then perform attention mechanism weighting and average pooling dimensionality reduction on the spliced ​​features to obtain the final global semantic features, which specifically include:

[0051] In the feature extraction layer, the dynamic features of the text obtained by the word embedding layer are Input into the bidirectional long short-term memory network and get the output of the bidirectional long short-term memory network , the calculation process is:

[0052] ;

[0053] ;

[0054] ;

[0055] in, is the state of the forward LSTM layer at time t, is the state of the forward LSTM layer at time t-1, is the state of the backward LSTM layer at time t, is the state of the backward LSTM layer at time t-1, , , , , , is the weight parameter, and is the activation function;

[0056] The attention mechanism is a mechanism that imitates human attention. It is essentially an allocation mechanism. Its core idea is to highlight certain important features of an object. By weighting the information at different positions in the input sequence and giving greater weight to more important words, the attention mechanism can make the neural network pay more attention to important information in the text and improve the influence of keywords on text sentiment classification. The features are weighted by the attention mechanism to obtain the features weighted by the attention mechanism. , the calculation process is:

[0057] ;

[0058] ;

[0059] ;

[0060] in, for After activation function The processed vector representation is, is a randomly initialized matrix, Representation and The corresponding weight value, represents the normalized exponential function, Indicates the total duration;

[0061] In order to further extract the global semantic information of the features and reduce semantic loss, this embodiment uses the features weighted by the attention mechanism Dynamic features with text Perform splicing to obtain splicing features , the calculation process is:

[0062] ;

[0063] in, Indicates the splicing operation. and The concatenation is performed along the last dimension of the vector;

[0064] Finally, the splicing features Input to the attention layer, perform attention mechanism weighting, and then perform average pooling operation to reduce dimension, highlight the overall information of the feature, and obtain the final global semantic feature .

[0065] In step 4, the feature fusion layer performs feature splicing on the local semantic features and the final global semantic features to obtain spliced ​​features, and performs attention fusion on the local semantic features and the final global semantic features to obtain attention fused features, and then uses the attention mechanism to perform feature fusion on the spliced ​​features and the attention fused features to obtain secondary fused features, and then average pools the secondary fused features to obtain comprehensive semantic features.

[0066] To address the problem that a single fusion method is prone to losing key information, this embodiment proposes a feature fusion strategy with multiple complementary fusion methods, which performs multiple complementary fusion methods on the global semantic features and local semantic features of the text extracted by the feature extraction layer.

[0067] Wherein, step 4 specifically includes:

[0068] In the feature fusion layer, the final global semantic feature and local semantic features Perform feature splicing to obtain the spliced ​​features , the calculation process is:

[0069] ;

[0070] The final global semantic features and local semantic features Perform attention fusion to obtain the features after attention fusion , the calculation process is:

[0071] ;

[0072] ;

[0073] ;

[0074] in, Represents the final global semantic features The i-th element in express After activation function The processed vector representation is, Representation and The corresponding weight value, is a local semantic feature The kth element in Representing local semantic features The total number of elements in , Represents the final global semantic features The total number of elements in .

[0075] The concatenation operation combines the extracted global and local semantic information, while the attention fusion operation assigns greater weights to important features and focuses attention on features that are more helpful for the task.

[0076] Then, use the attention mechanism to focus on the concatenated features Features after fusion with attention Perform feature fusion to obtain secondary fusion features , and then the secondary fusion features Perform average pooling to reduce the risk of model overfitting, improve the generalization ability of the model, and obtain comprehensive semantic features.

[0077] Step 5: The output layer outputs the text sentiment classification result based on the comprehensive semantic features.

[0078] Among them, the output layer inputs the comprehensive semantic features into the Dropout layer, randomly discards some neurons of the model, reduces the complexity of the neural network, and finally the fully connected layer maps the output to the corresponding category to obtain the text sentiment classification result.

[0079] According to the above-mentioned text sentiment classification method based on syntactic dependency and attention mechanism, the key information extraction layer extracts the attribute-opinion pair information of the text based on syntactic dependency analysis. The extraction of key information can enable the model to better understand the sentiment tendency in the text, which is helpful to better identify and understand the sentiment information in the text and improve the accuracy of sentiment classification. The word embedding layer uses the text as background information and the attribute-opinion pair as key information, and uses the dynamic word embedding model BERT to obtain the dynamic features of the text, which can overcome the problem that the traditional static word embedding model cannot solve the polysemy of a word, and can better obtain the rich grammatical and semantic features of the text. The feature extraction layer adopts a dual-channel feature extraction strategy to extract local semantic features and global semantic features respectively, so as to extract richer semantic information, wherein the dynamic features are spliced ​​with the features weighted by the attention mechanism to obtain spliced ​​features. After the concatenated features are weighted by the attention mechanism and reduced in dimension by average pooling, the final global semantic features are obtained, which enriches the semantic features and strengthens the important information of the features, thereby improving the expressiveness of the features. The feature fusion layer adopts a feature fusion strategy with multiple fusion methods that complement each other, and concatenates and fuses the local semantic features and the global semantic features respectively. The concatenation operation combines the global and local semantic information, while the attention fusion operation gives greater weight to important features, focusing attention on features that are more helpful to the task. The concatenated and attention fused features are further fused using the attention mechanism, and average pooling is used to reduce model overfitting to obtain comprehensive semantic features. The fused comprehensive semantic features combine local and global information, strengthen important information, make feature expression richer, reduce the problem of key information loss in feature fusion, and help improve the final performance of sentiment classification.

[0080] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.

[0081] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.

Claims

1. A text sentiment classification method based on syntactic dependency and attention mechanism, characterized in that: Applied to a text sentiment classification model, the text sentiment classification model includes a key information extraction layer, a word embedding layer, a feature extraction layer, a feature fusion layer and an output layer; The method comprises: The key information extraction layer extracts attribute-viewpoint pair information of the text based on syntactic dependency; The word embedding layer uses the text as background information, the attribute-viewpoint pair information as key information, and uses the dynamic word embedding model BERT to obtain dynamic features of the text; The feature extraction layer uses a convolutional neural network to extract local semantic features of the text, and the feature extraction layer uses a bidirectional long short-term memory network based on an attention mechanism and the dynamic features to extract global semantic features to obtain features weighted by the attention mechanism, and then splices the dynamic features with the features weighted by the attention mechanism to obtain spliced ​​features, and then performs attention mechanism weighting and average pooling dimensionality reduction on the spliced ​​features to obtain the final global semantic features; The feature fusion layer performs feature splicing on the local semantic features and the final global semantic features to obtain spliced ​​features, and performs attention fusion on the local semantic features and the final global semantic features to obtain attention fused features, and then uses the attention mechanism to perform feature fusion on the spliced ​​features and the attention fused features to obtain secondary fused features, and then average pools the secondary fused features to obtain comprehensive semantic features; The output layer outputs text sentiment classification results based on the comprehensive semantic features; The word embedding layer uses the text as background information and the attribute-viewpoint pair information as key information, and uses the dynamic word embedding model BERT to obtain the dynamic features of the text, specifically including: In the word embedding layer, the attribute-viewpoint pair information is used as key information and the text is used as background information to construct the input text of the word embedding. , enter text The following conditions are met: ; in, represents the attribute-viewpoint pair information, represents the text, Represents a splicing operation; Then use the dynamic word embedding model BERT to input the text Perform word embedding to obtain a vectorized representation of the text; Finally, the dynamic word embedding model BERT is used to process the vectorized representation of the text to obtain the dynamic features of the text. .

2. The text sentiment classification method based on syntactic dependency and attention mechanism according to claim 1, characterized in that: The key information extraction layer extracts attribute-viewpoint pair information of the text based on syntactic dependency, specifically including: In the key information extraction layer, syntactic dependency information of the text is obtained based on the syntactic dependency; Establish text attribute-opinion pair extraction rules through pre-built attribute-opinion pair templates; The syntactic dependency information of the text is matched with the extraction rules to extract the attribute-opinion pair information in the text.

3. The text sentiment classification method based on syntactic dependency and attention mechanism according to claim 1, characterized in that: The feature extraction layer uses a convolutional neural network to extract local semantic features of the text, specifically including: In the feature extraction layer, a convolutional neural network is used to slide a fixed-size window at different positions of the text through a convolution operation to extract local features. Then, the maximum pooling method is adopted through the pooling layer to reduce the feature size of the local features, extract the target local features, and splice the target local features to finally obtain the local semantic features. .

4. The text sentiment classification method based on syntactic dependency and attention mechanism according to claim 3, characterized in that: The feature extraction layer uses the bidirectional long short-term memory network based on the attention mechanism and the dynamic features to extract global semantic features, obtains features weighted by the attention mechanism, and then splices the dynamic features with the features weighted by the attention mechanism to obtain spliced ​​features, and then performs attention mechanism weighting and average pooling dimensionality reduction on the spliced ​​features to obtain the final global semantic features, which specifically include: In the feature extraction layer, the dynamic features of the text obtained by the word embedding layer are Input into the bidirectional long short-term memory network and get the output of the bidirectional long short-term memory network , the calculation process is: ; ; ; in, is the state of the forward LSTM layer at time t, is the state of the forward LSTM layer at time t-1, is the state of the backward LSTM layer at time t, is the state of the backward LSTM layer at time t-1, , , , , , is the weight parameter, and is the activation function; Then the output of the bidirectional long short-term memory network The features are weighted by the attention mechanism to obtain the features weighted by the attention mechanism. , the calculation process is: ; ; ; in, for After activation function The processed vector representation is, is a randomly initialized matrix, Representation and The corresponding weight value, represents the normalized exponential function, Indicates the total duration; Then the features weighted by the attention mechanism are Dynamic features with text Perform splicing to obtain splicing features , the calculation process is: ; in, Represents a splicing operation; Finally, the splicing features Input to the attention layer, perform attention mechanism weighting, and then perform average pooling operation and dimensionality reduction to obtain the final global semantic features. .

5. The text sentiment classification method based on syntactic dependency and attention mechanism according to claim 4, characterized in that: The feature fusion layer performs feature splicing on the local semantic features and the final global semantic features to obtain spliced ​​features, and performs attention fusion on the local semantic features and the final global semantic features to obtain attention fused features, and then uses the attention mechanism to perform feature fusion on the spliced ​​features and the attention fused features to obtain secondary fused features, and then average pools the secondary fused features to obtain comprehensive semantic features, specifically including: In the feature fusion layer, the final global semantic feature and local semantic features Perform feature splicing to obtain the spliced ​​features , the calculation process is: ; The final global semantic features and local semantic features Perform attention fusion to obtain the features after attention fusion , the calculation process is: ; ; ; in, Represents the final global semantic features The i-th element in express After activation function The processed vector representation is, Representation and The corresponding weight value, is a local semantic feature The kth element in Representing local semantic features The total number of elements in , Represents the final global semantic features The total number of elements in ; Then use the attention mechanism to the concatenated features Features after fusion with attention Perform feature fusion to obtain secondary fusion features , and then the secondary fusion features Perform average pooling to obtain comprehensive semantic features.