Aspect-level sentiment classification method based on multi-strategy text data enhancement
By combining word-level and sentence-level data augmentation techniques, hybrid augmented text is generated. By utilizing a long short-term memory network with an attention mechanism, the problem of insufficient aspect-level sentiment classification data under conditions of few samples and low resources is solved, thereby improving the accuracy and generalization ability of the model.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANXI UNIV OF FINANCE & ECONOMICS
- Filing Date
- 2023-09-26
- Publication Date
- 2026-04-21
AI Technical Summary
Existing aspect-level sentiment classification methods suffer from insufficient data under conditions of few samples and low resources, resulting in inadequate model accuracy and generalization ability. Existing data augmentation techniques suffer from excessive noise or high complexity.
A multi-strategy text data augmentation method is adopted, combining word-level and sentence-level data augmentation techniques, including synonym replacement, random swapping, sentence reorganization, and syntax tree operations, to generate hybrid augmented text, and sentiment classification is performed through a long short-term memory network with an attention mechanism.
It effectively expands the amount of data, improves the accuracy and generalization ability of aspect-level sentiment classification, and enhances the performance of the model under conditions of few samples and low resources.
Smart Images

Figure CN121901807A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of natural language processing sentiment analysis technology, and proposes an aspect-level sentiment classification method based on multi-strategy text data augmentation. Background Technology
[0002] Aspect-based sentiment analysis (ABSA) is a significant research area in Natural Language Processing (NLP). This method can uncover the sentiment tendency of a specific entity or attribute in text data, thus more accurately reflecting complex emotional features. However, due to the wide range of applications of aspect-based sentiment classification, some domains have relatively small datasets and lack complete and high-quality corpora, resulting in problems such as few available samples and low resources. These issues may affect the accuracy and generalization ability of the model.
[0003] Text classification requires a large amount of labeled data to train deep learning models. However, labeling text datasets is a difficult and time-consuming task, resulting in a limited number of labeled datasets suitable for sentiment classification. To overcome this problem, data augmentation techniques, which originated in image processing, can be employed. Some simple text augmentation techniques, such as synonym replacement, random deletion, back-translation, and sentence structure alteration, can augment text data in a short time. However, the former easily alters the core meaning of the text, the latter relies excessively on sentence order, and back-translation needs to consider the accuracy of machine translation. Therefore, these individual operations can introduce a significant amount of noise, thus failing to achieve the desired data augmentation effect. Overly complex text augmentation algorithms increase complexity, training time, and cost, thereby reducing the efficiency of data augmentation.
[0004] The discreteness, contextual relevance, and ambiguity of text data across different contexts limit the diversity of text data augmentation methods. To address the problem of insufficient data, data augmentation techniques are used to generate data samples that conform to the distribution of real-world data. Combining data augmentation and generation techniques with deep learning networks is an important research direction. Applying data augmentation techniques to aspect-level sentiment classification tasks can solve the problem of insufficient data, but it is necessary to ensure that the augmented data conforms to the distribution of real-world data. Text augmentation techniques at the word and sentence levels can improve the robustness and generalization ability of models for small-sample text classification.
[0005] Aspect-level sentiment classification is a crucial task in sentiment analysis, aiming to identify the sentiment polarity of specific aspects (or attributes) within a given text. This task goes beyond simply identifying overall sentiment; it requires understanding the sentiment of specific aspects within the text. With the development of deep learning technology, deep neural network methods have gradually surpassed and replaced traditional feature engineering-based approaches to solve this task. In recent years, researchers have utilized attention mechanisms to model dependencies between commentary text and the evaluated object, capturing key information based on relevance. Deep learning methods based on attention mechanisms have achieved breakthroughs in aspect-level sentiment classification.
[0006] This invention proposes an aspect-level sentiment classification method based on multi-strategy text data augmentation. First, we use simple data augmentation techniques such as random swapping and synonym replacement to achieve local text enhancement at the word level. Next, we employ sentence-level strategies such as sentence pruning, reordering, and syntax tree operations to modify key sentences, and then reconstruct the text using back-translation. Finally, we combine word-level and sentence-level strategies to construct a multi-strategy text augmentation scheme. This multi-strategy text data augmentation-based aspect-level sentiment classification method can further improve the performance of aspect-level sentiment classification in domains with few samples and low resources. Summary of the Invention
[0007] This invention aims to solve aspect-level sentiment classification tasks in domains with few samples and low resources by applying a multi-strategy hybrid text data augmentation scheme that combines word-level and sentence-level data augmentation.
[0008] To achieve the above objectives, and considering the impact of text data augmentation on aspect-level sentiment classification, this invention proposes an aspect-level sentiment classification method based on multi-strategy text data augmentation, comprising the following steps:
[0009] S1, the overall framework of the aspect-level sentiment classification method based on multi-strategy text data augmentation, mainly includes three modules: data preprocessing, hybrid augmentation, and sentiment classification. First, the data is preprocessed, then the augmented text data is generated based on the multi-strategy text data augmentation method, and finally, it is input into the sentiment classification module for aspect-level sentiment classification.
[0010] S2, Data Preprocessing; Data preprocessing is a key step in natural language understanding tasks, which involves processing the collected data into the input format required by the model, including data cleaning, stop word removal, and word vectorization.
[0011] S3, in the hybrid enhancement module, a multi-strategy-based text data augmentation scheme is designed, which includes data augmentation strategies at the word level and sentence level, to generate enhanced and expanded text, and apply it to the aspect-level sentiment classification task;
[0012] S4. In the sentiment classification module, an attention-based long and short term memory (LSTM) network is constructed. The model architecture includes four parts: word embedding, LSTM encoding, attention mechanism, and sentiment classification.
[0013] The aspect-level sentiment classification method based on multi-strategy text data augmentation proposed in this invention first expands the data at the word level by performing operations such as synonym replacement, word position swapping, and partial word deletion on the original corpus text to obtain word-enhanced data. Second, it performs sentence-level operations on the original data, including sentence reorganization, text pruning, syntax tree operations, and back-translation, to form sentence-enhanced data. Finally, it combines word-level and sentence-level operations to generate multi-strategy text-enhanced data. Experimental results show that the method proposed in this invention effectively expands the data volume and improves the aspect-level sentiment classification performance.
[0014] According to an embodiment of the present invention, step S1 includes:
[0015] S11, the data preprocessing module includes data cleaning, stop word removal and text word vectorization, which can improve the quality of data and transform unstructured raw data into numerical features suitable for model processing, which is crucial for aspect-level sentiment classification tasks.
[0016] S12, the hybrid enhancement module combines word-level and sentence-level data enhancement to generate hybrid enhanced text. Word-level data enhancement uses simple data enhancement techniques, including random swapping and synonym replacement, while sentence-level data enhancement uses techniques such as sentence-level reorganization, pruning, and syntax tree operations.
[0017] S13, the sentiment classification module inputs the original text, word-level and sentence-level enhanced text, and multi-strategy hybrid enhanced text into the sentiment classification model, and outputs sentiment labels for each aspect;
[0018] According to one embodiment of the present invention, step S2 further includes:
[0019] S21, Data cleaning includes removing HTML tags, special characters, punctuation marks and unnecessary spaces, while correcting spelling errors and removing duplicate characters in text data to ensure that the data is clean and consistent;
[0020] S22, removing stop words refers to removing common stop words (such as "the", "is", etc.) from text data. These words usually do not contain useful information in aspect-level sentiment analysis tasks and are of no help to sentiment analysis tasks.
[0021] S23, word vectorization refers to the process of converting text data into numerical vectors. Word vectorization first requires word segmentation of the text data, dividing the text into words or sub-words; then, based on word embedding technologies such as Word2Vec and GloVe, the words are represented as vectors.
[0022] According to one embodiment of the present invention, step S3 further includes:
[0023] S31, word-level data augmentation employs simple data augmentation techniques, including four operations: random swapping, synonym replacement, random insertion, and random deletion, to enhance the original text and generate word-level augmented text. Through word-level data augmentation, the data text has achieved local text enhancement, effectively expanding the dataset to a certain extent. However, this method only changes some words and their order in the text. Due to the limited number of synonyms and the inability to guarantee that too much noise is not added, there is still a problem of insufficient data volume. Therefore, it can be improved by combining sentence-level data augmentation techniques.
[0024] S32, after obtaining the word-level augmented text, the original text and the word-level augmented text are combined into a text pair, and sentence-level data augmentation is performed, including sentence reorganization, sentence pruning, syntax tree operations, and sentence back-translation operations, to generate sentence-level augmented text; based on the original data, after sentence-level data augmentation and other operations, the word order and structure of the text sentences have changed; however, the aspect words and polarity of the text remain unchanged, that is, the original meaning of the sentences has not changed;
[0025] S33. After obtaining word-level and sentence-level augmented text, they are merged with the original data text to form the final augmented text data for training the aspect-level sentiment classification model.
[0026] According to one embodiment of the present invention, step S4 further includes:
[0027] S41, First, the input text data (e.g., comments) is word-embedded, converting each word into a word vector. This can be done using a pre-trained word embedding model, such as Word2Vec or GloVe word embedding.
[0028] S42, Subsequently, the obtained word vectors are fed into the LSTM layer as the input sequence for encoding processing, outputting a hidden state sequence H = {h1, h2, ..., h...} T}, where each h t This represents the hidden state of the text at time step t;
[0029] S43, an attention mechanism is introduced to calculate the importance of the relevance of each word in the input text to the target, and attention weights are assigned based on this to extract the representation of important words in the input text and encode them into the context vector representation of the sentence;
[0030] e t =tanh(W a a+W h h t +b)
[0031]
[0032] r = ∑ t α t ×h t
[0033] Among them, e t It's the attention score, W a and W h It is a weight matrix, b is the bias term; r is the context vector, α t It is the attention weight, which represents the relevance of the input text to the target word a at time step t;
[0034] S44, Finally, the context vector is fed into a fully connected layer for aspect-level sentiment classification prediction; this invention uses the Softmax function for sentiment classification, and the output is the sentiment label of the target aspect;
[0035] y = softmax(W p r+b p )
[0036] Where y is the predicted probability distribution of the output sentiment polarity, and W p and b p These are the learnable weighted proofs and the bias vectors, respectively.
[0037] Compared with the prior art, the present invention has the following beneficial effects:
[0038] (1) This invention proposes an aspect-level sentiment classification method based on multi-strategy text data augmentation. This method can effectively expand the amount of data through multi-strategy text data augmentation schemes and effectively improve the aspect-level sentiment classification effect under conditions of few samples and low resources.
[0039] (2) This invention combines word-level and sentence-level data augmentation strategies to generate hybrid augmented text. While some simple text augmentation techniques, such as synonym replacement, random deletion, back-translation, and sentence structure alteration, can augment text data quickly, the former easily changes the core meaning, the latter relies excessively on sentence order, and back-translation requires consideration of machine translation accuracy. Therefore, these individual operations introduce significant noise, failing to achieve the desired data augmentation effect. Combining word-level and sentence-level data augmentation techniques reduces the significant noise introduced by individual data augmentations, ensuring the efficiency of text data augmentation.
[0040] (3) The aspect-level sentiment classification method proposed in this invention was experimentally verified on the Semeval-2014 restaurant domain dataset, a benchmark dataset for aspect-level sentiment classification tasks. The experimental results verified that the data augmentation method can improve the accuracy of machine learning models and neural network models on datasets of different sizes, and the experimental accuracy is improved compared with the original dataset. In addition, the multi-strategy data augmentation scheme is significantly better than the results of word-level and sentence-level data augmentation alone. The multi-strategy text data augmentation method can effectively improve the aspect-level sentiment classification effect. Attached Figure Description
[0041] Figure 1 This is a flowchart of aspect-level sentiment classification based on multi-strategy text data augmentation according to an embodiment of the present invention.
[0042] Figure 2 This is a general framework diagram for aspect-level sentiment classification based on multi-strategy text data augmentation. Detailed Implementation
[0043] The present invention will now be further described with reference to the accompanying drawings.
[0044] like Figure 1 As shown, the framework of this invention mainly consists of the following four steps, which are interconnected and ultimately integrated. The learning process mainly includes the following steps:
[0045] S1, the overall framework of the aspect-level sentiment classification method based on multi-strategy text data augmentation, mainly includes three modules: data preprocessing, hybrid augmentation, and sentiment classification. First, the data is preprocessed, then the augmented text data is generated based on the multi-strategy text data augmentation method, and finally, it is input into the sentiment classification module for aspect-level sentiment classification.
[0046] Step S1 also includes:
[0047] S11, the data preprocessing module includes data cleaning, stop word removal and text word vectorization, which can improve the quality of data and transform unstructured raw data into numerical features suitable for model processing, which is crucial for aspect-level sentiment classification tasks.
[0048] S12, the hybrid enhancement module combines word-level and sentence-level data enhancement to generate hybrid enhanced text. Word-level data enhancement uses simple data enhancement techniques, including random swapping and synonym replacement, while sentence-level data enhancement uses techniques such as sentence-level reorganization, pruning, and syntax tree operations.
[0049] S13, the sentiment classification module inputs the original text, word-level and sentence-level enhanced text, and multi-strategy hybrid enhanced text into the sentiment classification model, and outputs sentiment labels for each aspect;
[0050] The formal definition of the problem of this invention is given below:
[0051] Given an aspect sentiment classification dataset D, a sentence S = {w1, ... w1} consisting of n words. i , ...w n}, where w i It is the i-th word in the sequence, and the aspect set A = {a1, ... a2} j , ...a n}, where a j It is an aspect of the sequence, and an emotional polarity set Y = {Postive, Negative}, where Postive is the positive emotional polarity and Negative is the negative emotional polarity.
[0052] Aspect-level sentiment classification aims to determine the aspect words w in sentence S. i The objective function of this task is typically to maximize the consistency between the predicted sentiment label and the true sentiment label, which can be achieved using the cross-entropy loss function:
[0053]
[0054] Where n is the length of the text sequence, y i p(y) is the true label of the i-th word. i ) is the probability predicted by the model.
[0055] The overall framework diagram of the aspect-level sentiment classification method based on multi-strategy text data augmentation is as follows: Figure 2 As shown, the input is the aspect review dataset D, and the output is the aspect category label Y.
[0056] S2, Data Preprocessing; Data preprocessing is a key step in natural language understanding tasks, which involves processing the collected data into the input format required by the model, including data cleaning, stop word removal, and word vectorization.
[0057] Step S2 also includes:
[0058] S21, Data cleaning includes removing HTML tags, special characters, punctuation marks and unnecessary spaces, while correcting spelling errors and removing duplicate characters in text data to ensure that the data is clean and consistent;
[0059] S22, removing stop words refers to removing common stop words (such as "the", "is", etc.) from text data. These words usually do not contain useful information in aspect-level sentiment analysis tasks and are of no help to sentiment analysis tasks.
[0060] S23, word vectorization refers to the process of converting text data into numerical vectors. Word vectorization first requires word segmentation of the text data, dividing the text into words or sub-words; then, based on word embedding technologies such as Word2Vec and GloVe, the words are represented as vectors.
[0061] The dataset used is the Semeval-2014 restaurant dataset. To perform word-level enhancements, the original XML data needs to be preprocessed. Table 1 shows the data format of the Semeval-2014 restaurant dataset after preprocessing. Each text data point corresponds to an aspect term in the text, which can be used as label information for sentiment classification and corresponds to the aspect polarity of the text.
[0062] Table 1 Example of preprocessing the original data set
[0063]
[0064] S3, in the hybrid enhancement module, designs a text data augmentation method based on multiple strategies, which includes word-level and sentence-level data augmentation strategies, generates augmented text, and applies it to aspect-level sentiment classification tasks;
[0065] Step S3 also includes:
[0066] S31, word-level data augmentation employs simple data augmentation techniques, including four operations: random swapping, synonym replacement, random insertion, and random deletion, to enhance the original text and generate word-level augmented text. Through word-level data augmentation, local text enhancement has been achieved, effectively expanding the dataset to some extent. However, this method only changes some words and their order in the text. Due to the limited number of synonyms and the inability to guarantee the absence of excessive noise, the data volume remains insufficient. Therefore, it can be improved by combining sentence-level data augmentation techniques.
[0067] S32, after obtaining the word-level augmented text, the original text and the word-level augmented text are combined into a text pair, and sentence-level data augmentation is performed, including sentence reorganization, sentence pruning, syntax tree operations, and sentence back-translation operations, to generate sentence-level augmented text; based on the original data, after sentence-level data augmentation and other operations, the word order and structure of the text sentences have changed; however, the aspect words and polarity of the text remain unchanged, that is, the original meaning of the sentences has not changed;
[0068] S33. After obtaining word-level and sentence-level augmented text, they are merged with the original data text to form the final augmented text data for training the aspect-level sentiment classification model.
[0069] Word-level data augmentation includes random insertion, random swapping, and random deletion, with the specific operations as follows:
[0070] (1) Synonym Replacement: Randomly select some non-stop words in the sentence and replace them with their synonyms. Specifically:
[0071] SR=S[i:j]+synonym(S[j])+S[j+1:]
[0072] Where S is the original sentence, SR is the enhanced sentence, i and j are the start and end positions of randomly selected words, and synonym(S[j]) is a synonym of S[j].
[0073] (2) Random Insertion: Randomly select some positions in the sentence and insert random synonyms. Specifically:
[0074] RI=S[i:j]+synonym(S[j])+S[j:i]+S[i+1:]
[0075] Where S is the original sentence, RI is the enhanced sentence, i and j are randomly selected positions, and synonym(S[j]) is a synonym of S[j].
[0076] (3) Random Swap: This method involves randomly selecting two words in a sentence and then swapping their positions. The specific steps are as follows:
[0077] RS=S[i:j]+S[k]+S[j+1:k]+S[j]+S[k+1:]
[0078] Where S is the original sentence, RS is the enhanced sentence, and i, j, and k are randomly selected positions.
[0079] (4) Random Deletion: This method involves randomly deleting some words from a sentence. The specific steps are as follows:
[0080] RD = S[i:j] + S[j+1:]
[0081] In this sentence, S is the original sentence, RD is the enhanced sentence, i and j are the randomly selected start and end positions of words, S[i:j] is the words in the original sentence from position i to j-1, and S[j+1:] is the words in the original sentence from position j+1 to the end. These two parts are concatenated to obtain the new sentence RD.
[0082] Sentence-level data augmentation includes sentence reorganization, sentence pruning, syntax tree operations, and sentence back-translation, with the specific operations as follows:
[0083] (1) Sentence shuffling is a method that reorders the words or phrases in a sentence to generate a new sentence. Specifically, it involves breaking down a sentence into words or phrases, randomly changing the order of the words or phrases, and then recombining the reordered words or phrases into a sentence.
[0084] SS = shuffle(S)
[0085] Here, S is the original sentence, SS is the enhanced sentence, and shuffle() is a function that randomly shuffles the input sequence.
[0086] (2) The sentence trimming method is to delete some words or phrases in a sentence to generate a new sentence.
[0087] ST = S - subset(S)
[0088] Where S is the original sentence, ST is the enhanced sentence, and subset(S) is a subset randomly selected from S.
[0089] (3) The Syntax Tree Manipulation method first performs syntactic analysis, then manipulates the syntactic structure of the sentence, and finally generates a new sentence.
[0090] STM=generate(manipulate(parse(S)))
[0091] Syntactic analysis requires parsing a sentence into a syntax tree. This is typically done by a syntactic analyzer, which can be represented as T = parse(S), where S is the original sentence, T is the generated syntax tree, and parse() is the syntactic analysis function.
[0092] Syntax tree operations perform various operations on the syntax tree, such as node replacement, insertion, and deletion. This can be represented as T′ = manipulate(T), where T′ is the syntax tree after the operations, and manipulate() is the syntax tree operation function.
[0093] Sentence generation transforms the processed syntax tree back into a sentence. This is typically accomplished using a sentence generator, which can be represented as STM = generate(T′), where STM is the generated new sentence and generate() is the sentence generation function.
[0094] (4) Back Translation: This method translates a sentence into another language and then translates it back into the original language to generate a new sentence. The specific steps are as follows:
[0095] BT=translate(translate(S,target language ), source language )
[0096] Where S is the original sentence, BT is the enhanced sentence, translate() is a translation function, and target is the target. language and source language These are the target language and the source language.
[0097] S4. In the sentiment classification module, an attention-based long and short term memory (LSTM) network is constructed. The model architecture includes four parts: word embedding, LSTM encoding, attention mechanism, and sentiment classification.
[0098] Step S4 also includes:
[0099] S41, First, the input text data (e.g., comments) is word-embedded, converting each word into a word vector. This can be done using a pre-trained word embedding model, such as Word2Vec or GloVe word embedding.
[0100] S42, Subsequently, the obtained word vectors are fed into the LSTM layer as the input sequence for encoding processing, outputting a hidden state sequence H = {h1, h2, ..., h...} T}, where each h t This represents the hidden state of the text at time step t;
[0101] S43, an attention mechanism is introduced to calculate the importance of the relevance of each word in the input text to the target, and attention weights are assigned based on this to extract the representation of important words in the input text and encode them into the context vector representation of the sentence;
[0102] e t =tanh(W a a+W h h t +b)
[0103]
[0104] r = ∑ t α t ×h t
[0105] Among them, e t It's the attention score, W a and W h It is a weight matrix, b is the bias term; r is the context vector, α t It is the attention weight, which represents the relevance of the input text to the target word a at time step t;
[0106] S44, Finally, the context vector is fed into a fully connected layer for aspect-level sentiment classification prediction. This invention uses the Softmax function for sentiment classification, and the output is the sentiment label for the target aspect;
[0107] y = softmax(w p r+b p )
[0108] Where y is the predicted probability distribution of the output sentiment polarity, and w p and b p These are the learnable weighted proofs and the bias vectors, respectively.
[0109] LSTM is a temporal convolutional neural network derived from recurrent neural networks. By introducing a gate function, it can uncover temporal variations with relatively long time intervals and delays in a time series. For an input sequence x = (x1, x2, ..., x...),... T The expression for LSTM is:
[0110] Forgotten Gate:
[0111] f t =σ(w f [h t-1 x t ]+b f )
[0112] Input Gate:
[0113] i t =σ(W i [h t-1 x t ]+b i )
[0114] Output gate:
[0115] o t =σ(W o [h t-1 x t ]+b o )
[0116] New state of cell unit:
[0117]
[0118] Updated unit status:
[0119]
[0120] Output:
[0121] h t =o t ⊙tanh(C t )
[0122] Among them, [h t-1 x t ] represents the concatenation of the previous hidden state and the current input, ⊙ represents the element-wise multiplication of vectors, and W f W i W o and W C These refer to the weight vectors from the input layer and hidden layer to the forget gate, input gate, output gate, and cell state, respectively. f b i b o and b C These refer to the offsets of the forget gate, input gate, output gate, and cell state, respectively; σ() refers to the sigmoid activation function, and tanh() refers to the hyperbolic tangent activation function.
[0123] The data generated through word-level and sentence-level data augmentation (1629 records in total) was merged with the original Semeval2014-Restaurant dataset training set (3174 records in total), resulting in a training set of 4803 records. Among them, there are 1610 records with a label of -1 and 3193 records with a label of 1, a ratio of approximately 2:1.
[0124] To verify the effectiveness of the hybrid multi-strategy text data augmentation method, this invention designed four sets of comparative experiments on the SemEval2014 restaurant dataset as follows:
[0125] (1) Original data group: No operation is performed on the original data;
[0126] (2) Word-level augmentation: The original text is augmented at the word level using strategies such as synonym replacement and random swapping;
[0127] (3) Sentence-level augmentation: The original text is reorganized, pruned and processed by syntax tree, and finally the text data is improved by back translation.
[0128] (4) Multi-strategy augmentation: This method augments the original text using a combination of word-level and sentence-level augmentation techniques.
[0129] Finally, the four sets of data were input into SVM, CNN, and Bi-LSTM neural network models respectively for aspect-level sentiment classification, and the results were compared.
[0130] Table 2 presents the aspect-level sentiment classification results of three models (SVM, CNN, and Bi-LSTM) after word-level, sentence-level, and multi-strategy data augmentation. According to the experimental results in Table 2, word-level, sentence-level, and multi-strategy data augmentation methods can improve the accuracy of machine learning and neural network models on datasets of different sizes, showing improved accuracy compared to the original dataset. Although different experimental performances were achieved in word-level data augmentation, their overall trends were generally consistent. The Bi-LSTM model achieved the highest F1 score on multiple datasets, at 73.1%. Notably, the Bi-LSTM model showed a more significant improvement compared to other models, indicating that Bi-LSTM has a greater advantage than convolutional neural networks and SVM in sequence modeling problems.
[0131] Sentence-level data augmentation, as an independent operation, outperforms the original data in sentiment classification models. Taking the Bi-LSTM model as an example, the F1 score of the model increased from 70.9% to 72%, an improvement of 2.1%, proving that sentence-level data augmentation can effectively expand the data.
[0132] The multi-strategy text generation data is the result of word-level and sentence-level integration. In aspect-level sentiment classification models, it outperforms the original data in the model. After multi-strategy text enhancement, the F1 score of the SVM model increased from 68.2% to 68.9%, an improvement of 0.7%. The F1 score of the CNN model increased by 0.4%. The Bi-LSTM model showed the most significant improvement, with its F1 score increasing from 71.1% to 74.3%, an improvement of 3.2%, demonstrating the effectiveness of the multi-strategy text data scheme.
[0133] Table 2. Aspect-level sentiment classification results of the three models (SVM, CNN, and Bi-LSTM) at the word-level, sentence-level, and multi-strategy data augmentation levels.
[0134]
[0135] To better verify whether multi-strategy text data augmentation schemes have an enhancing effect on aspect-level text sentiment classification in different languages, this invention utilizes a cross-language view approach. Augmented data from English is machine-translated into a Chinese dataset, which is then used as an auxiliary Chinese classifier. This achieves text data augmentation effects from a Chinese perspective, thus validating the effectiveness of the text data augmentation scheme.
[0136] Table 3 shows the sentiment classification results of word-level augmented data, sentence-level augmented data, and multi-strategy augmented data under the Bi-LSTM model. Table 3 reveals that, under the Chinese view, the hybrid multi-strategy data augmentation effect is consistent with that under the English data. Furthermore, the model classification performance under the multi-strategy hybrid text data augmentation scheme is better than that of the individual word-level and sentence-level groups, with the F1 score increasing from 66.0% for word-level and 70.2% for sentence-level to 73.0%. This demonstrates that the multi-strategy text data augmentation scheme outperforms two independent word-level or sentence-level operations under different language views.
[0137] Table 3. Results of cross-linguistic view data augmentation aspect-level sentiment classification.
[0138]
[0139] To further verify the feasibility of the data augmentation scheme in aspect-level sentiment classification models, this invention combines an attention-based LSTM model (ATT-LSTM) with a comparative experiment. The experimental results are shown in Table 4. Table 4 shows that:
[0140] (1) Comparative experimental results of the three text augmentation methods show that the multi-strategy hybrid augmentation method based on word-level and sentence-level data outperforms other methods in terms of P, R, and F1 scores, with an F1 score of 82%. Under the action of data augmentation mechanisms, the aspect-level sentiment classification model achieves better experimental performance than without data augmentation, and the F1 score is effectively improved. The LSTM model based on the attention mechanism combined with the multi-strategy data augmentation scheme exhibits the best experimental performance, indicating that this model has stronger generalization ability under data augmentation mechanisms.
[0141] (2) Compared to Original, word-level augmentation and sentence-level augmentation improved accuracy by 5.0%, 2.9%, and 0.3%, respectively, indicating that multi-strategy text augmentation methods can effectively improve model accuracy. Furthermore, compared to word-level augmentation methods, sentence-level methods improved F1 scores by 2.6%. Sentence-level augmentation methods may better understand and preserve the semantic content of the text, or better improve the model's generalization ability, thus resulting in improved F1 scores.
[0142] Table 6 shows the experimental results of the original dataset and the three text enhancement strategies.
[0143]
[0144] In summary, this invention applies a multi-strategy text data augmentation scheme to predict aspect-level sentiment classification. Experiments verify that the aspect-level sentiment classification based on multi-strategy text data augmentation proposed in this invention achieves a relatively high F1 score, and the hybrid augmentation strategy improves the aspect-level sentiment classification effect to a certain extent.
[0145] This description, in conjunction with the accompanying drawings and specific embodiments, is solely for the purpose of aiding understanding the methods and core concepts of the present invention. The methods described in this invention are not limited to the embodiments depicted in the specific implementation details. Other implementation methods derived by those skilled in the art based on the methods and concepts of this invention also fall within the scope of the technical innovations of this invention. The content of this specification should not be construed as limiting the invention.
Claims
1. An aspect-level sentiment classification method based on multi-strategy text data augmentation, characterized in that, Includes the following steps: S1, the overall framework of the aspect-level sentiment classification method based on multi-strategy text data augmentation, mainly includes three modules: data preprocessing, hybrid augmentation, and sentiment classification. First, the data is preprocessed, then the augmented text data is generated based on the multi-strategy text data augmentation method, and finally, it is input into the sentiment classification module for aspect-level sentiment classification. Step S1 also includes: S11, the data preprocessing module includes data cleaning, stop word removal and text word vectorization, which can improve the quality of data and transform unstructured raw data into numerical features suitable for model processing, which is crucial for aspect-level sentiment classification tasks. S12, the hybrid enhancement module combines word-level and sentence-level data enhancement to generate hybrid enhanced text. Word-level data enhancement uses simple data enhancement techniques, including random swapping and synonym replacement, while sentence-level data enhancement uses techniques such as sentence-level reorganization, pruning, and syntax tree operations. S13, the sentiment classification module inputs the original text, word-level and sentence-level enhanced text, and multi-strategy hybrid enhanced text into the sentiment classification model, and outputs sentiment labels for each aspect; S2, Data Preprocessing; Data preprocessing is a key step in natural language understanding tasks, which involves processing the collected data into the input format required by the model, including data cleaning, stop word removal, and word vectorization. Step S2 also includes: S21, Data cleaning includes removing HTML tags, special characters, punctuation marks and unnecessary spaces, while correcting spelling errors and removing duplicate characters in text data to ensure that the data is clean and consistent; S22, removing stop words refers to removing common stop words (such as "the", "is", etc.) from text data. These words usually do not contain useful information in aspect-level sentiment analysis tasks and are of no help to sentiment analysis tasks. S23, word vectorization refers to the process of converting text data into numerical vectors. Word vectorization first requires segmenting the text data into words or sub-words; then, based on word embedding technologies such as Word2Vec and GloVe, the words are represented as vectors. S3, in the hybrid enhancement module, a multi-strategy-based text data augmentation method is designed, which includes word-level and sentence-level data augmentation strategies to generate augmented text and apply it to aspect-level sentiment classification tasks; Step S3 also includes: S31, word-level data augmentation employs simple data augmentation techniques, including four operations: random swapping, synonym replacement, random insertion, and random deletion, to enhance the original text and generate word-level augmented text. Through word-level data augmentation, local text enhancement has been achieved, effectively expanding the dataset to some extent. However, this method only changes some words and their order in the text. Due to the limited number of synonyms and the inability to guarantee the absence of excessive noise, the data volume remains insufficient. Therefore, it can be improved by combining sentence-level data augmentation techniques. S32, after obtaining the word-level augmented text, the original text and the word-level augmented text are combined into a text pair, and sentence-level data augmentation is performed, including sentence reorganization, sentence pruning, syntax tree operations, and sentence back-translation operations, to generate sentence-level augmented text; based on the original data, after sentence-level data augmentation and other operations, the word order and structure of the text sentences have changed; however, the aspect words and polarity of the text remain unchanged, that is, the original meaning of the sentences has not changed; S33. After obtaining word-level and sentence-level augmented text, they are merged with the original data text to form the final augmented text data for training the aspect-level sentiment classification model. S4. In the sentiment classification module, an attention-based long short term memory (LSTM) network is constructed. The model architecture includes four parts: word embedding, LSTM encoding, attention mechanism, and sentiment classification. Step S4 also includes: S41, First, the input text data (e.g., comments) is word-embedded, converting each word into a word vector. This can be done using a pre-trained word embedding model, such as Word2Vec or GloVe word embedding. S42, Subsequently, the obtained word vectors are fed into the LSTM layer as the input sequence for encoding processing, outputting a hidden state sequence H = {h1, h2, ..., h T }, where each h t This represents the hidden state of the text at time step t; S43, an attention mechanism is introduced to calculate the importance of the relevance of each word in the input text to the target, and attention weights are assigned based on this to extract the representation of important words in the input text and encode them into the context vector representation of the sentence; e t = tanh(W a a+W h h t +b) r=∑ t α t ×h t Among them, e t It's the attention score, W a and W h It is a weight matrix, b is the bias term; r is the context vector, α t It is the attention weight, which represents the relevance of the input text to the target word a at time step t; S44, Finally, the context vector is fed into a fully connected layer for aspect-level sentiment classification prediction. This invention uses the Softmax function for sentiment classification, and the output is the sentiment label for the target aspect; y =softmax(W p r+b p ) Where y is the predicted probability distribution of the output sentiment polarity, and W p and b p These are the learnable weighted proofs and the bias vectors, respectively.