Module:siwa-noun/data: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 7: Line 7:
local ce = {"a", "ta", "ka", "ma", "bma", "ska"}
local ce = {"a", "ta", "ka", "ma", "bma", "ska"}


local function lenition(word)
local m_com = require('Module:siwa-noun/common')
local lenition_patterns = {
[v.."[vųbhḥg]"..v] = "%1%2", ["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",  ["d[aou]"] = "l", ["ġ[aou]"] = "vv", ["[dġ][eůy]"] = "", ["[rġ]i"] = "ṡi",
["di"] = "", ["ɲi"] = "ɟi", ["ħį"] = "ṡ", ["[ou]ų"] = "ů", ["ɬ"] = "l",
}
for regex, repl in ipairs(lenition_patterns) do
word = mw.ustring.gsub(word, regex, repl)
end
--word = mw.ustring.gsub(word, v.."[vųbhḥg]"..v, "%1%2")
return word
end


local data = {}
local data = {}
Line 32: Line 17:
}
}
setmetatable(data["a"], {__call = function(self, args, data)
setmetatable(data["a"], {__call = function(self, args, data)
local stem = args.nolen and data.head or lenition(data.head)
local stem = args.nolen and data.head or m_com.lenition(data.head)
local s2, s3 = sub(stem, 1, -3), sub(stem, 1, -4)
local s2, s3 = sub(stem, 1, -3), sub(stem, 1, -4)
table.insert(data.categories, "Siwa a-declension nouns")
table.insert(data.categories, "Siwa a-declension nouns")
Line 69: Line 54:
loc = s2 .. "ki"
loc = s2 .. "ki"
else
else
data.forms["m"] = {lenition(stem) .. "ka"}
data.forms["m"] = {stem .. "ka"}
loc = lenition(stem) .. "ki"
loc = stem .. "ki"
end
end
Line 99: Line 84:
}
}
setmetatable(data["e"], {__call = function(self, args, data)
setmetatable(data["e"], {__call = function(self, args, data)
local stem = args.nolen and data.head or lenition(data.head)
local stem = args.nolen and data.head or m_com.lenition(data.head)
local s1, s2, s3 = sub(stem, 1, -2), sub(stem, 1, -3), sub(stem, 1, -4)
local s1, s2, s3 = sub(stem, 1, -2), sub(stem, 1, -3), sub(stem, 1, -4)
table.insert(data.categories, "Siwa e-declension nouns")
table.insert(data.categories, "Siwa e-declension nouns")
Line 142: Line 127:
loc = s2 .. "ġġi"
loc = s2 .. "ġġi"
else
else
data.forms["m"] = {lenition(stem) .. "ri"}
data.forms["m"] = {stem .. "ri"}
loc = lenition(stem) .. "ri"
loc = stem .. "ri"
end
end
elseif stem:match("[io]$") then
elseif stem:match("[io]$") then
Line 172: Line 157:
loc = s2 .. (data.q == "s" and "gme" or "hme")
loc = s2 .. (data.q == "s" and "gme" or "hme")
else
else
data.forms["m"] = {lenition(stem) .. "me"}
data.forms["m"] = {stem .. "me"}
loc = lenition(stem) .. "mei"
loc = stem .. "mei"
end
end
end
end
Line 199: Line 184:
}
}
setmetatable(data["i"], {__call = function(self, args, data)
setmetatable(data["i"], {__call = function(self, args, data)
local stem = args.nolen and data.head or lenition(data.head)
local stem = args.nolen and data.head or m_com.lenition(data.head)
local s1, s2, s3 = sub(stem, 1, -2), sub(stem, 1, -3), sub(stem, 1, -4)
local s1, s2, s3 = sub(stem, 1, -2), sub(stem, 1, -3), sub(stem, 1, -4)
table.insert(data.categories, "Siwa i-declension nouns")
table.insert(data.categories, "Siwa i-declension nouns")
Line 236: Line 221:
table.insert(data.forms["ine"], s1 .. "ỉa")
table.insert(data.forms["ine"], s1 .. "ỉa")
else
else
data.forms["m"] = {lenition(stem) .. "di"}
data.forms["m"] = {stem .. "di"}
ill, ela, ade = lenition(stem) .. "h", lenition(stem) .. "h", lenition(stem) .. "h"
ill, ela, ade = stem .. "h", stem .. "h", stem .. "h"
all, abl = lenition(stem) .. "i", lenition(stem) .. "i"
all, abl = stem .. "i", stem .. "i"
ine = lenition(stem) .. "di"
ine = stem .. "di"
end
end
Line 258: Line 243:
}
}
setmetatable(data["o"], {__call = function(self, args, data)
setmetatable(data["o"], {__call = function(self, args, data)
local stem = args.nolen and data.head or lenition(data.head)
local stem = args.nolen and data.head or m_com.lenition(data.head)
local s1, s2, s3 = sub(stem, 1, -2), sub(stem, 1, -3), sub(stem, 1, -4)
local s1, s2, s3 = sub(stem, 1, -2), sub(stem, 1, -3), sub(stem, 1, -4)
table.insert(data.categories, "Siwa o-declension nouns")
table.insert(data.categories, "Siwa o-declension nouns")
Line 284: Line 269:
loc = s2 .. "lmoi"
loc = s2 .. "lmoi"
else
else
data.forms["m"] = {lenition(stem) .. "mo"}
data.forms["m"] = {stem .. "mo"}
loc = lenition(stem) .. "moi"
loc = stem .. "moi"
end
end
elseif stem:match("i$") then
elseif stem:match("i$") then
if stem:match(v.."hhį.$") then
if stem:match(v.."hhį.$") then
data.forms["m"] = {sub(lenition(stem), 1, -5) .. "ṡko"}
data.forms["m"] = {sub(stem, 1, -5) .. "ṡko"}
loc = sub(lenition(stem), 1, -5) .. "ṡkoi"
loc = sub(stem, 1, -5) .. "ṡkoi"
elseif stem:match(v.."[mn][mn].$") then
elseif stem:match(v.."[mn][mn].$") then
data.forms["m"] = {s3 .. "kko"}
data.forms["m"] = {s3 .. "kko"}
Line 310: Line 295:
loc = s2 .. "ṡkoi"
loc = s2 .. "ṡkoi"
else
else
data.forms["m"] = {lenition(stem) .. "ko"}
data.forms["m"] = {stem .. "ko"}
loc = lenition(stem) .. "koi"
loc = stem .. "koi"
end
end
elseif stem:match("[ouyů].$") then
elseif stem:match("[ouyů].$") then
Line 327: Line 312:
loc = s2 .. "lmi"
loc = s2 .. "lmi"
else
else
data.forms["m"] = {lenition(stem) .. "ma"}
data.forms["m"] = {stem .. "ma"}
ill, ela = lenition(stem) .. "n", lenition(stem) .. "n"
ill, ela = stem .. "n", stem .. "n"
ine, ade, all, abl = lenition(stem) .. "mi", lenition(stem) .. "mi", lenition(stem) .. "mi", lenition(stem) .. "mi"
ine, ade, all, abl = stem .. "mi", stem .. "mi", stem .. "mi", stem .. "mi"
end
end
end
end
Line 357: Line 342:
}
}
setmetatable(data["u"], {__call = function(self, args, data)
setmetatable(data["u"], {__call = function(self, args, data)
local stem = args.nolen and data.head or lenition(data.head)  
local stem = args.nolen and data.head or m_com.lenition(data.head)  
local s1, s2, s3 = sub(stem, 1, -2), sub(stem, 1, -3), sub(stem, 1, -4)
local s1, s2, s3 = sub(stem, 1, -2), sub(stem, 1, -3), sub(stem, 1, -4)
table.insert(data.categories, "Siwa u-declension nouns")
table.insert(data.categories, "Siwa u-declension nouns")
Line 380: Line 365:
loc = s2 .. "lmoi"
loc = s2 .. "lmoi"
else
else
data.forms["m"] = {lenition(stem) .. "mo"}
data.forms["m"] = {stem .. "mo"}
loc = lenition(stem) .. "moi"
loc = stem .. "moi"
end
end
elseif stem:match("[ouyů]$") then
elseif stem:match("[ouyů]$") then
Line 397: Line 382:
loc = s2 .. "lmi"
loc = s2 .. "lmi"
else
else
data.forms["m"] = {lenition(stem) .. "ma"}
data.forms["m"] = {stem .. "ma"}
ill, ela = lenition(stem) .. "n", lenition(stem) .. "n"
ill, ela = stem .. "n", stem .. "n"
ine, ade, all, abl = lenition(stem) .. "mi", lenition(stem) .. "mi", lenition(stem) .. "mi", lenition(stem) .. "mi"
ine, ade, all, abl = stem .. "mi", stem .. "mi", stem .. "mi", stem .. "mi"
end
end
end
end
Line 427: Line 412:
}
}
setmetatable(data["y"], {__call = function(self, args, data)
setmetatable(data["y"], {__call = function(self, args, data)
local stem = args.nolen and data.head or lenition(data.head)
local stem = args.nolen and data.head or m_com.lenition(data.head)
local s1, s2, s3 = sub(stem, 1, -2), sub(stem, 1, -3), sub(stem, 1, -4)
local s1, s2, s3 = sub(stem, 1, -2), sub(stem, 1, -3), sub(stem, 1, -4)
table.insert(data.categories, "Siwa y-declension nouns")
table.insert(data.categories, "Siwa y-declension nouns")
Line 449: Line 434:
loc = s2 .. "lmoi"
loc = s2 .. "lmoi"
else
else
data.forms["m"] = {lenition(stem) .. "mo"}
data.forms["m"] = {stem .. "mo"}
loc = lenition(stem) .. "moi"
loc = stem .. "moi"
end
end
elseif stem:match("i$") then
elseif stem:match("i$") then
Line 483: Line 468:
table.insert(data.forms["ine"], s1 .. "ỉa")
table.insert(data.forms["ine"], s1 .. "ỉa")
else
else
data.forms["m"] = {lenition(stem) .. "di"}
data.forms["m"] = {stem .. "di"}
ill, ela, ade = lenition(stem) .. "h", lenition(stem) .. "h", lenition(stem) .. "h"
ill, ela, ade = stem .. "h", stem .. "h", stem .. "h"
all, abl = lenition(stem) .. "i", lenition(stem) .. "i"
all, abl = stem .. "i", stem .. "i"
ine = lenition(stem) .. "di"
ine = stem .. "di"
end
end
end
end

Navigation menu