Harnessing Ensemble and Transformers for Sentiment Analysis and Emotion Detection in Hausa Text
Authors
Department of Computer Science, Federal University Lokoja, P.M.B 1154 Lokoja, Kogi State, Nigeria. (Nigeria)
Department of Computer Science, Federal University Lokoja, P.M.B 1154 Lokoja, Kogi State, Nigeria. (Nigeria)
Article Information
DOI: 10.47772/IJRISS.2026.100601109
Subject Category: Computer Science
Volume/Issue: 10/6 | Page No: 15860-15876
Publication Timeline
Submitted: 2026-06-22
Accepted: 2026-06-27
Published: 2026-07-13
Abstract
Understanding emotional tone and sentiment in text has driven significant advancements in Natural Language Processing (NLP), particularly in sentiment analysis and emotion detection. This study addresses the challenge of developing effective NLP tools for low-resource languages, focusing on the Hausa language. By leveraging ensemble methods and pre-trained transformer models like BERT and XLM-R, along with traditional classifiers such as Logistic Regression, SVM, Naive Bayes, Random Forest, and XGBoost, we aim to improve sentiment analysis and emotion detection for Hausa text. Utilizing a balanced sentiment dataset (9,958 samples) and a complex multi-label emotion dataset (19,757 samples across 11 categories), we benchmark individual classifiers, voting ensembles, and deep contextual models. For sentiment analysis, a Hard Voting Ensemble of TF-IDF-vectorized base learners achieved a highly competitive F1-score of 0.8748. However, Transformer models significantly outperformed traditional baselines, with Multilingual BERT (mBERT) achieving a peak F1-score of 0.8983. In the multi-label emotion detection task, individual traditional models struggled with label sparsity, yielding low Subset Accuracy scores (2.88% to 8.30%) and moderate Micro-F1 scores. Standard Hard Voting ensembles further underperformed due to discrete prediction conflicts. To resolve this, a Probability-based Majority Voting mechanism with calibrated thresholding (0.3) was introduced, boosting the Micro-F1 to 0.3825 and reducing the Hamming Loss to 0.1967. Ultimately, XLM-RoBERTa emerged as the superior architecture, achieving a Subset Accuracy of 0.1545, a Micro-F1 of 0.4275, and the lowest Hamming Loss of 0.1804. This research establishes a rigorous benchmark for Hausa NLP, highlighting the indispensable role of subword tokenization, contextual embeddings, and threshold calibration in handling the morphological richness and multi-label complexities of low-resource languages
Keywords
Sentiment analysis, Emotion detection, Transformers, Hausa text
Downloads
References
1. Ali, A., & Mashwani, W. K. (2023). A supervised machine learning algorithms: applications, challenges, and recommendations. Proceedings of the Pakistan Academy of Sciences: A Physical and Computational Sciences, 60(4), 1-12. [Google Scholar] [Crossref]
2. Al Maruf, A., Khanam, F., Haque, M. M., Jiyad, Z. M., Mridha, F., & Aung, Z. (2024). Challenges and opportunities of text-based emotion detection: a survey. IEEE Access, 12, 18416-18450. [Google Scholar] [Crossref]
3. Alslaity, A., & Orji, R. (2024). Machine learning techniques for emotion detection and sentiment analysis: current state, challenges, and future directions. Behaviour & Information Technology, 43(1), 139-164. [Google Scholar] [Crossref]
4. Başarslan, M. S., & Kayaalp, F. (2024). Sentiment analysis using a deep ensemble learning model. Multimedia Tools and Applications, 83(14), 42207-42231. [Google Scholar] [Crossref]
5. Buyukkececi, M., & Okur, M. C. (2023). A comprehensive review of feature selection and feature selection stability in machine learning. Journal of Science, 36(4), 1506-1520. [Google Scholar] [Crossref]
6. Dejaeghere, T., Singh, P., Lefever, E., & Birkholz, J. (2024, May). Exploring aspect-based sentiment analysis methodologies for literary-historical research purposes. In Proceedings of the Third Workshop on Language Technologies for Historical and Ancient Languages (LT4HALA)@ LREC-COLING-2024 (pp. 129-143). [Google Scholar] [Crossref]
7. Dang, N. C., Moreno-García, M. N., & De la Prieta, F. (2020). Sentiment analysis based on deep learning: a comparative study. Electronics, 9(3), 483. [Google Scholar] [Crossref]
8. Garba, K., Kolajo, T., & Agbogun, J. B. (2024). A transformer-based approach to Nigerian Pidgin text generation. International Journal of Speech Technology, 27(4), 1027-1037. [Google Scholar] [Crossref]
9. Gupta, R. (2024). Bidirectional encoders to state-of-the-art: a review of BERT and its transformative impact on natural language processing. Информатика. Экономика. Управление/Informatics. Economics Management, 3(1), 0311-0320. [Google Scholar] [Crossref]
10. Inuwa-Dutse, I. (2021). The first large scale collection of diverse Hausa language datasets. arXiv preprint arXiv:2102.06991. [Google Scholar] [Crossref]
11. Kolajo, T., & Kolajo, J.O. (2018). Sentiment analysis on Twitter health news. FUDMA Journal of Sciences, 2(2), 14-20. [Google Scholar] [Crossref]
12. Shehu, H. A., Majikumna, K. U., Suleiman, A. B., Luka, S., Sharif, H., Ramadan, R. A. (2024). Unveiling Sentiments: A deep dive into sentiment analysis for low-resource languages–a case study on Hausa texts. IEEE Access, 12, 98900-98916. [Google Scholar] [Crossref]
13. Liu, Y., Ott, M., Goyal, N., Du, J., Joshi, M., Chen, D., ... & Stoyanov, V. (2019). RoBERTa: A Robustly Optimized BERT Pretraining Approach. arXiv preprint arXiv:1907.11692. [Google Scholar] [Crossref]
14. Muhammad, A., Abdulmumin, I., & Bello, H. (2020). Developing language resources for Hausa language. International Journal of Advanced Computer Science and Applications, 11(7), 30-36. [Google Scholar] [Crossref]
15. Pang, B., & Lee, L. (2008). Opinion mining and sentiment analysis. Foundations and Trends in Information Retrieval, 2(1-2), 1-135. [Google Scholar] [Crossref]
16. Ramanathan, N., Sivanaiah, R., & Thanagathai, M. T. N. (2023, July). TechSSN at SemEval-2023 Task 12: Monolingual Sentiment Classification in Hausa Tweets. In Proceedings of the 17th International Workshop on Semantic Evaluation (SemEval-2023) (pp. 1190-1194). [Google Scholar] [Crossref]
17. Salahudeen, S. A., Lawan, F. I., Wali, A. M., Imam, A. A., Shuaibu, A. R., Aliyu, Y., ... & Jamoh, A. Y. (2023, April). HausaNLP at SemEval-2023 task 12: leveraging African low resource TweetData for sentiment analysis. In 4th Workshop on African Natural Language Processing (pp. 50-57). Association for Computational Linguistic: Toronto, Canada [Google Scholar] [Crossref]
18. Sani, M., Ahmad, A., & Abdulazeez, H. S. (2022). Sentiment analysis of hausa Language Tweet using machine learning approach. Journal of Research in Applied Mathematics, 8(9), 07-16. [Google Scholar] [Crossref]
19. Shehu, H. A., Majikumna, K. U., Suleiman, A. B., Luka, S., Sharif, M. H., Ramadan, R. A., & Kusetogullari, H. (2024). Unveiling sentiments: a deep dive into sentiment analysis for low-resource languages–a case study on Hausa texts. IEEE Access, 12, 98900-98916. [Google Scholar] [Crossref]
20. Smith, A., Jones, B., & Wang, X. (2019). Ensemble methods for sentiment analysis: an empirical study. Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing (pp. 1234-1244). [Google Scholar] [Crossref]
21. Shiri, F. M., Perumal, T., Mustapha, N., & Mohamed, R. (2023). A comprehensive overview and comparative analysis on deep learning models: CNN, RNN, LSTM, GRU. arXiv preprint arXiv:2305.17473. [Google Scholar] [Crossref]
22. Tahir, M. F., Haoyong, C., Mehmood, K., Larik, N. A., Khan, A., & Javed, M. S. (2020). Short term load forecasting using bootstrap aggregating based ensemble artificial neural network. Recent Advances in Electrical & Electronic Engineering (Formerly Recent Patents on Electrical & Electronic Engineering), 13(7), 980-992. [Google Scholar] [Crossref]
23. Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., ... & Polosukhin, I. (2017). Attention is all you need. 31st Conference on Neural Information Processing Systems, (pp. 1-11). Long Beach, CA, USA. [Google Scholar] [Crossref]
24. Wolf, T., Debut, L., Sanh, V., Chaumond, J., Delangue, C., Moi, A., ... & Rush, A. M. (2020, October). Transformers: State-of-the-art natural language processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations (pp. 38-45). [Google Scholar] [Crossref]
25. Yusuf, M., Ahmad, K., & Bala, A. (2019). Sentiment analysis for Hausa language: challenges and future directions. Journal of Information Technology & Software Engineering, 9(3), 237. [Google Scholar] [Crossref]
Metrics
Views & Downloads
Similar Articles
- What the Desert Fathers Teach Data Scientists: Ancient Ascetic Principles for Ethical Machine-Learning Practice
- Comparative Analysis of Some Machine Learning Algorithms for the Classification of Ransomware
- Comparative Performance Analysis of Some Priority Queue Variants in Dijkstra’s Algorithm
- Transfer Learning in Detecting E-Assessment Malpractice from a Proctored Video Recordings.
- Dual-Modal Detection of Parkinson’s Disease: A Clinical Framework and Deep Learning Approach Using NeuroParkNet