Sentiment classification method and device based on multi-dimensional data enhancement and twin feature extraction
Through the methods of multidimensional data enhancement and twin feature extraction, Chinese text is enhanced at the character level, word level and sentence level. Combined with deep neural networks, the problem of low accuracy in Chinese text sentiment classification is solved and higher classification accuracy is achieved.
Patent Information
- Application Number
- CN202510018059.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-06
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2045-01-06
AI Technical Summary
Existing Chinese text sentiment classification methods do not fully consider language differences during data augmentation, resulting in low classification accuracy and deficiencies in feature encoding capabilities and interpretability of the models.
A multidimensional data enhancement model is used to enhance the text at the character level, word level, and sentence level. The twin feature extraction model is combined to extract sentence structure information and semantic information from Chinese text, and feature integration and classification are performed through a deep neural network.
It improves the accuracy of Chinese text sentiment classification, enhances the model's ability to extract text features, and achieves higher classification accuracy.
Smart Images

Figure CN119961452B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of sentiment classification technology, and in particular to a sentiment classification method and device based on multidimensional data enhancement and twin feature extraction. Background Art
[0002] Text classification is a fundamental task in natural language processing and is widely used in fields such as sentiment analysis. Early efforts relied on manual classification, which was inefficient. With the development of deep learning and neural networks, machine learning algorithms have become widely used in classification tasks. However, Chinese text classification faces challenges in terms of sentence structure and semantics.
[0003] Existing methods fail to fully consider language differences when augmenting data, resulting in limited data augmentation effectiveness. Furthermore, existing models lack feature encoding capabilities and interpretability, leading to low classification accuracy. Summary of the Invention
[0004] The present invention provides a sentiment classification method and device based on multidimensional data enhancement and twin feature extraction, which are used to solve the defect of low accuracy of text sentiment classification in the prior art and improve the accuracy of text sentiment classification.
[0005] The present invention provides a sentiment classification method based on multidimensional data enhancement and twin feature extraction, comprising:
[0006] Based on the multidimensional data enhancement model, the classified text is enhanced at the character level, word level and sentence level respectively;
[0007] Extracting Chinese sentence structure information and Chinese semantic information from the enhanced text to be classified based on a twin feature extraction model, wherein the Chinese sentence structure information and the Chinese semantic information form a twin feature pair;
[0008] Extracting text features from the integrated features of the twin feature pairs using a deep neural network, and obtaining a predicted sentiment category of the text to be classified based on the text features;
[0009] The multidimensional data enhancement model, twin feature extraction model and deep neural network are trained as a whole using text samples as samples and the labeled emotion categories of the text samples as labels.
[0010] According to the present invention, a sentiment classification method based on multidimensional data enhancement and twin feature extraction is provided. The multidimensional data enhancement model includes an improved EDA method and a ChatGLM3 model. Based on the multidimensional data enhancement model, the text to be classified is enhanced at the character level, word level, and sentence level, including:
[0011] Based on the improved EDA method, the text to be classified is enhanced at the character level and the word level, respectively, wherein the character level and the word level enhancement processing each include one or more of synonym replacement, random insertion, random exchange and random deletion;
[0012] The text to be classified is subjected to sentence-level enhancement processing based on the ChatGLM3 model, wherein the sentence-level enhancement processing includes prompt generation and / or semantic conversion to enhance the semantic information at the sentence level.
[0013] According to the present invention, a sentiment classification method based on multidimensional data enhancement and twin feature extraction is provided. The twin feature extraction model includes a StructBert model and an ERNIE model. Based on the twin feature extraction model, Chinese sentence structure information and Chinese semantic information are extracted from the enhanced text to be classified, including:
[0014] Extracting the Chinese sentence structure information from the enhanced text to be classified based on the StructBert model;
[0015] The Chinese semantic information is extracted from the enhanced text to be classified based on the ERNIE model.
[0016] According to the present invention, a sentiment classification method based on multidimensional data enhancement and twin feature extraction is provided. The twin feature extraction model further includes an input embedding layer. The method extracts Chinese sentence structure information and Chinese semantic information from the enhanced text to be classified based on the twin feature extraction model, including:
[0017] Inputting the enhanced text to be classified into the PE layer, ME layer and TE layer in the input embedding layer respectively, and outputting the corresponding embedding vector;
[0018] Obtaining an embedding representation of the text to be classified according to the embedding vectors output by the PE layer, the ME layer, and the TE layer;
[0019] The embedded representation is input into the StructBert model and the ERNIE model respectively to obtain the twin feature pairs.
[0020] According to the present invention, a sentiment classification method based on multidimensional data enhancement and twin feature extraction is provided, which uses a deep neural network to extract text features from the integrated features of the twin feature pairs, including:
[0021] Performing weighted voting on the Chinese sentence structure information and Chinese semantic information in the twin feature pair to obtain an integrated feature of the twin feature pair;
[0022] The integrated features are input into the deep neural network, and text features are extracted from the integrated features.
[0023] According to a sentiment classification method based on multidimensional data enhancement and twin feature extraction provided by the present invention, the deep neural network is a DPCNN model, and the deep neural network is used to extract text features from the integrated features of the twin feature pairs, and the predicted sentiment category of the text to be classified is obtained based on the text features, including:
[0024] Performing a convolution operation on the integrated features of the twin feature pair to generate a first word vector matrix;
[0025] Output a second word vector matrix after performing equal-length convolution on the first word vector matrix;
[0026] Processing the second word vector matrix using a self-attention mechanism and inputting it into a fully connected layer to obtain the text features output by the fully connected layer;
[0027] The text features are classified using a softmax function to obtain a predicted sentiment category of the text to be classified.
[0028] According to the present invention, a sentiment classification method based on multidimensional data enhancement and twin feature extraction further includes:
[0029] Based on the multidimensional data enhancement model, the text samples are enhanced at the character level, word level and sentence level respectively;
[0030] Extracting twin feature pairs from the enhanced text sample based on the twin feature extraction model;
[0031] Extracting text features from the integrated features of the twin feature pairs of the text sample using the deep neural network, and obtaining a predicted sentiment category of the text sample based on the text features of the text sample;
[0032] Calculate the loss between the predicted emotion category and the labeled emotion category of the text sample, and use the Adam optimizer to update the parameters of the multidimensional data enhancement model, the twin feature extraction model, and the deep neural network based on the loss.
[0033] The present invention also provides a sentiment classification device based on multidimensional data enhancement and twin feature extraction, comprising:
[0034] The data enhancement module is used to perform character-level, word-level, and sentence-level enhancement processing on the classified text based on the multidimensional data enhancement model;
[0035] A feature extraction module, configured to extract Chinese sentence structure information and Chinese semantic information from the enhanced text to be classified based on a twin feature extraction model, wherein the Chinese sentence structure information and the Chinese semantic information form a twin feature pair;
[0036] A sentiment classification module, configured to extract text features from the integrated features of the twin feature pairs using a deep neural network, and obtain a predicted sentiment category of the text to be classified based on the text features;
[0037] The multidimensional data enhancement model, twin feature extraction model and deep neural network are trained as a whole using text samples as samples and the labeled emotion categories of the text samples as labels.
[0038] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and runnable on the processor. When the processor executes the program, it implements any of the above-described sentiment classification methods based on multidimensional data enhancement and twin feature extraction.
[0039] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the above-described sentiment classification methods based on multidimensional data enhancement and twin feature extraction.
[0040] The present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements any of the above-mentioned sentiment classification methods based on multidimensional data enhancement and twin feature extraction.
[0041] The present invention provides a sentiment classification method and device based on multidimensional data enhancement and twin feature extraction, and proposes a new Chinese text data enhancement method. The method processes the original text at the character level, word level, and sentence level through a multidimensional data enhancement model to enhance the multidimensional features of the text data, such as knowledge, emotion, and cognition. A new feature extraction method is proposed, which extracts Chinese-specific sentence structure information and Chinese semantic information through a twin feature extraction model to achieve multi-model, dual-scale twin feature sampling and extraction with different semantic understanding capabilities. At the same time, a deep neural network is integrated to process the twin features, achieving complementarity of different features, enhancing the model's ability to extract text features, and thus improving the accuracy of text sentiment classification. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions in the present invention or the prior art, a brief introduction will be given below to 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 work.
[0043] Figure 1 Schematic diagram of the process of the sentiment classification method based on multidimensional data enhancement and twin feature extraction provided by the present invention;
[0044] Figure 2 Schematic diagram of the model structure of the sentiment classification method based on multidimensional data enhancement and twin feature extraction provided by the present invention;
[0045] Figure 3 Schematic diagram of the structure of the twin feature extraction model in the sentiment classification method based on multidimensional data enhancement and twin feature extraction provided by the present invention;
[0046] Figure 4 Schematic diagram of the structure of the sentiment classification device based on multidimensional data enhancement and twin feature extraction provided by the present invention;
[0047] Figure 5 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0048] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the embodiments described are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative efforts shall fall within the scope of protection of the present invention.
[0049] The following combination Figure 1 and Figure 2 The present invention describes a sentiment classification method based on multidimensional data enhancement and twin feature extraction, comprising:
[0050] Step 101: Based on the multidimensional data enhancement model, the text to be classified is enhanced at the character level, word level and sentence level respectively;
[0051] Step 102: extracting Chinese sentence structure information and Chinese semantic information from the enhanced text to be classified based on the twin feature extraction model, wherein the Chinese sentence structure information and the Chinese semantic information form a twin feature pair;
[0052] Step 103: Using a deep neural network to extract text features from the integrated features of the twin feature pair, and obtaining a predicted sentiment category of the text to be classified based on the text features;
[0053] The multidimensional data enhancement model, twin feature extraction model and deep neural network are trained as a whole using text samples as samples and the labeled emotion categories of the text samples as labels.
[0054] The first objective of this example is to propose a new method for Chinese text data augmentation, namely the Multidimensional Data Augmentation (MDA) model. This model processes the original text at the character, word, and sentence levels to enhance the text's multidimensional features, such as knowledge, emotion, and cognition. The processed data at the character, word, and sentence levels are then integrated to form the final input text data.
[0055] The second objective of this example is to propose a new feature extraction method, the Twin Feature Extraction Model (SEDM), which extracts Chinese-specific sentence structure and semantic information from input text data. This method uses a multi-model, dual-scale approach to sample and extract twin features with varying semantic understanding capabilities. This method also incorporates a deep neural network to process twin features, achieving complementary features and enhancing the model's ability to extract textual features.
[0056] In experiments on sentiment data in different fields, the model trained by the sentiment classification method based on multidimensional data enhancement and twin feature extraction proposed in this embodiment outperforms the existing model in all aspects.
[0057] This embodiment proposes a new Chinese text data enhancement method, which processes the original text at the character level, word level, and sentence level through a multidimensional data enhancement model to enhance the multidimensional features of the text data, such as knowledge, emotion, and cognition; proposes a new feature extraction method, which extracts Chinese-specific sentence structure information and Chinese semantic information through a twin feature extraction model, realizes multi-model, dual-scale twin feature sampling and extraction with different semantic understanding capabilities, and at the same time integrates deep neural networks to process twin features, realizes the complementarity of different features, enhances the model's ability to extract text features, and thus improves the accuracy of text sentiment classification.
[0058] Based on the above embodiment, the multidimensional data enhancement model in this embodiment includes an improved EDA (Easy Data Augmentation) model and a ChatGLM3 model. Based on the multidimensional data enhancement model, the text to be classified is enhanced at the character level, word level, and sentence level, including:
[0059] Based on the improved EDA method, the text to be classified is enhanced at the character level and the word level, respectively, wherein the character level and the word level enhancement processing each include one or more of synonym replacement, random insertion, random exchange and random deletion;
[0060] The text to be classified is subjected to sentence-level enhancement processing based on the ChatGLM3 model, wherein the sentence-level enhancement processing includes prompt generation and / or semantic conversion to enhance the semantic information at the sentence level.
[0061] For example, for a test data set L = {x1, x2, ..., x l}, the formula processed by the MDA model is as follows:
[0062] L original ={x1, x2, ..., x l}
[0063] L character =Charprocess{x1,x2,...,x l}
[0064] L word =Wordprocess{x1,x2,...,x l}
[0065] L sentence = Sentence{x1, x2, ..., x l}
[0066] L={L character , L word , L sentence}={X1,X2,...,X l}
[0067] For the original input L _ Original is processed at the character, word, and sentence levels. Character and word processing is achieved using an improved EDA method. At the sentence level, the ChatGLM3 model is used to generate prompts and perform semantic transformations on the input. After processing, the corresponding texts L_character, L_word, and L_sentence are obtained.
[0068] After integrating the multi-dimensional data, the final input text data L={X1, X2, ..., X1} is obtained.
[0069] This embodiment proposes a new Chinese text data enhancement method, which integrates the prompt generation and deep encoding capabilities of a large language model, gives the text classification model deep features, effectively increases the model's receptive field, and thus improves the accuracy of text sentiment classification.
[0070] Based on the above embodiments, Figure 3 As shown, the twin feature extraction model described in this embodiment includes the StructBert model and the ERNIE model. Based on the twin feature extraction model, Chinese sentence structure information and Chinese semantic information are extracted from the enhanced text to be classified, including:
[0071] Extracting the Chinese sentence structure information from the enhanced text to be classified based on the StructBert model;
[0072] The Chinese semantic information is extracted from the enhanced text to be classified based on the ERNIE model.
[0073] The SEDM model combines the StructBert model and the ERNIE model to extract the unique sentence structure information and semantic information of Chinese, respectively, to form a twin feature pair. The StructBert model is used to extract the Chinese sentence structure information, and the ERNIE model is used to extract the deep semantic information of Chinese. The input of the SEDM model is the final input text data L = {X1, X2, ..., X l}.
[0074] Based on the above embodiments, Figure 3 As shown, the twin feature extraction model in this embodiment further includes an input embedding layer, which extracts Chinese sentence structure information and Chinese semantic information from the enhanced text to be classified based on the twin feature extraction model, including:
[0075] Input the enhanced text to be classified into the PE (Position Embeddings, position embedding) layer, ME (Mask Embeddings, mask embedding) layer and TE (Token Embeddings, word element embedding) layer in the input embedding layer respectively, and output the corresponding embedding vector;
[0076] Obtaining an embedding representation of the text to be classified according to the embedding vectors output by the PE layer, the ME layer, and the TE layer;
[0077] The embedded representation is input into the StructBert model and the ERNIE model respectively to obtain the twin feature pairs.
[0078] The input embedding layer includes the PE layer, the ME layer, and the TE layer. In this embodiment, the final input text data L is represented by a model embedding layer to obtain the input embedding E of the model. x . E x =PE+ME+TE.
[0079] E x Input into the trained StructBert model and ERNIE model to obtain the hidden layer twin feature pairs of the two models. -structbert and Feature -ERNIE , the formula is as follows:
[0080] feature -structbert =structbert{E x1 , E x1 , E x1 ......E xl}
[0081] feature -ERNIE =ERNIE{E x1 , E x1 , E x1 ......E xl}
[0082] Based on the above embodiments, Figure 3 As shown, in this embodiment, a deep neural network is used to extract text features from the integrated features of the twin feature pair, including:
[0083] Performing weighted voting on the Chinese sentence structure information and Chinese semantic information in the twin feature pair to obtain an integrated feature of the twin feature pair;
[0084] The integrated features are input into the deep neural network, and text features are extracted from the integrated features.
[0085] This embodiment uses a weighted voting mechanism to perform weighted voting on the twin feature pairs output by the StructBert model and the ERNIE model, selects and extracts deep-level emotional features, and thus obtains the integrated feature f after twin feature extraction. The formula is as follows, where λ is the weight parameter.
[0086]
[0087] The output integrated feature f is further extracted using DPCNN and self-attention mechanism. The number of medium-length convolutional layers in the DPCNN model is adjusted, and the self-attention mechanism is used to model the relationship between words, so as to better capture the semantic information of the text and fill the defect of insufficient feature extraction of the DPCNN model.
[0088] Based on the above embodiment, the deep neural network in this embodiment is a DPCNN (Deep Pyramid Convolutional Neural Networks) model, which uses a deep neural network to extract text features from the integrated features of the twin feature pairs, and obtains the predicted sentiment category of the text to be classified based on the text features, including:
[0089] Performing a convolution operation on the integrated features of the twin feature pair to generate a first word vector matrix;
[0090] Output a second word vector matrix after performing equal-length convolution on the first word vector matrix;
[0091] Processing the second word vector matrix using a self-attention mechanism and inputting it into a fully connected layer to obtain the text features output by the fully connected layer;
[0092] The text features are classified using a softmax function to obtain a predicted sentiment category of the text to be classified.
[0093] The DPCNN model and self-attention mechanism are used to further extract text features, the number of medium-length convolutional layers in the DPCNN model is adjusted, and the self-attention mechanism is introduced to model the relationship between words.
[0094] The processing formula of the DPCNN model is as follows:
[0095] f t =Regionembedding(f (t-1 ))
[0096] f cov =convolution(f t )=W*sigmoid(f t )
[0097] Among them, f (t-1) is the feature matrix output by the encoding layer, f t Represents the first word vector matrix generated after a set of convolution operations on the text fragment, W is the weight parameter of the convolution kernel, f cov Represents the second word vector matrix output after a layer of equal-length convolution.
[0098] For the self-attention mechanism, the query matrix W is introduced Q ,key( k ey)Matrix W K and the value matrix W v . covPerform self-attention mechanism processing to obtain the feature f input to the fully connected layer _fullconnect , the formula is as follows:
[0099] Q=fW Q
[0100] K=fW K
[0101] y=fW v
[0102]
[0103] f _fullconnect =selfattention(f cov )
[0104] Based on the above embodiments, before performing character-level, word-level, and sentence-level enhancement processing on the classified text based on the multidimensional data enhancement model, this embodiment further includes:
[0105] Based on the multidimensional data enhancement model, the text samples are enhanced at the character level, word level and sentence level respectively;
[0106] Extracting twin feature pairs from the enhanced text sample based on the twin feature extraction model;
[0107] Extracting text features from the integrated features of the twin feature pairs of the text sample using the deep neural network, and obtaining a predicted sentiment category of the text sample based on the text features of the text sample;
[0108] Calculate the loss between the predicted emotion category and the labeled emotion category of the text sample, and use the Adam optimizer to update the parameters of the multidimensional data enhancement model, the twin feature extraction model, and the deep neural network based on the loss.
[0109] This embodiment uses a dataset L={x1, x2, ..., x l} and the corresponding label set Y = {y1, y2, ..., y l} to conduct model training.
[0110] Cross entropy can be used to calculate the loss for model training. The formula is as follows:
[0111]
[0112] Among them, VLoss is the cross entropy loss, y i is the labeled sentiment category of the i-th text sample, p i is the probability that the i-th text sample belongs to the labeled sentiment category.
[0113] The Adam optimizer is used to calculate and update the model parameters. Adam is a gradient descent algorithm used to train neural networks. The update rule of the Adam optimizer is as follows:
[0114] m t =β1m t-1 +(1-β1)g t
[0115]
[0116] Among them, g t is the gradient of the parameter, β1 and β2 are the decay coefficients of the two exponentially weighted averages, and is the bias-corrected moving average of the gradient, θ t+1 is the updated parameter, η is the learning rate, and ∈ is a small constant used to avoid division by zero.
[0117] The Adam optimizer adaptively adjusts the learning rate of each parameter, thereby improving the model's convergence speed and generalization ability. The optimizer continuously iterates and updates the model's parameters until a preset termination condition is reached. The preset termination condition can be when the number of iterations reaches a preset maximum number of iterations or when the loss value falls below a preset threshold.
[0118] The following describes the sentiment classification device based on multidimensional data enhancement and twin feature extraction provided by the present invention. The sentiment classification device based on multidimensional data enhancement and twin feature extraction described below and the sentiment classification method based on multidimensional data enhancement and twin feature extraction described above can be referenced to each other.
[0119] like Figure 4 As shown, the device includes a data enhancement module 401, a feature extraction module 402 and a sentiment classification module 403, wherein:
[0120] The data enhancement module 401 is used to perform character-level, word-level and sentence-level enhancement processing on the text to be classified based on the multidimensional data enhancement model;
[0121] The feature extraction module 402 is used to extract Chinese sentence structure information and Chinese semantic information from the enhanced text to be classified based on the twin feature extraction model, wherein the Chinese sentence structure information and the Chinese semantic information form a twin feature pair;
[0122] The sentiment classification module 403 is used to extract text features from the integrated features of the twin feature pair using a deep neural network, and obtain the predicted sentiment category of the text to be classified based on the text features;
[0123] The multidimensional data enhancement model, twin feature extraction model and deep neural network are trained as a whole using text samples as samples and the labeled emotion categories of the text samples as labels.
[0124] This embodiment proposes a new Chinese text data enhancement method, which processes the original text at the character level, word level, and sentence level through a multidimensional data enhancement model to enhance the multidimensional features of the text data, such as knowledge, emotion, and cognition; proposes a new feature extraction method, which extracts Chinese-specific sentence structure information and Chinese semantic information through a twin feature extraction model, realizes multi-model, dual-scale twin feature sampling and extraction with different semantic understanding capabilities, and at the same time integrates deep neural networks to process twin features, realizes the complementarity of different features, enhances the model's ability to extract text features, and thus improves the accuracy of text sentiment classification.
[0125] Figure 5 An example of a physical structure diagram of an electronic device is shown below. Figure 5 As shown, the electronic device may include: a processor (processor) 510, a communication interface (Communications Interface) 520, a memory (memory) 530 and a communication bus 540, wherein the processor 510, the communication interface 520, and the memory 530 communicate with each other through the communication bus 540. The processor 510 can call the logic instructions in the memory 530 to execute the sentiment classification method based on multidimensional data enhancement and twin feature extraction, the method comprising: based on the multidimensional data enhancement model, performing character-level, word-level and sentence-level enhancement processing on the text to be classified; based on the twin feature extraction model, extracting Chinese sentence structure information and Chinese semantic information from the enhanced text to be classified, the Chinese sentence structure information and the Chinese semantic information form a twin feature pair; using a deep neural network to extract text features from the twin feature pair, and obtaining the predicted sentiment category of the text to be classified based on the text features; the multidimensional data enhancement model, the twin feature extraction model and the deep neural network are trained as a whole using text samples as samples and the annotated sentiment category of the text samples as labels.
[0126] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the 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, a server, or a 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: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0127] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the sentiment classification method based on multidimensional data enhancement and twin feature extraction provided by the above methods, the method including: based on a multidimensional data enhancement model, performing character-level, word-level and sentence-level enhancement processing on the text to be classified; based on a twin feature extraction model, extracting Chinese sentence structure information and Chinese semantic information from the enhanced text to be classified, and the Chinese sentence structure information and the Chinese semantic information form a twin feature pair; using a deep neural network to extract text features from the twin feature pair, and obtaining the predicted sentiment category of the text to be classified based on the text features; the multidimensional data enhancement model, the twin feature extraction model and the deep neural network as a whole are obtained by training with text samples as samples and the labeled sentiment categories of the text samples as labels.
[0128] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the sentiment classification method based on multidimensional data enhancement and twin feature extraction provided by the above-mentioned methods, the method comprising: performing character-level, word-level and sentence-level enhancement processing on the text to be classified based on a multidimensional data enhancement model; extracting Chinese sentence structure information and Chinese semantic information from the enhanced text to be classified based on a twin feature extraction model, the Chinese sentence structure information and the Chinese semantic information forming a twin feature pair; using a deep neural network to extract text features from the twin feature pair, and obtaining the predicted sentiment category of the text to be classified based on the text features; the multidimensional data enhancement model, the twin feature extraction model and the deep neural network as a whole are obtained by training with text samples as samples and the annotated sentiment categories of the text samples as labels.
[0129] The device embodiments described above are merely illustrative. 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, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.
[0130] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, or of course, by hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the existing technology can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiments.
[0131] 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 aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A sentiment classification method based on multidimensional data enhancement and twin feature extraction, characterized in that: include: Based on the multidimensional data enhancement model, the classified text is enhanced at the character level, word level and sentence level respectively; Extracting Chinese sentence structure information and Chinese semantic information from the enhanced text to be classified based on a twin feature extraction model, wherein the Chinese sentence structure information and the Chinese semantic information form a twin feature pair; Extracting text features from the integrated features of the twin feature pairs using a deep neural network, and obtaining a predicted sentiment category of the text to be classified based on the text features; The multidimensional data enhancement model, the twin feature extraction model and the deep neural network are trained as a whole using text samples as samples and the annotated emotion categories of the text samples as labels; The twin feature extraction model includes the StructBert model and the ERNIE model. Based on the twin feature extraction model, Chinese sentence structure information and Chinese semantic information are extracted from the enhanced text to be classified, including: Extracting the Chinese sentence structure information from the enhanced text to be classified based on the StructBert model; Extracting the Chinese semantic information from the enhanced text to be classified based on the ERNIE model; A deep neural network is used to extract text features from the integrated features of the twin feature pairs, including: Performing weighted voting on the Chinese sentence structure information and Chinese semantic information in the twin feature pair to obtain an integrated feature of the twin feature pair; The integrated features are input into the deep neural network, and text features are extracted from the integrated features.
2. The sentiment classification method based on multidimensional data enhancement and twin feature extraction according to claim 1 is characterized in that: The multidimensional data enhancement model includes an improved EDA method and a ChatGLM3 model. Based on the multidimensional data enhancement model, the text to be classified is enhanced at the character level, word level, and sentence level, including: Based on the improved EDA method, the text to be classified is enhanced at the character level and the word level, respectively, wherein the character level and the word level enhancement processing each include one or more of synonym replacement, random insertion, random exchange and random deletion; The text to be classified is subjected to sentence-level enhancement processing based on the ChatGLM3 model, wherein the sentence-level enhancement processing includes prompt generation and / or semantic conversion to enhance the semantic information at the sentence level.
3. The sentiment classification method based on multidimensional data enhancement and twin feature extraction according to claim 1 is characterized in that: The twin feature extraction model further includes an input embedding layer, which extracts Chinese sentence structure information and Chinese semantic information from the enhanced text to be classified based on the twin feature extraction model, including: Inputting the enhanced text to be classified into the PE layer, ME layer and TE layer in the input embedding layer respectively, and outputting the corresponding embedding vector; Obtaining an embedding representation of the text to be classified according to the embedding vectors output by the PE layer, the ME layer, and the TE layer; The embedded representation is input into the StructBert model and the ERNIE model respectively to obtain the twin feature pairs.
4. The sentiment classification method based on multidimensional data enhancement and twin feature extraction according to claim 1 is characterized in that: The deep neural network is a DPCNN model, which uses a deep neural network to extract text features from the integrated features of the twin feature pairs, and obtains the predicted sentiment category of the text to be classified based on the text features, including: Performing a convolution operation on the integrated features of the twin feature pair to generate a first word vector matrix; Output a second word vector matrix after performing equal-length convolution on the first word vector matrix; Processing the second word vector matrix using a self-attention mechanism and inputting it into a fully connected layer to obtain the text features output by the fully connected layer; The text features are classified using a softmax function to obtain a predicted sentiment category of the text to be classified.
5. The sentiment classification method based on multidimensional data enhancement and twin feature extraction according to any one of claims 1 to 4, characterized in that: Before performing character-level, word-level, and sentence-level enhancement processing on the classified text based on the multidimensional data enhancement model, the following steps are also included: Based on the multidimensional data enhancement model, the text samples are enhanced at the character level, word level and sentence level respectively; Extracting twin feature pairs from the enhanced text sample based on the twin feature extraction model; Extracting text features from the integrated features of the twin feature pairs of the text sample using the deep neural network, and obtaining a predicted sentiment category of the text sample based on the text features of the text sample; Calculate the loss between the predicted emotion category and the labeled emotion category of the text sample, and use the Adam optimizer to update the parameters of the multidimensional data enhancement model, the twin feature extraction model, and the deep neural network based on the loss.
6. A sentiment classification device based on multidimensional data enhancement and twin feature extraction, characterized in that: The sentiment classification method based on multidimensional data enhancement and twin feature extraction applied to any one of claims 1 to 5 comprises: The data enhancement module is used to perform character-level, word-level, and sentence-level enhancement processing on the classified text based on the multidimensional data enhancement model; A feature extraction module, configured to extract Chinese sentence structure information and Chinese semantic information from the enhanced text to be classified based on a twin feature extraction model, wherein the Chinese sentence structure information and the Chinese semantic information form a twin feature pair; A sentiment classification module, configured to extract text features from the integrated features of the twin feature pairs using a deep neural network, and obtain a predicted sentiment category of the text to be classified based on the text features; The multidimensional data enhancement model, twin feature extraction model and deep neural network are trained as a whole using text samples as samples and the labeled emotion categories of the text samples as labels.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, it implements the sentiment classification method based on multidimensional data enhancement and twin feature extraction as described in any one of claims 1 to 5.
8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the sentiment classification method based on multidimensional data enhancement and twin feature extraction as described in any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Text emotion recognition method, device and server and storage medium
CN106897439A
Picture change detection method and related device
CN115131284A