local export = {}
--[=[
Authors: ], ].
Inspired by ] by Ben Wing <benwing2>.
]=]
local lang = require("Module:languages").getByCode("txb")
local m_links = require("Module:links")
-- Internal substitutions
local encode = {
= "x",
= "z",
-- = "f",
-- = "q",
= "X",
= "Z",
-- = "F",
-- = "Q",
}
local decode = {
x = "ā",
z = "ä",
--f = "ī",
--q = "ū",
X = "Ā",
Z = "Ä",
--F = "Ī",
--Q = "Ū",
}
local function encodefunc(c)
return encode
end
local function decodefunc(c)
return decode
end
-- stressed variants of vowels
local stressed = {
a = "x",
z = "a",
--i = "f",
--u = "q",
A = "X",
Z = "A",
--I = "F",
--U = "Q",
}
local unstressed = {
x = "a",
a = "z",
--f = "i",
--q = "u",
X = "A",
A = "Z",
--F = "I",
--Q = "U",
}
local function palatalise(stem)
stem = stem:gsub("$",{t="c",k="c",s="ś"})
return stem
end
local function palatalize(stem)
local pos = stem:len()
while true do
if stem:sub(pos,pos):match("") then
pos = pos-1 -- if character in pos is n/t/k/s, shift pos to the left by 1
else
break -- first character from the right that is not n/t/k/s, break
end
end
-- before ..: first characters up to rightmost n/t/k/s chain unchanged
-- after .. (chain of n/t/k/s from rightmost character): palatalized
return stem:sub(1,pos)..stem:sub(pos+1,-1):gsub("",{n="ñ",t="c",k="ś",s="ś"})
end
-- count the number of syllables in stem
function export.countsyll(stem)
local count = 0
stem = stem:gsub("+",function(vowel)
count = count + 1
return vowel
end)
return count
end
-- stress the N-th syllable of stem
function export.stressvar(stem,N)
local count = 0
stem = stem:gsub("+",function(vowel)
local pos = stem:find(vowel)
count = count + 1
if count == N then
return stressed or vowel
end
if count == N-1 then
if stem:sub(pos,pos) == "a" and (stem:sub(pos+2,pos+2):match("+") ~= nil or stem:sub(pos+2,pos+2) == "") and pos ~= 1 and not stem:sub(pos+1,pos+1):match("") then
return ""
elseif stem:sub(pos,pos+1) == "uw" and (stem:sub(pos+2,pos+2):match("+") ~= "" or stem:sub(pos+2,pos+2) == "") and pos ~= 1 then
return ""
-- elseif stem:sub(pos,pos+1) == "iy" and (stem:sub(pos+2,pos+2):match("+") ~= "" or stem:sub(pos+2,pos+2) == "") and pos ~= 1 then
-- return "" -- no evidence for or against this deletion, but would make sense based on "uw"
else
return unstressed or vowel
end
end
return vowel
end)
return stem
end
local function unstress(stem)
--stemcode = string.gsub(stemcode,"^(.+)uw(.+)$","^(.+)w(.+)$")
--stemcode = string.gsub(stemcode,"^(.+)iy(.+)$","^(.+)y(.+)$")
local a,b,c = stem:match("^(.+)()(.+)$")
return a and a..({a="z",x="a"})..c or stem
end
local function stress(stem)
local a,b,c = stem:match("^(.+)()(.+)$")
return a and a..({a="x",z="a"})..c or stem
end
local function combine(table1,table2)
for key, value in pairs(table2) do
table1 = value
end
return table1
end
local patterns = {}
-- Class I.1; plurals in -(C)a
-- pikul: "pikul/pikwala<I.1>"
patterns = function(stem)
local sg_stem, pl_stem = stem:match("^(.+)/(.+)$")
local stem_syll = export.countsyll(sg_stem)
if stem_syll == 1 then
if sg_stem:sub(-1):match("o") then -- dubious since there are no I.1 -o monosyllables
sg_stem = sg_stem:sub(1,-2)
local plvr_stem = export.stressvar(pl_stem,2)
return {
= "*"..sg_stem.."o",
= "*"..sg_stem.."āntse",
= "*"..sg_stem.."a",
= "*"..sg_stem.."āmeṃ",
= "*"..pl_stem,
= "*"..plvr_stem.."ṃts",
= "*"..pl_stem,
= "*"..plvr_stem.."meṃ",
}
elseif sg_stem:sub(-1):match("") then
local sgvr_stem = export.stressvar(sg_stem,2)
local plvr_stem = export.stressvar(pl_stem,2)
return {
= sg_stem,
= "*"..sg_stem.."ntse",
= sg_stem,
= sg_stem.."meṃ",
= pl_stem,
= "*"..pl_stem.."ṃts",
= pl_stem,
= pl_stem.."meṃ",
}
else
local sgvr_stem = export.stressvar(sg_stem,2)
local plvr_stem = export.stressvar(pl_stem,2)
return {
= sg_stem,
= "*"..sg_stem.."äntse",
= sg_stem,
= sg_stem.."meṃ",
= pl_stem,
= "*"..pl_stem.."äṃts",
= pl_stem,
= plvr_stem.."meṃ",
}
end
elseif stem_syll == 2 then
if sg_stem:sub(-1):match("o") then -- true for all vowels?
sg_stem = sg_stem:sub(1,-2)
local sgvr_stem = export.stressvar(sg_stem,2)
local plvr_stem = export.stressvar(pl_stem,2)
return {
= sg_stem.."o",
= sgvr_stem.."āntse",
= sg_stem.."a",
= sgvr_stem.."āmeṃ",
= pl_stem,
= plvr_stem.."ṃts",
= pl_stem,
= plvr_stem.."meṃ",
}
elseif sg_stem:sub(-1):match("") then
local sgvr_stem = export.stressvar(sg_stem,2)
local plvr_stem = export.stressvar(pl_stem,2)
return {
= sg_stem,
= sgvr_stem.."ntse",
= sg_stem,
= sgvr_stem.."meṃ",
= pl_stem,
= pl_stem.."ṃts",
= pl_stem,
= pl_stem.."meṃ",
}
else
local sgvr_stem = export.stressvar(sg_stem,2)
local plvr_stem = export.stressvar(pl_stem,2)
return {
= "*"..sg_stem,
= "*"..sgvr_stem.."äntse",
= "*"..sg_stem,
= "*"..sgvr_stem.."meṃ",
= "*"..pl_stem,
= "*"..plvr_stem.."äṃts",
= "*"..pl_stem,
= "*"..plvr_stem.."meṃ",
}
end
elseif stem_syll == 3 and sg_stem:sub(-1):match("o") then
sg_stem = sg_stem:sub(1,-2)
return {
= sg_stem.."o",
= sg_stem.."antse",
= sg_stem.."a",
= sg_stem.."ameṃ",
= pl_stem,
= pl_stem.."ṃts",
= pl_stem,
= pl_stem.."meṃ",
}
else
if sg_stem:sub(-1):match("o") then -- true for all vowels?
sg_stem = sg_stem:sub(1,-2)
return {
= sg_stem.."o",
= sg_stem.."äntse",
= sg_stem.."a",
= sg_stem.."ämeṃ",
= pl_stem,
= pl_stem.."äṃts",
= pl_stem,
= pl_stem.."meṃ",
}
elseif sg_stem:sub(-1):match("") then
return {
= sg_stem,
= sg_stem.."ntse",
= sg_stem,
= sg_stem.."meṃ",
= pl_stem,
= pl_stem.."ṃts",
= pl_stem,
= pl_stem.."meṃ",
}
else
return {
= sg_stem,
= sg_stem.."äntse",
= sg_stem,
= sg_stem.."meṃ",
= pl_stem,
= pl_stem.."äṃts",
= pl_stem,
= pl_stem.."meṃ",
}
end
end
end
-- Class I.2; plurals in -wa
-- ost: "ost<I.2>"
-- EXCEPTIONS: or-ārwa
patterns = function(stem)
local stem_syll = export.countsyll(stem)
if stem_syll == 1 then
if stem:sub(-1):match("n") then
stem = stem:sub(1,-2)
local vr_stem = export.stressvar(stem,2)
return {
= stem.."ṃ",
= "*"..vr_stem.."nantse",
= stem.."ṃ",
= stem.."ṃmeṃ",
= vr_stem.."nuwa",
= "*"..vr_stem.."nwaṃts",
= vr_stem.."nuwa",
= vr_stem.."nuwameṃ",
}
else
local vr_stem = export.stressvar(stem,2)
return {
= stem,
= vr_stem.."antse",
= stem,
= stem.."meṃ",
= vr_stem.."uwa",
= vr_stem.."waṃts",
= vr_stem.."uwa",
= vr_stem.."uwameṃ",
}
end
elseif stem_syll == 2 then
if stem:sub(-1):match("n") then
stem = stem:sub(1,-2)
local vr_stem = export.stressvar(stem,2)
return {
= stem.."ṃ",
= vr_stem.."nntse",
= stem.."ṃ",
= vr_stem.."ṃmeṃ",
= vr_stem.."nwa",
= vr_stem.."nwaṃts",
= vr_stem.."nwa",
= vr_stem.."nwameṃ",
}
elseif stem:sub(-1):match("") then
local vr_stem = export.stressvar(stem,2)
return {
= stem,
= vr_stem.."ntse",
= stem,
= vr_stem.."meṃ",
= vr_stem:sub(1,-2).."wa",
= vr_stem:sub(1,-2).."waṃts",
= vr_stem:sub(1,-2).."wa",
= vr_stem:sub(1,-2).."wameṃ",
}
else
local vr_stem = export.stressvar(stem,2)
return {
= stem,
= vr_stem.."ntse",
= stem,
= vr_stem.."meṃ",
= vr_stem.."wa",
= vr_stem.."waṃts",
= vr_stem.."wa",
= vr_stem.."wameṃ",
}
end
else
if stem:sub(-1):match("n") then
stem = stem:sub(1,-2)
return {
= stem.."ṃ",
= stem.."nntse",
= stem.."ṃ",
= stem.."ṃmeṃ",
= stem.."nwa",
= stem.."nwaṃts",
= stem.."nwa",
= stem.."nwameṃ",
}
elseif stem:sub(-1):match("") then
return {
= stem,
= stem.."ntse",
= stem,
= stem.."meṃ",
= stem:sub(1,-2).."wa",
= stem:sub(1,-2).."waṃts",
= stem:sub(1,-2).."wa",
= stem:sub(1,-2).."wameṃ",
}
else
return {
= stem,
= stem.."ntse",
= stem,
= stem.."meṃ",
= stem.."wa",
= stem.."waṃts",
= stem.."wa",
= stem.."wameṃ",
}
end
end
end
-- Class II.1; plurals in -na
-- ñem: "ñem/ñemna<II.1>"
-- Enter ACC.SG/ACC.PL (= NOM.PL)
-- EXCEPTIONS: kliye, śaumo, stām.GEN.PL, lāntsa.GEN.SG
patterns = function(stem)
local sg_stem, pl_stem = stem:match("^(.+)/(.+)$")
local sg_stem_syll = export.countsyll(sg_stem)
if sg_stem_syll == 1 then
if sg_stem:sub(-1):match("n") then
sg_stem = sg_stem:sub(1,-2)
local vr_stem = export.stressvar(sg_stem,2)
sg_table = {
= sg_stem,
= vr_stem.."antse",
= sg_stem.."ṃ",
= sg_stem.."ṃmeṃ",
}
else
local vr_stem = export.stressvar(sg_stem,2)
sg_table = {
= sg_stem,
= vr_stem.."antse",
= sg_stem,
= sg_stem.."meṃ",
}
end
elseif sg_stem_syll == 2 then
if sg_stem:sub(-1):match("n") then
sg_stem = sg_stem:sub(1,-2)
local vr_stem = export.stressvar(sg_stem,2)
sg_table = {
= sg_stem,
= vr_stem.."ntse",
= sg_stem.."ṃ",
= vr_stem.."ṃmeṃ",
}
elseif sg_stem:sub(-1):match("a") then
sg_stem = sg_stem:sub(1,-2)
local vr_stem = export.stressvar(sg_stem,2)
sg_table = {
= sg_stem,
= vr_stem.."ntse",
= sg_stem.."i",
= unstress(sg_stem).."imeṃ",
}
elseif sg_stem:sub(-1):match("o") then
local vr_stem = export.stressvar(sg_stem,2)
sg_stem = sg_stem:sub(1,-2)
sg_table = {
= sg_stem.."a",
= vr_stem.."y",
= sg_stem.."o",
= vr_stem.."ymeṃ",
}
else
local vr_stem = export.stressvar(sg_stem,2)
sg_table = {
= sg_stem,
= vr_stem.."ntse",
= sg_stem,
= vr_stem.."meṃ",
}
end
else
if sg_stem:sub(-1):match("n") then
sg_stem = sg_stem:sub(1,-2)
sg_table = {
= sg_stem,
= sg_stem.."ntse",
= sg_stem.."ṃ",
= sg_stem.."ṃmeṃ",
}
elseif sg_stem:sub(-1):match("a") then
sg_stem = sg_stem:sub(1,-2)
sg_table = {
= sg_stem,
= sg_stem.."ntse",
= sg_stem.."i",
= sg_stem.."imeṃ",
}
elseif sg_stem:sub(-1):match("o") then
sg_stem = sg_stem:sub(1,-2)
sg_table = {
= sg_stem.."a",
= sg_stem.."y",
= sg_stem.."o",
= sg_stem.."ymeṃ",
}
else
sg_table = {
= sg_stem,
= sg_stem.."ntse",
= sg_stem,
= sg_stem.."meṃ",
}
end
end
pl_table = {
= pl_stem,
= pl_stem.."ṃts",
= pl_stem,
= pl_stem.."meṃ",
}
return combine(sg_table,pl_table)
end
-- Class II.2; plurals in -nma
-- śaul: "śaul<II.2>"
patterns = function(stem)
local stem_syll = export.countsyll(stem)
if stem:sub(-1) == "n" then
stem = stem:sub(1,-2)
return {
= stem.."ṃ",
= stem.."ntse",
= stem.."ṃ",
= stem.."nma",
= stem.."nmaṃts",
= stem.."nma",
}
elseif stem:sub(-1) == "i" then
local vr_stem = export.stressvar(stem:sub(1,-2),2)
return {
= stem,
= vr_stem.."intse",
= stem,
= vr_stem.."anma",
= vr_stem.."anmaṃts",
= vr_stem.."anma",
}
elseif string.match(stem:sub(-1),"") then
local vr_stem = export.stressvar(stem,2)
return {
= stem,
= vr_stem.."ntse",
= stem,
= vr_stem.."nma",
= vr_stem.."anmaṃts",
= vr_stem.."nma",
}
elseif stem_syll == 1 or stem == "akṣxr" then
local vr_stem = export.stressvar(stem,stem_syll+1)
return {
= stem,
= vr_stem.."antse",
= stem,
= vr_stem.."anma",
= vr_stem.."anmaṃts",
= vr_stem.."anma",
}
else
local vr_stem = export.stressvar(stem,2)
return {
= stem,
= vr_stem.."ntse",
= stem,
= vr_stem.."nma",
= vr_stem.."nmaṃts",
= vr_stem.."nma",
}
end
end
-- Class III, plurals in -nta (Weiss separates this into -enta and -nta but afaict there is no difference in inflection?)
-- oko: "oko<III>"
-- EXCEPTIONS: mñcuṣke-mcuṣkanta, pratin-pratinta, pärkāᵤ-pärkāwänta
patterns = function(stem)
local stem_syll = export.countsyll(stem)
if stem_syll == 1 then
local vr_stem = export.stressvar(stem,2)
if stem:sub(-1) == "n" then
stem = stem:sub(1,-2)
return {
= stem.."ṃ",
= vr_stem.."nantse",
= stem.."ṃ",
= stem.."nmeṃ",
= vr_stem.."nanta",
= vr_stem.."nantaṃts",
= vr_stem.."nanta",
= vr_stem.."nantameṃ",
}
elseif string.match(stem:sub(-1),"") then
return {
= stem,
= stem.."ntse",
= stem,
= stem.."meṃ",
= stem.."nta",
= stem.."ntaṃts",
= stem.."nta",
= stem.."ntameṃ",
}
else
return {
= stem,
= vr_stem.."antse",
= stem,
= stem.."meṃ",
= vr_stem.."anta",
= vr_stem.."antaṃts",
= vr_stem.."anta",
= vr_stem.."antameṃ",
}
end
elseif stem_syll == 2 then
if stem:sub(-1) == "n" then
stem = stem:sub(1,-2)
return {
= stem.."ṃ",
= stem.."näntse",
= stem.."ṃ",
= stem.."nänta",
= stem.."näntaṃts",
= stem.."nänta",
}
elseif string.match(stem:sub(-1),"") then
local vr_stem = export.stressvar(stem,2)
return {
= stem,
= vr_stem.."ntse",
= stem,
= vr_stem.."nta",
= vr_stem.."ntaṃts",
= vr_stem.."nta",
}
elseif stem:sub(-1) == "r" then
return {
= stem,
= stem.."ntse",
= stem,
= stem.."nta",
= stem.."ntaṃts",
= stem.."nta",
}
else
return {
= stem,
= stem.."äntse",
= stem,
= stem.."änta",
= stem.."äntaṃts",
= stem.."änta",
}
end
else
if string.match(stem:sub(-1),"") or stem:sub(-1) == "r" then
return {
= stem,
= stem.."ntse",
= stem,
= stem.."nta",
= stem.."ntaṃts",
= stem.."nta",
}
elseif stem:sub(-1) == "n" then
stem = stem:sub(1,-2)
return {
= stem.."ṃ",
= stem.."näntse",
= stem.."ṃ",
= stem.."nänta",
= stem.."näntaṃts",
= stem.."nänta",
}
else
return {
= stem,
= stem.."äntse",
= stem,
= stem.."änta",
= stem.."äntaṃts",
= stem.."änta",
}
end
end
end
-- Class IV.1: familial terms
-- pācer: "protär<IV.1>"
-- Enter ACC.SG
patterns = function(stem)
stem = stem:sub(1,-3)
local yd_stem = palatalise(stem)
local vr_stem = export.stressvar(yd_stem,2)
return {
= yd_stem.."er",
= stem.."ri",
= stem.."är",
= vr_stem.."era",
= stem.."ärñts",
= vr_stem.."era",
}
end
-- Class IV.2: pācer, tkācer
-- pācer: "pātär<IV.2>"
-- Enter ACC.SG
patterns = function(stem)
stem = stem:sub(1,-3)
local yd_stem = palatalise(stem)
local vr_stem = export.stressvar(yd_stem,2)
return {
= yd_stem.."er",
= stem.."ri",
= stem.."är",
= {vr_stem.."era", stem.."ärñ"},
= stem.."ärnts",
= {vr_stem.."era", stem.."ärñ"},
}
end
-- Class V.1: nom.pl in -i
-- eṅkwe: "eṅkwen<V.1>"
-- Enter ACC.SG
-- EXCEPTIONS: kertte-kercci
-- no monosyllables?
patterns = function(stem)
local stem_syll = export.countsyll(stem)
if stem_syll == 2 then
local vr_stem = export.stressvar(stem,2)
if stem:sub(-1) == "n" then
stem = stem:sub(1,-2)
return {
= stem,
= vr_stem.."ntse",
= stem.."ṃ",
= stem.."ṃmeṃ",
= stem:sub(1,-2).."i",
= stem.."ṃts",
= stem.."ṃ",
= stem.."ṃmeṃ",
}
elseif string.match(stem:sub(-1),"e") then
return {
= stem,
= vr_stem.."ntse",
= stem,
= vr_stem.."meṃ",
= stem:sub(1,-2).."i",
= stem.."ṃts",
= stem.."ṃ",
= vr_stem.."ṃmeṃ",
}
else
return {}
end
else
if stem:sub(-1) == "n" then
stem = stem:sub(1,-2)
return {
= stem,
= stem.."ntse",
= stem.."ṃ",
= stem.."ṃmeṃ",
= stem:sub(1,-2).."i",
= stem.."ṃts",
= stem.."ṃ",
= stem.."ṃmeṃ",
}
elseif string.match(stem:sub(-1),"e") then
return {
= stem,
= stem.."ntse",
= stem,
= stem.."meṃ",
= stem:sub(1,-2).."i",
= stem.."ṃts",
= stem.."ṃ",
= stem.."ṃmeṃ",
}
else
return {}
end
end
end
-- Class V.2
-- plāce: "plātän<V.2>"
-- Enter ACC.PL
-- NOTES: GEN unclear but all other cases have palatalized stems
patterns = function(stem)
local stem_syll = export.countsyll(stem)
stem = stem:sub(1,-3)
local yd_stem = palatalize(stem)
if stem_syll == 2 then
local vr_stem = export.stressvar(yd_stem,2)
return {
= yd_stem.."e",
= vr_stem.."antse",
= yd_stem,
= yd_stem.."meṃ",
= yd_stem.."i",
= yd_stem.."aṃts",
= stem.."äṃ",
= vr_stem.."aṃmeṃ",
}
else
return {
= yd_stem.."e",
= yd_stem.."äntse",
= yd_stem,
= yd_stem.."meṃ",
= yd_stem.."i",
= yd_stem.."aṃts",
= stem.."äṃ",
= yd_stem.."äṃmeṃ",
}
end
end
-- Class V.3
-- lyak: "lyak<V.3>"
-- EXCEPTIONS: sāṃ.ACC: sanaṃ
patterns = function(stem)
local stem_syll = export.countsyll(stem)
if stem_syll == 1 then
if stem:sub(-1) == "n" then
local vr_stem = export.stressvar(stem,2)
local yd_stem = palatalize(vr_stem)
stem = stem:sub(1,-2)
vr_stem = vr_stem:sub(1,-2)
if stem:find("x") then
return {
= stem.."ṃ",
= vr_stem.."nantse",
= vr_stem.."naṃ",
= vr_stem.."naṃmeṃ",
= yd_stem.."i",
= vr_stem.."naṃts",
= vr_stem.."naṃ",
= vr_stem.."naṃmeṃ",
}
else
return {
= stem.."ṃ",
= vr_stem.."nantse",
= stem.."ṃ",
= vr_stem.."ṃmeṃ",
= yd_stem.."i",
= vr_stem.."naṃts",
= vr_stem.."ṃ",
= vr_stem.."ṃmeṃ",
}
end
else
local vr_stem = export.stressvar(stem,2)
local yd_stem = palatalize(vr_stem)
return {
= stem,
= vr_stem.."antse",
= vr_stem.."aṃ",
= vr_stem.."aṃmeṃ",
= yd_stem.."i",
= vr_stem.."aṃts",
= vr_stem.."aṃ",
= vr_stem.."aṃmeṃ",
}
end
elseif stem_syll == 2 then
if stem:sub(-1) == "n" then
local vr_stem = export.stressvar(stem,2)
local yd_stem = palatalize(vr_stem)
stem = stem:sub(1,-2)
vr_stem = vr_stem:sub(1,-2)
if stem:find("x") then
return {
= stem.."ṃ",
= vr_stem.."näntse",
= vr_stem.."näṃ",
= vr_stem.."näṃmeṃ",
= yd_stem.."i",
= vr_stem.."näṃts",
= vr_stem.."näṃ",
= vr_stem.."näṃmeṃ",
}
else
return {
= stem.."ṃ",
= vr_stem.."näntse",
= vr_stem.."ṃ",
= vr_stem.."ṃmeṃ",
= yd_stem.."i",
= vr_stem.."naṃts",
= vr_stem.."ṃ",
= vr_stem.."ṃmeṃ",
}
end
else
local vr_stem = export.stressvar(stem,2)
local yd_stem = palatalize(vr_stem)
return {
= stem,
= vr_stem.."äntse",
= vr_stem.."äṃ",
= vr_stem.."äṃmeṃ",
= yd_stem.."i",
= vr_stem.."äṃts",
= vr_stem.."äṃ",
= vr_stem.."äṃmeṃ",
}
end
else
if stem:sub(-1) == "n" then
local yd_stem = palatalize(stem)
stem = stem:sub(1,-2)
if stem:find("x") then
return {
= stem.."ṃ",
= stem.."näntse",
= stem.."näṃ",
= stem.."näṃmeṃ",
= yd_stem.."i",
= stem.."näṃts",
= stem.."näṃ",
= stem.."näṃmeṃ",
}
else
return {
= stem.."ṃ",
= stem.."näntse",
= stem.."ṃ",
= stem.."ṃmeṃ",
= yd_stem.."i",
= stem.."naṃts",
= stem.."ṃ",
= stem.."ṃmeṃ",
}
end
else
local yd_stem = palatalize(stem)
return {
= stem,
= stem.."äntse",
= stem.."äṃ",
= stem.."äṃmeṃ",
= yd_stem.."i",
= stem.."äṃts",
= stem.."äṃ",
= stem.."äṃmeṃ",
}
end
end
end
-- IRREGULARS
patterns = function(stem)
local nom_sg,gen_sg,acc_sg,nom_pl,gen_pl,acc_pl = stem:match("(+)/(+)/(+)/(+)/(+)/(+)")
return {
= nom_sg,
= gen_sg,
= acc_sg,
= nom_pl,
= gen_pl,
= acc_pl,
}
end
local function make_links(forms)
for key,val in pairs(forms) do
if type(val) == "string" then
val = {val}
end
for i,form in ipairs(val) do
form = form:gsub("",decode)
val = m_links.full_link({lang=lang, term=form})
end
forms = table.concat(val," / ")
end
return true
end
local function make_table(forms)
local stylesheet = require("Module:TemplateStyles")("Template:txb-nominal/style.css")
return stylesheet .. '\n' .. ([=[
{| class="wikitable inflection-table inflection-table-txb"
|-
! class="corner-header" | Case
! class="number-header" | Singular
! class="number-header" | Plural
|-
! class="case-header" | ]
| class="form-cell" | {{{nom-sg}}}
| class="form-cell" | {{{nom-pl}}}
|-
! class="case-header" | ]
| class="form-cell" | {{{gen-sg}}}
| class="form-cell" | {{{gen-pl}}}
|-
! class="case-header" | ]
| class="form-cell" | {{{acc-sg}}}
| class="form-cell" | {{{acc-pl}}}
|-
! class="case-header" | ]
| class="form-cell" | {{{abl-sg}}}
| class="form-cell" | {{{abl-pl}}}
|}]=]):gsub("{{{(+)}}}", forms)
end
function export.show(frame)
local stem_typ = frame:getParent().args
stem_typ = stem_typ:gsub("",encode)
local stem,typ = stem_typ:match("^(.+)<(.+)>$")
local forms = patterns(stem)
make_links(forms)
return make_table(forms)
end
return export