Thompson Motif Index
Contents
Thompson Motif Index#
Katja Mellmann: Thompson’s Motif-Index as CSV File (version 1.2). Open Science Framework (OSF), 2020. DOI: 10.17605/OSF.IO/XEB67 (https://osf.io/xeb67/), also available via https://github.com/KatjaMellmann/TMI_as_CSV/, provides a handy lookup reference for the Thompson Motif index.
import pandas as pd
thompson_motif_df = pd.read_csv("https://github.com/KatjaMellmann/TMI_as_CSV/blob/main/tmi.csv?raw=true")
thompson_motif_df.fillna("", inplace=True)
thompson_motif_df.head()
code | [sorting field] | 1st ed. | chapter | division1 | division2 | division3 | section ("tens") | MOTIF | bibliographies | |
---|---|---|---|---|---|---|---|---|---|---|
0 | A0 | A0000 | A0 | A. Mythological motifs. | A0–A99. Creator. | A0. Creator. | A0. Creator. | For a general bibliography of creation myths, ... | ||
1 | A1 | A0001 | A. Mythological motifs. | A0–A99. Creator. | A0. Creator. | A1. Identity of creator. | ||||
2 | A1.1 | A0001.1 | A1 | A. Mythological motifs. | A0–A99. Creator. | A0. Creator. | A1.1. Sun-god as creator. | Egyptian: Müller 69; Persian: Carnoy 260. | ||
3 | A1.2 | A0001.2 | A. Mythological motifs. | A0–A99. Creator. | A0. Creator. | A1.2. Grandfather as creator. | S. Am. Indian (Paressi): Métraux BBAE CXLIII (... | |||
4 | A1.3 | A0001.3 | A. Mythological motifs. | A0–A99. Creator. | A0. Creator. | A1.3. Stone-woman as creator. | Paressi: Métraux BBAE CXLIII (3) 359. |
Tidy up some of the column names:
thompson_motif_df.rename(columns={"[sorting field]": "sortfield",
'section ("tens")': "section10s"}, inplace=True)
thompson_motif_df
code | sortfield | 1st ed. | chapter | division1 | division2 | division3 | section10s | MOTIF | bibliographies | |
---|---|---|---|---|---|---|---|---|---|---|
0 | A0 | A0000 | A0 | A. Mythological motifs. | A0–A99. Creator. | A0. Creator. | A0. Creator. | For a general bibliography of creation myths, ... | ||
1 | A1 | A0001 | A. Mythological motifs. | A0–A99. Creator. | A0. Creator. | A1. Identity of creator. | ||||
2 | A1.1 | A0001.1 | A1 | A. Mythological motifs. | A0–A99. Creator. | A0. Creator. | A1.1. Sun-god as creator. | Egyptian: Müller 69; Persian: Carnoy 260. | ||
3 | A1.2 | A0001.2 | A. Mythological motifs. | A0–A99. Creator. | A0. Creator. | A1.2. Grandfather as creator. | S. Am. Indian (Paressi): Métraux BBAE CXLIII (... | |||
4 | A1.3 | A0001.3 | A. Mythological motifs. | A0–A99. Creator. | A0. Creator. | A1.3. Stone-woman as creator. | Paressi: Métraux BBAE CXLIII (3) 359. | |||
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
46297 | Z352 | Z0352 | Z352 | Z. Miscellaneous groups of motifs. | Z300–Z399. Unique exceptions | Z350. Other unique exceptions. | Z352. All trees except aspen refuse to make Ch... | Dh II 209; North Carolina: Brown Collection I ... | ||
46298 | Z355 | Z0355 | Z355 | Z. Miscellaneous groups of motifs. | Z300–Z399. Unique exceptions | Z350. Other unique exceptions. | Z355. All snakes but one placated by music. In... | Hdwb. d. Märchens I 437a. | ||
46299 | Z356 | Z0356 | Z. Miscellaneous groups of motifs. | Z300–Z399. Unique exceptions | Z350. Other unique exceptions. | Z356. Unique survivor. Only one person left fr... | India: *Thompson-Balys; Hawaii: Beckwith Myth ... | |||
46300 | Z356.1 | Z0356.1 | Z. Miscellaneous groups of motifs. | Z300–Z399. Unique exceptions | Z350. Other unique exceptions. | Z56.1 Unique survivor from detruction of animals | India: *Thompson-Balys. | |||
46301 | Z357 | Z0357 | Z. Miscellaneous groups of motifs. | Z300–Z399. Unique exceptions | Z350. Other unique exceptions. | Z357. Unique exceptions from curse. | Irish myth: *Cross. |
46302 rows × 10 columns
We can also process it further to extract out the codes (we really should combine the following so we only iterate through the whole dataset once):
def motif_splitter(cell):
"""Split out motif label."""
if cell:
parts = cell.split()
return pd.Series({"motif_label": " ".join(parts[1:]).strip(".")})
return pd.Series({"motif_label":''})
thompson_motif_df[["motif_label"]] = thompson_motif_df["MOTIF"].apply(motif_splitter)
thompson_motif_df.head()
code | sortfield | 1st ed. | chapter | division1 | division2 | division3 | section10s | MOTIF | bibliographies | motif_label | |
---|---|---|---|---|---|---|---|---|---|---|---|
0 | A0 | A0000 | A0 | A. Mythological motifs. | A0–A99. Creator. | A0. Creator. | A0. Creator. | For a general bibliography of creation myths, ... | Creator | ||
1 | A1 | A0001 | A. Mythological motifs. | A0–A99. Creator. | A0. Creator. | A1. Identity of creator. | Identity of creator | ||||
2 | A1.1 | A0001.1 | A1 | A. Mythological motifs. | A0–A99. Creator. | A0. Creator. | A1.1. Sun-god as creator. | Egyptian: Müller 69; Persian: Carnoy 260. | Sun-god as creator | ||
3 | A1.2 | A0001.2 | A. Mythological motifs. | A0–A99. Creator. | A0. Creator. | A1.2. Grandfather as creator. | S. Am. Indian (Paressi): Métraux BBAE CXLIII (... | Grandfather as creator | |||
4 | A1.3 | A0001.3 | A. Mythological motifs. | A0–A99. Creator. | A0. Creator. | A1.3. Stone-woman as creator. | Paressi: Métraux BBAE CXLIII (3) 359. | Stone-woman as creator |
def chapter_splitter(cell):
"""Split out Chapter label."""
if cell:
parts = cell.split()
return pd.Series({"chapter_label": " ".join(parts[1:]).strip(".")})
return pd.Series({"chapter_label":''})
thompson_motif_df[["chapter_label"]] = thompson_motif_df["chapter"].apply(chapter_splitter)
thompson_motif_df.head()
code | sortfield | 1st ed. | chapter | division1 | division2 | division3 | section10s | MOTIF | bibliographies | motif_label | chapter_label | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | A0 | A0000 | A0 | A. Mythological motifs. | A0–A99. Creator. | A0. Creator. | A0. Creator. | For a general bibliography of creation myths, ... | Creator | Mythological motifs | ||
1 | A1 | A0001 | A. Mythological motifs. | A0–A99. Creator. | A0. Creator. | A1. Identity of creator. | Identity of creator | Mythological motifs | ||||
2 | A1.1 | A0001.1 | A1 | A. Mythological motifs. | A0–A99. Creator. | A0. Creator. | A1.1. Sun-god as creator. | Egyptian: Müller 69; Persian: Carnoy 260. | Sun-god as creator | Mythological motifs | ||
3 | A1.2 | A0001.2 | A. Mythological motifs. | A0–A99. Creator. | A0. Creator. | A1.2. Grandfather as creator. | S. Am. Indian (Paressi): Métraux BBAE CXLIII (... | Grandfather as creator | Mythological motifs | |||
4 | A1.3 | A0001.3 | A. Mythological motifs. | A0–A99. Creator. | A0. Creator. | A1.3. Stone-woman as creator. | Paressi: Métraux BBAE CXLIII (3) 359. | Stone-woman as creator | Mythological motifs |
def section_tens_splitter(cell):
"""Split out section(10s) Label and code."""
if cell:
parts = cell.split()
return pd.Series({"section10s_label": " ".join(parts[1:]).strip(".")})
return pd.Series({"section10s_label":''})
thompson_motif_df[["section10s_label"]] = thompson_motif_df['section10s'].apply(section_tens_splitter)
thompson_motif_df.head()
code | sortfield | 1st ed. | chapter | division1 | division2 | division3 | section10s | MOTIF | bibliographies | motif_label | chapter_label | section10s_label | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | A0 | A0000 | A0 | A. Mythological motifs. | A0–A99. Creator. | A0. Creator. | A0. Creator. | For a general bibliography of creation myths, ... | Creator | Mythological motifs | Creator | ||
1 | A1 | A0001 | A. Mythological motifs. | A0–A99. Creator. | A0. Creator. | A1. Identity of creator. | Identity of creator | Mythological motifs | Creator | ||||
2 | A1.1 | A0001.1 | A1 | A. Mythological motifs. | A0–A99. Creator. | A0. Creator. | A1.1. Sun-god as creator. | Egyptian: Müller 69; Persian: Carnoy 260. | Sun-god as creator | Mythological motifs | Creator | ||
3 | A1.2 | A0001.2 | A. Mythological motifs. | A0–A99. Creator. | A0. Creator. | A1.2. Grandfather as creator. | S. Am. Indian (Paressi): Métraux BBAE CXLIII (... | Grandfather as creator | Mythological motifs | Creator | |||
4 | A1.3 | A0001.3 | A. Mythological motifs. | A0–A99. Creator. | A0. Creator. | A1.3. Stone-woman as creator. | Paressi: Métraux BBAE CXLIII (3) 359. | Stone-woman as creator | Mythological motifs | Creator |
def section_division1_splitter(cell):
"""Split out division1 Label and code."""
if cell:
parts = cell.split()
return pd.Series({"division1_code": parts[0].strip("."),
"division1_label": " ".join(parts[1:]).strip(".")})
return pd.Series({"division1_code":'', "division1_label":''})
thompson_motif_df[["division1_code", "division1_label"]] = thompson_motif_df['division1'].apply(section_division1_splitter)
thompson_motif_df.head()
code | sortfield | 1st ed. | chapter | division1 | division2 | division3 | section10s | MOTIF | bibliographies | motif_label | chapter_label | section10s_label | division1_code | division1_label | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | A0 | A0000 | A0 | A. Mythological motifs. | A0–A99. Creator. | A0. Creator. | A0. Creator. | For a general bibliography of creation myths, ... | Creator | Mythological motifs | Creator | A0–A99 | Creator | ||
1 | A1 | A0001 | A. Mythological motifs. | A0–A99. Creator. | A0. Creator. | A1. Identity of creator. | Identity of creator | Mythological motifs | Creator | A0–A99 | Creator | ||||
2 | A1.1 | A0001.1 | A1 | A. Mythological motifs. | A0–A99. Creator. | A0. Creator. | A1.1. Sun-god as creator. | Egyptian: Müller 69; Persian: Carnoy 260. | Sun-god as creator | Mythological motifs | Creator | A0–A99 | Creator | ||
3 | A1.2 | A0001.2 | A. Mythological motifs. | A0–A99. Creator. | A0. Creator. | A1.2. Grandfather as creator. | S. Am. Indian (Paressi): Métraux BBAE CXLIII (... | Grandfather as creator | Mythological motifs | Creator | A0–A99 | Creator | |||
4 | A1.3 | A0001.3 | A. Mythological motifs. | A0–A99. Creator. | A0. Creator. | A1.3. Stone-woman as creator. | Paressi: Métraux BBAE CXLIII (3) 359. | Stone-woman as creator | Mythological motifs | Creator | A0–A99 | Creator |
We can add this table directly to a simple database. First, create the database:
from sqlite_utils import Database
db_name = "motifs_demo.db"
# While developing the script, recreate database each time...
db = Database(db_name, recreate=True)
Now add the dataframe to the database as a databse table:
#db["motifs_km"].drop()
#db["motifs_km_fts"].drop()
db["motifs_km"].create({
"code": str,
"sortfield": str,
"1st ed.": str,
"chapter": str,
"division1": str,
"division2": str,
"division3": str,
"section10s": str,
"MOTIF": str,
"bibliographies": str,
"motif_label": str,
"chapter_label": str,
"section10s_label": str,
"division1_code": str,
"division1_label": str,
})
# Create a full text search table to improve search support
db["motifs_km"].enable_fts(["bibliographies", "motif_label", "sortfield"], create_triggers=True, tokenize="porter")
db["motifs_km"].insert_all(thompson_motif_df.to_dict(orient="records"))
#thompson_motif_df.to_sql("motifs_km", index=False, if_exists="replace", con=db.conn)
<Table motifs_km (code, sortfield, 1st ed., chapter, division1, division2, division3, section10s, MOTIF, bibliographies, motif_label, chapter_label, section10s_label, division1_code, division1_label)>
And query:
from pandas import read_sql
q = "SELECT * FROM motifs_km_fts LIMIT 3"
read_sql(q, db.conn)
bibliographies | motif_label | sortfield | |
---|---|---|---|
0 | For a general bibliography of creation myths, ... | Creator | A0000 |
1 | Identity of creator | A0001 | |
2 | Egyptian: Müller 69; Persian: Carnoy 260. | Sun-god as creator | A0001.1 |
# FTS search
q = f"""
SELECT motifs_km_fts.* FROM motifs_km_fts
WHERE motifs_km_fts MATCH {db.quote('cockroach')};
"""
read_sql(q, db.conn)
bibliographies | motif_label | sortfield | |
---|---|---|---|
0 | India: Thompson-Balys. | Creation of cockroach | A2061 |
1 | Finnish: Aarne FFC VIII 22 No. 125. | Origin of cockroach in Finland | A2061.1 |
2 | India: Thompson-Balys. | Why cockroaches live in houses | A2433.5.7 |
3 | Antigua: Johnson JAFL XXXIV 66. | Enmity between fowl and cockroach | A2494.13.03 |
4 | India: Thompson-Balys. | Wedding of mouse and cockroach | B0281.02.2 |
5 | India: Thompson-Balys. | Wedding of rat and cockroach | B0281.11.1 |
6 | India: Thompson-Balys. | Wedding of cockroach and rat | B0285.8 |
7 | India: Thompson-Balys. | Magic whistle gives life to cockroach. (Cf. D1... | D1594.6 |
MOMFER - Meerten online motif finder#
The MOMFER - Meerten online motif finder, http://www.momfer.ml, is an online search engine over motifs.
Source code and related data files appear to be available at: https://github.com/fbkarsdorp/tmi TMI: Interface on Thompson’s Motif Index”.
See also:
Folgert Karsdorp, Marten van der Meulen, Theo Meder, Antal van den Bosch: MOMFER. A Search Engine of Thompson’s Motif-Index of Folk Literature. In: Folklore 126 (2015), no. 1, 37–52. https://doi.org/10.1080/0015587X.2015.1006954 ]
Thierry Declerck, Antónia Kostová, Lisa Schäfer: Linked Data Access to Folktales classified by Thompson’s Motifs and Aarne-Thompson-Uther’s Types. In: Rhian Lewis et al. (Eds.): Digital Humanities 2017 (DH2017), Montréal, August 8-11, 2017, Conference Abstracts. Montréal: ADHO, https://dh2017.adho.org/abstracts/465/465.pdf
https://www.dfki.de/fileadmin/user_upload/import/9028_Dh2017_LOD_TMI-ATU_final.pdf
The json data in the repository looks very reminiscent of Katja Mellmann’s Thompson’s Motif-Index as CSV File although there does appear to be some additional data, suc as the locations
field:
import requests
momfer_json = requests.get("https://github.com/fbkarsdorp/tmi/blob/master/data/tmi.json?raw=true")
print(momfer_json.text[:1500])
[
{
"motif": "A0",
"description": "Creator.",
"lemmas": [
"creator"
],
"locations": [
"Ireland",
"Mexico",
"Africa",
"India",
"Loango",
"Polynesia",
"United States",
"Armenia",
"Tahiti"
],
"additional_description": "",
"references": "For a general bibliography of creation myths, see Alexander N. Am. 278 n. 15. For bibliographies of North American Indian mythologies arranged by areas, see Thompson Tales 272 n. 1; **Feilberg Skabelses og Syndflodssagn; Jewish: Neuman. Mexican Indian: (Tarascan) Alexander Lat. Am. Armenian: Ananikian 20; African: Werner African 127ff., **Frobenius and Fox, (Loango): Pechul l-Loesche 267; Hindu: Penzer I 10; Buddhist myth: Malalasekera II 338; Icel.: Boberg, MacCulloch Eddic 326; Irish myth: Cross."
},
{
"motif": "A1",
"description": "Identity of creator.",
"lemmas": [
"identity",
"creator"
],
"locations": [],
"additional_description": "",
"references": ""
},
{
"motif": "A1.1",
"description": "Sun-god as creator.",
"lemmas": [
"sun-god",
"creator"
],
"locations": [
"Egypt"
],
"additional_description": "",
"references": "Egyptian: M' ller 69; P
momfer_json.json()[0]
{'motif': 'A0',
'description': 'Creator.',
'lemmas': ['creator'],
'locations': ['Ireland',
'Mexico',
'Africa',
'India',
'Loango',
'Polynesia',
'United States',
'Armenia',
'Tahiti'],
'additional_description': '',
'references': 'For a general bibliography of creation myths, see Alexander N. Am. 278 n. 15. For bibliographies of North American Indian mythologies arranged by areas, see Thompson Tales 272 n. 1; **Feilberg Skabelses og Syndflodssagn; Jewish: Neuman. Mexican Indian: (Tarascan) Alexander Lat. Am. Armenian: Ananikian 20; African: Werner African 127ff., **Frobenius and Fox, (Loango): Pechul l-Loesche 267; Hindu: Penzer I 10; Buddhist myth: Malalasekera II 338; Icel.: Boberg, MacCulloch Eddic 326; Irish myth: Cross.'}
tmi_data = requests.get("https://github.com/fbkarsdorp/tmi/blob/master/data/tmi-cleaned.txt?raw=true")
print(tmi_data.text[:1500])
A0. Creator.
A1. Identity of creator.
A1.1. Sun-god as creator.
A1.2. Grandfather as creator.
A1.3. Stone-woman as creator.
A1.4. Brahma as creator.
A2. Multiple creators.
A2.1. Three creators.
A2.2. First human pair as creators.
A3. Creative mother source of everything.
A5. Reason for creation.
A5.1. Gods make earth to have place to rest their feet.
A7. Creator's descendants.
A7.1. Creator has two sons.
A10. Nature of the creator.
A11. Invisible creator.
A11.1. Invisibility of creator learned from the impossibility of staring at the sun, his servant.
A12. Hermaphroditic creator.
A12.1. Male and female creators.
A13. Animal as creator.
A13.1. Beast as creator.
A13.1.1. Cow as creator.
A13.2. Bird as creator.
A13.2.1. Raven as creator.
A13.2.2. Eagle as creator of man.
A13.2.3. Black-winged bird as creator.
A13.3. Insect as creator.
A13.3.1. Spider as creator.
A13.3.2. Beetle as creator.
A13.4. Reptile as creator.
A13.4.1. Snake as creator.
A13.4.2. Worm as creator.
A15. Human creator.
A15.1. Female creator.
A15.1.1. Old woman as creator.
A15.2. Brothers as creators.
A15.3. Old man as creator.
A15.3.1. Old man with staff as creator.
A15.4. Artisan as creator.
A15.4.1. Potter as creator.
A17. Angel as creator.
A18. Pictorial representations of creator.
A18.1. Creator with dragon's head.
A18.2. Creator with two horns on head.
A18.3. Dwarfish creator.
A18.4. Creator clothed in bear-skin (or in leaves).
A18.5. Creator with hammer and chisel in hands.
A18.6. Creator with sun and mo