Open Access


BERT-CNN: A Deep Learning Model for Detecting Emotions from Text

Ahmed R. Abas1, Ibrahim Elhenawy1, Mahinda Zidan2,*, Mahmoud Othman2
1 Department of Computer Science, Faculty of Computer and Informatics, Zagazig University, Zagazig, 44519, Egypt
2 Department of Computer Science, Faculty of Computers and Information Technology, Future University in Egypt, 11835, Egypt
* Corresponding Author: Mahinda Zidan. Email:

Computers, Materials & Continua 2022, 71(2), 2943-2961.

Received 10 July 2021; Accepted 27 September 2021; Issue published 07 December 2021


Due to the widespread usage of social media in our recent daily lifestyles, sentiment analysis becomes an important field in pattern recognition and Natural Language Processing (NLP). In this field, users’ feedback data on a specific issue are evaluated and analyzed. Detecting emotions within the text is therefore considered one of the important challenges of the current NLP research. Emotions have been widely studied in psychology and behavioral science as they are an integral part of the human nature. Emotions describe a state of mind of distinct behaviors, feelings, thoughts and experiences. The main objective of this paper is to propose a new model named BERT-CNN to detect emotions from text. This model is formed by a combination of the Bidirectional Encoder Representations from Transformer (BERT) and the Convolutional Neural networks (CNN) for textual classification. This model embraces the BERT to train the word semantic representation language model. According to the word context, the semantic vector is dynamically generated and then placed into the CNN to predict the output. Results of a comparative study proved that the BERT-CNN model overcomes the state-of-art baseline performance produced by different models in the literature using the semeval 2019 task3 dataset and ISEAR datasets. The BERT-CNN model achieves an accuracy of 94.7% and an F1-score of 94% for semeval2019 task3 dataset and an accuracy of 75.8% and an F1-score of 76% for ISEAR dataset.


BERT-CNN; deep learning; emotion detection; semeval2019; text classification

Cite This Article

A. R. Abas, I. Elhenawy, M. Zidan and M. Othman, "Bert-cnn: a deep learning model for detecting emotions from text," Computers, Materials & Continua, vol. 71, no.2, pp. 2943–2961, 2022.

This work is licensed under a Creative Commons Attribution 4.0 International License , which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.
  • 916


  • 755


  • 0


Share Link

WeChat scan