Automated Motif Indexing on the Arabian Nights
Organizations: College of Computer Science and Information Systems, Najran University, King Abdul Aziz Rd, 66462, Najran, KSA · Knight Foundation School of Computing and Information Sciences, Florida International University, 11200 SW 8th Street, 33199, FL, USA
Abstract
Motifs are non-commonplace, recurring narrative elements, often found originally in folk stories. In addition to being of interest to folklorists, motifs appear as metaphoric devices in modern news, literature, propaganda, and other cultural texts. Finding expressions of motifs in the original folkloristic text is useful for both folkloristic analysis (motif indexing) as well as for understanding the modern usage of motifs (motif detection and interpretation). Prior work has primarily shown how difficult these problems are to tackle using automated techniques. We present the first computational approach to motif indexing. Our choice of data is a key enabler: we use a large, widely available text (the Arabian Nights) paired with a detailed motif index (by El-Shamy in 2006), which overcomes the common problem of inaccessibility of texts referred to by the index. We created a manually annotated corpus that identified 2,670 motif expressions of 200 different motifs across 58,450 sentences for training and testing. We tested five types of approaches for detecting motif expressions given a motif index entry: (1) classic retrieve and re-rank using keywords and a fine-tuned cross-encoder; (2) off-the-shelf embedding models; (3) fine-tuned embedding models; (4) generative prompting of off-the-shelf LLMs in N-shot setups; and (5) the same generative approaches on LLMs fine-tuned with LoRA. Our best performing system is a fine-tuned Llama3 model which achieves an overall performance of 0.85 F1.
Figures & tables
| Data | Count |
| Sentences in the Text | 45,769 |
| Tokens in the Text | 1,398,863 |
| Unique Motifs | 200 |
| Positive Examples in the Index | 266 |
| Motifs with 1 Positive Example in the Index | 175 |
| Motifs with more than 1 Positive Example in the Index | 26 |
| Expression Complexity | ||||
| Conceptual Complexity | ||||
| Simple | Simple & | Complex | ||
| Only | Complex | Only | Total | |
| Simple | 34 | 73 | 35 | 142 |
| Complex | 11 | 25 | 22 | 58 |
| Overall | 45 | 98 | 57 | 200 |
| Conceptual Complexity | Expression Complexity | ||
|---|---|---|---|
| Simple | Complex | Overall | |
| Simple | 1,467 | 689 | 2,156 |
| Complex | 211 | 303 | 514 |
| Overall | 1,678 | 992 | 2,670 |
| Conceptual Complexity | Expression Complexity | |||
|---|---|---|---|---|
| Total | ||||
| Simple | Complex | Overall | Motifs | |
| Simple | 0.87 | 0.51 | 0.71 | 50 |
| Complex | 0.73 | 0.54 | 0.72 | 10 |
| Overall | 0.85 | 0.53 | 0.72 | - |
| Total Motifs | 30 | 30 | - | 60 |
| Conceptual Complexity | Expression Complexity | |||
|---|---|---|---|---|
| Simple | Complex | Overall | ||
| Simple | Lex. | 0.48 | 0.16 | 0.38 |
| Sem. | 0.69 | 0.60 | 0.66 | |
| Both | 0.82 | 0.40 | 0.69 | |
| Complex | Lex. | 0.61 | 0.12 | 0.32 |
| Sem. | 0.58 | 0.59 | 0.59 | |
| Conceptual | Expression Complexity | ||
|---|---|---|---|
| Complexity | |||
| Simple | Complex | Overall | |
| Simple | 0.39 (0.25 / 0.94 ) | 0.30 (0.20 / 0.62 ) | 0.35 (0.23 / 0.78 ) |
| Complex | 0.37 (0.29 / 0.51 ) | 0.37 (0.29 / 0.50 ) | 0.37 (0.29 / 0.50 ) |
| Overall | 0.38 (0.27 / 0.72 ) | 0.34 (0.25 / 0.56 ) | 0.36 (0.26 / 0.64 ) |
| Conceptual Complexity | Expression Complexity | ||
|---|---|---|---|
| Simple | Complex | Overall | |
| Simple | 22 / 3 / 9 | 81 / 17 / 10 | 103 / 20 / 19 |
| Complex | 6 / 3 / 2 | 31 / 7 / 9 | 37 / 10 / 11 |
| Overall | 28 / 6 / 11 | 112 / 24 / 19 | 140 / 30 / 30 |
| Conceptual Complexity | Expression Complexity | Model Type | |||
|---|---|---|---|---|---|
| Simple | Complex | Overall | |||
| Simple | text-embedding-4 | 0.64 (0.71 / 0.58 ) | 0.55 (0.49 / 0.63 ) | 0.60 (0.60 / 0.60 ) | Embedding |
| NV-Embed-v2 | 0.60 (0.67 / 0.54 ) | 0.55 (0.47 / 0.66 ) | 0.58 (0.57 / 0.60 ) | Embedding | |
| mistral-embed | 0.58 (0.44 / 0.81 ) | 0.34 (0.21 / 0.78 ) | 0.47 (0.33 / 0.80 ) | Embedding | |
| jina-embeddings-v3 | 0.72 (0.71 / 0.74 ) | 0.57 (0.46 / 0.73 ) | 0.65 (0.59 / 0.74 ) | Embedding | |
| sentence-t5-base | 0.73 (0.66 / 0.83 ) | 0.57 (0.42 / 0.89 ) | 0.66 (0.54 / 0.86 ) | Embedding | |
Appendix figures & tables9 assets
Supplementary material from the paper’s appendix.
Appendix
| Motif ID | Motif | +Examples | -Examples | Expression | Conceptual |
|---|---|---|---|---|---|
| J0 | Acquisition and possession of wisdom | 43 | 258 | Simple&Complex | Simple |
| A630.1.1 | Adam created from clay (mud), mud foam (zabad), foam from sea, sea from darkness, darkness from bull, bull from whale, whale from rock, rock from ruby (gem), ruby from water, water from [God’s] Omnipotence (al-Qudrah) | 2 | 192 | Simple&Complex | Complex |
| F1041.15.1 | Addiction as an illness. Adverse effects of excessive consumption of commodity or service (e.g., food, drink, drug, or sex, entertainment, etc.) | 4 | 193 | Simple&Complex | Complex |
| K1514.4.1.1 | Adulteress refuses to admit husband under pretense that he is a stranger. [Husband forgot password] | 1 | 237 | Simple&Complex | Complex |
| K1966 | Alchemist | 11 | 188 | Simple&Complex | Simple |
| A1174.7 | Angel of nights and day | 1 | 279 | Simple&Complex | Simple |
| Motif ID | Motif | +Examples | -Examples | Expression | Conceptual |
|---|---|---|---|---|---|
| D1707.8 | Blessed places | 45 | 389 | Simple&Complex | Simple |
| M224 | Blind promise of immunity from punishment. Person of authority (king, queen, father, etc.) grants request for safety for culprit before learning nature of offense | 2 | 214 | Simple&Complex | Complex |
| T610.2.4 | Boy’s puberty | 12 | 297 | Simple&Complex | Simple |
| T415 | Brother-sister incest | 3 | 253 | Simple&Complex | Simple |
| P448 | Butcher | 40 | 147 | Simple&Complex | Simple |
| K199.2.1 | Buying an item for “Whatever [price] you may say.” Trickster names impossible price (e.g., bushel of fleas of which half are males and half females-or the like) | 9 | 177 | Simple&Complex | Complex |
| A2921.1 | Eblis: born as one of the fourteen children of Khalit and Malit. He disobeyed his father by refusing to marry one of his seven twin-sisters, and was transformed into worm (which became Eblis) | 2 | 194 | Simple&Complex | Complex |
| T320 | Escape from undesired lover | 2 | 190 | Simple&Complex | Simple |
| T33.1 | Faithless woman transforms lovers (husbands) to animals (birds) and keeps them as pets | 8 | 188 | Simple&Complex | Complex |
| F969.7 | Famine | 41 | 156 | Simple&Complex | Simple |
| P140.0.3 | Favor (pardon) won through intercession of person of influence | 29 | 224 | Simple&Complex | Complex |
| L51 | Favorite youngest daughter | 1 | 280 | Simple&Complex | Simple |
| Motif ID | Motif | +Examples | -Examples | Expression | Conceptual |
| F1041.2 | Horripilation. Hair rises on end in extraordinary fashion from joy, anger, or love. | 2 | 194 | Simple&Complex | Complex |
| P414 | Hunter | 65 | 104 | Simple | Simple |
| P12 | Hunting a madness of kings | 14 | 273 | Simple&Complex | Simple |
| K1874.2.1 | Husband driven insane with pseudo-doubles. His private possessions exhibited before him at his workplace, then quickly returned to his home before his arrival (usually via tunnel): he thinks he has seen a double and regrets having suspected his wife | 4 | 228 | Simple&Complex | Complex |
| Motif ID | Motif | +Examples | -Examples | Expression | Conceptual |
| K1534.1 | Husband made to sift dirt. Wife, whose food purchase was replaced with dirt and rocks during her sexual liaison with merchant, claims that she dropped the money on ground and that she brought the dirt home to search for it | 6 | 201 | Simple&Complex | Complex |
| R151 | Husband rescues wife | 1 | 298 | Simple&Complex | Simple |
| D1266 | Magic book | 5 | 406 | Simple&Complex | Simple |
| D1272 | Magic circle | 4 | 392 | Simple&Complex | Simple |
| D1242.0.1 | Magic elixir (nectar) | 21 | 448 | Simple&Complex | Simple |
| D2031 | Magic illusion | 23 | 401 | Simple&Complex | Simple |
| D1071 | Magic jewel (jewels) | 13 | 324 | Simple&Complex | Simple |
| D1254.2 | Magic rod | 24 | 376 | Simple&Complex | Simple |
| D1960 | Magic sleep | 8 | 345 | Simple&Complex | Simple |
| Motif ID | Motif | +Examples | -Examples | Expression | Conceptual |
| K2139 | Poisonous medicine for king: envious man gives king’s barber (doctor, etc.) a supposedly healing substance (actually poison), then he reports to the king that the barber plans to assassinate him with that ‘medicine’ | 4 | 188 | Simple&Complex | Complex |
| P5.3 | Possessions as indicators of social status | 58 | 250 | Simple&Complex | Complex |
| V59.0.1 | Prayers answered especially when gates of sky (heavens) are open | 11 | 185 | Simple&Complex | Complex |
| F679.12.1 | Precious stones (diamonds, emeralds, etc.) retrieved from bottom of inaccessible valley with the help of vultures. (Meat thrown from great heights into valley, stones adhere to meat, vultures carry meat along with stones to valley ridge where miners can collect them) | 5 | 177 | Simple&Complex | Complex |
| J1913.6 | Price of an ‘inexpensive’ article (service) raised through mutually misunderstood gesture (murmur). Owner thinks buyer is ridiculing him by offering too high a price and makes gestures to that effect, but buyer thinks owner thinks offer is too low and raises his offer-(this happens repeatedly) | 8 | 192 | Simple&Complex | Complex |
| L400 | Pride brought low | 17 | 268 | Simple&Complex | Simple |
| Motif ID | Motif | +Examples | -Examples | Expression | Conceptual |
| B811.10.1 | Sacred she-mule | 1 | 635 | Simple&Complex | Simple |
| B811.7 | Sacred wolf | 2 | 352 | Simple&Complex | Simple |
| B71 | Sea horse | 4 | 416 | Simple&Complex | Simple |
| B215.5 | Serpent language | 1 | 468 | Simple&Complex | Simple |
| P234.0.3.1 | Seven daughters | 7 | 358 | Simple&Complex | Simple |
| A874 | Seven strata of earth | 10 | 282 | Simple&Complex | Simple |
| Motif ID | Motif | +Examples | -Examples | Expression | Conceptual |
|---|---|---|---|---|---|
| W290.2 | The good wife (woman): no divorce, no remarriage, no desertion due to vanity (batar), no disagreement with husband, no quittuing of husband’s home to parent’s due to unhappiness (gadbanah) | 10 | 197 | Simple&Complex | Complex |
| K2151.2 | The seemingly dead is abandoned in street and made to look as if leaning against wall: one unsuspecting passer-by after another tries to awaken him and thinks that he caused his death | 3 | 213 | Simple&Complex | Complex |
| K366.1.5 | Theft by trained monkey | 1 | 266 | Simple&Complex | Simple |
| B778.5 | Thieving bird | 7 | 302 | Simple | Simple |
| P234.0.3.1 | Three daughters | 5 | 380 | Simple&Complex | Simple |
| M412 | Time of giving curse | 3 | 299 | Simple&Complex | Simple |
| Motif ID | Motif | +Examples | -Examples | Expression | Conceptual |
|---|---|---|---|---|---|
| B731.11.1 | White viper | 12 | 373 | Simple&Complex | Simple |
| R152 | Wife rescues husband | 5 | 293 | Simple&Complex | Simple |
| T197 | Wife’s relatives (father, brother, etc.) force her divorce from husband without her consent | 5 | 190 | Simple&Complex | Complex |
| B3.3.1 | Winged viper | 2 | 429 | Simple&Complex | Simple |
| B121.7 | Wise tortoise | 7 | 471 | Simple&Complex | Simple |
| D658.3.4 | Women (queen) transforms self to bird (animal) in order to copulate with men she had bewitched into birds (animals) | 8 | 179 | Simple&Complex | Complex |