|
|
| Line 2: |
Line 2: |
|
| |
|
| local m_u = require('Module:utilities') | | local m_u = require('Module:utilities') |
| local m_data = require('Module:siwa-noun/data') | | local m_data = require('Module:siwa-noun/common') |
|
| |
|
| local sub = mw.ustring.sub | | local sub = mw.ustring.sub |
| Line 12: |
Line 12: |
| local gsplit = mw.text.gsplit | | local gsplit = mw.text.gsplit |
|
| |
|
| local pagename = mw.title.getCurrentTitle().text | | local PAGENAME = mw.title.getCurrentTitle().text |
| local vowels = "[aeiouyůõảẻỉỏủỷę̊]" | | local vowels = "[aeiouyůõảẻỉỏủỷę̊]" |
| local consonants = "[mpbvntdsṡʦʨʥŋɲcɟħðrṁṅḥkgġhłƛɬḍ]" | | local consonants = "[mpbvntdsṡʦʨʥŋɲcɟħðrṁṅḥkgġhłƛɬḍ]" |
|
| |
| local stressed_vowels = {
| |
| ["ả"] = "a", ["a[ui]"] = "a", ["oa"] = "a", ["[eẻę]"] = "e", ["e[iu]"] = "e",
| |
| ["ay"] = "e", ["[iỉ]"] = "i", ["i[aeou]"] = "i", ["[oỏõ]"] = "o", ["[oõ]u"] = "o",
| |
| ["oi"] = "o", ["[uủ]"] = "u", ["u[oi]"] = "u", ["[yỷ]"] = "y", ["ů[ai]?"] = "y", ["ẻu"] = "y", ["ey"] = "y",
| |
| }
| |
|
| |
| local digraphs_to_single = {
| |
| ["ts"] = "ʦ", ["tṡ"] = "ʨ", ["dį"] = "ʥ", ["ng"] = "ŋ", ["nį"] = "ɲ",
| |
| ["kį"] = "c", ["gį"] = "ɟ", ["hh"] = "ħ", ["ḍḍ"] = "ð", ["dl"] = "ɬ", ["o̊"] = "ȯ"
| |
| }
| |
|
| |
| local lenition_patterns = {
| |
| ["bb"] = "b", ["dd"] = "d", ["gg"] = "g", ["ɟ"] = "į", ["mm"] = "m", ["ll"] = "l", ["nn"] = "n",
| |
| ["rr"] = "r", ["bġ"] = "p", ["pr"] = "p", ["dġ"] = "t", ["tr"] = "t", ["ḍb"] = "p", ["ð"] = "hh",
| |
| ["ḍg"] = "k", ["bm"] = "m", ["dn"] = "n", ["kn"] = "ng", ["([lr])pp"] = "%1p", ["([lr])tt"] = "%1t", ["([lrms])kk"] = "%1k",
| |
| ["k([lvs])"] = "g%1", ["ps"] = "bs", ["[vųbhḥg]"] = "", ["d[aou]"] = "l", ["ġ[aou]"] = "vv", ["[dġ][eůy]"] = "", ["[rġ]i"] = "ṡi",
| |
| ["di"] = "", ["ɲi"] = "ɟi", ["ħį"] = "ṡ", ["[ou]ų"] = "ů", ["ɬ"] = "l",
| |
| }
| |
|
| |
| local endings
| |
| endings["a"] = {
| |
| ["m"] = "i-a-mV", ["n"] = "i-a-nV", ["p"] = "i-a-pV", ["b"] = "i-a-bV", ["t"] = "i-a-tV",
| |
| ["r"] = "i-a-rV", ["vv"] = "i-a-vvV", ["lk"] = "i-a-CkV", ["rk"] = "i-a-CkV", ["sk"] = "i-a-CkV",
| |
| }
| |
|
| |
| endings["e"] = {
| |
| ["na"] = "i-e-na/e", ["ne"] = "i-e-na/e", ["ba"] = "i-e-ba/e", ["be"] = "i-e-ba/e",
| |
| ["ka"] = "i-e-ka/e", ["ke"] = "i-e-ka/e", ["ma"] = "i-e-ma/e", ["me"] = "i-e-ma/e",
| |
| ["va"] = "i-e-va/e", ["ve"] = "i-e-va/e", ["tsa"] = "i-e-tsa/e", ["tse"] = "i-e-tsa/e",
| |
| ["ta"] = "i-e-ta/e", ["te"] = "i-e-ta/e", ["sa"] = "i-e-sa/e", ["se"] = "i-e-sa/e",
| |
| ["la"] = "i-e-la/e", ["le"] = "i-e-la/e", ["ha"] = "i-e-ha/e", ["he"] = "i-e-ha/e",
| |
| ["ġa"] = "i-e-ha/e", ["ġe"] = "i-e-ha/e", ["a"] = "i-e-a/e", ["e"] = "i-e-a/e",
| |
| ["mi"] = "i-e-mi", ["pi"] = "i-e-p/bi", ["bi"] = "i-e-p/bi", ["vi"] = "i-e-vi",
| |
| ["ni"] = "i-e-ni", ["ri"] = "i-e-ri", ["li"] = "i-e-li", ["ki"] = "i-e-k/gi",
| |
| ["gi"] = "i-e-k/gi", ["i"] = "i-e-i", ["o"] = "i-e-o",
| |
| ["mu"] = "i-e-m/nU", ["my"] = "i-e-m/nU", ["mů"] = "i-e-m/nU", -- U = front vowel
| |
| ["nu"] = "i-e-m/nU", ["ny"] = "i-e-m/nU", ["nů"] = "i-e-m/nU",
| |
| ["ku"] = "i-e-kU", ["ky"] = "i-e-kU", ["ků"] = "i-e-kU",
| |
| ["u"] = "i-e-U", ["y"] = "i-e-U", ["ů"] = "i-e-U",
| |
| }
| |
|
| |
| endings["i"] = {
| |
| ["m"] = "i-i-mV", ["n"] = "i-i-nV", ["um"] = "i-i-u/om/n", ["om"] = "i-i-u/om/n", ["un"] = "i-i-u/om/n", ["on"] = "i-i-u/om/n",
| |
| ["v"] = "i-i-vV", ["g"] = "i-i-gV", ["s"] = "i-i-gV", ["r"] = "i-i-rV", ["h"] = "i-i-hV", ["k"] = "i-i-kV",
| |
| ["l"] = "i-i-lV", ["i"] = "i-i-i", -- else -V
| |
| }
| |
|
| |
| endings["o"] = {
| |
| ["ba"] = "i-o-b/ta/e", ["be"] = "i-o-b/ta/e", ["ta"] = "i-o-b/ta/e", ["te"] = "i-o-b/ta/e",
| |
| ["va"] = "i-o-v/m/na/e", ["ve"] = "i-o-v/m/na/e", ["ma"] = "i-o-v/m/na/e",
| |
| ["me"] = "i-o-v/m/na/e", ["na"] = "i-o-v/m/na/e", ["ne"] = "i-o-v/m/na/e",
| |
| ["ra"] = "i-o-r/h/ga/e", ["re"] = "i-o-r/h/ga/e", ["ha"] = "i-o-r/h/ga/e", ["he"] = "i-o-r/h/ga/e",
| |
| ["ga"] = "i-o-r/h/ga/e", ["ge"] = "i-o-r/h/ga/e", ["ka"] = "i-o-ka/e", ["ke"] = "i-o-ka/e", ["la"] = "i-o-la/e",
| |
| ["le"] = "i-o-la/e", ["mi"] = "i-o-m/n/k/gi", ["ni"] = "i-o-m/n/k/gi", ["ki"] = "i-o-m/n/k/gi", ["gi"] = "i-o-m/n/k/gi",
| |
| ["lki"] = "i-o-lki", ["rki"] = "i-o-rki", ["ski"] = "i-o-ski", ["sġi"] = "i-o-ski", ["li"] = "i-o-li",
| |
| ["ri"] = "i-o-r/hi", ["hi"] = "i-o-r/hi", ["ṡi"] = "i-o-ṡi", ["hhįi"] = "i-o-ṡi",
| |
| ["b"] = "i-o-b/p/t/dV", ["p"] = "i-o-b/p/t/dV", ["t"] = "i-o-b/p/t/dV", ["d"] = "i-o-b/p/t/dV", ["v"] = "i-o-v/m/nV",
| |
| ["m"] = "i-o-v/m/nV", ["n"] = "i-o-v/m/nV", ["r"] = "i-o-r/h/g/kV", ["h"] = "i-o-r/h/g/kV", ["g"] = "i-o-r/h/g/kV",
| |
| ["k"] = "i-o-r/h/g/kV", ["l"] = "i-o-lV", ["a"] = "i-o-a/e", ["e"] = "i-o-a/e", ["i"] = "i-o-i", --else -u/o/y/ů
| |
| }
| |
|
| |
|
| local function dedigraphize(word) | | local function dedigraphize(word) |
| for digraph, repl in pairs(digraphs_to_single) do | | for digraph, repl in pairs(m_data.digraphs_to_single) do |
| word = gsub(word, digraph, repl) | | word = gsub(word, digraph, repl) |
| end | | end |
| Line 131: |
Line 70: |
| local lenited = "" | | local lenited = "" |
| local _, c = stressed_components(word) | | local _, c = stressed_components(word) |
| for regex, repl in pairs(lenition_patterns) do | | for regex, repl in pairs(m_data.lenition_patterns) do |
| lenited = gsub(c, regex, repl, 1) | | lenited = gsub(c, regex, repl, 1) |
| end | | end |
| Line 145: |
Line 84: |
| | | |
| local decl_type = "i-a-s" | | local decl_type = "i-a-s" |
| local gender, word = parent_args[1], parent_args[2]~=nil and dedigraphize(parent_args[2]) or dedigraphize(pagename) | | local gender, word = parent_args[1], parent_args[2]~=nil and dedigraphize(parent_args[2]) or dedigraphize(PAGENAME) |
| local quality = parent_args[3]~=nil and parent_args[3] or detect_quality(word) | | local quality = parent_args[3]~=nil and parent_args[3] or detect_quality(word) |
| | | |
| args = require("Module:parameters").process(parent_args, m_data[decl_type].params, true) | | args = require("Module:parameters").process(parent_args, m_data[decl_type].params, true) |
| | | |
| local prefix = sub(pagename, 1, -(#word+1)) | | local prefix = sub(PAGENAME, 1, -(#word+1)) |
| | | |
| return stressed_components(word) .. " " .. lenition(word) | | return stressed_components(word) .. " " .. lenition(word) |