what machine learning can tell us about the Bhagavad Gita

Machine learning and other artificial intelligence (AI) methods have had immense success with scientific and engineering tasks such as predicting the folding of protein molecules and recognizing faces in a crowd. However, the application of these methods to the human sciences is not yet fully explored.

What can AI tell us about philosophy and religion, for example? As a starting point for such exploration, we used deep learning AI methods to analyze English translations of the Bhagavad Gita, an ancient Hindu text originally written in Sanskrit.

Using a deep learning-based language model called BERT, we investigated sentiment (emotions) and semantics (meanings) in translations. Despite huge variations in vocabulary and sentence structure, we found that patterns of emotion and meaning were broadly similar across all three.

This research paves the way for the use of AI-based technologies to compare translations and revise sentiment across a wide range of texts.

An ancient book of wisdom

The Bhagavad Gita is one of the main Hindu sacred and philosophical texts. Written over 2,000 years ago, it has been translated into over 100 languages ​​and has interested Western philosophers since the 18th century.

The 700-verse poem is part of the larger Mahabharata epic, which recounts the events of an ancient war that is said to have taken place at Kurukshetra near present-day Delhi in India.

Read more: Indian philosophy helps us see clearly and act wisely in an interconnected world

The text of the Bhagavad Gita recounts a conversation between the Hindu god Krishna and a prince called Arjuna. They discuss whether a soldier should go to war for ethics and duty (or “dharma”) if he has close friends or family on the opposite side.

The text helped lay the foundations of Hinduism. Among many other things, this is where the philosophy of karma (a spiritual principle of cause and effect) originates.

Scholars have also viewed the Bhagavad Gita as a book of psychology, management, leadership, and conflict resolution.

Countless translations

The first of many English translations of the Bhagavad Gita was published in 1785.
Wikimedia Commons, CC BY

There have been countless English translations of the Bhagavad Gita, but there is not much work that validates their quality. Translations of songs and poems not only break rhythm and rhyme patterns, but can also cause semantic information to be lost.

In our research, we used deep learning linguistic models to analyze three selected translations of the Bhagavad Gita (from Sanskrit to English) with semantic and sentimental analyzes that help in the assessment of translation quality. .

We used a pre-trained language model known as BERT, developed by Google. We further refined the model using a human labeled training dataset based on Twitter posts, which captures 10 different feelings.

These sentiments (optimistic, grateful, empathetic, pessimistic, anxious, sad, bored, denial, surprised, and joking) were adopted from our previous research on social media sentiment at the start of the COVID-19 pandemic.

A schematic diagram showing how AI analytics works.
Chandra, Author provided

Sentiment patterns

The three translations we studied used very different vocabulary and syntax, but the language model recognized similar sentiments in the different chapters of the respective translations. According to our model, optimistic, annoyed and surprised feelings are the most expressed.

Sentiments captured by our linguistic model for different translations of the Bhagavad Gita.
Chandra and Kulkarni, Author provided

Moreover, the model showed how the overall polarity of feelings changes (from negative to positive) during the conversation between Arjuna and Lord Krishna.

Arjuna is pessimistic at first and becomes optimistic when Lord Krisha imparts knowledge of Hindu philosophy to him. The sentiments expressed by Krishna show that with philosophical knowledge of dharma and mentorship, a troubled mind can gain clarity to make the right decisions in times of conflict.

One of the limitations of our model is that it was trained on data from Twitter, so it recognizes “kidding” as a common sentiment. He applies this label inappropriately to certain parts of the Bhagavad Gita. Humor is complicated and heavily culturally constrained, and understanding that is asking too much of our model at this point.

Due to the nature of the Sanskrit language, the fact that the Bhagavad Gita is a song with rhythm and rhyme, and the varying dates of the translations, different translators have used different vocabulary to describe the same concepts.

The table below shows some of the most semantically similar verses from the three translations.

The uses of sentiment analysis

Our research paves the way for the use of AI-based technologies to compare translations and revise sentiment across a wide range of texts.

This technology can also be extended to examine sentiments expressed in entertainment media. Another potential application is to analyze films and songs to provide information to parents and authorities on the suitability of content for children.

The author would like to acknowledge the invaluable contribution of Venkatesh Kulkarni to this research.

Sherry J. Basler