Skip to main content

Emotion Detection in Hindi Language Using GPT and BERT

  • Conference paper
  • First Online:
Artificial Intelligence XLI (SGAI 2024)

Abstract

Emotion detection in textual data plays an important role in various NLP applications and is an important branch of sentiment analysis. There is a dearth of applications of emotion detection in low resource languages such as Hindi. There are a number of challenges in the available open-source resources in Hindi language such as imbalanced datasets and lack of understanding of textual nuances specific to Hindi. This paper presents a comprehensive study on emotion detection in Hindi text using Large Language Models (LLMs). We will be leveraging GPT-3.5-turbo API for dataset augmentation using few-shot learning and zero-shot learning techniques and further fine-tuning pretrained BERT and mBERT models. This study’s key findings include generating two balanced datasets to establish baselines, fine-tuning models for emotion detection and evaluating their performance. There is a significant improvement in Accuracy and F1-score, demonstrating the effectiveness of the approach employed. We further discuss the future directions for research including multimodal emotion detection and cross lingual applications along with ethical considerations in deploying emotion detection systems. This research contributes to advancing the understanding and applications of emotion detection in Hindi text such as customer feedback assessment, social media sentiment analysis, mental health evaluation and human-computer interaction (HCI) via virtual assistants like Alexa and Siri.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

References

  1. Ahmad, Z., Jindal, R., Ekbal, A., Bhattachharyya, P.: Borrow from rich cousin: transfer learning for emotion detection using cross lingual embedding. Expert Syst. Appl. 139, 112851 (2020)

    Article  Google Scholar 

  2. Devlin, J., Chang, M.W., Lee, K., Toutanova, K.: Bert: pre-training of deep bidirectional transformers for language understanding (2018). arXiv preprint arXiv:1810.04805

  3. Devlin, J.: Bert/multilingual at google-research/bert. GitHub (2019). https://github.com/google-research/bert/blob/master/multilingual.md. Accessed 1 Mar 2024

  4. Dyvik, E.H. 2023. The most spoken languages worldwide 2023. Statista. [Online]. Available at: https://www.statista.com/statistics/266808/the-most-spoken-languages-worldwide/. Accessed 1 Mar 2024

  5. Ekbal, A., Bhattacharyya, P., Saha, T., Kumar, A., Srivastava, S.: HindiMD: a multi-domain corpora for low-resource sentiment analysis. In: Proceedings of the Thirteenth Language Resources and Evaluation Conference, pp. 7061–7070 (2022)

    Google Scholar 

  6. Garg, K., Lobiyal, D.K.: Hindi EmotionNet: a scalable emotion lexicon for sentiment classification of Hindi text. ACM Trans. Asian Low-Resource Lang. Inf. Process. (TALLIP) 19(4), 1–35 (2020)

    Article  Google Scholar 

  7. Harikrishna, D.M., Rao, K.S.: Emotion-specific features for classifying emotions in story text. In: 2016 Twenty Second National Conference on Communication (NCC), pp. 1–4. IEEE (2016)

    Google Scholar 

  8. Hugging Face. 2024. google-bert/bert-base-multilingual-cased. https://huggingface.co/google-bert/bert-base-multilingual-cased. Accessed 1 Mar 2024

  9. Hugging Face. 2024. google-bert/bert-base-uncased. https://huggingface.co/google-bert/bert-base-uncased. Accessed 1 Mar 2024

  10. Kemp, S.: Digital 2023: India (2023). https://datareportal.com/reports/digital-2023-india. Accessed 1 Mar 2024

  11. Kumar, Y., Mahata, D., Aggarwal, S., Chugh, A., Maheshwari, R., Shah, R.R.: Bhaav-a text corpus for emotion analysis from Hindi stories (2019). arXiv preprint arXiv:1910.04073

  12. Kumar, T., Mahrishi, M., Sharma, G.: Emotion recognition in Hindi text using multilingual BERT transformer. Multimed. Tools Appl.1–22 (2023)

    Google Scholar 

  13. Nandwani, P., Verma, R.: A review on sentiment analysis and emotion detection from text. Soc. Netw. Anal. Min. 11(1), 81 (2021)

    Article  Google Scholar 

  14. OpenAI. 2024. Text Generation. OpenAI Platform Documentation. https://platform.openai.com/docs/guides/text-generation. Accessed 1 Mar 2024

  15. Paszke, A., et al.: Pytorch: an imperative style, high-performance deep learning library. Adv. Neural Inf. Process. Syst. 32 (2019)

    Google Scholar 

  16. Phani, S., Lahiri, S., Biswas, A.: Sentiment analysis of tweets in three Indian languages. In: Proceedings of the 6th Workshop on South and Southeast Asian Natural Language Processing (WSSANLP2016), pp. 93–102 (2016)

    Google Scholar 

  17. Sahu, G., Rodriguez, P., Laradji, I.H., Atighehchian, P., Vazquez, D., Bahdanau, D.: Data augmentation for intent classification with off-the-shelf large language models, 2022. arXiv preprint arXiv:2204.01959

  18. Sasidhar, T.T., Premjith, B., Soman, K.P.: Emotion detection in Hinglish (Hindi+ English) code-mixed social media text. Procedia Comput. Sci. 171, 1346–1352 (2020)

    Article  Google Scholar 

  19. Singh, G.V., Priya, P., Firdaus, M., Ekbal, A., Bhattacharyya, P.: EmoInHindi: a multi-label emotion and intensity annotated dataset in Hindi for emotion recognition in dialogues (2022). arXiv preprint arXiv:2205.13908

  20. Venkatakrishnan, R., Goodarzi, M., Canbaz, M.A.: Exploring large language models’ emotion detection abilities: use cases from the middle east. In: 2023 IEEE Conference on Artificial Intelligence (CAI), pp. 241–24. IEEE (2023)

    Google Scholar 

  21. Wang, Y., Yao, Q., Kwok, J.T., Ni, L.M.: Generalizing from a few examples: a survey on few-shot learning. ACM Comput. Surv. (CSUR) 53(3), 1–34 (2020)

    Article  Google Scholar 

  22. Wikipedia contributors. 2024. Hindi. Wikipedia. https://en.wikipedia.org/wiki/Hindi. Accessed 1 Mar 2024

  23. Wolf, T., et al.: Huggingface’s transformers: State-of-the-art natural language processing, 2019. arXiv preprint arXiv:1910.03771

  24. Wong, B.: Top Social Media Statistics And Trends. Forbes (2024). https://www.forbes.com/advisor/in/business/social-media-statistics/. Accessed 1 Mar 2024

  25. Worlddata.info. 2024. Hindi speaking countries. https://www.worlddata.info/languages/hindi.php. Accessed 1 Mar 2024

  26. Yoo, K.M., Park, D., Kang, J., Lee, S.W., Park, W.: GPT3Mix: leveraging large-scale language models for text augmentation (2021). arXiv preprint arXiv:2104.08826

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Ritika Agarwal .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2025 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Agarwal, R., Abbas, N. (2025). Emotion Detection in Hindi Language Using GPT and BERT. In: Bramer, M., Stahl, F. (eds) Artificial Intelligence XLI. SGAI 2024. Lecture Notes in Computer Science(), vol 15447. Springer, Cham. https://doi.org/10.1007/978-3-031-77918-3_8

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-77918-3_8

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-77917-6

  • Online ISBN: 978-3-031-77918-3

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics