Emotional short text sentiment classification method based on ensemble learning

Through the combination of integrated learning and multiple models, dynamically adjusting the embed vector of emoticons, the problem of inaccurate emotion classification in the existing technology is solved, and higher emotional classification accuracy and robustness are achieved.

CN119621967APending Publication Date: 2025-03-14CHONGQING UNIV OF POSTS & TELECOMM
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411599121.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-11
Publication Date
2025-03-14

AI Technical Summary

Technical Problem

The prior art has problems with inaccurate identification in the issue of emotion classification, especially when processing short texts, which lack flexibility and adaptability, making it difficult to effectively capture the emotional information of emojis.

Method used

A method based on ensemble learning is adopted, combined with BERT, TextCNN, BiLSTM and GCN models, feature extraction and emotional classification of short texts are performed. Through dynamic weight allocation and attention mechanisms, embedding vectors of emoticons are adjusted and multi-level feature fusion is carried out to improve the accuracy of emotional classification.

Benefits of technology

It improves the accuracy and stability of emotion classification, can capture the emotional information of emoji more accurately, enhances the robustness of the model, and adapts to text data from different types and sources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119621967A_ABST
    Figure CN119621967A_ABST
Patent Text Reader

Abstract

The invention discloses an ensemble learning-based emotion classification method for short texts with emoticons, which comprises the following steps of: acquiring short text data containing emoticons, and carrying out preprocessing and feature processing on the short text data; vectorizing the short text by using a pre-trained BERT model to obtain context-related text embedding representation; a TextCNN model is adopted to extract text features, and a convolutional layer and a pooling layer carry out feature learning on embedded vectors; performing dynamic weight distribution on the emoticons, calculating dynamic weights of the emoticons, and adjusting embedded vectors of the emoticons; performing feature extraction on the adjusted embedded matrix by adopting a BiLSTM with an attention mechanism and a graph convolutional network (GCN) to obtain multi-level features; in ensemble learning, dynamic weight adjustment is carried out, and weighted fusion is carried out on features extracted by the models to form a comprehensive feature vector; and the comprehensive feature vector is input into the trained sentiment classification model to obtain a sentiment classification result of the short text, so that the problem of inaccurate recognition in the aspect of sentiment classification is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a control technology for intelligent communication, and in particular to a sentiment classification method for short texts with expressions based on ensemble learning. Background Art

[0002] With the rapid development of social media and mobile communication platforms, a large amount of short text data generated every day contains rich emotional information. This information has important reference value for brand management, market trend analysis, and public sentiment monitoring. Sentiment classification technology aims to automatically identify emotional tendencies in texts and has become an important research direction in the field of natural language processing. Although existing sentiment classification methods have made certain progress in this field, they still face many challenges when processing short texts with limited information and frequent use of Internet slang and emoticons. In addition, most existing models rely on a single algorithm or framework, lack flexibility and adaptability, and are particularly ineffective when processing texts with complex semantics and structures. Existing technologies provide possibilities for sentiment classification problems, but there are still problems with inaccurate recognition in practical applications, which affects recognition accuracy and robustness. Summary of the invention

[0003] The purpose of the present invention is to provide a sentiment classification method for short texts with expressions based on ensemble learning, so as to solve the problem of inaccurate recognition in sentiment classification in the prior art.

[0004] The following steps are involved:

[0005] S1. Obtain short text data containing emoticons, and perform preprocessing and feature processing on the short text data;

[0006] S2. Use the pre-trained BERT model to vectorize short texts and obtain context-sensitive text embedding representations;

[0007] S3. Use the TextCNN model to extract text features and perform feature learning on the embedded vector through convolutional layers and pooling layers;

[0008] S4. dynamically assign weights to emoticons, calculate dynamic weights of emoticons, and adjust their embedding vectors;

[0009] S5. Use BiLSTM with attention mechanism and graph convolutional network (GCN) to extract features from the adjusted embedding matrix and obtain multi-level features;

[0010] S6. In ensemble learning, the features extracted by each model are weighted and fused through dynamic weight adjustment to form a comprehensive feature vector;

[0011] S7. Input the comprehensive feature vector into the trained sentiment classification model to obtain the sentiment classification result of the short text.

[0012] The short text data containing emoticons is captured through big data for feature preprocessing, and the self-trained BERT model is used to vectorize the short text to generate an embedded representation. At the same time, the TextCNN model is used to extract text features, and the embedded vector is learned through the convolution layer and the pooling layer, and the extracted features are stored in the database. At this time, the BERT model and the TextCNN model are combined for feature fusion, and the dynamic weights of the emoticons are assigned, and the results are fed back to the short text. In addition, the expression processing method is adjusted in combination with the tone of the sender in the short text to match the emotional expression of the sender.

[0013] Next, BiLSTM and graph convolutional network (GCN) are used to perform multi-level feature extraction on the adjusted short text, extract and compare the weight information of each feature, and judge the emotional value in the short text. Specifically, the text is further preprocessed as follows: emoticons are retained during word segmentation, stop words, special characters and noise data are removed, and the text format is unified (such as uppercase and lowercase conversion and simplified and traditional Chinese conversion); at the same time, external knowledge bases or data enhancement methods are used to expand the context information of the text, and BERT is used for text embedding to obtain context-related word vector representations.

[0014] By marking characteristic words and filtering out the marked keywords, the fonts are standardized and combined with the self-learning system embedded in the above model to enhance the data processing method and further improve the recognition of short text emotions.

[0015] Furthermore, the feature extraction steps of the TextCNN model include:

[0016] For network text, multiple convolution kernels are used to perform convolution operations on text embedding and calculate convolution features:

[0017] z i =ReLU(W k ·x i:i+k-1 +b k )

[0018] Among them, z i is the convolution feature of the ith position, W k is the convolution kernel weight of size k, x i:i+k-1 is the word vector of the input text at position i to i+k-1, b k is the bias term of the convolution kernel.

[0019] The feature representations of multiple convolution kernels are concatenated into a vector as the output feature f of the TextCNN model. TextCNN :

[0020] f TextCNN =[h1, h2, ..., h n ]

[0021] Among them, h i is the feature representation of the jth convolution kernel.

[0022] The sub-feature model is used to obtain the individual expressions of words in the short text, and useful information is filtered out to enter the self-screening system.

[0023] Furthermore, the dynamic weight allocation step includes:

[0024] Calculate the relevance of an emoji to its context using the point mutual information (PMI) calculation formula:

[0025]

[0026] Among them, e i represents the i-th emoticon, c i Represents the emoji i In the context of i , c i ) represents the emoji e i and its context c i The probability of co-occurrence.

[0027] Label the initial sentiment intensity of the emojis, assign values ​​to each emoji using the sentiment dictionary, and calculate dynamic weights based on relevance and sentiment intensity:

[0028] w i =α·PMI(e i , c i )+β·s(e i )

[0029] Among them, w i represents the dynamic weight of the i-th emoji, α and β are weight coefficients used to balance the PMI value and sentiment intensity, PMI(e i , c i ) represents the emoji e i With its context c i The point mutual information value, s(e i ) represents the emoticon obtained through the sentiment dictionary i emotional intensity.

[0030] Adjust the emoji embedding vectors:

[0031] Emb′(e i )=w i ×Emb(e i )

[0032] Among them, Emb′(e i ) represents the emoji after dynamic weight adjustment i The embedding vector, w i It's the emoji i The dynamic weight of Emb(e i ) represents the emoji e i The original embedding vector of .

[0033] Furthermore, the BiLSTM and GCN models with attention mechanisms are used to extract features from the adjusted embedding matrix to obtain multi-level features:

[0034] (1) BiLSTM feature extraction with attention mechanism:

[0035] Input the embedding matrix to the bidirectional LSTM network and calculate the forward and backward hidden states:

[0036]

[0037] Take the average of the two-way hidden states h t , and combined with the calculated attention weights to form a weighted hidden representation:

[0038]

[0039] α t =softmax(W a ·h t )

[0040]

[0041] Get the eigenvector f BiLSTM :

[0042]

[0043] (2) GCN feature extraction with graphic attention mechanism:

[0044] The words and emoticons in the text are taken as nodes, and edges are established based on the co-occurrence relationship of words within a window size of k to generate an adjacency matrix A.

[0045] Normalize the adjacency matrix to obtain the normalized adjacency matrix

[0046]

[0047] Where D is the degree matrix, D ii =Σ j A ij.

[0048] Perform graph convolution on node features to extract global features:

[0049]

[0050] Among them, H (l+1) The output feature matrix of the l+1th layer represents the extracted global features. is the normalized adjacency matrix, which represents the connectivity between nodes, and W(l) is the weight matrix of the lth layer, which represents the parameters used for feature transformation.

[0051] Calculate the attention weight of the node feature and perform weighting:

[0052] a ij =softmax(LeakyReLU(a T [H i ||H j ]))

[0053]

[0054] After multiple layers of graph convolution and graph attention, the final node feature representation is obtained, and the feature vector is obtained by pooling:

[0055] f GCN =Pool(H (L) )

[0056] Furthermore, dynamic weight adjustment is adopted in ensemble learning feature fusion. The specific steps include:

[0057] First, based on the classification accuracy of each model on the validation set, the initial weight of each model is calculated:

[0058]

[0059] Then, combining the training time and complexity of the model, a dynamic adjustment mechanism is introduced to define the model complexity penalty term:

[0060]

[0061] Further considering the performance of the model on different data subsets, the accuracy of each model on the subset is standardized and the weights are adjusted:

[0062]

[0063] Finally, all weights are normalized so that their sum is 1:

[0064]

[0065] Finally, dynamic weights are applied to feature fusion:

[0066]

[0067] Among them, Accuracy i is the accuracy of the i-th model on the validation set, Complexity i is the complexity of the ith model, SubsetAccuracy i is the accuracy of the ith model on a specific data subset, f is the feature output of the ith model, including f TextCNN 、f BiLSTM and f GCN .

[0068] Furthermore, the training method of the sentiment classification model includes:

[0069] The cross entropy loss function is used to measure the difference between the predicted result and the true label:

[0070]

[0071] Among them, N is the number of samples, C is the number of categories, and y ij is the actual label, is the probability predicted by the model.

[0072] Adopt Adam optimizer to update the model parameters:

[0073]

[0074] Among them, θ t is the model parameter, η is the learning rate, Bias-corrected first- and second-order moment estimates.

[0075] The optimization strategy adopts an early stopping strategy, which decides whether to stop training based on the performance of the validation set to prevent overfitting. During the training process, hyperparameters such as learning rate and batch size are adjusted to obtain the best performance.

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

[0077] It can alleviate the problems of short texts such as microblogs being short and lacking in features. By utilizing contextual information such as comments and forwarding, the original text can be expanded and reconstructed based on semantic progressive associations. This method can enrich the expression of emotional semantics and has positive significance for feature extraction and emotional tendency judgment.

[0078] Ensemble learning combines multiple basic learning models to form a powerful learning framework. Each basic model independently trains candidate features to ensure that the feature vectors retain the original feature information as much as possible while being mapped to different feature spaces. This diversity enables ensemble learning to effectively overcome the limitations of a single model in feature extraction, thereby better mining the potential semantic features covered by the text.

[0079] After the introduction of ensemble learning, features are deeply adaptively learned, and different models can focus on different feature spaces to capture potential emotional signals and semantic information in the text. By aggregating the outputs of multiple models, ensemble learning can discover higher-quality features and improve the performance of the overall model. To further enrich the feature density, a distributed semantic similarity algorithm is used to expand the feature vector at the word level. This method can more deeply explore the potential semantic information of the text and improve the quality of emotional feature extraction. By weighted fusion of the features of each model, ensemble learning not only enhances the robustness of the model, but also improves the accuracy and stability of sentiment classification.

[0080] The widespread use of emojis in short texts increases the complexity of parsing. As an intuitive way to express emotions, emojis are increasingly used in short texts. Their meaning depends not only on the text context, but also on cultural background and personal understanding. Existing text analysis models tend to simply treat emojis as ordinary words, making it difficult to accurately capture the rich emotional information conveyed by these symbols.

[0081] This method avoids the data sparsity and brevity of social media texts. Short texts on social media are usually short and lack sufficient contextual information, which poses a huge challenge to sentiment analysis. Traditional methods based on statistics and word frequency have limited effect on feature extraction and it is difficult to fully understand the sentiment tendency of the text.

[0082] Enhanced the informality and innovation of Internet language. Internet language is full of informality and innovation, containing a large number of slang, abbreviations, new words and typos. These non-standard language elements make it difficult for conventional natural language processing tools to effectively parse, which in turn affects the accuracy of sentiment classification.

[0083] Improved model generalization capabilities. Due to the high diversity of texts generated by different social platforms, language environments, and user groups, a model that performs well on a specific dataset may not maintain the same performance on new or different types of data. This limits the practicality and promotion of the model.

[0084] The limitations of algorithms and frameworks are solved. A single algorithm or model may show limitations in specific tasks and fail to fully capture the multi-level features in the text. Especially when dealing with text with complex structure or semantics. These models may not be able to capture all the potential useful information in the text data.

[0085] By combining multiple learning algorithms, ensemble learning can combine the advantages of different models to achieve better results than any single model. Different models have their own strengths when processing different types of data. Through integration, these advantages can be fully utilized to improve the overall prediction performance. In addition, different models may make different mistakes in different situations. Ensemble learning can complement these mistakes and enhance the robustness of the model. At the same time, the dynamic emoji weight assignment method dynamically adjusts the weight of emojis in sentiment analysis by combining the contextual relevance and initial sentiment intensity of emojis. This method can more accurately capture the emotional information expressed by emojis and improve the accuracy of sentiment classification. BRIEF DESCRIPTION OF THE DRAWINGS

[0086] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be described in detail below in conjunction with the accompanying drawings, wherein:

[0087] Figure 1 This is a flow chart of a sentiment classification method for short texts with expressions based on ensemble learning; DETAILED DESCRIPTION

[0088] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention.

[0089] like Figure 1 , the present invention provides a flow chart: a sentiment classification method for short texts with expressions based on ensemble learning, comprising:

[0090] Follow these steps:

[0091] S1. Obtain short text data containing emoticons, and perform preprocessing and feature processing on the short text data;

[0092] S2. Use the pre-trained BERT model to vectorize short texts and obtain context-sensitive text embedding representations;

[0093] S3. Use the TextCNN model to extract text features and perform feature learning on the embedded vector through convolutional layers and pooling layers;

[0094] S4. dynamically assign weights to emoticons, calculate dynamic weights of emoticons, and adjust their embedding vectors;

[0095] S5. Use BiLSTM with attention mechanism and graph convolutional network (GCN) to extract features from the adjusted embedding matrix and obtain multi-level features;

[0096] S6. In ensemble learning, the features extracted by each model are weighted and fused through dynamic weight adjustment to form a comprehensive feature vector;

[0097] S7. Input the comprehensive feature vector into the trained sentiment classification model to obtain the sentiment classification result of the short text.

[0098] By marking characteristic words, we can filter out the marked keywords, unify and standardize the fonts, combine and embed them into the self-learning system in the above model, enhance the data processing method, and improve the recognition of short text emotions.

[0099] The TextCNN model feature extraction step includes:

[0100] For network text, multiple convolution kernels are used to perform convolution operations on text embedding and calculate convolution features:

[0101] z i is the convolution feature of the ith position, W k is the convolution kernel weight of size k, x i:i+k-1 is the word vector of the input text at position i to i+k-1, b k is the bias term of the convolution kernel.

[0102] The short text data containing emoticons is captured through big data for feature preprocessing, and the self-trained BERT model is used to vectorize the short text and embed it into the short text for further analysis. At the same time, the TextCNN model re-extracts the text features, and the convolutional layer and pooling layer are used to learn the distinguishing features between the first and second collection of the embedded vectors, and store them in the self-database;

[0103] At this time, through dual feature learning of BERT model and TextCNN model, weight distribution is performed again and fed back to the short article. The expression processing method is adjusted according to the tone of the sender in the short article, and the micro-movement adjustment of the expression is performed to match the tone of the sender. At this time, the three data collections are combined with BiLSTM and graph convolutional network (GCN) to perform multi-level feature extraction on the adjusted short article, and the weight information is repeatedly extracted and adjusted to judge the emotional value in the short article.

[0104] Perform word segmentation on the text and retain emoticons; remove stop words, special characters, and noise data; unify the text format, including case conversion and simplified and traditional Chinese conversion; use external knowledge bases or data augmentation methods to expand the text context; use BERT for text embedding to obtain context-related word vector representations.

[0105] The feature representations of multiple convolution kernels are concatenated into a vector as the output feature f of the TextCNN model. TextCNN :

[0106] f TextCNN =[h1, h2, ..., h n ]

[0107] h j is the feature representation of the jth convolution kernel.

[0108] The sub-feature model is used to obtain the individual expressions of words in the short text, and useful information is filtered out to enter the self-screening system.

[0109] The dynamic weight allocation step comprises:

[0110] Calculate the relevance of an emoji to its context using the point mutual information (PMI) calculation formula:

[0111]

[0112] e i represents the i-th emoticon, c i Represents the emoji i In the context of i , c i ) represents the emoji e i and its context c i The probability of co-occurrence.

[0113] Label the initial sentiment intensity of the emojis, assign values ​​to each emoji using the sentiment dictionary, and calculate dynamic weights based on relevance and sentiment intensity:

[0114] w i =α·PMI(e i , c i )+β·s(e i )

[0115] w i represents the dynamic weight of the i-th emoji, α and β are weight coefficients used to balance the PMI value and sentiment intensity, PMI(e i , c i ) represents the emoji e i With its context c i The point mutual information value, s(e i ) represents the emoticon obtained through the sentiment dictionary i emotional intensity.

[0116] By integrating three models, TextCNN, BiLSTM, and GCN, our method can comprehensively analyze and understand text data from different perspectives, including local features, sequence information, and global structure. In particular, when parsing short texts containing emojis, the dynamic weight allocation method enables the model to capture the emotional details of emojis more deeply. In addition, the framework of integrated learning improves the robustness of the system in the face of diverse and non-standardized language expressions, enabling it to maintain efficient performance on texts of different sources and styles.

[0117] Adjust the emoji embedding vectors:

[0118] Emb′(e i )=w i ×Emb(e i )

[0119] Emb′(e i ) represents the emoji after dynamic weight adjustment i The embedding vector, w i It's the emoji i The dynamic weight of Emb(e i ) represents the emoji e i The original embedding vector of .

[0120] The BiLSTM and GCN models with attention mechanisms are used to extract features from the adjusted embedding matrix to obtain multi-level features:

[0121] Input the embedding matrix to the bidirectional LSTM network and calculate the forward and backward hidden states:

[0122]

[0123] Take the average of the two-way hidden states h t , and combined with the calculated attention weights to form a weighted hidden representation:

[0124]

[0125] α t =softmax(W a ·h t )

[0126] Get the eigenvector f BiLSTM :

[0127]

[0128] The words and emoticons in the text are taken as nodes, and edges are established based on the co-occurrence relationship of words within a window size of k to generate an adjacency matrix A.

[0129] Normalize the adjacency matrix to obtain the normalized adjacency matrix

[0130]

[0131] D is the degree matrix, D ii =∑ j A ij .

[0132] Perform graph convolution on node features to extract global features:

[0133]

[0134] H (l+1) The output feature matrix of the l+1th layer represents the extracted global features. is the normalized adjacency matrix, representing the connectivity between nodes, and W(l) is the weight matrix of the Ith layer, representing the parameters used for feature transformation.

[0135] Calculate the attention weight of the node feature and perform weighting:

[0136] a ij =softmax(LeakyReLU(a T [H i ||H j ]))

[0137]

[0138] After multiple layers of graph convolution and graph attention, the final node feature representation is obtained, and the feature vector is obtained by pooling:

[0139] f GCN =Pool(H (L) )

[0140] Dynamic weight adjustment is adopted in the ensemble learning feature fusion, and the specific steps include:

[0141] First, based on the classification accuracy of each model on the validation set, the initial weight of each model is calculated:

[0142]

[0143] Combining the training time and complexity of the model, a dynamic adjustment mechanism is introduced to define the model complexity penalty term:

[0144]

[0145] Further considering the performance of the model on different data subsets, the accuracy of each model on the subset is standardized and the weights are adjusted:

[0146]

[0147] Normalize all weights so that they sum to 1:

[0148]

[0149] Apply dynamic weights to feature fusion:

[0150]

[0151] Accuracy i is the accuracy of the i-th model on the validation set, Complexity i is the complexity of the ith model, SubsetAccuracy i is the accuracy of the ith model on a specific data subset, f is the feature output of the ith model, including f TextCNN 、f BiLSTM and f GCN .

[0152] The training method of the sentiment classification model includes:

[0153] The cross entropy loss function is used to measure the difference between the predicted result and the true label:

[0154]

[0155] N is the number of samples, C is the number of categories, y ij is the actual label, is the probability predicted by the model.

[0156] Adopt Adam optimizer to update the model parameters:

[0157]

[0158] θ t is the model parameter, η is the learning rate, Bias-corrected first- and second-order moment estimates.

[0159] The emoticons and short phrases in this article are all included in the database and updated in real time with the Internet.

[0160] For example, this model is used to judge articles that praise, and all corpus sets are divided into training set and test set in a ratio of 8:2. The training set is used to train the model of the extraction method of the present invention, and the test set is used to test the advantages and disadvantages of the method of the present invention compared with the traditional method. The training corpus is manually labeled with emotional tendencies, with positive emotional tendencies labeled as 1, neutral emotional tendencies labeled as 0, and negative emotional tendencies labeled as -1. Data preprocessing: Data preprocessing can better standardize the textual expression of short articles, remove garbled text, perform word segmentation, part-of-speech tagging, etc., remove stop words, and build a short text association tree. A short article may contain a large amount of contextual information such as comments and forwarding. Based on the original short article text, the association sentences between the original short article and the forwarded comments are constructed, and a semantic progressive association dictionary is constructed. The semantic progressive association words are used to determine whether the contextual corpus such as comments and forwarding has the same emotional tendency as the original short article content. Examples of semantic progressive association dictionaries include: "Indeed", "Like", "I agree very much", "You are right", etc.; By integrating the three models of TextCNN, BiLSTM and GCN, a short article expression dictionary is constructed. Combined with the praise words in the online data, the expression words and new words are added to the ICTCLAS word segmentation model, and the word segmentation model is used to optimize the word segmentation of the preprocessed and expanded short text;

[0161] If this data optimization is not perfect, a distributed semantic computing model is introduced to train and construct a word semantic similarity model for the short text corpus after word segmentation. The feature vector of the candidate feature word set is expanded using the semantic similarity computing model to enrich the feature representation density. According to the format requirements of the model input layer, the frequency of occurrence of each feature item is counted and the input vector is constructed. Then, an ensemble learning method is used to extract and fuse the constructed input vector. These features are independently trained using TextCNN, BiLSTM, and GCN to ensure that the original feature information is retained as much as possible in different feature spaces. For the test set, the feature vector is extracted according to the same steps, and then the obtained classification model is used to annotate the sentiment tendency of the short text data.

[0162] The optimization strategy adopts an early stopping strategy, which decides whether to stop training based on the performance of the validation set to prevent overfitting. During the training process, hyperparameters such as learning rate and batch size are adjusted to obtain the best performance.

[0163] By combining multiple learning algorithms, ensemble learning can combine the advantages of different models to achieve better results than any single model. Different models have their own strengths when processing different types of data. Through integration, these advantages can be fully utilized to improve the overall prediction performance. In addition, different models may make different mistakes in different situations. Ensemble learning can complement these mistakes and enhance the robustness of the model. At the same time, the dynamic emoji weight assignment method dynamically adjusts the weight of emojis in sentiment analysis by combining the contextual relevance and initial sentiment intensity of emojis. This method can more accurately capture the emotional information expressed by emojis and improve the accuracy of sentiment classification.

[0164] By integrating the three models of TextCNN, BiLSTM and GCN, we adjusted the parameters of the classification algorithm and compared the weak learning classifier enhancement algorithm to further enhance the training of features and improve the classification performance of the classification algorithm. According to the effect of a single model, we dynamically adjusted the weight of each model in the integrated learning framework, repeated the above operations to obtain the adjusted experimental results, and compared different parameters to obtain the learning and training parameters with better effects.

[0165] Working principle: Dual feature learning is performed through the BERT model and the TextCNN model to extract contextual features and local features from the text respectively. Then, dynamic weight allocation is performed to feed back the features of the two models to the short text to ensure full integration of the features. On this basis, the expression processing method is adjusted in combination with the tone of the sender in the short text to dynamically adjust the weight of the expression to match the tone of the sender of the text. Subsequently, through three data collections, combined with BiLSTM and graph convolutional network (GCN), multi-level feature extraction is performed on the adjusted short text. In this process, weight information is continuously extracted, adjusted and compared to accurately judge the emotional value contained in the short text.

[0166] The text is segmented and emoticons are retained; stop words, special characters and noise data are removed; the text format is unified, including case conversion and simplified and traditional Chinese conversion; external knowledge bases or data augmentation methods are used to expand the text context; BERT is used for text embedding to obtain context-related word vector representations; by integrating three models, TextCNN, BiLSTM and GCN, our method can comprehensively analyze and understand text data from different perspectives, such as local features, sequence information and global structure. In particular, when parsing short texts containing emoticons, the dynamic weight allocation method enables the model to capture the emotional details of emoticons more deeply. In addition, the framework of ensemble learning improves the robustness of the system in the face of diverse and non-standardized language expressions, so that it can maintain efficient performance on texts of different sources and styles; ensemble learning can combine the advantages of different models by combining multiple learning algorithms to obtain better results than any single model. Different models have their own strengths when processing different types of data. Through integration, these advantages can be fully utilized to improve the overall prediction performance. In addition, different models may make different mistakes in different situations. Ensemble learning can complement these mistakes and enhance the robustness of the model. At the same time, the dynamic emoji weight assignment method dynamically adjusts the weight of emojis in sentiment analysis by combining the contextual relevance and initial sentiment intensity of emojis. This method can more accurately capture the emotional information expressed by emojis and improve the accuracy of sentiment classification.

[0167] The above embodiments are only used to illustrate the technical solutions of the present invention, but not to limit them.

Claims

1. A short text sentiment classification method based on dynamic emoticon weight allocation and ensemble learning, characterized by: The following steps are involved: S1. Obtain short text data containing emoticons, and perform preprocessing and feature processing on the short text data; S2. Use the pre-trained BERT model to vectorize short texts and obtain context-sensitive text embedding representations; S3. Use the TextCNN model to extract text features and perform feature learning on the embedded vector through convolutional layers and pooling layers; S4. dynamically assign weights to emoticons, calculate dynamic weights of emoticons, and adjust their embedding vectors; S5. Use BiLSTM with attention mechanism and graph convolutional network (GCN) to extract features from the adjusted embedding matrix and obtain multi-level features; S6. In ensemble learning, the features extracted by each model are weighted and fused through dynamic weight adjustment to form a comprehensive feature vector; S7. Input the comprehensive feature vector into the trained sentiment classification model to obtain the sentiment classification result of the short text.

2. The short text sentiment classification method based on dynamic emoticon weight allocation and ensemble learning according to claim 1, characterized in that: Preprocessing of text data and short text feature processing include: segmenting text and retaining emoticons; removing stop words, special characters and noise data; unifying text formats, including case conversion and simplified and traditional Chinese conversion; using external knowledge bases or data enhancement methods to expand text context; and using BERT for text embedding to obtain context-related word vector representations.

3. The short text sentiment classification method based on dynamic emoticon weight allocation and ensemble learning according to claim 1, characterized in that: The TextCNN model feature extraction step includes: For network text, multiple convolution kernels are used to perform convolution operations on text embedding and calculate convolution features: With i =ReLU(W k ·x i:i+k-1 +b k ) Among them, z i is the convolution feature of the ith position, W k is the convolution kernel weight of size k, x i:i+k-1 is the word vector of the input text at position i to i+k-1, b k is the bias term of the convolution kernel. The feature representations of multiple convolution kernels are concatenated into a vector as the output feature f of the TextCNN model. TextCNN : f TextCNN =[h1,h2,…,h n ] Among them, h j is the feature representation of the jth convolution kernel.

4. The short text sentiment classification method based on dynamic emoticon weight allocation and ensemble learning according to claim 1, characterized in that: The dynamic weight allocation step comprises: Calculate the relevance of an emoji to its context using the point mutual information (PMI) calculation formula: Among them, e i represents the i-th emoticon, c i Represents the emoji i In the context of i ,c i ) represents the emoji e i and its context c i The probability of co-occurrence. Label the initial sentiment intensity of the emojis, assign values ​​to each emoji using the sentiment dictionary, and calculate dynamic weights based on relevance and sentiment intensity: w i =α·PMI(e i ,c i )+β·s(e i ) Among them, w i represents the dynamic weight of the i-th emoji, α and β are weight coefficients used to balance the PMI value and sentiment intensity, PMI(e i ,c i ) represents the emoji e i With its context c i The point mutual information value, s(e i ) represents the emoticon obtained through the sentiment dictionary i emotional intensity. Adjust the emoji embedding vectors: Emb′(e i )jw i ×Emb(e i ) Among them, Emb′(e i ) represents the emoji after dynamic weight adjustment i The embedding vector, w i It's the emoji i The dynamic weight of Emb(e i ) represents the emoji e i The original embedding vector of .

5. The short text sentiment classification method based on dynamic emoticon weight allocation and ensemble learning according to claim 1, characterized in that: The BiLSTM and GCN models with attention mechanisms are used to extract features from the adjusted embedding matrix to obtain multi-level features: (1) BiLSTM feature extraction with attention mechanism: Input the embedding matrix to the bidirectional LSTM network and calculate the forward and backward hidden states: Take the average of the two-way hidden states h t , and combined with the calculated attention weights to form a weighted hidden representation: a t =softmax(W a ·h t ) Get the eigenvector f BiLSTM : (2) GCN feature extraction with graph attention mechanism: The words and emoticons in the text are taken as nodes, and edges are established based on the co-occurrence relationship of words within a window size of k to generate an adjacency matrix A. Normalize the adjacency matrix to obtain the normalized adjacency matrix Where D is the degree matrix, Perform graph convolution on node features to extract global features: Among them, H ( l+ 1) The output feature matrix of the l+1th layer represents the extracted global features. is the normalized adjacency matrix, which represents the connectivity between nodes, and W(l) is the weight matrix of the lth layer, which represents the parameters used for feature transformation. Calculate the attention weight of the node features and perform weighting: a,j=softmax(LeakyReLU(a T [H,]IH,I)) After multiple layers of graph convolution and graph attention, the final node feature representation is obtained, and the feature vector is obtained by pooling: f GCN --Pool(H( L> ) 6. The short text sentiment classification method based on dynamic emoticon weight allocation and ensemble learning according to claim 1, characterized in that: Dynamic weight adjustment is adopted in the ensemble learning feature fusion, and the specific steps include: First, based on the classification accuracy of each model on the validation set, the initial weight of each model is calculated: Then, combining the training time and complexity of the model, a dynamic adjustment mechanism is introduced to define the model complexity penalty term: Further considering the performance of the model on different data subsets, the accuracy of each model on the subset is standardized and the weights are adjusted: Finally, all weights are normalized so that their sum is 1: Finally, dynamic weights are applied to feature fusion: Among them, Accuracy i is the accuracy of the i-th model on the validation set, Complexity i is the complexity of the ith model, SubsetAccuracy i is the accuracy of the ith model on a specific data subset, f is the feature output of the ith model, including f TextCNN 、f BiLSTM and f GCN .

7. The short text sentiment classification method based on dynamic emoticon weight allocation and ensemble learning according to claim 1, characterized in that: The training method of the sentiment classification model includes: The cross entropy loss function is used to measure the difference between the predicted result and the true label: Among them, N is the number of samples, C is the number of categories, and y ij is the actual label, is the probability predicted by the model. Adopt Adam optimizer to update the model parameters: Among them, θ t is the model parameter, η is the learning rate, Bias-corrected first- and second-order moment estimates. The optimization strategy adopts an early stopping strategy, which decides whether to stop training based on the performance of the validation set to prevent overfitting. During the training process, hyperparameters such as learning rate and batch size are adjusted to obtain the best performance.

Citation Information

Patent Citations

  • Network social media sentiment classification method based on multi-dimensional and multi-level joint modeling

    CN112163607A

  • Graph neural network text sentiment classification method based on double sliding windows

    CN113220884A

  • Multi-modal emotion recognition method, system and device based on self-attention mechanism fusion and medium

    CN116564355A

  • Network short text sentiment classification method based on Bi-GRU neural network embedded with emoticons

    CN116737937A

  • Sentiment classification model and text sentiment analysis method applied by same

    CN117708328A