Automatic extraction of similar poetry for study of literary texts: An experiment on Hindi poetry

ETRI JournalVolume 44, Issue 3 p. 413-425 ORIGINAL ARTICLEFree Access Automatic extraction of similar poetry for study of literary texts: An experiment on Hindi poetry Amit Prakash, Amit Prakash orcid.org/0000-0001-5970-3489 Department of Computer Science and Engineering, Birla Institute of Technology, Mesra, Ranchi, IndiaSearch for more papers by this authorNiraj Kumar Singh, Niraj Kumar Singh orcid.org/0000-0001-5267-3547 Department of Computer Science and Engineering, Birla Institute of Technology, Mesra, Ranchi, IndiaSearch for more papers by this authorSujan Kumar Saha, Corresponding Author Sujan Kumar Saha sujan.kr.saha@gmail.com orcid.org/0000-0002-7275-7980 Department of Computer Science and Engineering, Birla Institute of Technology, Mesra, Ranchi, India Correspondence Sujan Kumar Saha, Department of Computer Science and Engineering, Birla Institute of Technology, Mesra, Ranchi, India. Email: sujan.kr.saha@gmail.comSearch for more papers by this author Amit Prakash, Amit Prakash orcid.org/0000-0001-5970-3489 Department of Computer Science and Engineering, Birla Institute of Technology, Mesra, Ranchi, IndiaSearch for more papers by this authorNiraj Kumar Singh, Niraj Kumar Singh orcid.org/0000-0001-5267-3547 Department of Computer Science and Engineering, Birla Institute of Technology, Mesra, Ranchi, IndiaSearch for more papers by this authorSujan Kumar Saha, Corresponding Author Sujan Kumar Saha sujan.kr.saha@gmail.com orcid.org/0000-0002-7275-7980 Department of Computer Science and Engineering, Birla Institute of Technology, Mesra, Ranchi, India Correspondence Sujan Kumar Saha, Department of Computer Science and Engineering, Birla Institute of Technology, Mesra, Ranchi, India. Email: sujan.kr.saha@gmail.comSearch for more papers by this author First published: 27 April 2022 https://doi.org/10.4218/etrij.2019-0396AboutSectionsPDF ToolsRequest permissionExport citationAdd to favoritesTrack citation ShareShare Give accessShare full text accessShare full-text accessPlease review our Terms and Conditions of Use and check box below to share full-text version of article.I have read and accept the Wiley Online Library Terms and Conditions of UseShareable LinkUse the link below to share a full-text version of this article with your friends and colleagues. Learn more.Copy URL Share a linkShare onFacebookTwitterLinkedInRedditWechat Abstract The study of literary texts is one of the earliest disciplines practiced around the globe. Poetry is artistic writing in which words are carefully chosen and arranged for their meaning, sound, and rhythm. Poetry usually has a broad and profound sense that makes it difficult to be interpreted even by humans. The essence of poetry is Rasa, which signifies mood or emotion. In this paper, we propose a poetry classification-based approach to automatically extract similar poems from a repository. Specifically, we perform a novel Rasa-based classification of Hindi poetry. For the task, we primarily used lexical features in a bag-of-words model trained using the support vector machine classifier. In the model, we employed Hindi WordNet, Latent Semantic Indexing, and Word2Vec-based neural word embedding. To extract the rich feature vectors, we prepared a repository containing 37 717 poems collected from various sources. We evaluated the performance of the system on a manually constructed dataset containing 945 Hindi poems. Experimental results demonstrated that the proposed model attained satisfactory performance. 1 INTRODUCTION Poetry is a creative expression of language that often utilizes one or more of the crafts of diction, sound, rhythm, imagery, and symbolism [1]. It is often classified in terms of different genres and subgenres. The term genre typically refers to a style, especially in the arts, that involves a particular set of characteristics. The various genres of poetry include "narrative," "lyric," "epic," "satirical," "elegy," "dramatic," "prose," "light," and "slam." Lines of poetry may be written in meter or may exhibit only a rhyming pattern at the ends of lines. In addition, poems are written in nonmetrical patterns. However, many modern poets prefer to write in free verse, free from the tyrant demands of the metered line. Poetry's inherent nature renders translation between languages difficult. Unlike prose, which conveys meaning more expansively, it is a form of literature that uses aesthetic and rhythmic qualities of language. Therefore, the computer processing of poetry is challenging. However, with the growth of information and communication technologies, the creation of the computerized repositories of various resources have gained substantial interest. Several computerized or online poetry collections in various languages have been revealed in recent years. Akin other digital repositories, poetry collection also demands intelligent processing for efficient storage, search, and retrieval. There have been several attempts toward the automated analysis of poetry (details are provided Section 3). The classification of poetry is essential for various reasons. The ever-increasing web content demands a well-organized data set. The creation of a poetry web repository is a critical aspect in that direction. Therefore, an appropriate classification task will help organize the data set in a better way to facilitate an efficient search process. A technical person, such as a statistician inclined toward poetry, might discover the statistical patterns hidden inside the literature (poetry in particular) data. Furthermore, similar interests might be shared by persons with a literature background. Poetry classification is necessary to develop a recommendation system for the target readers. Very often, a single poetry book on some specific theme may have poetry based on different Rasas. In the context of poetry, Rasa (emotion or mood) is used to denote the essence of poetry; it signifies the peculiar experience that poetry affords us. The scholars often become inclined only toward the segment based on some particular Rasa. The proposed system finds application in such a scenario. Hindi is the official language of the Republic of India and is the fourth most spoken first language in the world. The language has a rich legacy of poetry. Similar to other rich languages, there have been attempts to document Hindi poetry online in recent years. The most comprehensive online collections include "Kavitakosh," "Hindi Kavita," and "Geeta-Kavita." Although a few efforts were found for the automated classification of poetry in other languages, we did not find significant work on Hindi poetry (Kavita). In this paper, we present our study on exploring the importance of the vocabulary of poetry to determine its Rasa. For this purpose, we have prepared a Hindi poem corpus where the poems are manually labeled as the Rasa. For the manual labeling, we have employed two Hindi literature experts. The corpus contains 945 poems classified into four Rasa categories. We have also prepared a sizable Hindi poem repository containing 37 717 poems. We have utilized this corpus to investigate the efficiency of various content-specific document representation and word embedding techniques on poetry classification. For these text-classification experiments, we used the support vector machine (SVM) classifier. First, we used the bag of word (BOW) model to represent poems as a vector of weighted frequency for each unique word or token [2, 3]. Subsequently, we investigated the efficiency of term frequency (TF)–inverse document frequency (IDF) and latent semantic analysis (LSA) and Hindi WordNet in the poem classification task. In addition, we employed the popular neural network-based Word2Vec embedding to capture the semantic relationships among the words. First, we employed the vectors generated through a generic Wikipedia text collection, and then to provide task-specific information, we trained the Word2Vec model using the extensive poem collection. This domain-specific word embedding facilitated substantial performance improvement. This paper contributes to the literature in several ways. As per the best of our knowledge, it is the first attempt at Rasa-based classification of Hindi poetry. We developed a manually labeled Hindi poem corpus. We study the effectiveness of various feature selection and word embedding techniques on the poem classification task. We train a Word2Vec model on a large collection of Hindi poems and compare its efficiency with a generic domain Word2Vec based on Wikipedia Text. 2 A BRIEF INTRODUCTION TO POETRY AND RASA Although the classification of Hindi poetry literature is not unique, the majority of language scholars agree on the following broad type suggested by Acharya Ramchandra Shukla [4]. According to him, Hindi literature is broadly classified into four prominent categories based on periods (yugs/kaals). These are as follows: Adikal or Vir-Gatha Kal (Poem type: Extolling brave warriors, Period—11th–14th century) Bhakti Kal (Poem type: Devotional poems, Period—14th–18th century) Riti Kal (Poem type: Romantic poems, Period—18th–20th century) Adhunik Kal (Poem type: Contemporary poems, Period—20th century onwards) Although the history of Hindi poetry spans across almost a thousand years, the "Contemporary period" begins in the 20th century, which is widely regarded as the basis of modern literature in Hindi [5]. The poetries of earlier ages were primarily written in dialects such as Braj, Bundeli, Awadhi, Khariboli, Angika, Vajjika, Maithili, Magahi, Bhojpuri, and Chhattisgarhi [5]. Most poets in the contemporary period compose poems as free verse. This form of poetry does not use consistent meter patterns, rhyme, or any other musical pattern. The data set used in our work mainly contains free verses. Therefore, in our work, we have focused primarily on content-specific features. However, a free verse is not free; its only freedom is from the tyrant demands of the metered line [6], and the poems thus composed tend to follow the rhythm of natural speech [7]. In this paper, we have performed Rasa (emotion or mood) based classification of Hindi poetry. The first occurrence of the word Rasa appears in ancient Vedic literature, where it connotes a liquid, an extract, and flavor [8]. In post-Vedic literature, the word generally connotes "extract, essence, juice, or tasty liquid." In the present context, it is used to denote the essence of poetry; it signifies the peculiar experience that poetry affords us [9]. The oldest surviving manuscripts, with the Rasa theory, are of NatyaShastra, which mentions eight primaries Rasa [10-12]. Later, Shanta Rasa was included as the ninth Rasa. These nine Rasa are collectively named as the NavaRasa (nine emotions/moods). There are several genres of Hindi Kavita based on these Rasa. Every Rasa corresponds to a particular Bhava. Rasa means that which becomes (bhoo, bhav, [to become]), so it's Bhava which becomes Rasa [13]. The enlisting of these Rasa along with their corresponding Bhava is given in Table 1. TABLE 1. Navarasa and corresponding Bhava S. No. Rasa Bhava Meaning 1 Shringar (Erotic) Rati Delight 2 Hasya (Humorous) Hasa Laughter 3 Bibhatsa (Odius) Jugupsa Disgust 4 Raudra (Terrible) Krodh Anger 5 Karunya (Pathetic) Shoka Sorrow 6 Veer (Heroic) Uthasa Heroism 7 Bhayanaka (Fearful) Bhaya Fear 8 Adbhuta (Wonderous) Vishmaya Wonder 9 Shanta (Peaceful) Calm Peace Vatsalya and Bhakti Rasa are considered to be the 10th and 11th Rasa, respectively [11]. Out of 11 (nine from NavaRasa and two extended members), we have used four prominent Rasa of this family in this study. These are Bhakti, Hasya, Shringar, and Veer. The importance of Shringar may be realized by the fact that it is also known as "Rasaaraj" (the king of all Rasa) [9]. Veer is another important Rasa on which hundreds of verses have been composed. The majority of the poems written by Ramdhari Singh "Dinkar," hailed as "RashtraKavi" (National poet), are based on Shringar and Veer Rasa. However, Hasya and Bhakti Rasa have their importance, and many poetic works of literature are available based on these. 3 LITERATURE REVIEW Text classification is one of the heavily studied tasks of data mining. Several studies have been undertaken to classify structured text into predefined groups. However, the literary text contains creative writing styles and has been treated differently by researchers. Some attempts have been made to classify literary text according to different criteria, such as writing styles, themes, topics, authors, and genres in recent years. The most fundamental study on literary text classification is poem recognition, where documents are grouped into two classes: poems and nonpoems. Several attempts have been made to identify the features used by humans to recognize poems computationally. Tizhoosh and others used poetic features such as rhyme, shape, rhythm, meter, and meaning to identify poems written in English [14]. They reported a comparative study using three classifiers in their experiment: Naïve Bayes (NB), Decision Trees (DTs), and Neural Network. Almuhareb and others [15] proposed a rule-based method to classify poem and nonpoem segments intermixed in the same Arabic text document. The proposed method identifies the standard features of classical Arabic poems such as, structure, writing style, and rhyme to utilize them in the classification process. Jamal and others used SVM to differentiate Malay poems known as Pantun from other nonpoetic texts [16]. Shape structure of Malay poetry and TF-IDF weighting of terms have been used as features in this work. In addition, they trained a classifier to group poems in the 10 most popular themes of Malay culture. In addition, noticeable changes in the writing style of poems over different periods also attracted researchers to classify poems in two broad classes: classical and modern poems. Almuhareb and others [17] exploited the common visual and linguistic features of modern Arabic poems such as line length, rhyme, punctuations, and diacritics to recognize modern Arabic poetry. They used DT and NB classifiers with different feature sets in their experiments. Can and Patton used word length and most frequent word as features to analyze the change in writing style with time for Turkish language literature [18]. In another study, in 2010, Can and Patton analyzed 20th-century Turkish literature in terms of the change in word characteristics [19]. Kao and Jurafsky [20] used stylistic features to classify poems as written by professional and amateur poets. They reported a lack of imagism in modern poems primarily published by amateur poets. In 2013, Voigt and Jurafsky performed various experiments on modern Chinese poetry and reported a decline in traditional creative writing style [21]. The classification of poems according to style, theme, and genre is a widely studied issue in literary text processing. Lustrek [22] presented an overview of feature selection for text classification, focusing on genre classification of lyrics. Kaplan and Blei [23] used Orthographic, syntactic, and phonemic features to classify poems by style and visualize them as clusters. Bei Yu [24] compared the performance of two popular classification algorithms NB and SVM, for the eroticism classification of Dickinson's poems. They studied the impact of three preprocessing tools: stemming, stopword removal, and statistical feature selection to judge the classifiers' performance in the literary setting. The study results demonstrated that SVM outperforms NB for classifying documents of the literary domain. Lou and others proposed a system for multilabel classification of poems based on their subjects [25]. In the proposed method, the authors used a model that combines the methodologies of TF-IDF and Latent Dirichlet Allocation (LDA) for feature extraction. On a manually constructed dataset of English poems, they used SVM to classify them into three main categories: Living, Mythology & Folklore, and Love, allowing a poem to be in multiple classes. Rahgozar and Inkpen [26] used LDA and SVM to detect the semantics in Hafez's poems for classifying them chronologically. They used the Persian language dataset of Hafez corpus in their experiments. Kao and Jurafsky used sound devices such as alliteration, consonance, and rhyme [27]. Analyzing 359 English poems written by 19th-century poets of a different class, they reported that contemporary professional poets use more concrete words and fewer emotional words than traditional writers. In addition, recent developments in natural language processing tools have attracted researchers to use them for literary analysis. For example, Delmonte employed NER and POS tagger to classify poems by style [28]. Another common literary analysis problem is author attribution. It is a process that attempts to identify the possible author of an anonymous document. In most previous studies, the task has been approached as a classification problem where a collection of documents with known authorship is used to train a classifier. The common approaches used stylometry, traditional BOG method, or combination to represent a literary document for author attribution. Morales and others used both stylistic and topic features for classifying poems written by five contemporary Mexican poets [29]. The poems were characterized by word sequences that combine functional and content words in this work. The experimental results claim to achieve a satisfactory result using the NB classifier. In the Indian language scenario, we could not find any work reported for Hindi poem classification. However, few computational analyses have been performed on Bangla [30] and Punjabi [31] poetic literature. In 2011, Chakraborty and Bandyopadhyay conducted a series of experiments on Ravindranath Tagore's writings to detect stylometry in Bangla prose [32]. They used low-level, chunk-level, and context-level features for semisupervised learning of the classifier. Furthermore, the poems of three famous Bangla writers Rabindranath Tagore, Bankim Chandra Chattopadhyay, and Sukanta Bhattacharyay have been processed by Das and Mitra for author identification task [30]. The results showed that using simple unigram and bigram features, the NB classifier performed well for identifying authors. However, their dataset had only 36 documents, which is too limited to draw any conclusion. In 2015, Phani and others conducted the first large-scale study of authorship attribution in Bangla literature [33]. They constructed a corpus of 3000 literary passages from three eminent Bengali authors. They achieved satisfactory results using character bigrams as features in the NB classifier. Rakshit and others [34] used semantic features for subject-based classification of Bangla poems and various stylistic and semantic features for poet identification. For subject-based classification, they used Tagore's collection of poetry to classify them into four categories: devotional, love, nature, and nationalism. For poet identification, they used a manually constructed dataset containing poems of four renowned Bangla poets. The experiments using an SVM classifier showed that words and stylometric features worked well for classifying poems. 4 OUR APPROACH In this section, we discuss the methodology used for the poem classification task. Figure 1 presents a high-level workflow of the system, and the individual modules are discussed below. FIGURE 1Open in figure viewerPowerPoint High-level workflow of the proposed system 4.1 Preprocessing Hindi poem writings contain some unique structure and hence require few preprocessing steps before further analysis. The repetition of words and some sections are common in poem writing. To avoid rewriting of redundant sections, authors usually use annotations like −X, *X to represent it. We manually identified these annotations and replaced them with the actual repeating segment. In addition, poets also make extensive use of stop-words in their poems. However, these stop-words do not significantly contribute to defining the class. Therefore, we removed these words using manually constructed Hindi stop word list. In the next preprocessing step, words with morphological inflections were identified and reduced to their root form. This step is essential for a morphologically rich language like Hindi, which uses various case markers to signify certain functions. In this study, we employed the Hindi WordNet's morphology functions for mapping the inflected words to their corresponding root. 4.2 Feature extraction Once the poems were preprocessed, the next step was to extract their features. In this study, we used TF-IDF as our feature extraction technique. It is one of the popular methods in information retrieval that represents how important a specific word or phrase is to a given document. The feature extraction process aims to identify the terms that are discriminative and hence more relevant to certain classes. To achieve this, we used a class-based TF-IDF (c-TF-IDF) method to extract words that make a class stand out compared to all others. Then the words extracted from each class were merged to create a feature set for weighted vector representation of poems. A term is considered relevant to a particular class if it appears several times in that class—high TF value. In addition, the relevance can be further boosted by locating the document frequency of the term in a limited set of documents. The frequent appearance of a term in the same class underestimates its importance. From this intuition, we can locate the IDF of a term considering only documents outside the class under consideration. This strategy boosts the TF-IDF score to better represent the terms distribution among classes and helps the classifier better predict new documents. The c-TF-IDF score of a term t in class i can be found using the following formula. c _ TF _ IDF t , i = tf t , i w i * log m ∑ j n tf t , j , where tft,i is the number of occurrences of term t in class i having the total number of words w. The IDF is calculated by dividing the total number of documents m, by frequency of word t across all other classes n. For example, to discover the most relevant terms to the class Veer Rasa, we first merged all the poems of the Veer Rasa and then found the number of occurrences of each unique term (excluding stop-words) present there. The total number of occurrences here represents the TF of terms present in the class Veer Rasa. We found the IDF by dividing the total number of poems into all other classes (Bhakti, Hashya, and Shringar Rasa) to the number of occurrences of the Veer Rasa terms in those classes. We sorted the individual words of a class by their c-TF-IDF score. Subsequently, the different percentages of individual words with top c-TF-IDF scores were retained to construct the feature set (vocabulary). The feature set for the whole training data was then produced by merging the retained words of each class. Based on the occurrences of common words across classes, we used two strategies for merging the words. In the first strategy, we also used all the retained words of four classes, including the common words. While in the second strategy, we removed the common words across the classes. Finally, each poem in the data set was represented using the constructed feature sets. 4.3 Poem representation: BOW model For the classification task, the poems were converted into suitable vectors. In this study, we used the classical BOW model with TF-IDF to transform the poems into vectors of feature weights. BOW model considers each poem as a sequence of words. We represented a poem P as vector Vp = [wt(P, t1), wt(P, t2), …, wt(P, tn)] of dimension |F|, where F = [t1, t2, t3, …, tn] is the feature set. Here, wt(P, ti) denotes the importance of ith feature in the poem P. The feature set is the vocabulary extracted from training data. The vector Vp contains a nonzero weight value for common words between P and F, and 0 for every word in F that does not occur in P. We used the TF-IDF score as the weight for vector representation. The intuition behind taking TF-IDF as term weight is due to its precise representation of the importance of a term to a document in a corpus. Although the BOW is one of the widely used text representation methods and has performed well in many applications, it has several limitations. It fails to capture the semantic information present in the documents and ignores the word order. Consequently, dropping the semantic information while generating document vectors may degrade the overall classification performance. For the classification of variable length poems, we identified the following critical issues in this representation. Sparseness of vectors: The feature set extracted from training data decides the dimension of the BOW vector. As the training set increases, the unique words in the feature set are likely to increase and so does the vector size. To maintain the rhythm in poetry, the same set of words are used repeatedly. Therefore, a poem that seems to be large may contain a smaller number of unique words present in the feature set. This results in a vector with a more significant number of zeros and is referred to as a sparse vector. For processing these sparse vectors, traditional classification algorithms require more computational resources as well as higher execution time. Unknown or out of vocabulary words: Poets use a very diverse set of words to express their thoughts in a vivid and imaginative style. However, the poems used to train the classifier may not contain all the words present in the test dataset. These unknown words do not contribute to training the classifier and can affect prediction performance. The BOW model simply discards these words in the vector representation of test poems. However, some words might be present in the training set used in a similar sense of unknown words. To address these issues associated with the basic BOW representation of poems, we used alternate representations using LSA and word embeddings. These techniques handle both the issues of sparseness and unknown word problems and help to capture the semantic relation between words in poem representation. 4.4 Poem representation: LSA LSA [35] finds the relationship between sets of documents and the terms they contain. In this task, LSA is used as a dimensionality reduction technique that selects the most important words. For the LSA computation, a co-occurrence matrix was used. The matrix is multiplied by its transpose to obtain the correlation matrix of the words. The singular value decomposition (SVD) was performed on this matrix to find the most informative singular vectors. These vectors define the latent semantic subspace. The co-occurrence matrix A is decomposed into the product of three other matrices as A = T * S* DT, where T is the m × r term-concept vector matrix and D is the n × r document-concept vector matrix and S is the singular values diagonal matrix (the non-negative square root of the eigenvalues of A.AT). The first columns of T and D define the orthonormalized eigenvectors associated with the nonzero eigenvalues of A.AT and AT.A, respectively. These satisfy the property: TT.T = Ir and DT.D = Ir. A is the m × n matrix of term frequencies in the collection of poems, having n is the number of poems and m is the number of unique terms. Here, r is the rank of A and S is a computed r × r diagonal matrix of singular values. To reduce the dimension, the SVD was truncated by keeping only the largest k < r diagonal entries in the singular value matrix S. These k entries are the most important words. 4.5 Enriched BOW representation using Hindi WordNet We used the ontology-based enrichment method to include the semantic information in the BOW representation to construct an alternate vector representation. In this study, the Hindi WordNet (HWN) has been used as ontology, which is a well-known knowledge source to capture semantic relationships between Hindi words. For each poem vector Vp the weight value wt(P, ti) of a term ti is modified based on the presence of synonyms of ti in P. The details of the steps involved in constructing an enriched poem vector using HWN are described below. For every term t of feature set F, we investigated its presence in poem P. If t was found in P, we used its c-TF-IDF value in P as feature weight. If t was not found in P, we passed it to HWN and extract its synonyms. Subsequently, these synonyms were checked against the keywords of P. If any of the synonyms appeared in P, the c-TF-IDF of that synonym was used as feature weight of t. In case of the absence of any common term between P and synonyms, the weight value of t remained 0. In certain situations, more than one synonym of t may have appeared in P. In this case, the largest TF-IDF value among synonyms was used as the weight of term t. 4.6 Enriched BOW representation using Word2Vec An ontology-based enrichment system limits the entries in the dictionary and fails to capture any relation between words that causes due to word co-occurrences. Therefore, for enriching poem vectors, we decided to use information captured from word co-occurrences. For this purpose, we trained the Word2Vec model, which is based on the idea that contextually related words often occur with a similar set of surrounding words. However, training a model using mixed domain documents may not serve our purpose. Some words co-occur with high frequency in a particular domain and share a strong contextual relation. For example, words "नैन (eye)" and "खंजर (dagger)" frequently co-occur in poems related to 'Shrin