Context-aware bidirectional recurrent network with transformer encoding for text-based emotion detection

Main Article Content

Mohammad Mahzari
Noah N. Alsager
Anwer Mustafa Hilal

Abstract

Emotion detection is the process of recognizing the emotional state expressed through textual content. It has become an important task in Natural Language Processing (NLP) due to the growing amount of text-based communication. Moreover, the NLP techniques help to analyze textual information and classify it into different emotional categories. Traditional machine learning methods generally rely on manually selected features, while deep learning models can automatically learn features, they may not consistently capture the diverse linguistic patterns present in textual data. This may affect the accurate identification of emotions across different types of textual content. This manuscript introduces a Transformer-based Bidirectional Recurrent Network for Emotion Detection (TBiRN-ED), designed to learn complex textual representations for distinguishing different emotion categories. The proposed model employs Term Frequency-Inverse Document Frequency with Category-Distribution Weight, which integrates both term importance and category-specific information into the feature representation. These representations are further passed to the Transformer-Based Bidirectional Recurrent Network model, where transformer-based contextual encoding and bidirectional long short-term memory are combined to capture both contextual relationships and sequential dependencies among words. In addition, the Adan optimizer is utilized to improve the training process and parameter updates. The experimental analysis of the proposed TBiRN-ED framework is evaluated using the Emotions dataset and the Emotions Dataset for NLP, achieving accuracy of accuracy of 96.42 % and 95.70 % compared with existing methodologies. Additionally, an ablation study is conducted to examine the contribution of each component of TBiRN-ED to the overall classification performance. The results demonstrate its effectiveness in distinguishing different emotional categories from textual input, supporting its suitability for text-based emotion detection.

Downloads

Download data is not yet available.

Article Details

How to Cite
Mahzari, M., Alsager, N. N., & Hilal, A. M. (2026). Context-aware bidirectional recurrent network with transformer encoding for text-based emotion detection. Research Journal in Advanced Humanities, 7(4). https://doi.org/10.58256/s9bme461
Section
Articles

How to Cite

Mahzari, M., Alsager, N. N., & Hilal, A. M. (2026). Context-aware bidirectional recurrent network with transformer encoding for text-based emotion detection. Research Journal in Advanced Humanities, 7(4). https://doi.org/10.58256/s9bme461

Share

References

Khan, B., Usman, M. and Binsawad, M., 2026. A novel hybrid model for emotion detection in text through sequential and transformer-based approaches: LSTM enhanced RoBERTa (LER). Scientific Reports, 16(1), p.2224.

Muhammad, S.H., Ousidhoum, N., Abdulmumin, I., Yimam, S.M., Wahle, J.P., Ruas, T., Beloucif, M., De Kock, C., Belay, T.D., Ahmad, I.S. and Surange, N., 2025, July. SemEval-2025 task 11: Bridging the gap in text-based emotion detection. In Proceedings of the 19th international workshop on semantic evaluation (SemEval-2025) (pp. 2558-2569).

Lecourt, F., Croitoru, M. and Todorov, K., 2025, May. 'Only ChatGPT gets me': An Empirical Analysis of GPT versus other Large Language Models for Emotion Detection in Text. In Companion proceedings of the ACM on web conference 2025 (pp. 2603-2611).

Junianto, E., Puspitasari, M., Zakaria, S.I., Arifin, T. and Agung, I.W.P., 2025. Emotion Detection in Indonesian Text Using the Logistic Regression Method. Media Jurnal Informatika, 17(2), pp.305-316.

Deshpande, U.U., Shanbhag, S., Sukhasare, A., Dixit, M.M., Patil, R., Sangani, S., Srinivasaiah, S.H., Goudar, S. and Managuli, M., 2025. Multimodal sentiment analysis using image and text fusion for emotion detection. Discover Computing, 28(1), p.230.

Setyoningrum, N.G., SM, N.N.F., Alam, A., Nurdin, A.M., Nursamsi, D.R. and Lodana, M.B., 2025. The Impact of Linguistic Features on Emotion Detection in Social Media Texts. Innovation in Research of Informatics (Innovatics), 7(1).

Wu, Y., Zhang, S. and Li, P., 2025. Multi-modal emotion recognition in conversation based on prompt learning with text-audio fusion features. Scientific Reports, 15(1), p.8855.

Ngo, A. and Kocoń, J., 2025. Integrating personalized and contextual information in fine-grained emotion recognition in text: A multi-source fusion approach with explainability. Information Fusion, 118, p.102966.

Pugh, R., Wing, C., Huerta, M.X.J., Hernández, Á.M. and Tyers, F., 2025, April. Ihquin tlahtouah in Tetelahtzincocah: An annotated, multi-purpose audio and text corpus of Western Sierra Puebla Nahuatl. In Proceedings of the 2025 Conference of the Nations of the Americas Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 1: Long Papers) (pp. 3549-3562).

Barbara, S.W.Y., Afzaal, M. and Aldayel, H.S., 2024. A corpus-based comparison of linguistic markers of stance and genre in the academic writing of novice and advanced engineering learners. Humanities and Social Sciences Communications, 11(1), p.284.

Perkins, M. and Roe, J., 2024. Decoding academic integrity policies: A corpus linguistics investigation of AI and other technological threats. Higher Education Policy, 37(3), pp.633-653.

Incelli, E., 2025. Exploring the future of corpus linguistics: Innovations in AI and social impact. International Journal of Mass Communication, 3, pp.1-10.

Brezina, V., 2025. Corpus linguistics and AI:# LancsBox X in the context of emerging technologies. International Journal of Language Studies, 19(2), p.75.

Cheung, L. and Crosthwaite, P., 2025. CorpusChat: Integrating corpus linguistics and generative AI for academic writing development. Computer Assisted Language Learning, pp.1-27.

Hamed, D.M. and Alqurashi, N., 2025. A corpus-driven study on legal translation challenges among Arab law students: examining gender and academic level in applied legal linguistics. Humanities and Social Sciences Communications, 12(1), p.1065.

Ahmed, I.M. and Abbas, M.K., 2025. A Hybrid Lexico-Transformer Model for Real-Time Emotion Detection in English Text. interaction (HCI), 16, p.17.

Kusal, S., Patil, S. and Kotecha, K., 2025. Multimodal text-emoji fusion using deep neural networks for text-based emotion detection in online communication. Journal of Big Data, 12(1), p.32.

Singh, G., Singh, D., Sharma, R. and Bhardwaj, K., 2024, June. Potential approach for text-based emotion detection using NLP coupled with deep learning of sentiment analysis. In 2024 15th International Conference on Computing Communication and Networking Technologies (ICCCNT) (pp. 1-5). IEEE.

Kusal, S.D., Patil, S.G., Choudrie, J. and Kotecha, K.V., 2024. Understanding the performance of AI algorithms in text-based emotion detection for conversational agents. ACM Transactions on Asian and Low-Resource Language Information Processing, 23(8), pp.1-26.

https://doi.org/10.34740/kaggle/dsv/20875185

Bonthu, S., Muddam, H.S.S.G.B., Mudunuri, K.V., Dayal, A., Rao, V.M. and Bolla, B.K., 2023, August. TextRank–Based Keyword Extraction for Constructing a Domain-Specific Dictionary. In International Conference on Cognitive Computing and Cyber Physical Systems (pp. 340-349). Cham: Springer Nature Switzerland.

Li, C., Xie, Z. and Wang, H., 2025. Short text classification based on enhanced word embedding and hybrid neural networks. Applied Sciences, 15(9), p.5102.

Khan, S., Fazil, M., Sejwal, V.K., Alshara, M.A., Alotaibi, R.M., Kamal, A. and Baig, A.R., 2022. BiCHAT: BiLSTM with deep CNN and hierarchical attention for hate speech detection. Journal of King Saud University Computer and Information Sciences, 34(7), pp.4335-4344.

Li, C., Wu, H., Zhang, T., Lu, J. and Li, J., 2024. Lightweight network of multi-stage strawberry detection based on improved YOLOv7-Tiny. Agriculture, 14(7), p.1132.

Azhar, M., Riaz, N., Azeem, W., Dewi, D.A., Amjad, A. and Arman, M., 2026. Explainable Transformer Models for Human Emotion Recognition: A Multi-Method Explainability Study in the Context of Mental Health. Information, 17(5), p.496.

Yang, S., Xing, J., Liu, Z. and Sun, Y., 2025. Short-text sentiment classification model based on bert and dual-stream transformer gated attention mechanism. Electronics, 14(19), p.3904.