This module is not to be directly used. It is used by Template:eu-verb form of, see there for usage.
local export = {}
local m_links = require("Module:links")
local m_utilities = require("Module:utilities")
local m_alloc = require("Module:eu-allocutives")
local m_com = require("Module:eu-common")
local m_string_utilities = require("Module:string utilities")
local m_table = require("Module:table")
local rsub = m_string_utilities.gsub
local rfind = m_string_utilities.find
local lang = require("Module:languages").getByCode("eu")
function export.verb_form(frame)
local params = {
= {required = true},
= {required = true},
= {},
= {},
= {},
= {alias_of = "gloss"},
= {type = "boolean"},
= {}
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local text = ""
local nocat = true
local cats = {}
local dot = (args.nodot == true) and "" or "."
local pagename = args.pagename or mw.title.getCurrentTitle().text
--throw an error if the arguments 3/4 are being used with non-finite forms
if (args == "impfpar" or args == "fpar" or args == "vn" or args == "short" or args == "mall" or args == "fall") and (args or args) then
error("The parameters 3 and 4 are not used with non-finite or allocutive forms")
end
--automatically generate the allocutive alternative form, if it exists
local altform
local function check_allocutive(pseudolemma, gender)
local m_alloc_forms, f_alloc_forms, use_allocs
local duplicates = {
negian = {"mall", "negien"}, negiean = {"mall", "negien"}, neginan = {"fall", "negien"}, negienan = {"fall", "negien"},
zegian = {"mall", "zegien"}, zegiean = {"mall", "zegien"}, zeginan = {"fall", "zegien"}, zegienan = {"fall", "zegien"},
genegian = {"mall", "genegien"}, genegiean = {"mall", "genegien"}, geneginan = {"fall", "genegien"}, genegienan = {"fall", "genegien"},
zekizkian = {"mall", "zekizkien"}, zekizkiean = {"mall", "zekizkien"}, zekizkinan = {"fall", "zekizkien"}, zekizkienan = {"fall", "zekizkien"},
zekian = {"mall", "zekien"}, zekiean = {"mall", "zekien"}, zekinan = {"fall", "zekien"}, zekienan = {"fall", "zekien"},
ziok = {"mall", "dio"}, ziona = {"fall", "dio"}, zion = {"fall", "dio"}}
if duplicates then
local correct_values = duplicates
if correct_values ~= gender or correct_values ~= pseudolemma then
error("The allocutive form '" .. pagename .. "' doesn't correspond to the non-allocutive '" .. pseudolemma .. "'.")
else
return nil
end
end
--Get the allocutive forms
m_alloc_forms, f_alloc_forms = m_alloc.generate_allocutive(pseudolemma, nil)
use_allocs = (gender == "mall") and m_alloc_forms or f_alloc_forms
--Check whether the provided pseudolemma is correct
if not use_allocs then
error("The form '" .. pagename .. "' is not an allocutive.")
elseif not m_table.listToSet(use_allocs) then
error("The allocutive form '" .. pagename .. "' doesn't correspond to the non-allocutive '" .. pseudolemma .. "'.")
elseif #use_allocs == 1 then
return nil
elseif #use_allocs == 2 then
altform = (pagename == use_allocs) and use_allocs or use_allocs
else
error("The length of the allocutive form tables should be 1 or 2.")
end
end
--process the person parameters
local nor = ""
local nori = ""
local nork = ""
local nor_l = ""
local nori_l = ""
local nork_l = ""
if args == "nor" or args == "nor-nori" or args == "nor-nork" or args == "nor-nori-nork" then
if args then
person_arguments = mw.text.split(args, " ")
else
error("Please provide a person paramter.")
end
end
if (args == "nor" and #person_arguments ~= 1) or (args == "nor-nori" and #person_arguments ~= 2) or (args == "nor-nori-nork" and #person_arguments ~= 3) then
error("Invalid person parameter.")
end
if args == "nor" or args == "nor-nori" then --process the "nor" parameter in nor and nor-nori verbs
nor = person_arguments
local valid_nor = {ni = "First-person singular", hi = "Informal second-person singular", hura = "Third-person singular",
gu = "First-person plural", zu = "Second-person singular", zuek = "Second-person plural", haiek = "Third-person plural"}
if valid_nor then
local nor_text = valid_nor
nor_l = nor_text .. " (" .. m_links.full_link({term = nor, lang = lang}, "term") .. ")"
else
error("Invalid nor argument.")
end
end
if args == "nor-nori" or args == "nor-nori-nork" then --process the "nori" parameter
nori = person_arguments
local valid_nori = {niri = "first-person singular", hiri = "informal second-person singular", hirim = "informal second-person singular masculine",
hirif = "informal second-person singular feminine", hari = "third-person singular",
guri = "first-person plural", zuri = "second-person singular", zuei = "second-person plural", haiei = "third-person plural"}
if valid_nori then
local nori_text = valid_nori
local nori_pronoun = rsub(nori, "^hiri$", "hiri")
nori_l = nori_text .. " (" .. m_links.full_link({term = nori_pronoun, lang = lang}, "term") .. ")"
else
error("Invalid nori argument.")
end
end
if args == "nor-nork" or args == "nor-nori-nork" then --process the "nork" parameter and the "nor" parameter in nor-nork and nor-nori-nork verbs
nork = person_arguments
nor = (args == "nor-nork") and person_arguments or person_arguments
local valid_nork = {nik = "First-person singular", hik = "Informal second-person singular",
hikm = "Informal second-person singular masculine", hikf = "Informal second-person singular feminine", hark = "Third-person singular",
guk = "First-person plural", zuk = "Second-person singular", zuek = "Second-person plural", haiek = "Third-person plural"}
if valid_nork then
local nork_text = valid_nork
local nork_pronoun = rsub(nork, "^hik$", "hik")
nork_l = nork_text .. " (" .. m_links.full_link({term = nork_pronoun, lang = lang}, "term") .. ")"
else
error("Invalid nork argument.")
end
local valid_nor = {ni = "first-person singular", hi = "informal second-person singular", hura = "third-person singular",
gu = "first-person plural", zu = "second-person singular", zuek = "second-person plural", haiek = "third-person plural"}
if valid_nor then
local nor_text = valid_nor
nor_l = nor_text .. " (" .. m_links.full_link({term = nor, lang = lang}, "term") .. ")"
else
error("Invalid nor argument.")
end
end
--tenses
local nonfinites = {
impfpar = {"Imperfect participle of", "Basque imperfect participles"},
fpar = {"Future participle of", "Basque future participles"},
short = {"Short form of", "Basque short verb forms"},
vn = {"Verbal noun of", "Basque verbal nouns"}
}
local personal_paradigms = m_table.listToSet{"nor", "nor-nori", "nor-nork", "nor-nori-nork"}
local tenses = {presi = "present indicative", pasti = "past indicative", cond = "conditional indicative", hcons = "hypothetic consequential indicative",
pcons = "past consequential indicative", futi = "future indicative", presp = "present potential", pastp = "past potential",
hypp = "hypothetic potential", ccond = "close conditional potential", dcond = "distal conditional potential", press = "present subjunctive",
hyps = "hypothetic subjunctive", pasts = "past subjunctive", imp = "imperative" }
--generate the text
--nonfinite forms
if nonfinites] then
local nonfinite_data = nonfinites]
text = nonfinite_data
nocat = false
cats = {nonfinite_data}
--allocutive forms
elseif m_table.listToSet{"mall", "fall"}] then
local gender = (args == "mall") and "masculine" or "feminine"
check_allocutive(args, args)
text = m_com.rsub_multiple(gender, {"^m", "^f"}, {"M", "F"}) .. " allocutive form of"
nocat = false
cats = {"Basque " .. gender .. " allocutive verb forms"}
--nor forms
elseif args == "nor" then
text = nor_l
--nor-nori forms
elseif args == "nor-nori" then
text = nor_l .. ", taking " .. nori_l .. " as indirect object,"
--nor-nork forms
elseif args == "nor-nork" then
text = nork_l .. ", taking " .. nor_l .. " as direct object,"
--nor-nori-nork forms
elseif args == "nor-nori-nork" then
text = nork_l .. ", taking " .. nori_l .. " as indirect object and " .. nor_l .. " as direct object,"
else
error("Invalid verb form type.")
end
--add tenses
if personal_paradigms] then
if tenses] then
text = text .. " " .. tenses] .. " form of"
else
error("Please provide a valid tense/mood.")
end
end
--generate alternative forms (other than allocutives)
if args == "iritzi" then
local iritzi_repl = {
= "deritza", = "deritzo",
= "derizte", = "deritze",
= "eritzan", = "eritzon",
= "erizten", = "eritzen",
= "eritzaten", = "eritzoten",
= "erizteten", = "eritzeten",
}
for pat, repl in pairs(iritzi_repl) do
if rfind(pagename, pat) then
altform = rsub(pagename, pat, repl)
break
end
end
end
--return the result
local lemma_obj = {lang = lang, term = args, gloss = args}
local main_def = require("Module:form of").format_form_of{text = text, lemmas = {lemma_obj}, lemma_face = "term", posttext = dot} .. (nocat and "" or m_utilities.format_categories(cats, lang))
if not altform then
return main_def
else
local altform = mw.getCurrentFrame():preprocess('\n#: {{alti|eu|' .. altform .. '}}')
return main_def .. altform
end
end
return export