Abstract
To study the application of convolutional neural networks (CNN) in microblog sentiment analysis, a microblog sentiment dictionary is established first. Then, latent Dirichlet allocation (LDA) is proposed for user forwarding sentiment analysis. The sentiment analysis models of CNN and long short-term memory network (LSTM) are established. Experiments are conducted to verify the application effect. The main contributions of this work encompass the establishment of a sentiment lexicon for Weibo, the optimization of two sentiment analysis models, namely CNN and LSTM, as well as the comparison and analysis of the performance of three sentiment analysis approaches: CNN, LSTM, and LDA. The research findings indicate that the CNN model achieves a prediction accuracy of 78.6% and an actual output precision of 79.3%, while the LSTM model attains a prediction accuracy of 83.9% and an actual output precision of 84.9%. The three analysis models all have high sentiment analysis accuracy. Among them, LDA analysis model has the advantages of universality and irreplaceable in text classification, while LSTM analysis model has relatively higher accuracy in sentiment analysis of users forwarding microblog. In short, each sentiment analysis model has its own strengths, and reasonable allocation and use can better classify microblog sentiment.
Keywords
Introduction
Microblog is a short form of expression of life emotion in blog which has become popular in recent years. Short real-time information is shared at any time through microblog, spreading widely and forming a social network platform [1]. It can not only release various messages quickly and at any time using microblog, but also carry out real-time interaction among users in the member network. The reason why microblog is favored by users is that the requirements of microblog users is relatively low compared with traditional blogs, which makes microblog show an explosive development trend. It has developed into one of the most popular social networking places on the Internet with a very fast trend [2, 3]. In view of the fast speed of information transmission, strengthening communication with customers through technical research and development and market operation on Weibo has gradually become a new choice for enterprise development. Microblog will create a novel media atmosphere for users, including sound, text, images, mobile clients, and other hyperspace environments [4].
Microblog users can release microblog media in the form of SMS at anytime and anywhere, allowing all microblog visitors or their own designated blogs to browse the microblog content. Therefore, the introduction of microblog into human-computer interaction education has a great impact on the discourse power [5]. According to statistics, in 2016, more than 1,100 universities opened official Weibo accounts, and as of June 2018, the number of registered users of Sina microblog has exceeded 330 million [6, 7]. There is no doubt that microblog plays a positive role in our life, work, and education. However, with the growing maturity of microblog “our media”, all kinds of network emergencies will continue to spread and ferment on microblog and other “our media”, generating massive rumors and false information. In addition to information asymmetry and public perception deviation, once public opinion breaks out, there will be massive public opinions affecting social stability and unity. There will be a serious impact on the formulation of public policies in China, and the risk management of various departments will be extremely challenging [8]. Therefore, timely analysis of users’ emotions when forwarding microblogs, which aims to curb the widespread spread of negative public opinions, is of great significance to the social stability of China.
Latent Dirichlet allocation (LDA) model and deep learning model based on convolutional neural networks (CNN) model and long short-term memory network (LSTM) model are proposed innovatively. The microblog sentiment dictionary is established for the three models, the experimental environment of the deep learning model is analyzed. Then, the initial microblog text is obtained through web crawler. The main logical framework of this work is as follows. In Section 1 of the study, an introduction is provided on the background of sentiment analysis on Weibo and research methods using deep learning. In Section 2 of the study, an analysis is conducted on the current research status of deep learning and the utilization of neural networks in sentiment analysis. Section 3 of the study organizes the sentiment analysis using Dirichlet sentiment analysis and deep learning models. In Section 4 of the study, experimental design and analysis of experimental results are carried out through the configuration of experimental datasets and environments. Section 5 of the study derives research conclusions through induction and summarization. The research has practical reference value for promoting the development of convolutional neural network models in the field of sentiment analysis.
Literature review
Deep learning status
Human-computer interaction and deep learning technologies have been applied in many fields with the rapid development of artificial intelligence technology in the Internet era [9]. Interactive teaching based on human-computer interaction is mediated by computers or electronic devices. “Human-human” interaction, “human-machine” interaction, and “human-machine-human” interaction [10, 11] are all assisted by interaction.
Deep learning is a new research direction of machine learning. It learns tasks by simulating the neural network structure of the human brain [12]. Deep learning technology has gradually been applied to various fields and has been successfully applied to the related processing of pictures, audio, and video with the continuous advancement of science and technology [13]. The adoption of deep learning in the field of natural language processing started relatively late. Nevertheless, it solves many problems such as machine translation (Google translation), question-and-answer system (which can automatically generate corresponding feedback and answers based on user questions), and sentiment analysis (which can analyze the emotion of speech to generate relevant decisions). There are other functions of information extraction, tag sequence, and syntax analysis [14]. Machine learning techniques are currently widely used for related sentiment analysis of microblog, such as support vector machines, K-means clustering methods, and naive Bayes [15].
The adoption status of neural network in sentiment analysis
Research on application of deep learning in microblog sentiment analysis is focused on CNNs and recurrent neural networks only. The disadvantage of these networks is the processing sequence of short text data. Most sentiment analysis of Chinese microblogs can only divide microblogs into positive and negative categories [16, 17]. Topal and Kurt [18] found that the main motivation behind hidden communication was hiding the existence of communication between two users. In this work, the covert communication performance in a non-orthogonal multiple access non-orthogonal multiple access (NOMA) network with amplifying and forwarding relay was studied. Li et al. [19] revealed that high-resolution remote sensing images can provide rich feature information in the task of change detection. However, the interference of noise and complex background information can also bring some challenges to CD. In recent years, deep learning methods represented by CNN have harvested good results.
Materials and methods
Sentiment analysis of reposting microblog under LDA model
I. Establishment of microblog sentiment dictionary. The first step is text preprocessing. Institute of Computing Technology, Chinese Lexical Analysis System (ICTCLAS) word segmentation system [20] can support users to customize the dictionary. Basic emotional words and the words contained in the online emotional dictionary are added to the ICTCLAS word segmentation system. Then, microblog words and sentences are guided into the word segmentation system for data set processing. A stop word dictionary is established based on the characteristics of the microblog text, and the stop words in the word segmentation result are deleted. Second, the emotional benchmark words in Chinese vocabulary and microblog words are chosen. Half of the words are commendatory, and the other half are derogatory (praise: ha-ha, beautiful, nice, happy, perfect, praise, etc.; derogatory sense: garbage, tragedy, horror, regret, spit, etc.). Third, emotional candidate words are selected from microblog words. Template level words are adopted to select emotional candidate words for microblog (savory, powerful, abusive, beautiful, good future, like you, true love, very unfair, high, unaffordable, etc.). Fourth, the emotional trend of the emotional candidate words is judged, and the number of times the two words appear together are calculated to obtain the Point Mutual Information (PMI) [21] value, as shown in Eq. (1).
In Eq. (1),
The emotional tendency of words can be calculated from the PMI value, as shown in Eq. (2).
In Eq. (2),
III. Establishment of LDA model. LDA model [22] generates probabilistic processing discrete data (corpus). The LDA model is a topic model, using probability distribution of the topic to build a model for each document in the document set (Fig. 1).
LDA model.
The box on the right side of the Fig. 1 represents the topic, and
After all the microblog content of a certain user are trained, the blog content theme of the user is modelled. User characteristics, microblog characteristics, and content theme characteristics (topic vectors) are combined to form a microblog forwarding behavior characteristic model. Thus, a list of forwarding characteristics is formed, as shown in the Table 1.
I. Sentiment analysis of microblog forwarding.
The sentiment value of microblog
In Eq. (4),
Analysis of the status quo of advanced research
LSTM sentiment classification model
LSTM [24] is an optimized network belonging to the recurrent neural network, which updates the current node information in the form of three gates, so as to effectively memorize historical information. It calculates the next node according to the values of the previous node and the current node. The LSTM sentiment classification model includes the following three parts.
Input layer. The Word2vec tool is used to train Chinese microblog texts with well-divided words, and the word vectors containing contextual semantic information become the input vocabulary of the LSTM model.
Hidden layer. This layer performs feature learning. A vector representation of the word is obtained after the first training. Sentences in microblog are regarded as a collection of word vectors. The overall vector of the sentence is obtained as the input part of the LSTM model after the word vectors are concatenated. The LSTM model can fully and effectively use the context information of the text for feature learning. Under the action of the three gates, the state value of the hidden layer is changed according to the historical information of the input sequence, to obtain the feature vector.
Output layer. As the last layer of the model, it uses the activation function to calculate the classification probability. Sigmoid function [25] is used, after the hidden layer of the model completes feature learning, it is connected to the Sigmoid layer, and the classification probability is calculated through the Sigmoid function. From the calculation result, the sentiment classification result of the microblog is obtained, and the accuracy of the sentiment classification of the microblog is output. The model calculation process is shown in Fig. 2.
LSTM sentiment classification model calculation process.
Initially, the core application of the CNN sentiment analysis model [26] is image processing. It is now possible to apply natural language processing to the principles of CNN image processing. The first two data of the array in the expression of a sentence indicate the length of the sentence and the dimension of the word vector in turn. The proposed CNN sentiment classification model mainly consists of four parts.
The input layer uses word2vec model training to obtain word vectors representing words of text and uses the text as the input part of the CNN model. The convolution layer belongs to the feature learning layer. Several convolution kernels of different sizes are used to learn sentence features, and several feature expressions are obtained. The maximum pooling in the pooling layer compresses the features learned by the convolutional layer to obtain the core features. The fully connected layer connects all the features obtained by the collection layer, and then inputs the obtained feature vector into the classifier.
Results
Experimental data sets
The data of this research is taken from Tencent Weibo, and Application Programming Interface (API) crawler method [27] is adopted to obtain the microblog background data set. 41,235 microblogs from June 1–28, 2021 are selected as training data samples, and 4,126 microblogs from June 29–31 as test data samples. From April to June, the number of microblogs was 329,876, an epic number. To obtain accurate sentiment classification results, artificial sentiment labeling measures are adopted for the content of 4,100 reposted comments in the test data. After text preprocessing, 3,125 pieces of data are obtained. Of them, 1,003 items belong to positive emotional tendencies, and 406 items belong to negative emotional tendencies. Others are 1,716 items (positive emotions include happiness, encouragement, like, and worship, while negative emotions include hatred, anger, hatred, and sadness). Positive emotion prediction is defined as
The text classification experiment of the deep learning model is completed by the deep learning framework Keras [28]. The backend of Keras is Tensorflow or Theano. The deep learning lib library is a deep learning library that contains many currently very commonly used learning models, such as CNN and RNN. Keras is an advanced neural network that will include TensorFlow. Keras supports CNN and RNN (or a combination of the two), completes quickly and concisely, and can quickly transform ideas into experimental results. Moreover, it supports switching between CPU and GPU at any time. The design principles of Keras are as follows.
Keras provides a concise API, and the code implementation process is relatively simple, which reduces the workload and improves work efficiency. The network layer, activation function, loss function, and optimizer in the neural network are all encapsulated in different areas. High encapsulation allows users to arbitrarily combine modules according to actual needs to build their own models. Keras imitates the current module, and the new function written can be extended and innovated in the module. The models in Keras are all written in Python code [29], which is very scalable and convenient.
The hardware and software configuration of the experimental environment is shown in Table 3.
Forwarding feature list
The hardware and software configuration of the experiment
The content of the original data set obtained by the API crawler is very messy, which also contains useless symbols or characters. It is necessary to format the obtained data before data analysis. The main content of data preprocessing is data cleaning and Chinese word segmentation.
The first step is the data cleaning. Redundant and messy data are reduced, and the emotional analysis of the data that is meaningless in the later stage is also reduced, so that the efficiency and accuracy of the experiment is improved. The main methods of data cleaning are as follows.
Delete useless symbols in the data. Some bloggers will add symbols to words because of personal habits when they post on microblog, and these symbols are not common symbols, which have no practical significance for the later sentiment analysis, thus are removed. Delete the URL in the data. Some microblogs have a URL attached to the body content, which can be clicked on to where this microblog comes from. These URLs have no meaning for analyzing the sentimental issues of reposting microblog, so the URLs should be deleted.
Second, word segmentation measures are not needed, for Chinese word segmentation and English words are separated by spaces. However, the structure and grammar of Chinese are not very complicated. The same sentence may have multiple meanings and different combinations of words, which will increase the difficulty of Chinese word segmentation. The accuracy of word segmentation determines the accuracy of sentiment analysis results.
Currently, the most popular word segmentation tools are BosonNLP, language cloud, and Natural Language Processing & Information Retrieval (NLPIR) [30, 31]. The wording of microblog data is very serious, the types of words used are very diverse and casual, and the emerging vocabulary on the Internet is often used. Due to the characteristics of microblog data, BosonNLP [32] is very helpful to improve the accuracy of Chinese microblog word segmentation according to the starting point of new word recognition and the perspective of combining different meanings. BosonNLP is adopted to process and analyze Chinese word segmentation in the experimental data of microblog.
The sentence text will be supplemented with massive meaningless data if the number of qualifiers in the microblog text is too large, which increases the amount of calculation and affects the model’s extraction of semantic features. If the number of qualifiers is too small, the rich semantic information in the text will be wasted. Therefore, the number of qualifiers needs to be determined through experiments. Before the experiment, the frequency distribution of the microblog text length of the data set is drawn as shown in Fig. 4.
CNN sentiment classification process.
Microblog text length distribution.
In Fig. 4, the text length is mostly concentrated below 80 words, so it is relatively appropriate to select about 80 words as the number of experimental words. In this experiment, the length of the text is 10 words as the interval, a total of 5 words from 60 words to 100 words are tested, and their accuracy and F1 value on the test set are compared.
It is impossible to put the entire training set data into the model for training at one time because of the very large sample size of the data set for deep neural network training. The training set is usually divided into multiple mini-batches of the same number in practical applications. The model receives a batch of data for training each time, compares the output results obtained with the actual results of the batch, calculates the loss function, and updates the model parameters through backpropagation.
In general, the batch size should be kept at a reasonable level. The direction is random if the batch is small, though the model parameters are updated frequently, and it may be difficult to converge. It may be difficult to achieve due to the performance of the computer if the batch is large, though the direction of model training can be guaranteed to be stable. In this experiment, a total of 6 batch sizes of 16, 32, 64, 128, 256, and all data sets are used for comparison experiments. The training time of the model and the evaluation indicators on the test set are recorded. The results are shown in Table 4.
Comparison results of batch size experiments
As the sample size of a single batch increases, the time to run ten Epochs gets shorter and shorter. However, the GPU memory can’t be trained because it is full, if the batch size is the entire data set. From the evaluation index, the F1 value and accuracy do not tend to be ideal with the increase of the training batch size. The classification performance of the model is the best when the batch size is 128.
With and without the introduction of emotional features in LDA, the number of topics in the LDA model is set to 30, 50, 80, 110, 140, 170, and 200, and the sentiment value under different number of topics is analyzed. The accuracy, recall, and F1 values are calculated in Fig. 5a and b.
When the LDA model does not introduce emotional features, if the number of topics is 120, F1
Sentiment analysis results of user reposting microblog
I. Comparison of results of sentiment binary classification between CNN model and LSTM model.
Many parameters need to be adjusted in order not to affect the experimental results if CNN and LSTM models are employed to classify microblog sentiment. It is assumed that the maximum input length of a microblog sentence (Maxlen) is 130, the amount of data for each parameter update is (Batch _ size): 34, the word vector dimension (Embedding_Vecor_Length) is: 110, the number of data iterations (N_Epoch) during training is 15, and the ratio of the training set to the test set (Test_Size) is 0.3. The comparison results of the emotional binary classification results of the CNN model and the LSTM model are shown in Table 2.
Goodness of fit refers to the degree of fit of the regression line to the observed value. The statistic that measures the goodness of fit is the coefficient of determination (also known as the coefficient of determination)
Comparison of the results of sentiment binary classification between CNN model and LSTM model
Comparison of the results of sentiment binary classification between CNN model and LSTM model
Chinese corresponding to English abbreviations
LDA model feature representation. a: no emotional features are introduced; b: emotional features are introduced.
Equation symbols
Pseudo code of microblog sentiment analysis algorithm
ROC curve of CNN and LSTM sentiment analysis model.
From Table 5, the actual classification accuracy of the CNN model is 0.793, and that of the LSTM model is 0.849. Both have high accuracy in microblog sentiment classification, and the LSTM sentiment classification model has a fitting degree of 0.91, which is close to 1, indicating that the classification is accurate and LSTM is suitable for users to forward microblog sentiment classification.
Sentiment analysis of microblog forwarding under different feature combinations. a: positive trend; b: negative trend.
Performance comparison of different sentiment analysis methods.
Flow chart of the overall research framework.
Area under curve (AUC) is defined as the area under the receiver operating characteristic (ROC) curve and the coordinate axis. Obviously, the value of this area will not be greater than 1. Since the ROC curve is generally above the line
AUC
AUC
AUC
AUC
AUC
AUC
Comments and responses
Then, the ROC curve of CNN and LSTM models to classify microblog sentiment is shown in Fig. 6.
From Fig. 6, the AUCs of the CNN and LSTM sentiment analysis models are 0.85 and 0.91, respectively. The performance of the LSTM sentiment analysis model is better.
II. Sentiment analysis of microblog forwarding under different feature combinations.
The sentiment analysis of users forwarding microblog is carried out under three characteristics of user characteristics, user characteristics
Adding microblog features can improve the experimental results, indicating that analyzing microblog users can increase topic interest. Since microblog users repost microblog from their own hobbies, microblog of similar nature also has similar emotional tendencies. Therefore, the polarity of reposted comment content has not changed much. The positive F1 value is 69.98%, the negative F1 value is 66.01% after the sentiment analysis of users and microblog features, and the difference is relatively small.
To prove the superiority of the sentiment analysis method proposed in this study, the proposed LDA sentiment analysis method and the sentiment analysis method based on CNN and LSTM are compared with the advanced ones proposed in references [33, 34, 35]. Their performances are compared regarding the Accuracy, Precision, Recall, and F1 values. The results are shown in Fig. 8.
From Fig. 8, the sentiment analysis method of this study and other current advanced research methods in the literature are compared and analyzed in Accuracy, Precision, Recall, and F1 values. The sentiment analysis model based on the LSTM network has a good classification accuracy, reaching 83.4%, and the values in the three directions of Precision, Recall, and F1 are also the highest. The LSTM sentiment analysis model has superior performance in the sentiment analysis process of users forwarding microblog.
Conclusion
Research summary
To analyze the sentiment attributes of users who forwarded microblog, a microblog sentiment dictionary is firstly established, then an LDA model is put forward. A microblog sentiment analysis model under deep learning, including CNN and LSTM models, is proposed. The LDA model, the CNN model, and the LSTM model are used to conduct sentiment analysis on users’ reposted microblogs, and the sentiment analysis results of the CNN model and the LSTM model are compared and analyzed. In the LDA model, sentiment analysis is carried out on microblog forwarding under different feature combinations. The results show that the LSTM model under deep learning is more suitable for sentiment analysis of microblog users. The LDA model can perform sentiment analysis on users’ reposting microblog based on the different characteristics of users and microblog and the relationship between the two. The accuracy of the two models is very high, which can promote the practical application of microblog in human-computer interaction education.
Limitations of this research
Several deep neural network sentiment analysis models are fabricated in this study. Some achievements are achieved in this study, which proves that the proposed CNN and LSTM sentiment analysis models can achieve good classification results. Limited by experimental conditions and technical level, however, there are still some deficiencies, which should be further improved.
The emotion dictionary established in this work is not comprehensive enough. It only consists of negative and positive emotions. In fact, human emotions are complex and changeable Negative emotions are also classified into sadness, regret, regret, and other different degrees of emotional expression. Therefore, more delicate emotion should be added to this text, which will be more conducive to the realization of the control of the emotional tendency of the text. There is room for further mining of microblog comment information. This work only carries on the sentiment analysis to the microblog text. In fact, in addition to the Chinese text, pictures and videos may also reflect the reviewer’s emotional attitude, Therefore, multi-modal sentiment analysis of information content such as text and video in microblog may be better than single text sentiment analysis to grasp the emotional tendency of commentators.
Footnotes
Funding
This work was supported by following fundings:
Key Research Project of Guangdong Baiyun College, No. 2022BYKYZ02.
Key Research Platform of Guangdong Province, No. 2022GCZX009.
Special project in key fields of colleges and universities in Guangdong province, No. 2020ZDZX3009.
