A Method of Sentiment Analysis and Visualized Interaction Based on Ernie-Tiny and BiGRU
Abstract
:1. Introduction
- A subjective text sentiment analysis model ET_s_BG+p based on Ernie-Tiny and BiGRU is proposed, which can achieve efficient semantic feature representation and sentiment analysis for Chinese subjective texts with complex semantics, diverse sentence forms, and short texts.
- Based on the ET_s_BG+p model, an interactive application prototype integrating text input, sentiment analysis, intelligent interaction, and other functions is developed to provide a reference for sentiment visualization and interactive application design.
2. Materials and Methods
2.1. ET_s_BG+p Model Development
2.1.1. Overall Design Idea of the Model
2.1.2. Ernie-Tiny
2.1.3. The BiGRU
2.1.4. ET_s_BG+p
2.2. Database
2.3. Experimental Environment and Parameter Settings
2.4. Evaluation Criteria and Baseline Model
- CNN: The model uses the pre-trained model of PKUseg [35], an open-source word separation tool of Peking University on the Weibo corpus, for text word separation after data pre-processing. Then, Tencent word vectors are used to construct the word embedding matrix, and each word is converted into a 200-dimensional word vector, which is input into the two-layer convolutional neural network. After the convolution layer and the pooling layer, the output layer is finally passed through the fully connected layer, and the Softmax function is used to complete the sentiment polarity two-classification task.
- BiLSTM: After converting text data into word vectors according to the above method, the word vectors are input into the BiLSTM model. Finally, the output layer is passed through the fully connected layer, and the Softmax function is used for text sentiment classification.
- GRU: Similar to the method used above, the model uses GRU for text sentiment classification.
- ET_P: Sentence vectors representing the semantic features of whole sentences are obtained using Ernie-Tiny processing and passed into the output layer through the fully connected layer. The Softmax function is used for text sentiment classification.
- ET_s: The model calculates the mean value of the output sequence vector of the last layer of Ernie-Tiny, and then transmits it to the output layer through the fully connected layer. The Softmax function is used for text sentiment classification.
- ET_s_BiGRU: The sequence vector obtained through Ernie-Tiny processing is input into BiGRU, and then the output of BiGRU is passed into the output layer through the fully connected layer. Finally, text sentiment classification is performed using the Softmax function.
- ET_s_BG+p: The model proposed in this paper.
3. Results and Discussion
3.1. Model Performance Evaluation
3.2. Root Cause Analysis
3.3. Interactive Application Prototyping
3.3.1. Platform Framework Design
- The algorithm model part is based on the ET_s_BG+p sentiment analysis model, which calculates the sentiment value of the front-end input text and stores it in the database.
- The data storage part is implemented using Python’s own lightweight database SQLite.
- The interaction interface part uses the Flask framework to connect the front and back ends to achieve the interaction between data and the user interface.
- The front-end application part uses HTML, CSS, JavaScript, and other technologies to build direct interaction functions with users.
3.3.2. Interaction Function Design
- Text operation
- 2.
- Visual sentiment analysis
3.4. Value Evaluation and Improvement Direction of the Application Prototype
4. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Peng, H.; Cambria, E.; Hussain, A. A review of sentiment analysis research in Chinese language. Cogn. Comput. 2017, 9, 423–435. [Google Scholar] [CrossRef]
- Ahmad, M.; Aftab, S.; Muhammad, S.; Waheed, U. Tools and techniques for lexicon driven sentiment analysis: A review. Int. J. Multidiscip. Sci. Eng. 2017, 8, 17–23. [Google Scholar]
- Vapnik, V. SVM method of estimating density, conditional probability, and conditional density. In Proceedings of the IEEE International Symposium on Circuits and Systems, Geneva, Switzerland, 28–31 May 2000; pp. 749–752. [Google Scholar]
- Berger, A.L.; Pietra, V.J.D.; Pietra, S.A.D. A maximum entropy approach to natural language processing. Comput. Linguist. 1996, 22, 39–71. [Google Scholar]
- Pang, B.; Lee, L.; Vaithyanathan, S. Thumbs up: Sentiment classification using machine learning techniques. arXiv 2002, arXiv:cs/0205070 [cs.CL]. [Google Scholar] [CrossRef]
- Zhao, J.; Liu, K.; Wang, G. Adding redundant features for CRFs-based sentence sentiment classification. In Proceedings of the Conference on Empirical Methods in Natural Language Processing, Honolulu, HI, USA, 25 October 2008; pp. 117–126. [Google Scholar]
- Chen, T.; Guestrin, C. XGBoost: A scalable tree boosting system. In Proceedings of the ACM SIGKDD International Conference on Knowledge Discovery Data Mining, San Francisco, CA, USA, 13–17 August 2016. [Google Scholar]
- Seyfioglu, M.S.; Demirezen, M.U. A hierarchical approach for sentiment analysis and categorization of Turkish written customer relationship management data. In Proceedings of the 2017 Federated Conference on Computer Science and Information Systems, Prague, NY, USA, 3–6 September 2017; pp. 361–365. [Google Scholar]
- Han, T.; Yin, W.; Fang, M. Sentiment Analysis Model Based on Convolutional Neural Network and XGBoost. J. Fudan Univ. 2019, 58, 560–564. (In Chinese) [Google Scholar]
- Wang, N.-Y.; Ye, Y.-X.; Liu, L.; Feng, L.-Z.; Bao, T.; Peng, T. Language Models Based on Deep Learning: A Review. J. Softw. 2021, 32, 1082–1115. (In Chinese) [Google Scholar] [CrossRef]
- Wang, Q.; Li, B.; Xiao, T.; Zhu, J.; Li, C.; Wong, D.F.; Chao, L.S. Learning deep transformer models for machine translation. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, Florence, Italy, 5 June 2019; pp. 1810–1822. [Google Scholar]
- Qiu, X.P.; Sun, T.X.; Xu, Y.G.; Shao, Y.; Dai, N.; Huang, X. Pre-trained models for natural language processing: A survey. Sci. China Technol. Sci. 2020, 10, 1872–1897. [Google Scholar] [CrossRef]
- Kim, Y. Convolutional neural networks for sentence classification. arXiv 2015, arXiv:1510.03820. [Google Scholar]
- Irsoy, O.; Cardie, C. Opinion mining with deep recurrent neural networks. In Proceedings of the Conference on Empirical Methods in Natural Language Processing, Doha, Qatar, 25–29 October 2014; Association for Computational Linguistics: Stroudsburg, PA, USA, 2014; pp. 720–728. [Google Scholar]
- Mnih, V.; Heess, N.; Graves, A. Recurrent models of visual attention. In Proceedings of the 27th International Conference on Neural Information Processing Systems—Volume 2 (NIPS’14), Montreal, QC, Canada, 8–13 December 2014; MIT Press: Cambridge, MA, USA, 2014; pp. 2204–2212. [Google Scholar]
- Lin, L.; Li, J.; Zhang, R.; Yu, W.; Sun, C. Opinion mining and sentiment analysis in social networks: A retweeting structure-aware approach. In Proceedings of the 2014 IEEE/ACM 7th International Conference on Utility and Cloud Computing, London, UK, 8–11 December 2014; pp. 890–895. [Google Scholar]
- Hochreiter, S.; Schmidhuber, J. Long short-term memory. Neural Comput. 1997, 9, 1735–1780. [Google Scholar] [CrossRef]
- Palangi, H.; Deng, L.; Shen, Y.; Gao, J.; He, X.; Chen, J.; Song, X.; Ward, R. Deep sentence embedding using long short-term memory networks: Analysis and application to information retrieval. IEEE/ACM Trans. Audio Speech Lang. Process. 2016, 24, 694–707. [Google Scholar] [CrossRef]
- Bengio, Y.; Simard, P.; Frasconi, P. Learning long-term dependencies with gradient descent is difficult. IEEE Trans. Neural Netw. 1994, 5, 157–166. [Google Scholar] [CrossRef] [PubMed]
- Cho, K.; Van Merrienboer, B.; Gulcehre, C.; Bahdanau, D.; Bougares, F.; Schwenk, H.; Bengio, Y. Learning phrase representations using RNN encoder-decoder for statistical machine translation. arXiv 2014, arXiv:1406.1078. [Google Scholar] [CrossRef]
- Graves, A.; Schmidhuber, J. Framewise phoneme classification with bidirectional LSTM and other neural network architectures. Neural Netw. 2005, 18, 602–610. [Google Scholar] [CrossRef] [PubMed]
- Minaee, S.; Kalchbrenner, N.; Cambria, E.; Nikzad, N.; Chenaghlu, M.; Gao, J. Deep Learning Based Text Classification: A Comprehensive Review. arXiv 2004, arXiv:2004.03705. [Google Scholar] [CrossRef]
- Li, S.; Yan, Z.; Wu, X.; Li, A.; Zhou, B. A method of emotional analysis of movie based on convolution neural network and bi-directional LSTM RNN. In Proceedings of the IEEE Second International Conference on Data Science in Cyberspace, Shenzhen, China, 26–29 June 2017; pp. 156–161. [Google Scholar]
- Ehsan Basiri, M.; Nemati, S.; Abdar, M.; Cambria, E.; Acharrya, U.R. ABCDM: An Attention-based Bidirectional CNN-RNN Deep Model for sentiment analysis. Future Gener. Comput. Syst. 2020, 115, 279–294. [Google Scholar] [CrossRef]
- Devlin, J.; Chang, M.; Lee, K.; Toutanova, K. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Minneapolis, MI, USA, 2–7 June 2019; pp. 4171–4186. [Google Scholar]
- Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, K.; Polosukhin, I. Attention is all you need. In Proceedings of the 31st International Conference on Neural Information Processing Systems (NIPS’17), Long Beach, CA, USA, 4–9 December 2017; Curran Associates Inc.: Red Hook, NY, USA, 2017; pp. 6000–6010. [Google Scholar]
- Sun, Y.; Wang, S.H.; Li, Y.K.; Feng, S.; Chen, X.; Zhang, H.; Tian, X.; Wu, H. ERNIE: Enhanced representation through knowledge integration. arXiv 2019, arXiv:1904.09223. [Google Scholar]
- Lei, J.; Qian, Y. Chinese-test Classification Method Based on ERNIE-BiGRU. J. Shanghai Univ. Electr. Power 2020, 36, 329–335+350. (In Chinese) [Google Scholar]
- Cheng, X.; Zhang, C.; Li, Q. Improved Chinese Short Text Classification Method Based on ERNIE_BiGRU Model. J. Phys. Conf. Ser. 2021, 1993, 012038. [Google Scholar] [CrossRef]
- Dataset: Waimai_10k. Available online: https://github.com/SophonPlus/ChineseNlpCorpus/blob/master/datasets/waimai_10k/intro.ipynb (accessed on 3 September 2014).
- Dataset: Online_Shopping_10_Cats. Available online: https://github.com/SophonPlus/ChineseNlpCorpus/blob/master/datasets/online_shopping_10_cats/intro.ipynb (accessed on 3 September 2014).
- Dataset: Simplifyweibo_4_Moods. Available online: https://github.com/SophonPlus/ChineseNlpCorpus/blob/master/datasets/simplifyweibo_4_moods/intro.ipynb (accessed on 3 September 2014).
- Dataset: Weibo_Senti_100k. Available online: https://github.com/SophonPlus/ChineseNlpCorpus/blob/master/datasets/weibo_senti_100k/intro.ipynb (accessed on 3 September 2014).
- Yu, K. Large-scale deep learning at Baidu. In Proceedings of the 22nd ACM International Conference on Information & Knowledge Management, Burlingame, CA, USA, 27 October–1 November 2013; pp. 2211–2212. [Google Scholar]
- Luo, R.; Xu, J.; Zhang, Y.; Ren, X.; Sun, X. PKUSEG: A Toolkit for Multi-Domain Chinese Word Segmentation. arXiv 2019, arXiv:1906.11455. [Google Scholar]
- Li, Y.; Dong, H. Text sentiment analysis based on feature fusion of convolution neural network and bidirectional long short-term memory network. J. Comput. Appl. 2018, 38, 30753080. (In Chinese) [Google Scholar]
- Ebrahimi, J.; Dou, D. Chain Based RNN for Relation Classification [EB/OL]. Available online: http://www.aclweb.org/anthology/N/N15/N15-1133.pdf (accessed on 3 September 2014).
- Socher, R.; Perelygin, A.; Wu, J.; Chuang, J.; Manning, C.D.; Ng, A.; Potts, C. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, Seattle, WA, USA, 28 March 2013; pp. 1631–1642. [Google Scholar]
Dataset | Number |
---|---|
training set | 235,132 |
validation set | 29,392 |
test set | 29,392 |
Parameter | Value |
---|---|
learning rate | 5 × 105 |
batch_size | 100 |
epoch | 3 |
max_length | 200 |
Optimizer | AdamW |
Model Name | Accuracy (%) | Precision (%) | Recall (%) | F1(%) |
---|---|---|---|---|
CNN | 75.26 | 76.11 | 79.62 | 77.83 |
BiLSTM | 79.23 | 78.24 | 85.77 | 81.83 |
GRU | 79.14 | 78.77 | 84.54 | 81.56 |
ET_p | 83.70 | 82.05 | 89.74 | 85.72 |
ET_s | 83.25 | 82.05 | 88.70 | 85.25 |
ET_s_BiGRU | 83.94 | 84.48 | 86.42 | 85.44 |
ET_s_BG+p | 84.30 | 83.95 | 88.35 | 85.98 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Xiu, Y.; Liu, X.; Qiu, J.; Qu, T.; Liu, J.; Bian, Y. A Method of Sentiment Analysis and Visualized Interaction Based on Ernie-Tiny and BiGRU. Appl. Sci. 2023, 13, 5961. https://doi.org/10.3390/app13105961
Xiu Y, Liu X, Qiu J, Qu T, Liu J, Bian Y. A Method of Sentiment Analysis and Visualized Interaction Based on Ernie-Tiny and BiGRU. Applied Sciences. 2023; 13(10):5961. https://doi.org/10.3390/app13105961
Chicago/Turabian StyleXiu, Yiqi, Xinlei Liu, Jingjing Qiu, Tangjun Qu, Juan Liu, and Yulong Bian. 2023. "A Method of Sentiment Analysis and Visualized Interaction Based on Ernie-Tiny and BiGRU" Applied Sciences 13, no. 10: 5961. https://doi.org/10.3390/app13105961
APA StyleXiu, Y., Liu, X., Qiu, J., Qu, T., Liu, J., & Bian, Y. (2023). A Method of Sentiment Analysis and Visualized Interaction Based on Ernie-Tiny and BiGRU. Applied Sciences, 13(10), 5961. https://doi.org/10.3390/app13105961