0% found this document useful (0 votes)
20 views

Sentiment Analysis of User Comment Text Based On L

This document discusses sentiment analysis of user comment text based on LSTM. It constructs word vectors using word2vec and builds a sentiment analysis model using LSTM in TensorFlow. The model analyzes sentiment tendencies in user comments on platforms like hotels to understand consumer sentiment and improve service quality. The accuracy of the LSTM model on validation datasets is up to 0.89, though there is room for improvement, and future research will optimize the model for more stable and accurate sentiment analysis.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Sentiment Analysis of User Comment Text Based On L

This document discusses sentiment analysis of user comment text based on LSTM. It constructs word vectors using word2vec and builds a sentiment analysis model using LSTM in TensorFlow. The model analyzes sentiment tendencies in user comments on platforms like hotels to understand consumer sentiment and improve service quality. The accuracy of the LSTM model on validation datasets is up to 0.89, though there is room for improvement, and future research will optimize the model for more stable and accurate sentiment analysis.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

WSEAS TRANSACTIONS on SIGNAL PROCESSING

DOI: 10.37394/232014.2023.19.3 Feng Li, Chenxi Cui, Yashi Hu, Lingling Wang

Sentiment Analysis of User Comment Text based on LSTM


FENG LI, CHENXI CUI, YASHI HU, LINGLING WANG*
School of Management Science and Engineering,
Anhui University of Finance and Economics,
Bengbu 233030,
CHINA
*Corresponding Author

Abstract: Taking the user-generated Chinese comment dataset on online platforms as the research object, we
constructed word2vec word vectors using gensim and built a sentiment analysis model based on LSTM using
the TensorFlow deep learning framework. From the perspective of mining user comment data on the platform,
we analyzed the sentiment tendency of user comments, providing data support for hotels to understand
consumers' real sentiment tendencies and improve their own service quality. Through analysis of the validation
dataset results obtained by crawling the website, the accuracy of this LSTM model can reach up to 0.89, but
there is still much room for improvement in the accuracy of sentiment analysis for some datasets. In future
research, this model needs further optimization to obtain a stable and more accurate deep-learning model.

Key-Words: Online; Comment Text; LSTM; Sentiment Analysis.

Received: May 8, 2022. Revised: February 12, 2023. Accepted: March 3, 2023. Published: April 5, 2023.

1 Introduction have been made in various research methods.


In recent years, with the rapid development of Common methods for sentiment analysis include
Internet technology and the arrival of the era of traditional sentiment lexicons and machine learning.
universal 5G, Internet applications and big data The traditional sentiment lexicon method involves
computing are involved in every aspect of daily life. comparing the emotional tendency and information
By the end of 2021, the global Internet user base has intensity of the vocabulary in the pre-constructed
reached 4.9 billion. Compared with 2019 (401 sentiment lexicon with the content of the text and
billion), the global Internet user case has grown by then classifying the text. Traditional sentiment
19.5%, with an increase of 800 million new Internet lexicon methods can use existing high-quality
users. Among them, the growth rate of global lexicons, but the lexicon cannot cover all the
Internet users reached 10.2% in 2020, the highest in vocabulary in all fields, especially with the impact
a decade. As a result, the Internet generates around of the newly emerged internet language. Machine
4 PB of data every day, including about 10 billion learning models text classification by modeling
text messages. With the increasingly widespread use certain features and learning from manually labeled
of online shopping, the amount of information data data, but this method requires some manual feature
generated by users of e-commerce platforms is also engineering.
increasing, with a considerable portion being The content of user comments contains the
emotional evaluations, opinions, and thoughts. subjective emotions of the user. Sentiment analysis
Extracting user sentiment from such a large and of user message content usually refers to the mining,
complex volume of textual information and parsing, generalisation, and inference of user-
identifying users' sentiment tendencies has become a generated content based on machine learning, from
research area of great interest in the field of natural which user attitudes and opinions are obtained.
language processing. Sentiment analysis, also Sentiment analysis can be divided into chapter-level
known as opinion mining, is the process of sentiment analysis, sentence-level sentiment
classifying text into positive, negative, and neutral analysis, and aspect-level sentiment analysis, with
sentiments, [1]. The main purpose of sentiment chapter-level sentiment analysis and sentence-level
analysis is to classify text into positive, negative, sentiment analysis belonging to coarse-grained
and neutral sentiments. To date, sentiment analysis sentiment analysis and aspect-level sentiment
has been extensively explored and breakthroughs analysis belonging to fine-grained sentiment

E-ISSN: 2224-3488 19 Volume 19, 2023


WSEAS TRANSACTIONS on SIGNAL PROCESSING
DOI: 10.37394/232014.2023.19.3 Feng Li, Chenxi Cui, Yashi Hu, Lingling Wang

analysis. Coarse-grained sentiment analysis can only


analyse the sentiment of a whole text or paragraph,
but not the multiple perspectives contained in a
large text. In contrast, fine-grained sentiment
analysis can determine the sentiment of individual
entities more accurately, making aspect-level
sentiment analysis a hot research area in the field of
sentiment analysis. Aspect-Based Sentiment
Analysis (ABSA) is a fundamental task in sentiment
analysis, which aims to identify the aspects present
in a sentence and determine the sentiment polarity
of each aspect, 0.
Through research on relevant domestic and
foreign work, we found that the mainstream text Fig. 1: Neural network structure
sentiment analysis methods currently mainly include:
sentiment analysis based on sentiment dictionaries,
sentiment analysis based on machine learning, and 2 Related Works
sentiment analysis based on deep learning.
Sentiment analysis based on sentiment dictionaries 2.1 Studies Related to Sentiment Analysis
and rules first compares the text content with
specific entities in the sentiment dictionary to derive 2.1.1 Sentiment Analysis Methods based on
sentiment values, and then the results are weighted Sentiment Dictionaries
to derive the sentiment tendency of the text. This The earliest English sentiment lexicon that appeared
method can produce good sentiment analysis results is SentiWordNet, in addition to the commonly used
if the sentiment lexicon is sufficiently rich. A ones, such as General Inquirer, Opinion Lexicon,
machine learning algorithm is a generic term for a and MPQA. Chinese emotion dictionaries are
class of algorithms that construct a function with a widely used, such as HowNet and Dalian University
large amount of data as input, the output of which of Technology's Chinese emotion vocabulary
can be classification, prediction, etc. And this ontology database. In addition, 0, proposed a
function is equally applicable to new sample data. sentiment lexicon for Vietnamese, which includes
Machine learning-based sentiment analysis is a more than 100,000 Vietnamese emotional
method of constructing a function model into which vocabularies. The slang sentiment dictionary
a large amount of textual information is input and SlangSD, which was built by [4], from web
extracting features through machine learning resources, is also effective in identifying the
algorithms. KNN, NB, and SVM are common sentiment of users. [5], used a constructed
algorithms used in machine learning. Deep learning dictionary of network words, degree adverbial
is a practical application of multilayer neural dictionaries, negation dictionaries, and other related
networks in learning, which is still essentially in the dictionaries, and trained them with the help of
realm of machine learning, although it can solve
Weibo texts to derive updated sentiment values. [6],
complex problems that are difficult to solve with
proposed a sentiment classifier that trains
traditional machine learning, so it has been singled
incremental words from time-varying distributional
out as a separate discipline. Common models of
word vectors, automatically extracts continuously
deep learning include CNN, RNN, Transformer,
updated sentiment vocabulary from Twitter streams,
GRU, and LSTM. The underlying structure of a
and obtains a time-varying sentiment lexicon based
neural network is shown in Figure 1 and contains an
on incremental word vectors. [7], integrated emojis,
input layer, a hidden layer, and an output layer.
modifiers, and domain-specific terms to analyse
Each neuron in the input layer can be used as a
comments posted by online communities,
feature of an object, the hidden layer may have
overcoming the limitations of previous methods.
multiple layers and it will transform the information
Compared to the general approach, sentiment
from the input into something that can be used in the
analysis was greatly improved by integrating
output layer, and the output layer transforms the
modifiers, emojis, negation words, and domain-
results of the hidden layer into the desired result.
specific terms. However, the sentiment analysis
method based on sentiment dictionaries relies too
much on sentiment dictionaries, and in today's

E-ISSN: 2224-3488 20 Volume 19, 2023


WSEAS TRANSACTIONS on SIGNAL PROCESSING
DOI: 10.37394/232014.2023.19.3 Feng Li, Chenxi Cui, Yashi Hu, Lingling Wang

information age, a single sentiment dictionary training speed and reduce computational cost and
cannot make accurate judgments, while building a time, [15], proposed an attention-based LSTM
more complete and diverse dictionary can be labor- oriented aspect-level sentiment memory network
intensive. classification for sentiment classification based on
LSTM, [16], proposed a streamlined LSTM with six
2.1.2 Machine Learning-based Sentiment different parameters and compared the performance
Analysis Methods differences between these LSTMs using the Twitter
[8], compared the results of decision trees, Bernoulli dataset to establish the best set of parameters for the
NB (BNB), Maximum Entropy (ME), support LSTM, [17], proposed a new sentiment analysis
vector machines (SVM), and multinomial naive scheme based on Twitter and Weibo data, focusing
Bayes (MNB) in sentiment classification, and found on the impact of expressions on sentiment, and
that multinomial naive Bayes obtaining the best training an emotion classifier by attending to these
results of 88. 5%. [9], constructed a sentiment binary expressions, embedded in an attention-based
analyzer based on SVM and naive Bayes to analyze long- and short-term memory network, which is a
Twitter data and compared it with a sentiment good guide for sentiment analysis. Because of the
analyzer using only SVM or NB. [10], proposed an lower human input as well as the higher accuracy,
optimized sentiment analysis framework (OSAF), deep learning-based sentiment analysis methods
which uses SVM lattice search techniques and have become a hot research topic in recent years.
cross-validation. [11], proposed an emoticon-based
sentiment analysis method and discussed the role of 2.1.4 Analysis of Irony
symbolic expressions in sentiment analysis. [12], It is easy to find that there are a lot of phenomena of
proposed a computational algorithm for semantic irony and sarcasm on online platforms, and the
analysis based on the WordNet linguistic English emotion implied by such statements is often the
lexicon training set, using a combination of machine opposite of the surface meaning of the statements.
learning algorithms SVM and NB to automatically Therefore, the analysis of ironic statements and the
detect strongly associated negative tweets. analysis of the deeper meaning of the statements
Although machine learning-based sentiment will help to determine the emotional polarity of the
analysis has made progress compared to lexicon- text. [18], achieved good results in experiments with
based sentiment analysis, it still requires manual four machine learning methods by improving the
labeling of text and subjective factors can affect the sentiment analysis process and decision-making
final result. Traditional machine learning requires process and crawling data on Twitter, linear SVC
high model requirements, and if the model is not (accuracy=83%, f1-score=0.81), logistic regression
efficient, it is difficult to adapt to the era of (accuracy=83%, f1-score=0.81), Naïve Bayes
exploding information. In addition, traditional (accuracy=74%, f1- score=0.73) and random forest
machine learning has difficulty using contextual classifier (accuracy=80%, f1-score=0.81). Some
information in sentiment analysis, which also affects authors, [19], found that previous research on
accuracy. sarcasm detection has mostly been conducted using
natural language processing techniques, without
2.1.3 Deep Learning-based Sentiment Analysis considering the context, user's expression habits, etc.
Methods Therefore, a two-channel convolutional neural
A sentiment analysis method based on deep learning network was used to analyze the semantics of the
can automatically learn deep features from a large target text, as well as its emotional context, and to
amount of text information, and the sentiment extract the user's expression habits using an
analysis is effective and the model is highly attention mechanism. The effectiveness of the
adaptable without human intervention during the method is confirmed by experiments on several
learning process. [13], proposed a Restricted datasets, and it can effectively improve the
Boltzmann Machine (RBM) based rule model for performance of the irony detection task.
sentiment analysis of sentences. [14], proposed a
restricted data framework using RNN as a 2.1.5 Implicit Sentiment Analysis
framework to train a single model using the largest Implicit sentiment analysis is a special part of the
dataset of languages and reuse it for languages with sentiment analysis field because of the lack of
limited datasets. This framework has good results sentiment vocabulary and the ambiguity of
for sentiment analysis of small languages. LSTM is sentiment polarity, which is a difficult area of
a special structure of RNN, and to improve the research at this stage. Combing the literature on

E-ISSN: 2224-3488 21 Volume 19, 2023


WSEAS TRANSACTIONS on SIGNAL PROCESSING
DOI: 10.37394/232014.2023.19.3 Feng Li, Chenxi Cui, Yashi Hu, Lingling Wang

implicit sentiment analysis at this stage, it is found analysis of aspects of Arabic as a research direction,
that the current research is very limited. [20], found [23], and used a composite model combining a long
that previous Graph Convolutional Networks short-term memory (LSTM) model and a
(GCNs) used for the study of sentiment analysis convolutional neural network (CNN) to analyze the
problems had difficulty in effectively using sentiment of Arabic tweets. For the Arabic
contextual context or often ignored the sentiment tweet dataset (ASTD), this model scored
dependencies between phrases. Therefore, they 64.46% on F1, outperforming other deep learning
proposed a context-specific heterogeneous graph models; some scholars, [24], research using two
convolutional network (CsHGCN) based on this, different long short-term memory (LSTM) neural
and experimental results showed that the model networks for aspect-level sentiment analysis of
could effectively identify target emotions in Arabic hotel reviews. The first is an aspect-OTEs
sentences. oriented LSTM for aspect sentiment polarity
classification as sentiment polarity markers, and the
2.1.6 Aspect-level Sentiment Analysis second is a character-level bidirectional LSTM
Aspect-Based Sentiment Analysis (ABSA), an along with a conditional random field classifier (Bi-
actively challenging part of the sentiment analysis LSTM-CRF) for aspect opinion target expression
field, aims to identify and analyze the fine-grained (ballot) extraction. This method was evaluated using
sentiment polarities towards particular aspects. a reference dataset of Arabian hotel reviews and the
[21], proposed a new neural network-based results showed that this method outperformed the
framework to analyze the sentiment of aspect targets baseline study on both tasks by 6% and 39%
in comments. This framework captures distant respectively.
textual sentiment information through a multi-
attentive mechanism, employing a non-linear 2.2 Relevant Research Techniques
combination with recurrent neural networks to Sentiment analysis of text content is the complete
enhance the expressive power of the model, process of text preprocessing such as word
allowing it to handle more complex semantic segmentation, stop-word removal, and named entity
problems. The performance of this model is also recognition on the target text, followed by text
validated on four datasets (two from SemEval2014 vectorization, feature engineering, model training,
(restaurant and laptop reviews), a Chinese news classifier, and other processes to derive sentiment
review dataset, and Twitter datasets). tendency labels. A flowchart of text classification is
[22], found that most previous prediction presented in Figure 2.
methods used long- and short-term memory and
attention mechanisms to analyze the emotional
polarity of the target of interest, and that such
methods tended to be more complex and required
more training time. Therefore, it was proposed to
group the previous methods into two subtasks:
aspect-category sentiment analysis (ACSA) and
aspect-item sentiment analysis (ATSA). A model
based on gating mechanisms and convolutional
neural networks is also proposed, which is more
accurate and effective. The method firstly uses a
new gating unit, Tanh-ReLU, to selectively output
sentiment features based on a given entity or aspect;
this architecture is simpler than the attention layer
used in existing models; secondly, the computations
of this model are easily deserialized during training
and the gating unit works independently, and finally,
experiments on the SemEval dataset validate the
effectiveness of the model.
Arabic poses several challenges for the task of
sentiment analysis in Arabic because of its complex
grammatical structure and the lack of relevant
resources. Some scholars have taken the sentiment Fig. 2: Flowchart of text classification

E-ISSN: 2224-3488 22 Volume 19, 2023


WSEAS TRANSACTIONS on SIGNAL PROCESSING
DOI: 10.37394/232014.2023.19.3 Feng Li, Chenxi Cui, Yashi Hu, Lingling Wang

2.2.1 Text Pre-Processing features. Recurrent neural networks are used in


The implementation of text preprocessing mainly natural language processing such as speech
involves word segmentation of txt format texts. This recognition, language modelling, and machine
experiment uses the jieba Chinese word splitting translation, and also for various time-series
tool, a widely used and effective Chinese word predictions. The introduction of convolutional
splitter with exact mode, full mode, and search neural networks constructed recurrent neural
engine mode that allows for precise segmentation of networks that can process sequential inputs
text sentences, fast scanning of the entire content, containing computer vision problems.
and secondary recall segmentation of long words. It
is also possible to improve the segmentation effect 2.2.4 Long and Short-Term Memory
by manually defining proper nouns in the text. In Long short-term memory (LSTM) is a special kind
practice, there are a large number of intonational of RNN that was designed to address the problem of
auxiliaries, personal pronouns, and other words that gradient vanishing and explosion during the training
are not related to emotional tendencies, which can of long sequences. LSTM is a variant of RNN, with
be filtered by building a deactivation dictionary. In the core concept of cell states and "gate" structure.
addition, there are different dictionaries for different Cell states are the equivalent of information
domains, [25]. The dictionaries are designed to transmission paths that allow information to be
include new words and specialized words that are passed along in a sequence. You can think of it as
unique to the field. the 'memory' of the network. Theoretically, the cell
states can pass on information relevant to the
2.2.2 Text Vectorization sequence processing all the way through. Thus, even
Text vectorization refers to converting Chinese text information from earlier time steps can be carried to
content that cannot be recognized by a computer cells at later time steps, which overcomes the effects
into a vector form with digitized features that can be of short-term memory. Information is added and
recognized by a computer. In this paper, word2vec removed by means of 'gate' structures, which are
is used to complete text vectorization, transforming trained to learn which information to keep or forget.
the text preprocessed dataset into a vector with In recent years, recurrent neural networks have been
uniform dimensions, thus completing the used in speech recognition, image processing, ECG
simplification of shifting data from high latitude to arrhythmia classification, and natural language
low latitude. Depending on the definition of output processing, and so on [26]. The LSTM model is
and input, two algorithms can be classified: Skip- shown in Figure 3.
gram and CBOW. The CBOW algorithm is a three-
layer neural network that predicts target words from
contextual words, defining the words of the context
in which a word is located as input and itself as
output, using a corpus of corpora for training, and
calculating the vector values of the context in the
projection layer and summing them to output
information about the target word. The Skip-gram
algorithm reverses the causality of CBOW by
defining the words in the context of the target word
as the output, and the words themselves as the input,
predicting the information of the contextual words Fig. 3: LSTM structure
with the help of the target word.

2.2.3 Recurrent Neural Network (RNN) 3 Algorithm


Recurrent Neural Networks are a class of sequences Due to the over-reliance on sentiment lexicons,
data as input and perform in the direction of simple lexicons cannot accurately discriminate
evolution of the sequence recursively and all nodes sentiments, while constructing a more complex and
(recurrent units) are connected in a chain-like diverse lexicon will require a large amount of
manner in recurrent neural networks. Recurrent manpower and resources. Although sentiment
Neural Networks have memory, share parameters, analysis based on machine learning has made
and are Turing-complete and are therefore very progress compared to lexicon-based sentiment
useful in the analysis of sequential non-linear analysis, subjective factors have a significant impact

E-ISSN: 2224-3488 23 Volume 19, 2023


WSEAS TRANSACTIONS on SIGNAL PROCESSING
DOI: 10.37394/232014.2023.19.3 Feng Li, Chenxi Cui, Yashi Hu, Lingling Wang

during manual calibration. Moreover, traditional tasks related to sequence learning, such as speech
machine learning models require high model recognition, [31], language models, [32], part-of-
accuracy, and the explosion of information in speech tagging, [35], and machine translation, [36].
today's world makes it difficult for models to adapt Therefore, considering all factors, this paper uses
perfectly to complex and varied needs. In addition, LSTM as the deep learning model for sentiment
traditional machine learning has difficulty utilizing analysis.
contextual information, which can affect accuracy in
sentiment analysis. Deep learning-based sentiment 3.1 Recurrent Network Model
analysis methods can automatically learn deep RNNs, or Recurrent Neural Networks, excel in
features from a large amount of text information, processing sequences of data where context is
with good sentiment analysis effects and strong essential. One of the distinguishing features of
model adaptability, without the need for human RNNs is their ability to create directed loops
intervention in the learning process. Due to the low between nodes, [38]. Examples of sequence data
efficiency and quality of traditional methods, people that RNNs can handle well include speech
have begun to use deep learning to construct recognition, language prediction, garbage image
network models for text classification tasks. [30], classification, [39], and stock data analysis, [40].
reviewed more than 150 deep learning-based text Since the data at each node in the sequence is
classification models developed in recent years in related to the preceding and subsequent data points,
their review and discussed their technical RNNs can capture these dynamic relationships. By
contributions, similarities, and advantages. retaining previous information and using it as input
Therefore, this paper chose a deep learning-based for subsequent nodes, RNNs are ideal for analyzing
sentiment analysis method to complete the time-sequenced data.
sentiment judgment of text information.
Common deep-learning models include CNN, 3.2 RNN Model Gradient Disappearance
RNN, Transformer, GRU, and LSTM. Traditional Phenomenon
CNN models may not activate neurons that [41], proposed that standard RNNs suffer from
recognize the same object slightly differently due to gradient vanishing, which refers to the vanishing of
translational invariance, i.e., changes in the gradients in RNNs for more distant time steps. The
orientation or position of the same object. Moreover, BPTT method is used for backpropagation in RNNs,
the pooling layer causes a significant loss of where the gradient of loss against parameter W is
valuable information, ignoring the correlation equal to the sum of the derivatives of loss against W
between local and global features. Therefore, CNN at each time step. This can be expressed
models are difficult to accurately judge the precise mathematically as a formula.:
textual sentiment. Although RNN models can t
consider historical information during calculation ∂E ∂E ∂yt ∂ℎt ∂ℎi
=∑ t
and share weights over time compared to CNN ∂W ℎ ∂y ∂ℎt ∂ℎi ∂W ℎ
i=1
models, their computation speed is slow and cannot
consider any future input of the current state. In The calculation in the above equation is more
addition, RNN models often suffer from gradient complex and is based on a continuous derivative of
disappearance and explosion because it is difficult the complex function.
to capture long-term dependencies, and t
multiplication gradients can decrease or increase ∂ℎt ∂ℎk
i
= ∏
exponentially with the number of layers. Although ∂ℎ k=i+1
∂ℎk−1
GRU models can effectively alleviate the problem ∂ℎk
is the partial derivative of the current
of gradient explosion in RNN models, compared to ∂ℎk−1
GRU models, LSTM models have more parameters,
stronger functionality, and stronger expressive hidden state with respect to the previous hidden
power. state.
∂ℎk
LSTM has a similar working mechanism to = σ′W ℎ
RNN, but its implementation of more refined ∂ℎk−1
internal processing units enables effective storage Suppose that a time step j is (t-j) moments away
and updating of contextual information. Due to its from time step t. So:
excellent properties, LSTM has been used in many

E-ISSN: 2224-3488 24 Volume 19, 2023


WSEAS TRANSACTIONS on SIGNAL PROCESSING
DOI: 10.37394/232014.2023.19.3 Feng Li, Chenxi Cui, Yashi Hu, Lingling Wang

t−j
∂ℎt The forget gate is closed when it tends to 1 and
i
= ∏ σ′W ℎ
∂ℎ opened when it tends to 0. By setting a large bias
term, most forget gates tend to 1. By setting a large
If t-j is large, that is, j is far from the t time step, bias term, most of the forgetting gates converge to 1.
whenσ′W h >1, a gradient explosion problem arises This also alleviates the problem of gradient
and σ′W h <1, there is a gradient disappearance disappearance due to fractional multiplication.
problem. And when t-j is small, there is no gradient
disappearance/gradient explosion problem. In
summary, the gradient of j farther away from time 4 Sentiment Analysis based on LSTM
step t will vanish and j does not affect the final
output y t has no effect on the final output. This 4.1 Data and Processing
means that there can be no long-term dependence on In this paper, the dataset is based on the comment
RNN. corpus collated by Tan Songbo, with 2000 positive
and negative examples each, which is a relatively
3.3 Gradient Disappearance Phenomenon small dataset. Examples are shown in Table 1.
To address the problem of long-term dependencies, Moreover, Table 2 presents model parameter
[42], proposed a Long Short-Term Memory (LSTM) settings.
network, which performs much better than RNN,
especially in long-distance dependent tasks, [43]. Table 1. Example of ChnSentiCorp data
The LSTM was originally designed so that the bias Positive Negative
It is a very nice 5-star Depressed!!!
derivative of the current memory unit with respect
hotel, the rooms are large, Angry!!! I don't
to the previous memory unit would be constant. As the facilities are new, and understand that the fiber
in the original version of the LSTM in 1997, the the location is convenient to optic is even slower than
memory cell update formula was the financial center, so I the internet speed in
would consider staying Shanghai Jinjiang Star,
C t = C t−1 + Zi ⨀x t there again. don't go to this place if
you want fast internet
∂Ct speed at night!!!!
=1
∂C t−1 The room was clean, The room was never
Later, to avoid the wireless growth of memory the facilities were ok, the arranged to have a frontal
furniture was a bit old. The lake view, especially as
cells, Σφάλμα! Το αρχείο προέλευσης της business room has a good the standard of the
αναφοράς δεν βρέθηκε., later refined the LSTM floor front desk and the reception was really poor,
cell by introducing the "forget gate". The updated price point is relatively low with grumbling and
formula is: for a 4-star. expressionless faces.
The hotel was clean, Not as bad as a good
C t = Zf ⨀Ct−1 + Zi ⨀x t the waiter would 2-star or no-star hotel
recommend me to the ladies'
The value of the partial derivatives at this non-smoking floor, the
moment is: facilities were better, and
the dim sum in the
∂Ct restaurant tasted ok.
= Zf
∂C t−1
AlthoughZf is a value in the interval [0,1], not in
the sense of satisfying the bias of the current
memory cell to the previous memory cell as a
constant. However, it is common to set a large bias
term to the forgetting gate such that the forgetting
gate is closed in most cases and open only in a few
cases. Recall the formula for the forgetting gate,
here we have added the bias b.

Zf = σ(Wf [ℎt−1 , xt ] + bf )

E-ISSN: 2224-3488 25 Volume 19, 2023


WSEAS TRANSACTIONS on SIGNAL PROCESSING
DOI: 10.37394/232014.2023.19.3 Feng Li, Chenxi Cui, Yashi Hu, Lingling Wang

Table 2. Model parameter settings


Dim Words Buffer LSTM_size Dropout Epochs Batch size
300 300 3500 32 0.5 25 20

Word vectors: This experiment uses open- information into 300-dimensional word vectors. The
source word vectors and Chinese-word-vectors The parameters of the LSTM model were set as follows:
Word Vector is a Word Vector trained from the the maximum word count was set to 300 (setting the
Zhihu corpus. dimension too high would result in longer training
In this work, the data was divided into a training time); a buffer zone of 3500 was reserved; the
set and a test set in a ratio of 4:1. For the training regularization parameter was set to 0.5; the batch
and validation sets, the following format was size was set to 20; and the algorithm worked 25
followed when producing the training data: In the times on the entire training dataset.
text file, each row is the input for one sample, where
each paragraph is commented on for one line and 4.4 Results
separated from the word by space using jieba. Table 3. Experiment results using LSTM
Textual Results
4.2 Measurement Criteria
In this paper, recall, accuracy, precision, and F1 Emotional support
Tendencies Positive Negative
values are used as experimental measures and
positive texts are used to refer to texts with positive 1000
affective tendencies and negative texts to refer to Positive texts TP: 865 FN: 135
texts with negative affective tendencies. In the
above confusion matrix, TP is the number of texts 1000
correctly classified as positive; FN is the number of Negative text FP: 91 TN: 909
texts incorrectly classified as positive; FP is the
number of texts incorrectly classified as negative;
and TN is the number of texts correctly classified as
Table 4. LSTM model processing data results
negative.
precision recall f1- support
Precision is the percentage of texts judged to be score
of a certain type that is correctly judged. POS 0.90 0.87 0.88 1000
TP TN NEG 0.87 0.91 0.89 1000
p= or micro avg 0.89 0.89 0.89 2000
TP + FP TN + FN
macro avg 0.89 0.89 0.89 2000
The recall is the percentage of texts that are weighted 0.89 0.89 0.89 2000
actually of a certain type that are judged to be avg
correct.
TP TN 4.4.1 Model Training Results
R= or In this paper, 5000 positive and 5000 negative
TP + FN TN + FP
emotion texts were used for the training of the
The F1 value is the summed mean value of model, which were divided into a training set and a
precision and recall, which corresponds to the test set according to 4:1, with 8000 texts in the
combined precision and recall evaluation metric. training set, 4000 positive and 4000 negative
2∗P∗R emotions texts in the training set, and 2000 texts in
F1 = the test set, containing positive and the test set
P+R
contains 2000 texts, including 1000 positive and
Accuracy is the percentage of correctly judged 1000 negative texts. After processing the LSTM
texts out of all texts. model, the following results were obtained.
TP + TN In Table 3 we present the experiment results
Accuracy = using LSTM. Similarly, in Table 4 we present the
TP + TN + FP + FN
LSTM model processing the data results of our
paper. Specifically, regarding Table 4 properties, we
4.3 Parameter Settings specify the following:
The experiment in this paper used the open-source
word embedding model from Zhihu to train text

E-ISSN: 2224-3488 26 Volume 19, 2023


WSEAS TRANSACTIONS on SIGNAL PROCESSING
DOI: 10.37394/232014.2023.19.3 Feng Li, Chenxi Cui, Yashi Hu, Lingling Wang

1. Macro average macro avg: sums the The results show that the classification accuracy
accuracy, recall, and F1 values for each of this LSTM model can reach a maximum of 0.89,
category to find the average. but there is still much room for improvement. The
2. Micro avg builds a global confusion LSTM model implemented in this paper aims to
matrix for each instance in the dataset, judge the sentiment tendency of user-generated
reviews on e-commerce platforms, to perform
regardless of category, and then
sentiment analysis on reviews on e-commerce
calculates the corresponding metric. platforms, and to provide a proven method for e-
3. weighted avg: an improvement on commerce platforms to judge the sentiment polarity
macro-averaging, considering the of user reviews and extract keywords in the process
number of samples in each category as a of investigating user feedback, to provide data
proportion of the total sample. support for merchants to understand consumers'
needs and real reviews, and to improve service
4.4.2 Validation of the Dataset Results quality in a targeted manner. It provides data
By importing a corpus of e-commerce reviews from support. Sentiment analysis of user reviews can
Baidu's library into the trained model, containing effectively find out whether users identify with a
1000 positive and negative texts each, the 2000 texts shop, observe how much they like the product, help
were divided into 20 groups of data, and the the management of the e-commerce platform to
accuracy, recall, F1 value, and accuracy of these 20 discover the strengths and weaknesses of the shop,
groups were calculated. The following graphs were improve the level of service and enhance user
generated from the results. satisfaction.
According to the analysis of the above graphs, The collective amount of data taken in this
we can find that: the accuracy of the positive text experiment is not large enough for effective analysis
can reach a maximum of 0.98 and a minimum value of non-semantic symbols and expressions, the
of 0.82; the accuracy of the negative text can reach a model training takes too long, and there are
maximum of 0.92 and a minimum value of 0.44; the individually large differences in the process of
recall of the positive text can reach a maximum of analyzing the accuracy of the validation set. The
0.91 and a minimum value of 0.64; the recall of the analysis of emoji information, the use of multiple
negative text can reach a maximum of 0.98 and a parameters, and the optimization of the model will
minimum value of 0.68; the accuracy of the positive be the next research directions in the future. In
text The maximum F1 value for positive text is subsequent research, a comparison between the
0.8727 and the minimum value is 0.7189; the optimized LSTM model and other neural network
maximum F1 value for negative text is 0.8383 and deep learning models will also be obtained with the
the minimum value is 0.5626; the accuracy of this increasing capability of text information recognition
LSTM model can reach up to 0.89. and generalization.
A comprehensive analysis of this LSTM model Based on the content of this paper, future
leads to the conclusion that the accuracy of this research can be conducted in four areas. First, it can
LSTM model still needs to be improved and further further optimize the sentiment analysis model and
improvements are needed to achieve more accurate try to use more efficient and accurate deep learning
sentiment propensity analysis. models, such as pre-trained language models such as
BERT and GPT, and combine with attention
mechanisms to improve the model's performance.
5 Conclusion Second, it is necessary to explore how to deal with
In this paper, the sentiment tendency analysis of e- the challenges of semantic complexity and
commerce platform reviews is carried out by the ambiguity in Chinese sentiment analysis, further
LSTM model, which is trained and validated by an improving the accuracy and robustness of the model.
open dataset downloaded from the web. Our Finally, it is necessary to consider the evolution of
research findings are summarized in Figure 4 emotions and contextual factors to more accurately
regarding our experimental results for the LSTM determine the user's emotional tendencies. These
model validation dataset. Moreover, Figure 5 research directions will help further improve the
showcases the accuracy, recall, and F1 values for effectiveness of text sentiment analysis based on
forward text whereas Figure 6 is for negative text. LSTM and make it more applicable to practical
Lastly, Figure 7 presents the overall accuracy of the scenarios.
studied data sets.

E-ISSN: 2224-3488 27 Volume 19, 2023


WSEAS TRANSACTIONS on SIGNAL PROCESSING
DOI: 10.37394/232014.2023.19.3 Feng Li, Chenxi Cui, Yashi Hu, Lingling Wang

Summary of results for the validation dataset


1,2

0,8

0,6

0,4

0,2

0
8 4 9 10 12 14 5 18 20 11 17 1 6 7 13 3 16 2 15 19

P(POS) R(POS) F1(POS) P(NEG)


R(NEG) F1(NEG) Accuracy

Fig. 4: Summary of experimental results for the LSTM model validation dataset

Positive text accuracy, recall, F1 values


1,2

0,8

0,6

0,4

0,2

0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

P(POS) R(POS) F1(POS)

Fig. 5: Accuracy, recall, F1 values for forward text

E-ISSN: 2224-3488 28 Volume 19, 2023


WSEAS TRANSACTIONS on SIGNAL PROCESSING
DOI: 10.37394/232014.2023.19.3 Feng Li, Chenxi Cui, Yashi Hu, Lingling Wang

Accuracy, recall, F1 values for negative text


1,2

0,8

0,6

0,4

0,2

0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

P(NEG) R(NEG) F1(NEG)

Fig. 6: Accuracy, recall, F1 values for negative text

Accuracy
0,89
8 0,88
0,88
12 0,87
0,86
14 0,85
0,84
15 0,83
0,83
5 0,80
0,76
11 0,75
0,75
17 0,74
0,74
20 0,73
0,73
16 0,72
0,71
2 0,71
0 0,2 0,4 0,6 0,8 1

Accuracy

Fig. 7: Accuracy of data sets

E-ISSN: 2224-3488 29 Volume 19, 2023


WSEAS TRANSACTIONS on SIGNAL PROCESSING
DOI: 10.37394/232014.2023.19.3 Feng Li, Chenxi Cui, Yashi Hu, Lingling Wang

Acknowledgment: [12] Birjali M, Benihssane A, Erritali M. Machine


We thank the anonymous reviewers and editors for learning and semantic sentiment analysis based
their very constructive comments. This work was algorithms for suicide sentiment prediction in social
supported in part by the Undergraduate teaching networks. Procedia Computer Science,2017,113:65-
quality and teaching reform project of Anhui 72.
University of Finance and Economics under Grant [13] Dwivedi R K, Aggarwal M, Keshari S K, et al.
Sentiment analysis and feature extraction using rule-
No. acszjyyb2021035. based model (RBM). Proceedings of the 2019
International Conference on Innovative Computing
and Communications. Cham: Springer,2019:57-63.
References: [14] Can E F, Ezencan A, Can F. Multilingual sentiment
[1] Chaturvedi I, Ragusa E, Gastaldo P, et al. Bayesian analysis: an RNN-based framework for limited data
network based extreme learning machine for [EB/OL]. [2018-06-08]. https://arxiv. org/pdf/1806.
subjectivity detection, Journal of the Franklin 04511. pdf.
Institute, 2017, 355(4): 1780-1797. [15] Wang Y Q, Huang M L, Zhu X Y, et al. Attention-
[2] Zhou J, Huang J X, Chen Q, et al. Deep learning for based LSTM for aspect-level sentiment
aspect-level sentiment classification: survey, vision, classification. Proceedings of the 2016 Conference
and challenges, IEEE Access, 2019,7: 78454-78483. on Empirical Methods in Natural Language
[3] Thien K T, Thi P T. A hybrid approach for building Processing. Stroudsburg, PA: Association for
a Vietnamese sentiment dictionary. Journal of Computational Linguistics,2016:606-615.
Intelligent & Fuzzy Systems,2018,35(1):1-12. [16] Gopalakrishnan K, Salem F M. Sentiment analysis
[4] Wu L, Morestatter F, Liu H, Et al. SlangSD: using simplified long short-term memory recurrent
building, expanding and using a sentiment neural networks. https://arxiv. org/abs/2005.
dictionary of slang words for short text sentiment 03993v1.
classification . Language Resources and [17] Chen Y X, Yuan J B, You Q Z, et al. Twitter
Evaluation,2018,52:839-852. sentiment analysis via bi-sense emoji embedding
[5] Zhang S X, Wei Z L, Wang Y, et al. Sentiment and attention-based LSTM . Proceedings of the 26th
analysis of Chinese micro-blog text based on ACM international conference on Multimedia. New
extended sentiment dictionary . Future Generation York:ACM,2018:117-125.
Computer Systems,2018,81:395-403. [18] Chaudhary S, Kakkar M. Sarcasm detection
[6] Bravo-Marques F, Khanchandani A, Pfahringer B. technique on twitter data with natural language
Incremental word vectors for time-evolving processing.Proceedings of International Conference
sentiment lexicon induction. Cognitive on Big Data, Machine Learning and their
Computation,2021,14:425-441. Applications. Singapore: Springer,2021:283-293.
[7] Asghar M Z, Khan A, Ahmad S, et al. Lexicon- [19] Du Y, Li T, Pathan M S, et al. An effective sarcasm
enhanced sentiment analysis framework using rule- detection approach based on sentimental context and
based classification scheme. PLoS One,2017,12(2): individual expression habits. Cognitive
e0171649. Computation,2021(1):1-13.
[8] Baid P, Gupta A, Chaplot N. Sentiment analysis of [20] Zuo E, Zhao H, Chen B, et al. Context-specific
movie reviews using machine learning techniques. heterogeneous graph convolutional network for
International Journal of Computer implicit sentiment analysis. IEEE
Applications,2017,179(7):45-49. Access,2020,8:37967-37975.
[9] Hasan A, Moin S, Karim A, et al. Machine learning- [21] Chen Peng, Sun Zhongqian. Recurrent attention
based sentiment analysis for twitter accounts. network on memory for aspect sentiment
Mathematical and Computational analysis.Proceedings of the 2017 Conference on
Applications,2018,23(1):11. Empirical Methods in Natural Language
[10] Ahmad M, Aftab S, Bashir S, et al. SVM Processing,2017.
optimization for sentiment analysis. International [22] Wei X, Tao L. Aspect based sentiment analysis with
Journal Advanced Computer Science and gated convolutional networks.
Applications,2018,9(4):393-398. arXiv:1805.07043,2018.
[11] Mathapati S, Nafeesa A, Manjula S H, et al. [23] Heikal M, Torki M, Elmakky N. Sentiment analysis
OTAWE Optimized topic-adaptive word expansion of arabic tweets using deep learning. Procedia
for cross domain sentiment classification on tweets. Computer Science,2018,142:114-122.
Advances in Machine Learning and Data Science. [24] Al-Smadi M, Talafha B, Al-Ayyoub M, et al. Using
Singapore: Springer,2018,705:213-224. long short-term memory deep neural networks for
aspect-based sentiment analysis of Arabic reviews.
International Journal of Machine Learning and
Cybernetics,2018,10:2163-2175.

E-ISSN: 2224-3488 30 Volume 19, 2023


WSEAS TRANSACTIONS on SIGNAL PROCESSING
DOI: 10.37394/232014.2023.19.3 Feng Li, Chenxi Cui, Yashi Hu, Lingling Wang

[25] Cai Y, Yang K, Huang D P, et al. A hybrid model [39] Feng Li, Lingling Wang, "Application of Deep
for opinion mining based on domain sentiment Learning Based on Garbage Image Classification,"
dictionary. International Journal of Machine WSEAS Transactions on Computers, vol. 21, pp.
Learning and Cybernetics,2019,10:2131-2142. 277-282, 2022
[26] Graves A, Mohamed A, Hinton G. Speech [40] Feng Li, Lingling Wang, "Case-Based Teaching for
Recognition with Deep Recurrent Neural Stock Prediction System Based on Deep Learning,"
Networks.Proceedings of International Conference WSEAS Transactions on Business and Economics,
on Acoustics, Speech and Signal Processing, 2013: vol. 19, pp. 1325-1331, 2022
6645-6649. [41] Bengio Y, Simard P, Frasconi P. Learning long-term
[27] B. Hou, J. Yang, P. Wang, and R. Yan, “LSTM dependencies with gradient descent is difficult.
Based Auto-Encoder Model for ECG Arrhythmias IEEE Transactions on Neural Networks, 1994, 5(2):
Classification”, IEEE Transactions on 157 - 166.
Instrumentation and Measurement, 2020, pp. 1232- [42] Hochreiter S, Schmidhuber J. Long short-term
1240. memory. Neural Computation, 1997, 9(8): 1735 -
[28] Gregor K, Danihelka I, Graves A, Rezende D J, 1780.
Wierstral D. DRAW: A Recurrent Neural Network [43] Gers F A, Schraudolph N N. Learning precise timing
for Image Generation.Proceedings of International with LSTM recurrent networks . Journal of Machine
Conference on Machine Learning, 2015: 1462-1471. Learning Research, 2002,3(1): 115 - 143.
[29] Mikolov T, Kombrink S, Deoras A, Burget L, [44] Gers F A, Schmidhube R J, Cummins F. Learning to
Cernocky A J H. RNNLM-Recurrent Neural forget: continual prediction with LSTM . Neural
Network Language Modeling Toolkit.Proceedings Computation, 2000, 12(10): 2451 - 2471.
of Automatic Speech Recognition and
Understanding Workshop, 2011: 196-201.
[30] Minaee S, Kalchbrenner N, Cambria E, et al. Deep Contribution of Individual Authors to the
learning based text classification: a comprehensive Creation of a Scientific Article (Ghostwriting
review. Computation and Language, 2020, 8(5):
Policy)
85616- 85638.
-Feng Li, Chenxi Cui carried out the simulation and
[31] Graves A, Jaitly N. Towards end-to-end speech
recognition with recurrent neural networks. the optimization.
Proceedings of the 31st International Conference on -Yashi Hu, Lingling Wang have organized and
Machine Learning. Beijing: JMLR, 2014: 1764 - executed the experiments of Section 4.
1772.
[32] Akase S, Suzuki J, Nagata M. Input-to-output gate Sources of Funding for Research Presented in a
to improve RNN language models. arXiv Preprint, Scientific Article or Scientific Article Itself
2017, 2017: arXiv: 1709. 08907. This work was supported in part by the
[33] Miyamoto Y, Cho K. Gated word-character Undergraduate teaching quality and teaching reform
recurrent language model. arXiv Preprint, 2016, project of Anhui University of Finance and
2016: arXiv: 1606. 01700. Economics under Grant No. acszjyyb2021035.
[34] Jozefowicz R, Vinyals O, Schuster M, et al.
Exploring the limits of language modeling. arXiv
Conflict of Interest
Preprint, 2016, 2016: arXiv: 1602. 02410.
The authors declare that the research was conducted
[35] CHO K, Van Merrienboer B, Gulcehre C, et al.
Learning phrase representations using RNN in the absence of any commercial or financial
encoder-decoder for statistical machine translation. relationships that could be construed as a potential
arXiv Preprint, 2014, 2014: arXiv: 1406. 1078. conflict of interest.
[36] Bahdanau D, Cho K, Bengio Y. Neural machine
translation by jointly learning to align and translate. Creative Commons Attribution License 4.0
arXiv Preprint, 2014, 2014: arXiv: 1409. 0473. (Attribution 4.0 International, CC BY 4.0)
[37] Wu Y, Schuster M, Chen Z, et al. Google's neural This article is published under the terms of the
machine translation system: Bridging the gap Creative Commons Attribution License 4.0
between human and machine translation. arXiv https://creativecommons.org/licenses/by/4.0/deed.en
Preprint, 2016, 2016: arXiv: 1609. 08144. _US
[38] Mou, Lichao, Pedram Ghamisi, and Xiao Xiang
Zhu. "Deep recurrent neural networks for
hyperspectral image classification." IEEE
Transactions on Geoscience and Remote Sensing
55.7 (2017): 3639-3655.

E-ISSN: 2224-3488 31 Volume 19, 2023

You might also like