A Comprehensive Study of Mahabharat using Semantic and Sentiment Analysis (2022)

Abstract: Indian epics have not been analyzed computationally to the extent that Greek epics have. In this paper, we show how interesting insights can be derived from the ancient epic Mahabharata by applying a variety of analytical techniques based on a combination of natural language processing methods like semantic analysis, sentiment analysis and Named Entity Recognition (NER). The key findings include the analysis of events and their importance in shaping the story, character’s life and their actions leading to consequences and change of emotions across the eighteen parvas of the story.

## introduction semantic analysis is the study of the meaning of language, whereas sentiment analysis is the study of emotions depicted. sentimental analysis is prevailing in various domains such as social media monitoring @xcite , customer support management @xcite , and analysing customer feedback @xcite . mahabharat is a tightly interwoven story with intricate characters traversing various incidents resulting in many course of actions. this makes mahabharat an interesting study for analysing such characters and incidents using the various nlp techniques. the goal of the project is to provide a comprehensive analysis of this rich ancient text to allow for ease of understanding of the same. we are proposing a completely automated technique using semantic and sentiment analysis. the mahabharat ganguli translation is used for conducting such an analysis. entity analysis involves named entity recognition which helps in discovering many unfamiliar characters present in mahabharat. semantic analysis is used to understand and interpret the insights of the story whereas sentiment analysis is used to analyze the flow of emotions as the story progresses. character analysis describes the character's life, the trails and tribulations the character has been through and his/her characteristics. the paper presents a unified technique to achieve the above as stated. ## organization of the paper the paper is organized into 5 different sections. introduction gives a general idea of the goal of the paper and the motivation behind the proposal of the idea. related works provides a summary of works which are similar in nature and how those works can be further extended to meet our goals. the next section discusses the different approaches used and their role in achieving the goal of the project. performance analysis depicts the metrics used for comparing the results obtained the final output of the proposed idea. conclusion acts as a footnote to encourage readers to utilize this paper to supplement their future works. ## related works mahabharat is an epic with valuable lessons on life and values. an epic typically has a plot which impart life lessons to the readers. plots of an epic have various constituents i.e. happiness, sadness, suffering, reversal, recognition of latest knowledge, surprise etc. an epic is different from a newer literary genre like a novel and will have lot of negative sentiment across its breadth but in spite of that conveys a noble theme in the minds of its audience. @xcite have proposed the usage of nlp techniques such as sentiment analysis and characterization of important characters with respect to their emotion. mabhabharatha text is tokenized using standard nlp techniques. -the tokens are pos (parts of speech) tagged and tagged tokens are mapped to synsets in wordnet(priyatno, 2019) in a word sense disambiguation process. the sentiment scores are picked up from sentiwordnet for each synset. overall sentiment of the parva is derived from these values by summing the constituent sentiment scores. emotion analysis for the full text and each of the protagonists is done with the help of nrc word-emotion association lexicon @xcite . after extracting the relevant part of the corpus,the score is calculated for each pos (part of speech) tagged token for each emotion and finally summed up. however, by this approach one cannot get an overall view of the character in terms of their life, relations and actions but only about their emotions. the usage of lexicon based approach limits the ability of the model to learn new vocabulary. the proposed idea in this paper aims to remove these two limitations. @xcite have discussed the results of semantic and sentiment analysis on bhagavad gita which revolves around two characters i.e arjuna and krishna. the sentiments discussed in the paper are classified into optimistic and pessimistic sentiments. there is no discussion about different types of emotions which can shed light on the change in tone as the story transpires. the semantic analysis of bhagavad gita discusses about the similarity between verses of three authors and not on the overall text. using the discussed paper as a motivation, this paper emphasizes on performing a detailed study by considering 28 different emotions on mahabharat text and discuss about the different characters involved in the epic, important events which transpire and an interactive question answering model. named entity recognition is identifying propernouns in the text. the biggest challenge in named entity recognition is the lack of sufficient labelled data. this poses a challenge for ner in mahabharat as the standard tagged datasets are different in comparison. active learning is an efficient option as it helps identify samples that will be the most informative to the model @xcite , discuss active learning technique for named entity recognition. further work is done by yanyao shen et.al @xcite where a cnn-cnn-lstm model is built for ner, in an iterative approach. they have used various selection strategies for ner such as least confidence and maximum normalized log-probabilities. named entity recognition is a sequence labelling task. @xcite discusses the merits of using bidirectional long short term (bilstm) models for sequence labelling tasks. for any sequence labelling task the model is required to take into consideration the context of the entire sentence. @xcite introduced a model called (bert) bidirectional encoder representations from transformers. bert is designed to help computers understand the meaning of ambiguous language in text by using surrounding text to establish context. bert is trained on two tasksmasked word prediction and next sentence prediction. these tasks can make use of data that requires no labelling and is widely available. conditional random field is a popular probabilistic method for structured prediction. @xcite discussed the problem of classification by predicting a single discrete class variable y given a vector of features. in co-referencing resolution, training recurrent neural networks to model long term dependencies is an issue faced. @xcite had proposed to use external linguistic knowledge as an explicit signal to inform the model which memories it should utilize. ## methods this section describes the idea being proposed with the help of an overall system architecture represented in figure 1 . using nlp techniques such as co-referencing, relationship extraction, analysis on events, many other functions are performed like automated question-answering, graphical representations and identifying relationships of different entities in the mahabharat dataset. relationship extraction is a key task done with the help of coreferencing. event analysis utilizes bart for summarizing and whole word masking bert for question answering. the character sketch is drawn from using adjective extraction model using bert and pos tags. the pos tags along with generated summary of each parva in mahabharat is used to draw the character sketch. the emotion sketch is derived from using bert model by using emotions from go-emotion dataset @xcite . the generated summary along with emotions extracted in every parva is passed through a text generation model for generating an emotion sketch. ## analysis this section represents the results of semantic analysis tasks on mahabharat like ner, relationship extraction, summary and question answering modules, character analysis and emotion analysis. ## conclusion the paper has discussed the different techniques used to analyze intricate events of mahabharat and present them in a lucid and interesting manner to a user without prior knowledge of the text . various entities present in the mahabharat text were identified using a crf model after a comparative analysis. once the entities were identified, the observations and inferences based on their count, frequency distribution and interactions have been recorded. various events in the text including swayamvara and war have been analysed using summary generation models and question answering models. the character analysis provides a first hand impression of the character under consideration and the trails and tribulations which the character has gone through. emotion analysis draws the flow of emotions and reactions of events described in ma-habharat to be presented in a concise manner to the user. since mahabharat is an extensive epic and the focus was rather on important events, interactive question answering model, analysis of characters and the overall sentiment expressed throughout different sections of the text, coherent text generation using large language models wasn't discussed in a larger context. this study can be used to discuss generation of coherent text for other literature using above mentioned techniques. aspect based sentiment analysis provides a deeper understanding on underlying emotions especially in a complex and intertwined epic like mahabharat. however, since the general idea is to present to the reader an overall view of how emotions transpire through major events of the epic, paying too much focus on different sets of conflicting emotions within sentences strays way from the goal. this study can be used as a motivation for further diving deep into aspect-based sentiment analysis with compound analysis of emotions as the major task. large language models like gpt-2 by openai can be used for generating coherent text. gpt-2 uses input text to set the initial context for further text generation. mahabharatha is an extensive epic and the focus was rather on important events, interactive question answering model, analysis of characters and the overall sentiment expressed throughout different sections of the text, coherent text generation using large language models wasn't discussed in a larger context. this study can be used to discuss generation of coherent text for other literature using discussed techniques. interested readers can utilize the obtained results from this paper as an incentive for any additional work.