Jump to content

Module:goh-verb

From Wiktionary, the free dictionary

This module is used to create inflection tables for Old High German verbs.


local m_utilities = require("Module:utilities")
local com = require("Module:goh-common")
 
local export = {}
 
 local lang = require("Module:languages").getByCode("goh")
 
-- Within this module, conjugations are the functions that do the actual
-- conjugating by creating the forms of a basic verb (not prefixed or
-- separable). They are defined further down.
local conjugations = {}
 
-- The main entry point.
-- This is the only function that can be invoked from a template.
function export.show(frame)
	local conj_type = frame.args[1] or error("Conjugation type has not been specified. Please pass parameter 1 to the module invocation.")
	local args = frame:getParent().args
	SUBPAGENAME = mw.title.getCurrentTitle().subpageText
	NAMESPACE = mw.title.getCurrentTitle().nsText
 
	local forms, title, categories
 
	if conjugations[conj_type] then
		forms, title, categories = conjugations[conj_type](args)
	else
		error("Unknown conjugation type '" .. conj_type .. "'")
	end
 
	return make_table(forms, title) .. m_utilities.format_categories(categories, lang)
end


--[=[
	*** STRONG VERBS ***
]=]--
 
-- Conjugate a strong verb
conjugations["strong"] = function(args)
	local forms = {}
	local class = args["class"] or ""; if class ~= "" then class = " class " .. class end
	local categories = {"Old High German" .. class .. " strong verbs"}
	local title = "strong" .. class
	
	local pres_stem = args[1] or (NAMESPACE == "Template" and "(1)") or error("The first parameter is missing")
	local past_sg_stem = args[2] or (NAMESPACE == "Template" and "(2)") or error("The second parameter is missing")
	local past_stem = args[3] or (NAMESPACE == "Template" and "(3)") or error("The third parameter is missing")
	local past_part_stem = args[4] or (NAMESPACE == "Template" and "(4)") or error("The fourth parameter is missing")
	local mut_stem = (args["mutstem"] or ""); if mut_stem == "" then mut_stem = pres_stem end
	local imperative = (args["imp"] or ""); if imperative == "" then imperative = mut_stem end
	
	present_strong(forms, pres_stem, mut_stem, imperative)
	past_strong(forms, past_stem, past_sg_stem)
	forms["past_ptc"] = "gi" .. past_part_stem .. "an"
	
	return forms, title, categories
end

-- Conjugate a weak class 1a verb
conjugations["weak1a"] = function(args)
	local forms = {}
	local categories = {"Old High German class 1 weak verbs"}
	local title = "weak class 1"
	
	local pres_stem = args[1] or (NAMESPACE == "Template" and "(1)") or error("The first parameter is missing")
	local past_stem = args[2] or (NAMESPACE == "Template" and "(2)") or error("The first parameter is missing")
	
	present_weak1(forms, pres_stem)
	present_weak1a(forms, pres_stem)
	past_weak(forms, past_stem .. "it")
	
	return forms, title, categories
end

-- Conjugate a weak class 1b verb
conjugations["weak1b"] = function(args)
	local forms = {}
	local categories = {"Old High German class 1 weak verbs"}
	local title = "weak class 1"
	
	local pres_stem = args[1] or (NAMESPACE == "Template" and "(1)") or error("The first parameter is missing")
	local past_stem = (args[2] or ""); if past_stem == "" then past_stem = pres_stem end
	local tt = args["tt"] or ""; if tt == "" then if past_stem:find("[cfhklnprst]t$") then tt = "" else tt = "t" end end
		
	present_weak1(forms, pres_stem)	
	present_weak1b(forms, pres_stem)
	past_weak(forms, past_stem .. tt)
	
	return forms, title, categories
end

-- Conjugate a weak class 2 verb
conjugations["weak2"] = function(args)
	local forms = {}
	local categories = {"Old High German class 2 weak verbs"}
	local title = "weak class 2"
	
	local stem = args[1] or (NAMESPACE == "Template" and "(1)") or error("The first parameter is missing")
	
	present_weak2(forms, stem)	
	past_weak(forms, stem .. "ot")
	
	return forms, title, categories
end

-- Conjugate a weak class 3 verb
conjugations["weak3"] = function(args)
	local forms = {}
	local categories = {"Old High German class 3 weak verbs"}
	local title = "weak class 3"
	
	local stem = args[1] or (NAMESPACE == "Template" and "(1)") or error("The first parameter is missing")
	
	present_weak3(forms, stem)	
	past_weak(forms, stem .. "et")
	
	return forms, title, categories
end

-- Conjugate a preterite-present verb
conjugations["pp"] = function(args)
	local forms = {}
	local categories = {"Old High German preterite-present verbs"}
	local title = "[[preterite-present verb|preterite-present]]"
	
	local pres_stem = args[1] or (NAMESPACE == "Template" and "(1)") or error("The first parameter is missing")
	local pres_sg_stem = args[2] or (NAMESPACE == "Template" and "(2)") or error("The second parameter is missing")
	local past_stem = args[3] or (NAMESPACE == "Template" and "(3)") or error("The third parameter is missing")
	
	present_pp(forms, pres_stem, pres_sg_stem)
	past_weak(forms, past_stem)
	
	return forms, title, categories
end

--[=[
	*** IRREGULAR VERBS ***
]=]--

conjugations["tuon"] = function(args)
	local forms = {}
	local categories = {"Old High German irregular verbs"}
	local title = "irregular"
	
	present_weak2(forms, "tu")
	forms["pres_subj_2sg"] = "tues"
	
	forms["past_indc_1sg"] = "teta"
	forms["past_indc_2sg"] = "tati"
	forms["past_indc_3sg"] = "teta"
	
	past_generic(forms, "tat")
	
	forms["past_ptc"] = "gitan"
	
	return forms, title, categories
end

conjugations["gan"] = function(args)
	local forms = {}
	local categories = {"Old High German irregular verbs"}
	local title = "irregular, suppletive"
	
	-- Indicative
	forms["pres_indc_1sg"] = "gam"
	forms["pres_indc_2sg"] = "gas"
	forms["pres_indc_3sg"] = "gat"
	forms["pres_indc_1pl"] = "gam(es)"
	forms["pres_indc_2pl"] = "gat"
	forms["pres_indc_3pl"] = "gant"
	
	-- Subjunctive
	forms["pres_subj_1sg"] = "ge"
	forms["pres_subj_2sg"] = "ges"
	forms["pres_subj_3sg"] = "ge"
	forms["pres_subj_1pl"] = "gem(es)"
	forms["pres_subj_2pl"] = "get"
	forms["pres_subj_3pl"] = "gen"
	
	-- Imperative
	forms["impr_2sg"] = "gang"
	forms["impr_2pl"] = "gat"
	
	forms["infinitive"] = "gan"
	forms["pres_ptc"] = "ganti"
	
	past_strong(forms, "giang", "giang")
	forms["past_ptc"] = "gigangan"
	
	return forms, title, categories
end

conjugations["stan"] = function(args)
	local forms = {}
	local categories = {"Old High German irregular verbs"}
	local title = "irregular, suppletive"
	
	-- Indicative
	forms["pres_indc_1sg"] = "stam"
	forms["pres_indc_2sg"] = "stas"
	forms["pres_indc_3sg"] = "stat"
	forms["pres_indc_1pl"] = "stam(es)"
	forms["pres_indc_2pl"] = "stat"
	forms["pres_indc_3pl"] = "stant"
	
	-- Subjunctive
	forms["pres_subj_1sg"] = "ste"
	forms["pres_subj_2sg"] = "stes"
	forms["pres_subj_3sg"] = "ste"
	forms["pres_subj_1pl"] = "stem(es)"
	forms["pres_subj_2pl"] = "stet"
	forms["pres_subj_3pl"] = "sten"
	
	-- Imperative
	forms["impr_2sg"] = "stant"
	forms["impr_2pl"] = "stat"
	
	forms["infinitive"] = "stan"
	forms["pres_ptc"] = "stanti"
	
	past_strong(forms, "stuont", "stuont")
	forms["past_ptc"] = "gistantan"
	
	return forms, title, categories
end
 
function present_strong(forms, stem, mut_stem, imperative)
	-- Indicative
	forms["pres_indc_1sg"] = mut_stem .. "u"
	forms["pres_indc_2sg"] = mut_stem .. "is"
	forms["pres_indc_3sg"] = mut_stem .. "it"
	forms["pres_indc_1pl"] = stem .. "em(es)"
	forms["pres_indc_2pl"] = stem .. "et"
	forms["pres_indc_3pl"] = stem .. "ant"
	
	-- Subjunctive
	forms["pres_subj_1sg"] = stem .. "e"
	forms["pres_subj_2sg"] = stem .. "es"
	forms["pres_subj_3sg"] = stem .. "e"
	forms["pres_subj_1pl"] = stem .. "em(es)"
	forms["pres_subj_2pl"] = stem .. "et"
	forms["pres_subj_3pl"] = stem .. "en"
	
	-- Imperative
	forms["impr_2sg"] = com.dbl_cons(imperative)
	forms["impr_2pl"] = stem .. "et"
	
	forms["infinitive"] = stem .. "an"
	forms["pres_ptc"] = stem .. "anti"
end
 
function present_weak1(forms, stem, pres_stem)
	pres_stem = stem
	
	-- Indicative
	forms["pres_indc_1sg"] = stem .. "u"
	forms["pres_indc_2sg"] = stem .. "is"
	forms["pres_indc_3sg"] = stem .. "it"
	forms["pres_indc_1pl"] = stem .. "em(es)"
	forms["pres_indc_2pl"] = stem .. "et"
	forms["pres_indc_3pl"] = stem .. "ent"
	
	-- Subjunctive
	forms["pres_subj_1sg"] = stem .. "e"
	forms["pres_subj_2sg"] = stem .. "es"
	forms["pres_subj_3sg"] = stem .. "e"
	forms["pres_subj_1pl"] = stem .. "em(es)"
	forms["pres_subj_2pl"] = stem .. "et"
	forms["pres_subj_3pl"] = stem .. "en"
end

function present_weak1a(forms, stem, pres_stem)
	pres_stem = stem
	
	present_weak1(forms, stem)
	
	-- Imperative
	forms["impr_2sg"] = com.impr_1a(stem .. "i")
	forms["impr_2pl"] = stem .. "et"
	
	forms["infinitive"] = stem .. "en"
	forms["pres_ptc"] = stem .. "enti"
end

function present_weak1b(forms, stem, pres_stem)
	pres_stem = stem
	
	present_weak1(forms, stem)
	
	-- Imperative
	forms["impr_2sg"] = stem .. "i"
	forms["impr_2pl"] = stem .. "et"
	
	forms["infinitive"] = stem .. "en"
	forms["pres_ptc"] = stem .. "enti"
end

function present_weak2(forms, stem)
	-- Indicative
	forms["pres_indc_1sg"] = stem .. "om"
	forms["pres_indc_2sg"] = stem .. "os"
	forms["pres_indc_3sg"] = stem .. "ot"
	forms["pres_indc_1pl"] = stem .. "om(es)"
	forms["pres_indc_2pl"] = stem .. "ot"
	forms["pres_indc_3pl"] = stem .. "ont"
	
	-- Subjunctive
	forms["pres_subj_1sg"] = stem .. "o"
	forms["pres_subj_2sg"] = stem .. "os"
	forms["pres_subj_3sg"] = stem .. "o"
	forms["pres_subj_1pl"] = stem .. "om(es)"
	forms["pres_subj_2pl"] = stem .. "ot"
	forms["pres_subj_3pl"] = stem .. "on"
	
	-- Imperative
	forms["impr_2sg"] = stem .. "o"
	forms["impr_2pl"] = stem .. "ot"
	
	forms["infinitive"] = stem .. "on"
	forms["pres_ptc"] = stem .. "onti"
end

function present_weak3(forms, stem)
	-- Indicative
	forms["pres_indc_1sg"] = stem .. "em"
	forms["pres_indc_2sg"] = stem .. "es"
	forms["pres_indc_3sg"] = stem .. "et"
	forms["pres_indc_1pl"] = stem .. "em(es)"
	forms["pres_indc_2pl"] = stem .. "et"
	forms["pres_indc_3pl"] = stem .. "ent"
	
	-- Subjunctive
	forms["pres_subj_1sg"] = stem .. "e"
	forms["pres_subj_2sg"] = stem .. "es"
	forms["pres_subj_3sg"] = stem .. "e"
	forms["pres_subj_1pl"] = stem .. "em(es)"
	forms["pres_subj_2pl"] = stem .. "et"
	forms["pres_subj_3pl"] = stem .. "en"
	
	-- Imperative
	forms["impr_2sg"] = stem .. "e"
	forms["impr_2pl"] = stem .. "et"
	
	forms["infinitive"] = stem .. "en"
	forms["pres_ptc"] = stem .. "enti"
end
 
-- Create preterite-present present forms
function present_pp(forms, stem, sg_stem)
	-- Indicative
	forms["pres_indc_1sg"] = sg_stem
	forms["pres_indc_2sg"] = sg_stem
	forms["pres_indc_3sg"] = sg_stem
	forms["pres_indc_1pl"] = stem .. "um(es)"
	forms["pres_indc_2pl"] = stem .. "ut"
	forms["pres_indc_3pl"] = stem .. "un"
	
	-- Subjunctive
	forms["pres_subj_1sg"] = stem .. "ī"
	forms["pres_subj_2sg"] = stem .. "is"
	forms["pres_subj_3sg"] = stem .. "i"
	forms["pres_subj_1pl"] = stem .. "im(es)"
	forms["pres_subj_2pl"] = stem .. "it"
	forms["pres_subj_3pl"] = stem .. "in"
	
	-- Imperative
	forms["impr_2sg"] = ""
	forms["impr_2pl"] = ""
	
	forms["infinitive"] = stem .. "an"
	forms["pres_ptc"] = stem .. "anti"
end

-- Create strong past-tense forms
function past_strong(forms, stem, sg_stem, indc_stem)
	forms["past_indc_1sg"] = com.dbl_cons(sg_stem)
	forms["past_indc_2sg"] = sg_stem .. "i"
	forms["past_indc_3sg"] = com.dbl_cons(sg_stem)
	
	past_generic(forms, stem, indc_stem)
end

-- Create weak past-tense forms
function past_weak(forms, stem, past_stem)
	forms["past_indc_1sg"] = com.dbl_t(stem .. "a")
	forms["past_indc_2sg"] = com.dbl_t(stem .. "os")
	forms["past_indc_3sg"] = com.dbl_t(stem .. "a")
	
	past_generic(forms, stem, past_stem)
	
	forms["past_ptc"] = com.dbl_cons(com.dbl_t("gi" .. stem))
end

-- Create general past-tense forms
function past_generic(forms, stem, indc_stem, past_stem)
	past_stem = indc_stem
	indc_stem = indc_stem or stem
	
	-- Nonsingular indicative
	forms["past_indc_1pl"] = com.dbl_t(indc_stem .. "um(es)")
	forms["past_indc_2pl"] = com.dbl_t(indc_stem .. "ut")
	forms["past_indc_3pl"] = com.dbl_t(indc_stem .. "un")
	
	-- Subjunctive
	forms["past_subj_1sg"] = com.dbl_t(stem .. "i")
	forms["past_subj_2sg"] = com.dbl_t(stem .. "is")
	forms["past_subj_3sg"] = com.dbl_t(stem .. "i")
	forms["past_subj_1pl"] = com.dbl_t(stem .. "im(es)")
	forms["past_subj_2pl"] = com.dbl_t(stem .. "it")
	forms["past_subj_3pl"] = com.dbl_t(stem .. "in")
end

-- Make the table
function make_table(forms, title)
	-- Make links out of all forms
	
	for key, form in pairs(forms) do
		forms[key] = com.link_form(form)
	end
	
	return [=[
<div class="NavFrame" style="width: 40em">
<div class="NavHead" style="text-align: left">Conjugation of '']=] .. forms["infinitive"] .. "''" .. (title and " (" .. title .. ")" or "") .. [=[</div>
<div class="NavContent">
{| style="width: 100%; line-height: 125%; background-color:#F5FFFA; text-align:center; border: 1px solid #CCCCFF;" cellpadding="3" cellspacing="1" class="inflection-table"
|- style="background-color:#EFEFEF; "
|-
! style="font-size:90%; background-color:#93C572" | [[indicative mood|indicative]]
! style="font-size:90%; background-color:#90EE90" | [[present tense|present]]
! style="font-size:90%; background-color:#90EE90" | [[preterite]]
|-
! [[first person|1st]]&nbsp;[[singular]]
| ]=] .. forms["pres_indc_1sg"] .. " || " .. forms["past_indc_1sg"] .. [=[
 
|-
! [[second person|2nd]]&nbsp;[[singular]]
| ]=] .. forms["pres_indc_2sg"] .. " || " .. forms["past_indc_2sg"] .. [=[
 
|-
! [[third person|3rd]]&nbsp;[[singular]]
| ]=] .. forms["pres_indc_3sg"] .. " || " .. forms["past_indc_3sg"] .. [=[
 
|-
! [[first person|1st]]&nbsp;[[plural]]
| ]=] .. forms["pres_indc_1pl"] .. " || " .. forms["past_indc_1pl"] .. [=[
 
|-
! [[second person|2nd]]&nbsp;[[plural]]
| ]=] .. forms["pres_indc_2pl"] .. " || " .. forms["past_indc_2pl"] .. [=[
 
|-
! [[third person|3rd]]&nbsp;[[plural]]
| ]=] .. forms["pres_indc_3pl"] .. " || " .. forms["past_indc_3pl"] .. [=[
 
|-
! style="font-size:90%; background-color:#93C572" | [[subjunctive mood|subjunctive]]
! style="font-size:90%; background-color:#90EE90" | [[present tense|present]]
! style="font-size:90%; background-color:#90EE90" | [[past tense|past]]
|-
! [[first person|1st]]&nbsp;[[singular]]
| ]=] .. forms["pres_subj_1sg"] .. " || " .. forms["past_subj_1sg"] .. [=[
 
|-
! [[second person|2nd]]&nbsp;[[singular]]
| ]=] .. forms["pres_subj_2sg"] .. " || " .. forms["past_subj_2sg"] .. [=[
 
|-
! [[third person|3rd]]&nbsp;[[singular]]
| ]=] .. forms["pres_subj_3sg"] .. " || " .. forms["past_subj_3sg"] .. [=[
 
|-
! [[first person|1st]]&nbsp;[[plural]]
| ]=] .. forms["pres_subj_1pl"] .. " || " .. forms["past_subj_1pl"] .. [=[
 
|-
! [[second person|2nd]]&nbsp;[[plural]]
| ]=] .. forms["pres_subj_2pl"] .. " || " .. forms["past_subj_2pl"] .. [=[
 
|-
! [[third person|3rd]]&nbsp;[[plural]]
| ]=] .. forms["pres_subj_3pl"] .. " || " .. forms["past_subj_3pl"] .. [=[
 
|-
! style="font-size:90%; background-color:#93C572" | [[imperative mood|imperative]]
! style="font-size:90%; background-color:#90EE90" | 
! style="font-size:90%; background-color:#90EE90" | 
|-
! [[singular]]
| ]=] .. forms["impr_2sg"] .. [=[
 
|-
! [[plural]]
| ]=] .. forms["impr_2pl"] .. [=[
 
|-
! style="font-size:90%; background-color:#93C572" | [[participle]]
! style="font-size:90%; background-color:#90EE90" | [[present tense|present]]
! style="font-size:90%; background-color:#90EE90" | [[past tense|past]]
|-
!
| ]=] .. forms["pres_ptc"] .. " || " .. forms["past_ptc"] .. [=[
 
|}</div></div>]=]
end

return export