Module:User:Santi2222/bvb-verb

local lang = require("Module:languages").getByCode("bvb")

local export = {}

-- Table-generating functions local function make_table(data) local function repl(param) local accel = true local no_store = false if param == "info" then return mw.getContentLanguage:ucfirst(data.info or "") elseif string.sub(param, 1, 1) == "!" then no_store = true param = string.sub(param, 2) elseif string.sub(param, 1, 1) == "#" then accel = false param = string.sub(param, 2) end

local forms = data.forms[param] if not forms then return "&mdash;" end local ret = {} for key, subform in ipairs(forms) do			if param == "pres" then table.insert(ret, subform) else table.insert(ret, require("Module:links").full_link({lang = lang, term = subform, accel = accel and {form = param, lemma = data.lemma, no_store = no_store} or nil})) end end return table.concat(ret, " ") end local wikicode = [=[ return mw.ustring.gsub(wikicode, "", repl) .. require("Module:utilities").format_categories(data.categories, lang) end --normal table

-- Inflection functions (common nouns) function export.show(frame) local args = frame:getParent.args local data = { forms = {}, info = "Conjugation of ", categories = {}, }	--parameters local lemma = mw.title.getCurrentTitle.text if args.head then lemma = args.head end local theme = args[1] local transitivity = args[2] local theme_class = "" data.info = data.info .. require("Module:links").full_link({lang = lang, alt = lemma}, "term") .. " ("	if theme:sub(1,2) == "aa" then		theme_class = "aa"		data.info = data.info .. "-aa-) " elseif theme:sub(1,2) == "âa" then theme_class = "âa" theme = aa .. string.sub(theme,3,-1) data.info = data.info .. "-âa-) "	elseif theme:sub(1,1) == "a" or theme:sub(1,1) == "á" then		theme_class = "a"		data.info = data.info .. "-a-) " elseif theme:sub(1,2) == "ee" then theme_class = "ee" data.info = data.info .. "-ee-) "	elseif theme:sub(1,1) == "e" then		theme_class = "e"		data.info = data.info .. "-e-) " elseif theme:sub(1,2) == "ii" then theme_class = "ii" data.info = data.info .. "-ii-) "	elseif theme:sub(1,1) == "i" then		theme_class = "i"		data.info = data.info .. "-i-) " elseif theme:sub(1,2) == "oo" then theme_class = "oo" data.info = data.info .. "-oo-) "	elseif theme:sub(1,1) == "o" then		theme_class = "o"		data.info = data.info .. "-o-) " elseif theme:sub(1,1) == "t" and (lemma:sub(1,2) == "cc" or lemma:sub(1,3) == "cqu") then theme_class = "*t" theme = string.sub(theme,2,-1) data.info = data.info .. "-*t-) "	else		theme_class = "C"		data.info = data.info .. "-C-) " end

--create the forms --present positive data.forms["pres"] = {lemma}

--A,B,C data.forms["snounap"] = {lemma} --A if transitivity == "tr" then --B if theme_class == "e" then data.forms["snounpp"] = {"hap" .. theme} elseif theme_class == "ee" then data.forms["snounpp"] = {"hap" .. theme:sub(2,-1)} elseif theme_class == "i" then data.forms["snounpp"] = {"hape" .. theme:sub(2,-1)} end end

if theme_class =="*t" then --C TODO data.forms["snounan"] = {"imm" .. theme:sub(2,-1)} elseif theme_class == "i" and lemma:sub(1,4) == "quii" then data.forms["snounan"] = {"imi" .. theme} elseif theme:sub(1) == "y" then data.forms["snounan"] = {"in" .. theme} else data.forms["snounan"] = {"im" .. theme} end --J,K,L,M (distal, emphatic) if transitivity == "tr" then if theme_class == "*t" then data.forms["disp"] = {"iyo" .. theme:sub(2,-1)} data.forms["disn"] = {"iyomm" .. theme:sub(2,-1)} data.forms["empp"] = {"ixo" .. theme:sub(2,-1)} data.forms["empn"] = {"ixomm" .. theme:sub(2,-1)} elseif theme:sub(1,1) == y then data.forms["disp"] = {"iyo" .. theme} data.forms["disn"] = {"iyon" .. theme} data.forms["empp"] = {"ixo" .. theme} data.forms["empn"] = {"ixon" .. theme} else if theme_class == "e" then data.forms["disp"] = {"iyoo" .. theme:sub(2,-1)} data.forms["empp"] = {"ixoo" .. theme:sub(2,-1)} elseif theme_class == "a" then if lemma:sub(1,2) == "qu" then if theme(2,2) == "a" then data.forms["disp"] = {"iyo" .. theme:sub(2,-1)} data.forms["empp"] = {"ixo" .. theme:sub(2,-1)} else data.forms["disp"] = {"iyoo" .. theme:sub(2,-1)} data.forms["empp"] = {"ixoo" .. theme:sub(2,-1)} end else data.forms["disp"] = {"iy" .. theme} data.forms["empp"] = {"ix" .. theme} end elseif theme_class == "âa" then data.forms["disp"] = {"iyoo" .. theme:sub(3,-1)} data.forms["empp"] = {"ixoo" .. theme:sub(3,-1)} else data.forms["disp"] = {"iyo" .. theme} data.forms["empp"] = {"ixo" .. theme} end data.forms["disn"] = {"iyom" .. theme} data.forms["empn"] = {"ixom" .. theme} end else if theme_class == "*t" then data.forms["disp"] = {"yo" .. theme:sub(2,-1)} data.forms["disn"] = {"yomm" .. theme:sub(2,-1)} data.forms["empp"] = {"xo" .. theme:sub(2,-1)} data.forms["empn"] = {"xomm" .. theme:sub(2,-1)} elseif theme:sub(1,1) == y then data.forms["disp"] = {"yo" .. theme} data.forms["disn"] = {"yon" .. theme} data.forms["empp"] = {"xo" .. theme} data.forms["empn"] = {"xon" .. theme} else if theme_class == "e" or theme_class == "a" then data.forms["disp"] = {"yoo" .. theme:sub(2,-1)} data.forms["empp"] = {"xoo" .. theme:sub(2,-1)} elseif theme_class == "âa" then data.forms["disp"] = {"yoo" .. theme:sub(3,-1)} data.forms["empp"] = {"xoo" .. theme:sub(3,-1)} elseif theme_class == "oo" then data.forms["disp"] = {"ya" .. theme:sub(3,-1)} data.forms["empp"] = {"xöa" .. theme:sub(3,-1)} elseif theme_class == "o" then data.forms["disp"] = {"ya" .. theme:sub(2,-1)} data.forms["empp"] = {"xöa" .. theme:sub(2,-1)} elseif theme_class == "C" then data.forms["disp"] = {"yo" .. theme} data.forms["empp"] = {"xo" .. theme} else data.forms["disp"] = {"y" .. theme} data.forms["empp"] = {"x" .. theme} end data.forms["disn"] = {"yom" .. theme} data.forms["empn"] = {"xom" .. theme} end end --N,O,P (mi- present/past, dependent future) if transitivity == "tr" then if theme_class == "*t" then data.forms["mipp"] = {"imm" .. theme:sub(2,-1)} data.forms["futp"] = {"iss" .. theme:sub(2,-1)} data.forms["futn"] = {"iscomm" .. theme:sub(2,-1)} elseif theme_class == "C" then data.forms["futp"] = {"is" .. theme} if theme:sub(1,1) == "y" then data.forms["mipp"] = {"in" .. theme} data.forms["futn"] = {"iscon" .. theme} else data.forms["mipp"] = {"im" .. theme} data.forms["futn"] = {"iscom" .. theme} end else if theme_class == "a" and lemma:sub(1,2) == "qu" then if lemma:sub(4,4) == "a" then data.forms["mipp"] = {"im" .. theme:sub(3,-1)} data.forms["futp"] = {"is" .. theme:sub(3,-1)} else data.forms["mipp"] = {"imi" .. theme:sub(3,-1)} data.forms["futp"] = {"isi" .. theme:sub(3,-1)} end elseif theme_class == "e" then data.forms["mipp"] = {"imii" .. theme:sub(2,-1)} data.forms["futp"] = {"isii" .. theme:sub(2,-1)} elseif theme_class == "âa" then data.forms["mipp"] = {"imii" .. theme:sub(3,-1)} data.forms["futp"] = {"isii" .. theme:sub(3,-1)} else data.forms["mipp"] = {"im" .. theme} data.forms["futp"] = {"is" .. theme} end data.forms["futn"] = {"iscm" .. theme} end else if theme_class == "*t" then data.forms["mipp"] = {"imm" .. theme:sub(2,-1)} data.forms["futp"] = {"ss" .. theme:sub(2,-1)} data.forms["futn"] = {"somm" .. theme:sub(2,-1)} elseif theme_class == "C" then data.forms["futp"] = {"s" .. theme} if theme:sub(1,1) == "y" then data.forms["mipp"] = {"in" .. theme} data.forms["futn"] = {"son" .. theme} else data.forms["mipp"] = {"im" .. theme} data.forms["futn"] = {"som" .. theme} end else if theme_class == "a" or theme_class == "e" then data.forms["futp"] = {"sii" .. theme:sub(2,-1)} data.forms["mipp"] = {"mii" .. theme:sub(2,-1)} else data.forms["mipp"] = {"m" .. theme} data.forms["futp"] = {"s" .. theme} end data.forms["futn"] = {"sm" .. theme} end end --Q,R (imperatives) if transitivity ~= "st" then if theme_class == "*t" then --Q data.forms["impp"] = {"ih" .. theme:sub(2,-1)} elseif theme_class == "a" then data.forms["impp"] = {"c" .. theme} elseif theme_class == "e" then data.forms["impp"] = {"qu" .. theme} elseif (theme_class == "aa" or theme_class == "ee" or theme_class == "o" or theme_class == "oo") and (transitivity == "in") then if theme_class == "o" then if theme:sub(2,2) == "a" then data.forms["impp"] = {theme:sub(2,-1)} else data.forms["impp"] = {"a" .. theme:sub(2,-1)} end elseif theme_class == "oo" then if theme:sub(3,3) == "a" then data.forms["impp"] = {theme:sub(3,-1)} else data.forms["impp"] = {"a" .. theme:sub(3,-1)} end else data.forms["impp"] = {theme} end elseif theme_class == "C" then data.forms["impp"] = {"ih" .. theme} else data.forms["impp"] = {"h" .. theme} end if theme_class == "*t" then --R data.forms["impn"] = {"comm" .. theme:sub(2,-1)} elseif theme_class == "C" then if theme:sub(1,1) == "y" then data.forms["impn"] = {"con" .. theme} else data.forms["impn"] = {"com" .. theme} end else data.forms["impn"] = {"cm" .. theme} end end return make_table(data) end

return export