Data-driven Identification of Idioms in Song Lyrics (2021)

Abstract: The automatic recognition of idioms poses a challenging problem for NLP applications. Whereas native speakers can intuitively handle multiword expressions whose compositional meanings are hard to trace back to individual word semantics, there is still ample scope for improvement regarding computational approaches. We assume that idiomatic constructions can be characterized by gradual intensities of semantic non-compositionality, formal fixedness, and unusual usage context, and introduce a number of measures for these characteristics, comprising count-based and predictive collocation measures together with measures of context (un)similarity. We evaluate our approach on a manually labelled gold standard, derived from a corpus of German pop lyrics. To this end, we apply a Random Forest classifier to analyze the individual contribution of features for automatically detecting idioms, and study the trade-off between recall and precision. Finally, we evaluate the classifier on an independent dataset of idioms extracted from a list of Wikipedia idioms, achieving state-of-the art accuracy.

## introduction traditional accounts of idiomaticity distinguish idiomatic use of language from literal use, claiming that idioms are multiword expressions (mwes) which do not conform to frege's principle, i.e. whose meaning as a whole cannot fully be derived from the aggregated meaning of their components @xcite . in other words, the definition refers to non-compositionality and non-transparencyidiomatic mwes seem semantically opaque; @xcite consider this "lexical idiomaticity" to be one of five sub-types of idiomacity. classifying idioms is not trivial: with reference to recent findings in discourse analysis and psycholinguistics, @xcite describes idiomati-city as a non-binary, multifactorial concept for a "continuum ranging from clearly non-idiomatic patterns to core idioms"; @xcite support this observation experimentally. at least core idioms are considered to be (mentally) lexicalized: @xcite describe them as "lexicalized combinations of two or more words" which, though often syntactically diverse, "are exceptional enough to be considered as individual units in the lexicon". this corresponds to sinclair's idiom principle @xcite , postulating that text is often constructed from ready made phrases. due to morphological and syntactic variation, the degree of formal fixedness ranges from semi-to fully-fixed. however, idiomaticity should be corpus-based verifiable, as e.g. @xcite states that "researchers interested in phraseologisms use frequencies and other more elaborated statistics" to identify "symbolic units and constructions". some of these statistics may relate to local contexts, because one can reasonably argue that words that are not used literally will probably be somehow surprising in their context. against this background, we regard idioms as a subcategory of mwes that are conspicuous in function, form and distribution -and with fuzzy boundaries to other multiword units like metaphors @xcite or proverbs. our objective is to cover idiom characteristics with an innovative set of quantitative features, taking up some ideas described in the subsequent section, and to apply and evaluate machine-learning classifiers for a presumable idiomatically rich specialized corpus. ## related work idioms are a key concern and pose challenging problems for nlp applications such as information extraction, retrieval, summarization and translation, as well as for lexicographical studies or lan-guage learning; see @xcite . @xcite refer to them as "a pain in the neck for nlp"; consequently their machine-supported recognition constitutes an ideal testbed for a variety of methodical approaches and is the subject of shared tasks; see, e.g., @xcite . @xcite propose measures that quantify the degree of lexical and syntactic fixedness. @xcite rely on lexical features in order to identify mwes whose meanings differ from their components' meanings. @xcite include the collocational contexts of idiomatic mwes into their computation; they model semantic relatedness with the help of lexical chains and cohesion graphs, and, based on this, compare supervised with unsupervised approaches for token-based idiom classification. @xcite use latent semantic analysis in order to verify whether context word vectorsimilarity between idiomatic mwes and its constituents helps with the calculation. @xcite achieve a precision level of 65% for the distinction between idiomatic and literal wiktionary phrases, using lexical and graph-based features in order to quantify the assumption that literal phrases are more likely to have closely related words in their definition clause than idiomatic phrases. @xcite investigate whether sentential distributed semantics of idiomatic verbnoun (vn) combinations show significant differences from non-idiomatic usage, and therefore train sent2vec models for sentence-level contexts. using the same dataset, @xcite compute local context differences between word vector matrices on the basis of frobenius norm. @xcite train vector-based models on a gold standard of vn constructions that has been annotated regarding idiomaticity on a 1-7 likert scale. hashempour and villavicencio (2020) use contextualized word embeddings in order to distinguish between literal and idiomatic senses of mwes that are treated as individual tokens in training and testing, producing average f1-scores of more than 70%. we take up the idea of evaluating different context representations, expand corresponding measures with syntagmatic and other statistical features, and analyze how they complement each other to characterize idioms. furthermore, we broaden the scope by extending the dataset beyond vn combinations, including all kinds of mwes without morphosyntactic restrictions. ## dataset and features the aim of this study is to evaluate quantitative features of mwes with regard to their suitability of detecting idiomatic mwes in a given text corpus. contemporary pop song lyrics -a yet sparsely examined register -seem intrinsically promising for two reasons: firstly, lyrics combine qualities of spoken and written language @xcite with wordplay creativity @xcite and can thus be expected to constitute a valuable source of both well-known and innovative idiomatic constructions. secondly, on account of their formal structure, catchy and often idiomatic phrases tend to be repeated in choruses, so that there should be good prospects for empirical evidence. we use the freely available corpus of german song lyrics @xcite , covering a period of five decades and a broad range of artists, in order to ensure that our findings can be reproduced and compared by future studies. the general approach should also be applicable to languages other than german. although the corpus comes with xml-coded multi-layer annotations, we mainly work on the raw data and do not rely on linguistic preprocessing like parsing or lemmatization. to avoid reference to lexica or pre-defined syntactic template lists (like v-np constructions), we include any ngram, spanning a minimum of two word tokens and a maximum of six word tokens within sentence boundaries. this yields a dataset of more than six million ngrams. from these we randomly select a sample of 10,000 ngrams. this dataset is manually annotated by a native speaker in order to serve as a gold standard. to cope with the abovementioned fact that idiomatic status cannot always be described as either clearly idiomatic or clearly literal, we allow for three categories and mark idiom candidates as either literal, idiomatic, or partly idiomatic, where the latter comprises ngrams with both idiomatic and nonidiomatic content, which are excluded for our analysis, see as a starting point for our evaluation, each dataset entry is automatically annotated with a number of features. we distinguish between three main groups of features to characterize idioms, for a detailed break down see syntagmatic features (sy) measure collocation strength between all word pairs within an idiom candidate. context features (co) measure semantic similarity between the words within an idiom can-didate and the words in its left/right context. finally, other features (o) represent a variety of counts to assess the amount of evidence available, such as number of words in an idiom candidate. sy_c1 and sy_c2 comprise a number of countbased collocation measures between a word and its neighbours within a window of +/-5 foot_0 @xcite . sy_c1 are based on the counts in dereko @xcite , whereas sy_c2 are based on the counts in the pop lyrics corpus. these count-based measures all aim at identifying mwes that occur more often than randomly expected. we expect that idioms, like other mwes, are characterized by high sy_c. sy_w comprises a number of predictive collocation measures. these are all calculated by aggregating the output activations in a three layer neural network using the structured skipgram variant @xcite of word2vec @xcite , again with a window size of +/-5 foot_1 . as shown by @xcite , these output activations approximate the shifted pointwise mutual information 3 . these predictive measures generalize from actually used collocations by means of dimensionality reduction in the hidden layer and thus can also predict unseen but meaningful collocations. however, due to generalization they are typically biased towards the dominant, usually literal usage. thus, we expect that idioms, unlike other mwes, are characterized by low sy_w. tables 1 and 2 exemplify the interplay between count-based and predictive collocations. among the top 10 count-based collocates of 'kuh' (cow), there are 6 collocates (in bold) stemming from idiomatic use, for example, 'die kuh vom eis kriegen' literally for 'getting the cow from the ice' meaning 'working out a situation'. in contrast, the predictive collocates all pertain to the literal meaning of cow as a domestic animal; e.g., 'eis' does not occur among the top 400 predictive collocates. the count-based and predictive collocates of 'versuch' ('attempt'), on the other hand, show no such difference. both refer to the literal meaning of 'versuch'. however, also here we can observe a bias of the predictive collocates towards 'failed attempts'. sy_r comprises non-parametric variants for some collocation measures by means of their ranks to account for the different scales of sy_c1 and sy_w. this includes sy_c1_r, sy_w_r1, sy_w_r2, and the rank difference sy_r_d. as depicted in equation 1, for all syntagmatic collocation measures 𝑐𝑜𝑙, we take the average over all pairs of words 𝑤 𝑖 , 𝑤 𝑗 in an idiom candidate of size |𝑤|. null-values, occurring when there exists no pair with measures from dereko, are transformed to min (or max) values appropriate for each feature. ∑ 𝑖≠𝑗 𝑐𝑜𝑙(𝑤 𝑖 , 𝑤 𝑗 )/|𝑤|(|𝑤| -1) the context features co_vec and co_vec_lex aim at identifying idioms based on the heuristics that they occur within unusual thematic contexts. idiomatic ngrams such as 'perlen vor die säue werfen' ('cast pearls before swine') are often found in local contexts that are thematically rather untypical for non-idiomatic uses of the individual ngram words. the expression can be expected in a theatre review or a political speech, but rather not in texts explicitly dealing with jewellery or livestock. to this end, co_vec uses cosine similarity between word vectors, which identifies paradigmatically related words occurring in similar usage contexts, comprising (near) synonyms, but also hyponyms, meronyms, etc. continuing with the above example, among the most similar words for 'perle' are words like 'kostbarkeit' ('preciousness'), 'schatztruhe' ('treasure chest'), 'liebeserklärung' ('declaration of love') or 'brosche' ('brooch'). close to 'säue', we find 'rindvieh' ('cattle'), 'schafe' ('sheep'), 'köter' ('pooch'), 'hufe' ('hooves') or 'schlachtbank' ('slaughterhouse'). assuming that these words appear less likely in the local contexts of our example idiom than in the typical contexts of its constituents, low value for co_vec may indicate idiomatic use. more specifically, co_vec is calculated as the mean cosine similarity between all pairs of words 𝑤 𝑖 in the idiom candidate of size |𝑤| and words 𝑐 𝑗 in the left/right context of size |𝑐| (in the present case we include five context words to the left and right foot_2 ; see figure 1 and equation 2 ). co_vec_lex is calculated like co_vec, but only takes lexical words into account, i.e. nouns, verbs, adverbs and adjectives. if the idiom candidate appears at several places within the corpus, an average is calculated. the last group o comprises o_gram, the number of words in an idiom candidate, o_nstopw foot_3 , the number of non stopwords, and o_dereko, the number of words for which a word embedding is available. in summary, the syntagmatic features (sy) analyze idiom candidates for frequent (sy_c), but unusual (sy_w) collocations along the syntagmatic axis to assess their phraseness and non transparency. the context features (co) analyze their surrounding context for unsimilar words along the paradigmatic axis as a complementary measure of non transparency. both feature sets utilize the observation that word embeddings are typically biased towards the dominant/transparent meaning. ## methods and results to evaluate our feature set we have trained a random forest classifier foot_4 . unless stated explicitly otherwise, all results have been obtained using 5-fold cross validation. to avoid overlap between training and test sets, we have removed all duplicates after lower-casing and stopword removal, leaving a dataset with 542 idioms and 8697 non-idioms. because this dataset is highly unbalanced, we have systematically varied the random forest's cutoff hyperparameter (default 0.5). as shown in figure 2 , a cutoff of 0.3 achieves the best f1-score of 61.9%, balancing recall and precision around 62%. the best balanced accuracy of 83% is achieved at a much smaller cutoff of about 0.05. this may be a more appropriate cutoff for explorative idiom detection, where sensitivity (recall) is more important than precision. to assess the contribution of the individual feature sets, we compare classification performance between using all features, each feature set individually, and subsets of features obtained by excluding individual feature sets. the bottom half of the table analyzes how much performance is lost when excluding a feature set. the relative order is largely consistent with the upper half. in particular, also from this perspective, count-based collocations sy_c1 (including their rank variants) turn out to be most important, i.e., they lead to the largest loss in performance. interestingly, omitting the other features (o) also decreases performance, even though they do not contribute individually. this may be due to the fact that they do not model intrinsic characteristics of idioms, but just the number of word pairs available for estimating sy and co feature sets, i.e., essentially the amount of evidence available. thus they are only useful in combination with other feature sets. for sy_r the effect is the other way around. sy_r has a remarkable f1-score of 29.5% when taken alone, but the overall performance increases, when the classifier is trained on all feature sets but sy_r. the lack of loss in performance may be due to the fact sy_r is highly correlated with sy_c1 and sy_w by construction, and thus does not add information. the slight increase seems to be a random effect. the information gain (*1000), ttest the degree of significance by a welch two sample t-test for confidence levels 0.95 (*), 0.99 (**), and 0.999 (***), and δ the sign of the difference between the mean of a feature for idioms vs. non-idioms. the context features co_vec and co_vec_lex have the highest mda followed by the other features o and the count-based collocation features estimated from the pop lyrics corpus sy_c2. all collocation (and rank) features estimated from dereko are in a similar range. note however, that mda tends to be shared among correlated features. igain assesses the individual (univariate) contribution of the features for classification. the two estimates of the overall frequency of an idiom candidate o_c2_n and o_c2_sgt have the highest igain, closely followed by the count-based collocation features sy_c2 and sy_c1. the predictive collocation features sy_w and context features co have slightly smaller igain. this largely corroborates the results of the analysis of feature sets above. with the exception of co_vec and two of the predictive collocation features, the difference between the means of all features in idioms vs. nonidioms is highly significant. to better understand the contribution of the individual features, it is helpful to look at the difference δ between their means: compared to all non-idioms, words within idioms have a lower cosine similarity co_vec (but still higher co_vec_lex) to their left and right neighbours, i.e., indeed they occur in unusual contexts. on the other hand, they have a higher count-based and predictive collocation strength among each other (sy_c1, sy_c2, sy_w) with some exceptions (sy_c1_ll,sy_w_con,sy_w_nsumaf). consequently, they also have a smaller rank for these measures (sy_c1_r, sy_w_r1, sy_w_r2), although we would expect larger ranks. however, non-idioms comprise random ngrams that do not occur more often than expected as well as frequent mwes with high collocation strength. thus it is instructive to constrain the comparsion as follows: δ ′ gives the sign of the difference between the mean for idioms and all those non-idioms with sy_c1_ld larger than the mean of sy_c1_ld of all non-idioms, i.e., only the non-idiomatic but still frequent mwes. incidentally, all these differences are highly significant (at least 0.99), with the exception of co_vec. in this comparison, the context features co and both, the count-based and predictive collocation features estimated from dereko (sy_c1 and sy_w, except sy_c1_mi,) are smaller, and accordingly the corresponding rank features are larger for idioms. in particular, the rank difference sy_r_d between count-based and predictive collocation is larger, i.e., co-occuring words in an idiom tend to be less represented by the predictive collocations which are biased towards the dominant meaning. in summary, idioms, like non-idiomatic mwes, are characterized by high collocation strength in comparison to randomly selected ngrams. however, in comparison with non-idiomatic but frequent mwes, they are characterized by occurring in unusual contexts (low co_vec), and by low predictive collocation strength sy_w; or, put more bluntly, idiomatic mwes occur frequently but are unusual. to demonstrate the transferability of our approach, we have applied it to a dataset of german idioms extracted from german wikipedia 8 . after removing duplicates (72) with our gold standard 9 , and all idioms that consist of less than 2 words after stopword removal, this set comprises 760 idioms. as training set for this out-of-domain scenario, we use a sample of 80% of non-idioms and all idioms of our base data set. the test set consists of the remaining 20% of the non-idioms and the wikipedia idioms. we train the classifier on the feature ensemble sy_c1 + sy_w + sy_r + o (without the feature o_dereko). this is because the feature sets sy_c2 and co are calculated based on 8 https://de.wikipedia.org/wiki/ liste_deutscher_redewendungen , accessed february, 22, 2021. ## conclusions the aim of this study was to model well-studied idiom characteristics with quantitative features and to evaluate them on suitable datasets. our evaluations show that count-based collocation measures indeed characterize idioms' frequent usage and stable occurrence, i.e. phraseness. the predictive collocation measures and the context features on the other hand are able to model uncommon usage, that is, non transparency. by applying our model, trained on an annotated dataset that was sampled from a pop lyrics corpus, to an out-of-domain dataset of idioms crawled from wikipedia, we demonstrated the generalizability of our approach. the introduced features do not require sophisticated or knowledge intensive preprocessing, and need only minimal context. even, when no context is available, as for the out-of-domain dataset, we achieve state-of-the art classification performance. however, the feature set also has limitations. for idioms that consist of only one content word, possibly with some stopwords, the collocation measures do not produce very meaningful results. in this case we need to entirely rely on the context features. in a similar vein, count based collocation strength obviously does not apply to novel idioms. moreover, when idiomatic use constitutes the overwhelmingly dominant use, such as 'kenne meine pappenheimer' (literal: 'know my pappenheimers', roughly: 'know the weak people (in my team)'), neither co nor sy_w features can contribute. but in sum, all evaluation results -and the detailed analysis of how the count-based and predictive features complement each other for discriminating between idioms and non idioms -shed an additional empirical light on the linguistically intricate and multifaceted phenomenon of idiomaticity. waiving limitations on morphosyntactic templates (like, e.g., vn constructions), our approach should work well for any potentially idiomatic mwes. for future work, we intend to apply the approach to bigger datasets; attractive candidates might be the corpora of the parseme (parsing and multiword expressions) network @xcite or the colf-vid dataset of verbal idioms @xcite . we will also experiment with additional features, in particular to better capture fixedness of idiomaticity and cope with non transparent compound idiomatic words. all data and source code is publicly available under a creative commons license at http:// songkorpus.de/data/.