| |
| """Extract Rhaetic (xrr) and Messapic (cms) lexicons from Wiktionary/scholarly sources. |
| |
| Words are hardcoded from WebFetch of: |
| - Thesaurus Inscriptionum Raeticarum (tir.univie.ac.at) |
| - mnamon.sns.it (Scuola Normale Superiore, Pisa) |
| - Grokipedia / Wikipedia mirrors |
| - Paleoglot blog (paleoglot.blogspot.com) |
| - en-academic.com (Messapian language article) |
| |
| Transliteration→IPA via the existing maps in transliteration_maps.py. |
| SCA encoding via cognate_pipeline's ipa_to_sound_class(). |
| """ |
|
|
| from __future__ import annotations |
|
|
| import sys |
| from pathlib import Path |
|
|
| ROOT = Path(__file__).resolve().parent.parent |
| sys.path.insert(0, str(ROOT / "cognate_pipeline" / "src")) |
| sys.path.insert(0, str(ROOT / "scripts")) |
|
|
| from cognate_pipeline.normalise.sound_class import ipa_to_sound_class |
| from transliteration_maps import transliterate |
|
|
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| RHAETIC_WORDS = [ |
| |
| |
| |
| ("tinake", "made/donated (preterite)"), |
| ("tinakhe", "made/donated (preterite, aspirated variant)"), |
| ("eluku", "sacrificed (participle)"), |
| ("upiku", "offered (participle/verbal noun)"), |
| ("utiku", "given/donated (participle)"), |
| ("trinakhe", "it was poured (passive preterite)"), |
| ("tauke", "perfective preterite verb"), |
| |
| ("akhvil", "present/gift"), |
| ("sphura", "community"), |
| ("vaku", "votive offering"), |
| ("hepru", "artifact/plaque"), |
| ("hil", "property/land"), |
| |
| ("thal", "two"), |
| |
| ("ikh", "thus"), |
| ("khan", "this"), |
| ("ihi", "here/there (locative particle)"), |
| |
| ("taniun", "obscure recurring term"), |
| ("terisna", "obscure, -na suffix"), |
| ("phuter", "noun (plural form)"), |
| ("vinutalina", "wine-bearing"), |
| ("phelna", "name element or noun"), |
| |
| ("reithe", "personal name"), |
| ("muiu", "personal name"), |
| ("kastrie", "personal name"), |
| ("ethunnu", "personal name"), |
| ("tvalos", "personal name"), |
| ("pithamne", "personal name"), |
| ("helanu", "personal name"), |
| ("lasta", "personal name"), |
| ("pithamnu", "personal name (variant)"), |
| ("tvalur", "personal name (variant)"), |
| ("khaisurus", "personal name"), |
| ("enikes", "personal name"), |
| ("laviseseli", "patronymic (of the son of Lavis)"), |
| ("velkhanu", "deity name"), |
| ("lupinu", "dead/crossed over"), |
| ("pitiave", "locative form"), |
| ("kusenkus", "uncertain (artifact descriptor)"), |
| ("avaśuerasi", "for the departed ones"), |
| ("avaśura", "the departed (nom. pl.)"), |
| ("kleimunteis", "to that in this plot"), |
| ("phelturies", "relating to Velturie"), |
| ("klanturus", "uncertain meaning"), |
| |
| ("ka", "and (enclitic)"), |
| |
| ("śaili", "inhabitant"), |
| ] |
|
|
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| MESSAPIC_WORDS = [ |
| |
| |
| |
| ("bilia", "daughter"), |
| ("bennan", "a sort of vehicle"), |
| ("tabara", "priestess"), |
| ("argorapandes", "treasurer/coin magistrate"), |
| ("teuta", "community/people"), |
| ("kalator", "herald"), |
| ("aran", "arable land"), |
| ("brendon", "deer"), |
| ("brention", "place name (Brindisi)"), |
| ("menzana", "colt"), |
| ("dasta", "personal name"), |
| ("morθana", "personal name"), |
| |
| ("apistaθi", "he offers (present indicative 3sg)"), |
| ("hipades", "he dedicated (aorist indicative 3sg)"), |
| ("hadive", "he put/stood (perfect indicative 3sg)"), |
| ("klaohi", "hear (present imperative 3sg)"), |
| ("beran", "let them bring (present conjunctive 3pl)"), |
| ("berain", "they must bring (present optative 3pl)"), |
| ("tepise", "placed/offered (aorist indicative 3sg)"), |
| ("epigravan", "they have offered"), |
| ("rodita", "verb form (from Aphrodite inscription)"), |
| |
| ("penkaheh", "five"), |
| |
| ("toi", "dative masculine article"), |
| ("tai", "dative feminine article"), |
| ("tan", "accusative feminine singular article"), |
| |
| ("ai", "conjunction (hypothetical)"), |
| ("ma", "prohibition particle"), |
| ("apa", "preposition: from"), |
| ("epi", "verbal preposition"), |
| ("kos", "relative pronoun: someone"), |
| ("si", "enclitic conjunction: and"), |
| ("θi", "enclitic conjunction: and"), |
| ("ti", "enclitic conjunction: and"), |
| |
| ("mazzes", "greater"), |
| ("andirahho", "adjective (possibly 'under')"), |
| |
| ("zis", "Zeus (Messapic form)"), |
| ("thautori", "infernal god (related to Tartarus)"), |
| ("aprodita", "Aphrodite (loanword from Greek)"), |
| |
| ("artorres", "personal name"), |
| ("blatθes", "personal name"), |
| ("dazimas", "personal name"), |
| ("dekias", "personal name"), |
| ("artahias", "patronym/nomen gentile"), |
| |
| ("tabaras", "genitive of tabara"), |
| ("logetibas", "theonym (dative plural)"), |
| ] |
|
|
|
|
| def build_tsv_rows( |
| words: list[tuple[str, str]], |
| iso: str, |
| ) -> list[str]: |
| """Convert word list to TSV rows: Word, IPA, SCA, Source, Concept_ID, Cognate_Set_ID.""" |
| rows = [] |
| errors = [] |
| for translit, gloss in words: |
| try: |
| ipa = transliterate(translit, iso) |
| sca = ipa_to_sound_class(ipa) |
| if not sca: |
| errors.append(f" WARN: empty SCA for {translit!r} -> IPA={ipa!r}") |
| sca = "?" |
| rows.append(f"{translit}\t{ipa}\t{sca}\twiktionary\t{gloss}\t-") |
| except Exception as exc: |
| errors.append(f" ERROR: {translit!r}: {exc}") |
| return rows, errors |
|
|
|
|
| def main(): |
| outdir = ROOT / "data" / "training" / "lexicons" |
| outdir.mkdir(parents=True, exist_ok=True) |
|
|
| header = "Word\tIPA\tSCA\tSource\tConcept_ID\tCognate_Set_ID" |
| total_errors = [] |
|
|
| |
| xrr_rows, xrr_errors = build_tsv_rows(RHAETIC_WORDS, "xrr") |
| xrr_path = outdir / "xrr.tsv" |
| with open(xrr_path, "w", encoding="utf-8") as f: |
| f.write(header + "\n") |
| for row in xrr_rows: |
| f.write(row + "\n") |
| print(f"Rhaetic (xrr): {len(xrr_rows)} entries -> {xrr_path}") |
| if xrr_errors: |
| total_errors.extend(["Rhaetic errors:"] + xrr_errors) |
|
|
| |
| cms_rows, cms_errors = build_tsv_rows(MESSAPIC_WORDS, "cms") |
| cms_path = outdir / "cms.tsv" |
| with open(cms_path, "w", encoding="utf-8") as f: |
| f.write(header + "\n") |
| for row in cms_rows: |
| f.write(row + "\n") |
| print(f"Messapic (cms): {len(cms_rows)} entries -> {cms_path}") |
| if cms_errors: |
| total_errors.extend(["Messapic errors:"] + cms_errors) |
|
|
| |
| print() |
| if total_errors: |
| print("ERRORS/WARNINGS:") |
| for e in total_errors: |
| print(e) |
| else: |
| print("No errors.") |
|
|
| |
| import io, sys as _sys |
| _sys.stdout = io.TextIOWrapper(_sys.stdout.buffer, encoding="utf-8", errors="replace") |
| print("\n--- Rhaetic sample ---") |
| for row in xrr_rows[:5]: |
| print(row) |
| print("\n--- Messapic sample ---") |
| for row in cms_rows[:5]: |
| print(row) |
|
|
|
|
| if __name__ == "__main__": |
| main() |
|
|