Jump to content

Module:User:IsomorphycSandbox/la-verb-fake

From Wiktionary, the free dictionary


local m_utilities = require("Module:utilities")
local m_links = require("Module:links")

local export = {}

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

NAMESPACE = NAMESPACE or mw.title.getCurrentTitle().nsText
PAGENAME = PAGENAME or mw.title.getCurrentTitle().text

-- Conjugations are the functions that do the actual
-- conjugating by creating the forms of a basic verb.
-- They are defined further down.
local conjugations = {}

-- Check if this verb is reconstructed
-- i.e. the pagename is Reconstruction:Latin/... or Appendix:Latin/...
local reconstructed = (NAMESPACE == "Reconstruction" or NAMESPACE == "Appendix") and mw.ustring.find(PAGENAME,"^Latin/")

-- The main entry point.
-- This is the only function that can be invoked from a template.

function export.shuo(frame) return mw.ustring.gsub(mw.ustring.toNFD(frame:getParent().args[1]),'[^%w]+',"") end

function export.show(frame)
	local data, domain = make_data(frame), frame:getParent().args['search']
	if domain == nil then
		return make_table(data) .. m_utilities.format_categories(data.categories, lang)
	else 
		local verb = data['forms']['1s_pres_actv_indc'] ~= nil and ('[['..mw.ustring.gsub(mw.ustring.toNFD(data['forms']['1s_pres_actv_indc']),'[^%w]+',"")..'|'..data['forms']['1s_pres_actv_indc'].. ']]') or 'verb'
		return link_google_books(verb, flatten_values(data['forms']), domain) end
end


function make_data(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
	local subtype = frame.args["type"] or args["type"]; if subtype == nil then subtype = '' end
	local sync_perf = args["sync_perf"]; if sync_perf == nil then sync_perf = '' end
	local p3inf = args["p3inf"]; if p3inf == nil then p3inf = '' end
	
	NAMESPACE = mw.title.getCurrentTitle().nsText
	
	if not conjugations[conj_type] then
		error("Unknown conjugation type '" .. conj_type .. "'")
	end
	
	local data = {forms = {}, title = {}, categories = {}, form_footnote_indices = {}, footnotes = {}}  --note: the addition of red superscripted footnotes ('<sup style="color: red">' ... </sup>) is only implemented for the three form printing loops in which it is used
	local typeinfo = {conj_type = conj_type, subtype = subtype, sync_perf = sync_perf, p3inf = p3inf}
	
	-- Generate the verb forms
	conjugations[conj_type](args, data, typeinfo)
	
	-- Override with user-set forms
	override(data, args)
	
	-- Post-process the forms
	postprocess(data, typeinfo)
	
	-- Check if the links to the verb forms exist
	checkexist(data)
	
	-- Check if the verb is irregular
	if not conj_type == 'irreg' then checkirregular(args, data) end
	return data
end

function postprocess(data, typeinfo)
	-- Add information for the passive perfective forms
	if data.forms["perf_pasv_ptc"] then
		local ppplink = m_links.full_link({lang = lang, term = data.forms["perf_pasv_ptc"]}, "term")
		local sumlink = m_links.full_link({lang = lang, term = "sum"}, "term")
		
		data.forms["perf_pasv_indc"] = ppplink .. " + present active indicative of " .. sumlink
		data.forms["futp_pasv_indc"] = ppplink .. " + future active indicative of " .. sumlink
		data.forms["plup_pasv_indc"] = ppplink .. " + imperfect active indicative of " .. sumlink
		data.forms["perf_pasv_subj"] = ppplink .. " + present active subjunctive of " .. sumlink
		data.forms["plup_pasv_subj"] = ppplink .. " + imperfect active subjunctive of " .. sumlink
	end
	
	-- Types of irregularity related primarily to the active.
	-- These could in theory be combined with those related to the passive and imperative,
	-- i.e. there's no reason there couldn't be an impersonal deponent verb with no imperatives.
	if typeinfo.subtype == "impers" then
		-- Impersonal verbs have only third-person singular forms.
		table.insert(data.title, "[[impersonal]]")
		table.insert(data.categories, "Latin impersonal verbs")
		
		-- Remove all non-3sg forms
		for key, form in pairs(data.forms) do
			if key:find("[12][sp]") or key:find("3p") then
				data.forms[key] = nil
			end
		end
	elseif typeinfo.subtype == "impers-nopass" then
		-- Impersonal verbs have only third-person singular forms.
		table.insert(data.title, "[[impersonal]]")
		table.insert(data.title, "active only")
		table.insert(data.categories, "Latin impersonal verbs")
		table.insert(data.categories, "Latin active-only verbs")
		
		-- Remove all non-3sg and passive forms
		for key, form in pairs(data.forms) do
			if key:find("[12][sp]") or key:find("3p") or key:find("pasv") then
				data.forms[key] = nil
			end
		end
	elseif typeinfo.subtype == "impers-depon" then
		-- Impersonal verbs have only third-person singular forms.
		table.insert(data.title, "[[impersonal]]")
		table.insert(data.title, "[[deponent]]")
		table.insert(data.categories, "Latin impersonal verbs")
		table.insert(data.categories, "Latin deponent verbs")
		
		-- Remove all non-3sg and active forms and future passive infinitive
		for key, form in pairs(data.forms) do
			if key:find("[12][sp]") or key:find("3p") or key:find("actv") and key ~= "pres_actv_ptc" and key ~= "futr_actv_ptc" or key == "futr_pasv_inf" then
				data.forms[key] = nil
			end
		end
		
		-- Change passive to active
		for key, form in pairs(data.forms) do
			if key:find("pasv") and key ~= "pres_pasv_ptc" and key ~= "futr_pasv_ptc" then
				data.forms[key:gsub("pasv", "actv")] = form
				data.forms[key] = nil
			end
		end
	elseif typeinfo.subtype == "3only" then
		table.insert(data.title, "[[impersonal]]")
		table.insert(data.categories, "Latin impersonal verbs")
		
		-- Remove all non-3sg forms
		for key, form in pairs(data.forms) do
			if key:find("[12][sp]") then
				data.forms[key] = nil
			end
		end
	elseif typeinfo.subtype == "3only-nopass" then
		table.insert(data.title, "[[impersonal]]")
		table.insert(data.title, "active only")
		table.insert(data.categories, "Latin impersonal verbs")
		table.insert(data.categories, "Latin active-only verbs")
		
		-- Remove all non-3sg and passive forms
		for key, form in pairs(data.forms) do
			if key:find("[12][sp]") or key:find("pasv") then
				data.forms[key] = nil
			end
		end
	elseif typeinfo.subtype == "3only-depon" then
		table.insert(data.title, "[[impersonal]]")
		table.insert(data.title, "[[deponent]]")
		table.insert(data.categories, "Latin impersonal verbs")
		table.insert(data.categories, "Latin deponent verbs")
		
		-- Remove all non-3sg and active forms and future passive infinitive
		for key, form in pairs(data.forms) do
			if key:find("[12][sp]") or key:find("actv") and key ~= "pres_actv_ptc" and key ~= "futr_actv_ptc" or key == "futr_pasv_inf" then
				data.forms[key] = nil
			end
		end
		
		-- Change passive to active
		for key, form in pairs(data.forms) do
			if key:find("pasv") and key ~= "pres_pasv_ptc" and key ~= "futr_pasv_ptc" then
				data.forms[key:gsub("pasv", "actv")] = form
				data.forms[key] = nil
			end
		end
	end
	
	-- Handle certain irregularities in the passive
	if typeinfo.subtype == "depon" then
		-- Deponent verbs use passive forms with active meaning
		table.insert(data.title, "[[deponent]]")
		table.insert(data.categories, "Latin deponent verbs")
		
		-- Remove active forms and future passive infinitive
		for key, form in pairs(data.forms) do
			if key:find("actv") and key ~= "pres_actv_ptc" and key ~= "futr_actv_ptc" and key ~= "futr_actv_inf" or key == "futr_pasv_inf" then
				data.forms[key] = nil
			end
		end
		
		-- Change passive to active
		for key, form in pairs(data.forms) do
			if key:find("pasv") and key ~= "pres_pasv_ptc" and key ~= "futr_pasv_ptc" and key ~= "futr_pasv_inf" then
				data.forms[key:gsub("pasv", "actv")] = form
				data.forms[key] = nil
			end
		end
	
		-- Generate correct form of infinitive for nominative gerund
		data.forms["ger_nom"] = data.forms["pres_actv_inf"]
		
	elseif typeinfo.subtype == "semi-depon" then
		-- Semi-deponent verbs use perfective passive forms with active meaning,
		-- and have no imperfective passive
		table.insert(data.title, "[[semi-deponent]]")
		table.insert(data.categories, "Latin semi-deponent verbs")
		
		-- Remove perfective active and imperfective passive forms
		for key, form in pairs(data.forms) do
			if key:find("perf_actv") or key:find("plup_actv") or key:find("futp_actv") or key:find("pres_pasv") or key:find("impf_pasv") or key:find("futr_pasv") then
				data.forms[key] = nil
			end
		end
		
		-- Change perfective passive to active
		for key, form in pairs(data.forms) do
			if key:find("perf_pasv") or key:find("plup_pasv") or key:find("futp_pasv") then
				data.forms[key:gsub("pasv", "actv")] = form
				data.forms[key] = nil
			end
		end
	elseif typeinfo.subtype == "depon-noperf" then --(e.g. calvor, -ī)
		table.insert(data.title, "[[deponent]]")
		table.insert(data.categories, "Latin deponent verbs")
		table.insert(data.title, "[[defective verb|defective]]")
		table.insert(data.categories, "Latin defective verbs")
		
		-- Remove active forms and future passive infinitive
		for key, form in pairs(data.forms) do
			if key:find("actv") and key ~= "pres_actv_ptc" and key ~= "futr_actv_ptc" and key ~= "futr_actv_inf" or key == "futr_pasv_inf" then
				data.forms[key] = nil
			end
		end
		
		-- Change passive to active
		for key, form in pairs(data.forms) do
			if key:find("pasv") and key ~= "pres_pasv_ptc" and key ~= "futr_pasv_ptc" and key ~= "futr_pasv_inf" then
				data.forms[key:gsub("pasv", "actv")] = form
				data.forms[key] = nil
			end
		end
		
		-- Remove all perfect forms
		for key, form in pairs(data.forms) do
			if key:find("perf") or key:find("plup") or key:find("futp") then
				data.forms[key] = nil
			end
		end
	elseif typeinfo.subtype == "noperf" then
		-- Some verbs have no perfect forms (e.g. inalbēscō, -ěre)
		table.insert(data.title, "[[defective verb|defective]]")
		table.insert(data.categories, "Latin defective verbs")

		-- Remove all perfect forms
		for key, form in pairs(data.forms) do
			if key:find("perf") or key:find("plup") or key:find("futp") then
				data.forms[key] = nil
			end
		end
	elseif typeinfo.subtype == "no-actv-perf" then
		-- Some verbs have no active perfect forms (e.g. interstinguō, -ěre)
		table.insert(data.title, "no active perfect forms")
		table.insert(data.categories, "Latin defective verbs")
		
		-- Remove all active perfect forms
		for key, form in pairs(data.forms) do
			if key:find("actv") and (key:find("perf") or key:find("plup") or key:find("futp")) then
				data.forms[key] = nil
			end
		end
	elseif typeinfo.subtype == "no-pasv-perf" then
		-- Some verbs have no passive perfect forms (e.g. ārēscō, -ěre)
		table.insert(data.title, "no passive perfect forms")
		table.insert(data.categories, "Latin defective verbs")
		
		-- Remove all passive perfect forms
		for key, form in pairs(data.forms) do
			if key:find("pasv") and (key:find("perf") or key:find("plup") or key:find("futp")) then
				data.forms[key] = nil
			end
		end
	elseif typeinfo.subtype == "nopass-noperf" then
		-- Some verbs have no passive and no perfect forms (e.g. albēscō, -ěre)
		table.insert(data.title, "[[defective verb|defective]]")
		table.insert(data.title, "active only")
		table.insert(data.categories, "Latin defective verbs")
		table.insert(data.categories, "Latin active-only verbs")
		
		-- Remove all passive and all perfect forms
		for key, form in pairs(data.forms) do
			if key:find("pasv") or key:find("perf") or key:find("plup") or key:find("futp") then
				data.forms[key] = nil
			end
		end
	elseif typeinfo.subtype == "nopass" then
		-- Some verbs have no passive forms (usually intransitive)
		table.insert(data.title, "active only")
		table.insert(data.categories, "Latin active-only verbs")
		
		-- Remove all passive forms
		for key, form in pairs(data.forms) do
			if key:find("pasv") then
				data.forms[key] = nil
			end
		end
	elseif typeinfo.subtype == "pass-3only" then
		-- Some verbs have only third-person forms in the passive
		table.insert(data.title, "only third-person forms in passive")
		table.insert(data.categories, "Latin verbs with third-person passive")
		
		-- Remove all non-3rd-person passive forms and all passive imperatives
		for key, form in pairs(data.forms) do
			if key:find("pasv") and (key:find("[12][sp]") or key:find("impr")) then
				data.forms[key] = nil
			end
		end
	elseif typeinfo.subtype == "pass-impers" then
		-- Some verbs are impersonal in the passive
		table.insert(data.title, "[[impersonal]] in passive")
		table.insert(data.categories, "Latin verbs with impersonal passive")
		
		-- Remove all non-3sg passive forms
		for key, form in pairs(data.forms) do
			if key:find("pasv") and (key:find("[12][sp]") or key:find("3p") or key:find("impr")) or key:find("futr_pasv_inf") then
				data.forms[key] = nil
			end
		end
	elseif typeinfo.subtype == "perf-as-pres" then
		-- Perfect forms as present tense
		table.insert(data.title, "active only")
		table.insert(data.title, "[[perfect]] forms as present")
		table.insert(data.title, "pluperfect as imperfect")
		table.insert(data.title, "future perfect as future")
		table.insert(data.categories, "Latin defective verbs")
		table.insert(data.categories, "Latin active-only verbs")
        table.insert(data.categories, "Latin verbs with perfect forms having imperfective meanings")
		
		-- Change perfect passive participle to perfect active participle
		data.forms["perf_actv_ptc"] = data.forms["perf_pasv_ptc"]
		
		-- Change perfect active infinitive to present active infinitive
		data.forms["pres_actv_inf"] = data.forms["perf_actv_inf"]
		
		-- Remove passive forms
		-- Remove present active, imperfect active and future active forms
		for key, form in pairs(data.forms) do
			if key ~= "futr_actv_inf" and key ~= "futr_actv_ptc" and (key:find("pasv") or key:find("pres") and key ~= "pres_actv_inf" or key:find("impf") or key:find("futr")) then
				data.forms[key] = nil
			end
		end

		-- Change perfect forms to non-perfect forms
		for key, form in pairs(data.forms) do
			if key:find("perf") and key ~= "perf_actv_ptc" then
				data.forms[key:gsub("perf", "pres")] = form
				data.forms[key] = nil
			elseif key:find("plup") then
				data.forms[key:gsub("plup", "impf")] = form
				data.forms[key] = nil
			elseif key:find("futp") then
				data.forms[key:gsub("futp", "futr")] = form
				data.forms[key] = nil
			elseif key:find("ger") then
				data.forms[key] = nil
			end
		end
		
		data.forms["pres_actv_ptc"] = nil
	elseif typeinfo.subtype == "memini" then
		-- Perfect forms as present tense
		table.insert(data.title, "active only")
		table.insert(data.title, "[[perfect]] forms as present")
		table.insert(data.title, "pluperfect as imperfect")
		table.insert(data.title, "future perfect as future")
		table.insert(data.categories, "Latin defective verbs")
		table.insert(data.categories, "Latin verbs with perfect forms having imperfective meanings")

		-- Remove passive forms
		-- Remove present active, imperfect active and future active forms
		-- Except for future active imperatives
		for key, form in pairs(data.forms) do
			if key:find("pasv") or key:find("pres") or key:find("impf") or key:find("futr") or key:find("ptc") or key:find("ger") then
				data.forms[key] = nil
			end
		end

		-- Change perfect forms to non-perfect forms
		for key, form in pairs(data.forms) do
			if key:find("perf") and key ~= "perf_actv_ptc" then
				data.forms[key:gsub("perf", "pres")] = form
				data.forms[key] = nil
			elseif key:find("plup") then
				data.forms[key:gsub("plup", "impf")] = form
				data.forms[key] = nil
			elseif key:find("futp") then
				data.forms[key:gsub("futp", "futr")] = form
				data.forms[key] = nil
			end
		end
		
		-- Add imperative forms
		data.forms["2s_futr_actv_impr"] = "mementō"
		data.forms["2p_futr_actv_impr"] = "mementōte"
	end

	-- Handle certain irregularities in the imperative
	if typeinfo.subtype == "noimp" then
		-- Some verbs have no imperatives
		table.insert(data.title, "no [[imperative]]s")
	end
	

	-- Add the ancient future_passive_participle of certain verbs
	if typeinfo.pres_stem == "lāb" then
		data.forms["futr_pasv_ptc"] = "lābundus"
	elseif typeinfo.pres_stem == "collāb" then
		data.forms["futr_pasv_ptc"] = "collābundus"
	elseif typeinfo.pres_stem == "illāb" then
		data.forms["futr_pasv_ptc"] = "illābundus"
	elseif typeinfo.pres_stem == "relāb" then
		data.forms["futr_pasv_ptc"] = "relābundus"
	end

	-- Add the poetic present passives infinitive forms of certain verbs
	if typeinfo.p3inf == '1' then
			local form, noteindex = "pres_"..(typeinfo.subtype=='depon' and "actv" or "pasv").."_inf", #(data.footnotes)+1
			data.forms[form] = {data.forms[form], mw.ustring.sub(data.forms[form], 1,-2).."ier" }
			data.form_footnote_indices[form] = tostring(noteindex)
			if typeinfo.subtype=='depon' then
				data.form_footnote_indices["ger_nom"] = tostring(noteindex)
				data.forms['ger_nom'] = data.forms[form]
			end
			data.footnotes[noteindex] = 'The present passive infinitive in -ier is a rare poetic form which is attested for this verb.'
	end
	
	--Add the syncopated perfect forms, omitting the separately handled fourth conjugation cases
	
	if typeinfo.sync_perf == 'poetic' then
		local sss = { {'perf_actv_inf', 'sse'}, --infinitive
			    {'2s_perf_actv_indc','sti'},  {'2p_perf_actv_indc','stis'}, --unambiguous perfect actives
			    {'1s_plup_actv_subj','ssem'}, {'2s_plup_actv_subj','sses'}, {'3s_plup_actv_subj','sset'}, {'1p_plup_actv_subj','ssemus'},  {'2p_plup_actv_subj','ssetis'},  {'3p_plup_actv_subj','ssent'} } --pluperfect subjunctives
		local noteindex = #(data.footnotes)+1
		function add_sync_perf(form, suff_sync) 
			local old = data.forms[form]
			data.forms[form] = type(old) == "table" and old or {old, mw.ustring.sub(old, 1, -mw.ustring.len(suff_sync)-3)..suff_sync }
			data.form_footnote_indices[form] = noteindex end
		for k,v in pairs(sss) do
			add_sync_perf(v[1],v[2]) end
		data.footnotes[noteindex] = "At least one rare poetic syncopated perfect form is attested." end

end


--[=[
	Conjugation functions
]=]--

function get_regular_stems(args, typeinfo)
	-- Get the parameters
	if typeinfo.subtype:find("depon") then
		-- Deponent and semi-deponent verbs don't have the perfective principal part
		typeinfo.pres_stem = args[1]; if typeinfo.pres_stem == "" then typeinfo.pres_stem = nil end
		typeinfo.perf_stem = nil
		typeinfo.supine_stem = args[2]; if typeinfo.supine_stem == "" then typeinfo.supine_stem = nil end
	else
		typeinfo.pres_stem = args[1]; if typeinfo.pres_stem == "" then typeinfo.pres_stem = nil end
		typeinfo.perf_stem = args[2]; if typeinfo.perf_stem == "" then typeinfo.perf_stem = nil end
		typeinfo.supine_stem = args[3]; if typeinfo.supine_stem == "" then typeinfo.supine_stem = nil end
	end
	
	if (typeinfo.subtype == "perf-as-pres" or typeinfo.subtype == "memini") and not typeinfo.pres_stem then typeinfo.pres_stem = "whatever" end
	
	-- Prepare stems
	if not typeinfo.pres_stem then
		if NAMESPACE == "Template" then
			typeinfo.pres_stem = "-"
		else
			error("Present stem has not been provided")
		end
	end
	
	if not typeinfo.perf_stem and not typeinfo.subtype:find("depon") and not typeinfo.subtype:find("noperf") then
		if typeinfo.conj_type == "1st" then
			typeinfo.perf_stem = typeinfo.pres_stem .. "āv"
		elseif NAMESPACE == "Template" then
			typeinfo.perf_stem = "-"
		else
			error("Perfect stem has not been provided")
		end
	end
	
	if not typeinfo.supine_stem and not typeinfo.subtype:find("nopass") and not typeinfo.subtype:find("noperf") and typeinfo.subtype ~= "no-pasv-perf" and typeinfo.subtype ~= "memini" and typeinfo.subtype ~= "pass-3only" then
		if typeinfo.conj_type == "1st" then
			typeinfo.supine_stem = typeinfo.pres_stem .. "āt"
		elseif NAMESPACE == "Template" then
			typeinfo.supine_stem = "-"
		else
			error("Supine stem has not been provided")
		end
	end
end

conjugations["1st"] = function(args, data, typeinfo)
	get_regular_stems(args, typeinfo)
	
	table.insert(data.title, "[[Appendix:Latin first conjugation|first conjugation]]")
	table.insert(data.categories, "Latin first conjugation verbs")
	
	if typeinfo.perf_stem then
		if typeinfo.perf_stem == typeinfo.pres_stem .. "āv" then
			table.insert(data.categories, "Latin first conjugation verbs with perfect in -av-")
		elseif typeinfo.perf_stem == typeinfo.pres_stem .. "u" then
			table.insert(data.categories, "Latin first conjugation verbs with perfect in -u-")
		elseif typeinfo.perf_stem == typeinfo.pres_stem then
			table.insert(data.categories, "Latin first conjugation verbs with suffixless perfect")
		else
			table.insert(data.categories, "Latin first conjugation verbs with irregular perfect")
		end
	end
	
	make_pres_1st(data, typeinfo.pres_stem)
	make_perf(data, typeinfo.perf_stem)
	make_supine(data, typeinfo.supine_stem)
end

conjugations["2nd"] = function(args, data, typeinfo)
	get_regular_stems(args, typeinfo)
	
	table.insert(data.title, "[[Appendix:Latin second conjugation|second conjugation]]")
	table.insert(data.categories, "Latin second conjugation verbs")
	
	if typeinfo.perf_stem then
		typeinfo.pres_stem = mw.ustring.gsub(typeinfo.pres_stem,"qu","1")
		typeinfo.perf_stem = mw.ustring.gsub(typeinfo.perf_stem,"qu","1")
		apocope = mw.ustring.gsub(typeinfo.pres_stem,"[bcdfghjklmnp1rstvwxz]+$","")
		if typeinfo.perf_stem == typeinfo.pres_stem .. "ēv" then
			table.insert(data.categories, "Latin second conjugation verbs with perfect in -ev-")
		elseif typeinfo.perf_stem == typeinfo.pres_stem .. "u" then
			table.insert(data.categories, "Latin second conjugation verbs with perfect in -u-")
		elseif typeinfo.perf_stem == typeinfo.pres_stem then
			table.insert(data.categories, "Latin second conjugation verbs with suffixless perfect")
		elseif typeinfo.perf_stem == apocope .. "x" or typeinfo.perf_stem == apocope .. "s" then
			table.insert(data.categories, "Latin second conjugation verbs with perfect in -s- or -x-")
		else
			table.insert(data.categories, "Latin second conjugation verbs with irregular perfect")
		end
		typeinfo.pres_stem = mw.ustring.gsub(typeinfo.pres_stem,"1","qu")
		typeinfo.perf_stem = mw.ustring.gsub(typeinfo.perf_stem,"1","qu")
	end
	
	make_pres_2nd(data, typeinfo.pres_stem)
	make_perf(data, typeinfo.perf_stem)
	make_supine(data, typeinfo.supine_stem)
end

conjugations["3rd"] = function(args, data, typeinfo)
	get_regular_stems(args, typeinfo)
	
	table.insert(data.title, "[[Appendix:Latin third conjugation|third conjugation]]")
	table.insert(data.categories, "Latin third conjugation verbs")
	
	if typeinfo.perf_stem then
		typeinfo.pres_stem = mw.ustring.gsub(typeinfo.pres_stem,"qu","1")
		typeinfo.perf_stem = mw.ustring.gsub(typeinfo.perf_stem,"qu","1")
		apocope = mw.ustring.gsub(typeinfo.pres_stem,"[bcdfghjklmnp1rstvwxz]+$","")
		if typeinfo.perf_stem == typeinfo.pres_stem .. "āv" then
			table.insert(data.categories, "Latin third conjugation verbs with perfect in -av-")
		elseif typeinfo.perf_stem == typeinfo.pres_stem .. "ēv" then
			table.insert(data.categories, "Latin third conjugation verbs with perfect in -ev-")
		elseif typeinfo.perf_stem == typeinfo.pres_stem .. "īv" then
			table.insert(data.categories, "Latin third conjugation verbs with perfect in -iv-")
		elseif typeinfo.perf_stem == typeinfo.pres_stem .. "u" then
			table.insert(data.categories, "Latin third conjugation verbs with perfect in -u-")
		elseif typeinfo.perf_stem == typeinfo.pres_stem then
			table.insert(data.categories, "Latin third conjugation verbs with suffixless perfect")
		elseif typeinfo.perf_stem == apocope .. "x" or typeinfo.perf_stem == apocope .. "s" then
			table.insert(data.categories, "Latin third conjugation verbs with perfect in -s- or -x-")
		else
			table.insert(data.categories, "Latin third conjugation verbs with irregular perfect")
		end
	typeinfo.pres_stem = mw.ustring.gsub(typeinfo.pres_stem,"1","qu")
	typeinfo.perf_stem = mw.ustring.gsub(typeinfo.perf_stem,"1","qu")
	end
	
	if typeinfo.pres_stem and mw.ustring.match(typeinfo.pres_stem,"[āēīōū]sc$") then
		table.insert(data.categories, "Latin inchoative verbs")
	end
	
	make_pres_3rd(data, typeinfo.pres_stem)
	make_perf(data, typeinfo.perf_stem)
	make_supine(data, typeinfo.supine_stem)
end

conjugations["3rd-io"] = function(args, data, typeinfo)
	get_regular_stems(args, typeinfo)
	
	table.insert(data.title, "[[Appendix:Latin third conjugation|third conjugation]] ''iō''-variant")
	table.insert(data.categories, "Latin third conjugation verbs")
	
	if typeinfo.perf_stem then
		typeinfo.pres_stem = mw.ustring.gsub(typeinfo.pres_stem,"qu","1")
		typeinfo.perf_stem = mw.ustring.gsub(typeinfo.perf_stem,"qu","1")
		apocope = mw.ustring.gsub(typeinfo.pres_stem,"[bcdfghjklmnp1rstvwxz]+$","")
		if typeinfo.perf_stem == typeinfo.pres_stem .. "āv" then
			table.insert(data.categories, "Latin third conjugation verbs with perfect in -av-")
		elseif typeinfo.perf_stem == typeinfo.pres_stem .. "ēv" then
			table.insert(data.categories, "Latin third conjugation verbs with perfect in -ev-")
		elseif typeinfo.perf_stem == typeinfo.pres_stem .. "īv" then
			table.insert(data.categories, "Latin third conjugation verbs with perfect in -iv-")
		elseif typeinfo.perf_stem == typeinfo.pres_stem .. "u" then
			table.insert(data.categories, "Latin third conjugation verbs with perfect in -u-")
		elseif typeinfo.perf_stem == typeinfo.pres_stem then
			table.insert(data.categories, "Latin third conjugation verbs with suffixless perfect")
		elseif typeinfo.perf_stem == apocope .. "x" or typeinfo.perf_stem == apocope .. "s" then
			table.insert(data.categories, "Latin third conjugation verbs with perfect in -s- or -x-")
		else
			table.insert(data.categories, "Latin third conjugation verbs with irregular perfect")
		end
		typeinfo.pres_stem = mw.ustring.gsub(typeinfo.pres_stem,"1","qu")
		typeinfo.perf_stem = mw.ustring.gsub(typeinfo.perf_stem,"1","qu")
	end
	
	make_pres_3rd_io(data, typeinfo.pres_stem)
	make_perf(data, typeinfo.perf_stem)
	make_supine(data, typeinfo.supine_stem)
end

conjugations["4th"] = function(args, data, typeinfo)
	get_regular_stems(args, typeinfo)
	
	table.insert(data.title, "[[Appendix:Latin fourth conjugation|fourth conjugation]]")
	table.insert(data.categories, "Latin fourth conjugation verbs")
	
	
	if typeinfo.perf_stem then
		typeinfo.pres_stem = mw.ustring.gsub(typeinfo.pres_stem,"qu","1")
		typeinfo.perf_stem = mw.ustring.gsub(typeinfo.perf_stem,"qu","1")
		apocope = mw.ustring.gsub(typeinfo.pres_stem,"[bcdfghjklmnp1rstvwxz]+$","")
		clone = mw.ustring.gsub(typeinfo.perf_stem,"%.","")
		if clone == typeinfo.pres_stem .. "īv" then
			table.insert(data.categories, "Latin fourth conjugation verbs with perfect in -iv-")
		elseif clone == typeinfo.pres_stem .. "u" then
			table.insert(data.categories, "Latin fourth conjugation verbs with perfect in -u-")
		elseif clone == typeinfo.pres_stem then
			table.insert(data.categories, "Latin fourth conjugation verbs with suffixless perfect")
		elseif clone == apocope .. "x" or clone == apocope .. "s" then
			table.insert(data.categories, "Latin fourth conjugation verbs with perfect in -s- or -x-")
		else
			table.insert(data.categories, "Latin fourth conjugation verbs with irregular perfect")
		end
		typeinfo.pres_stem = mw.ustring.gsub(typeinfo.pres_stem,"1","qu")
		typeinfo.perf_stem = mw.ustring.gsub(typeinfo.perf_stem,"1","qu")
	end
	
	make_pres_4th(data, typeinfo.pres_stem)
	make_perf(data, typeinfo.perf_stem)
	make_supine(data, typeinfo.supine_stem)
	
	if data.forms["1s_pres_actv_indc"] == "serviō" or data.forms["1s_pres_actv_indc"] == "saeviō" then
		data.forms["1s_impf_actv_indc"] = {typeinfo.pres_stem .. "iēbam",   typeinfo.pres_stem .. "ībam"}
		data.forms["2s_impf_actv_indc"] = {typeinfo.pres_stem .. "iēbās",   typeinfo.pres_stem .. "ībās"}
		data.forms["3s_impf_actv_indc"] = {typeinfo.pres_stem .. "iēbat",   typeinfo.pres_stem .. "ībat"}
		data.forms["1p_impf_actv_indc"] = {typeinfo.pres_stem .. "iēbāmus", typeinfo.pres_stem .. "ībāmus"}
		data.forms["2p_impf_actv_indc"] = {typeinfo.pres_stem .. "iēbātis", typeinfo.pres_stem .. "ībātis"}
		data.forms["3p_impf_actv_indc"] = {typeinfo.pres_stem .. "iēbant",  typeinfo.pres_stem .. "ībant"}
	
		data.forms["1s_futr_actv_indc"] = {typeinfo.pres_stem .. "iam",   typeinfo.pres_stem .. "ībō"}
		data.forms["2s_futr_actv_indc"] = {typeinfo.pres_stem .. "iēs",   typeinfo.pres_stem .. "ībis"}
		data.forms["3s_futr_actv_indc"] = {typeinfo.pres_stem .. "iet",   typeinfo.pres_stem .. "ībit"}
		data.forms["1p_futr_actv_indc"] = {typeinfo.pres_stem .. "iēmus", typeinfo.pres_stem .. "ībimus"}
		data.forms["2p_futr_actv_indc"] = {typeinfo.pres_stem .. "iētis", typeinfo.pres_stem .. "ībitis"}
		data.forms["3p_futr_actv_indc"] = {typeinfo.pres_stem .. "ient",  typeinfo.pres_stem .. "ībunt"}
	end
	
	if typeinfo.sync_perf == "y" then
		for key,form in pairs(data.forms) do
			if key~="3p_perf_actv_indc" and key:find("perf") or key:find("plup") or key:find("futp") then
				form = mw.ustring.gsub(form,"%.īvī","iī")
				form = mw.ustring.gsub(form,"%.īvi","ī")
				form = mw.ustring.gsub(form,"%.īve","ī")
				form = mw.ustring.gsub(form,"%.īvē","ē")
				data.forms[key] = form
			end
		end
		for index,form in pairs(data.forms["3p_perf_actv_indc"]) do
			form = mw.ustring.gsub(form,"%.īvī","iī")
			form = mw.ustring.gsub(form,"%.īvi","ī")
			form = mw.ustring.gsub(form,"%.īve","ī")
			form = mw.ustring.gsub(form,"%.īvē","ē")
			data.forms["3p_perf_actv_indc"][index] = form
		end
	end
	
	if typeinfo.sync_perf == "yn" then
		for key,form in pairs(data.forms) do
			if key~="3p_perf_actv_indc" and key:find("perf") or key:find("plup") or key:find("futp") then
				sync = mw.ustring.gsub(form,"%.īvī","iī")
				sync = mw.ustring.gsub(sync,"%.īvi","ī")
				sync = mw.ustring.gsub(sync,"%.īve","ī")
				sync = mw.ustring.gsub(sync,"%.īvē","ē")
				form = mw.ustring.gsub(form,"%.","")
				if form~=sync then data.forms[key] = {form,sync} end
			end
		end
		temp = {}
		for _,form in ipairs(data.forms["3p_perf_actv_indc"]) do
			clone = mw.ustring.gsub(form,"%.","")
			table.insert(temp,clone)
			form = mw.ustring.gsub(form,"%.īvī","iī")
			form = mw.ustring.gsub(form,"%.īvi","ī")
			form = mw.ustring.gsub(form,"%.īve","ī")
			form = mw.ustring.gsub(form,"%.īvē","ē")
			table.insert(temp,form)
		end
		data.forms["3p_perf_actv_indc"] = temp
	end
end

-- Irregular conjugations
local irreg_conjugations = {}

conjugations["irreg"] = function(args, data, typeinfo)
	local verb = args[1]; if verb == "" then verb = nil end
	local prefix = args[2]; if prefix == "" then prefix = nil end
	
	if not verb then
		if NAMESPACE == "Template" then
			verb = "sum"
		else
			error("The verb to be conjugated has not been specified.")
		end
	end
	
	if not irreg_conjugations[verb] then
		error("The verb '" .. verb .. "' is not recognised as an irregular verb.")
	end
	
	typeinfo.verb = verb
	typeinfo.prefix = prefix
	
	-- Generate the verb forms
	irreg_conjugations[verb](args, data, typeinfo)
end

irreg_conjugations["aio"] = function(args, data, typeinfo)
	table.insert(data.title, "[[Appendix:Latin third conjugation|third conjugation]] iō-variant")
	table.insert(data.title, "[[Appendix:Latin irregular verbs|irregular]]")
	table.insert(data.title, "active only")
	table.insert(data.title, "highly [[defective verb|defective]]")
	table.insert(data.categories, "Latin third conjugation verbs")
	table.insert(data.categories, "Latin irregular verbs")
	table.insert(data.categories, "Latin active-only verbs")
	table.insert(data.categories, "Latin defective verbs")
	
	local prefix = typeinfo.prefix or ""
	
	data.forms["1s_pres_actv_indc"] = {prefix .. "āiō", prefix .. "aiiō"}
	data.forms["2s_pres_actv_indc"] = {prefix .. "āis", prefix .. "ais"}
	data.forms["3s_pres_actv_indc"] = prefix .. "ait"
	data.forms["3p_pres_actv_indc"] = {prefix .. "āiunt", prefix .. "aiiunt"}
	
	data.forms["1s_impf_actv_indc"] = {prefix .. "aiēbam", prefix .. "āībam"}
	data.forms["2s_impf_actv_indc"] = {prefix .. "aiēbās", prefix .. "āībās"}
	data.forms["3s_impf_actv_indc"] = {prefix .. "aiēbat", prefix .. "āībat"}
	data.forms["1p_impf_actv_indc"] = {prefix .. "aiēbāmus", prefix .. "āībāmus"}
	data.forms["2p_impf_actv_indc"] = {prefix .. "aiēbātis", prefix .. "āībātis"}
	data.forms["3p_impf_actv_indc"] = {prefix .. "aiēbant", prefix .. "āībant"}
	
	data.forms["2s_perf_actv_indc"] = prefix .. "aistī"
	data.forms["3s_perf_actv_indc"] = prefix .. "ait"
	
	data.forms["2s_pres_actv_subj"] = prefix .. "āiās"
	data.forms["3s_pres_actv_subj"] = prefix .. "āiat"
	data.forms["3p_pres_actv_subj"] = prefix .. "āiant"
	
	data.forms["2s_pres_actv_impr"] = prefix .. "aï"
	
	data.forms["pres_actv_inf"] = prefix .. "āiere"
	data.forms["pres_actv_ptc"] = prefix .. "aiēns"
end

irreg_conjugations["dico"] = function(args, data, typeinfo)
	table.insert(data.title, "[[Appendix:Latin third conjugation|third conjugation]]")
	table.insert(data.title, "[[Appendix:Latin irregular verbs|irregular]] short imperative")
	table.insert(data.categories, "Latin third conjugation verbs")
	table.insert(data.categories, "Latin irregular verbs")
	
	local prefix = typeinfo.prefix or ""
	
	make_pres_3rd(data, prefix .. "dīc")
	make_perf(data, prefix .. "dīx")
	make_supine(data, prefix .. "dict")
	
	data.forms["2s_pres_actv_impr"] = {prefix .. "dīc", data.forms["2s_pres_actv_impr"]}
end

irreg_conjugations["do"] = function(args, data, typeinfo)
	table.insert(data.title, "[[Appendix:Latin first conjugation|first conjugation]]")
	table.insert(data.title, "[[Appendix:Latin irregular verbs|irregular]] short ''a'' in most forms except " .. m_links.full_link({lang = lang, alt = "dās"}, "term") .. " and " .. m_links.full_link({lang = lang, alt = "dā"}, "term"))
	table.insert(data.categories, "Latin first conjugation verbs")
	table.insert(data.categories, "Latin irregular verbs")
	
	local prefix = typeinfo.prefix or ""
	
	make_perf(data, prefix .. "ded")
	make_supine(data, prefix .. "dat")
	
	-- Active imperfective indicative
	data.forms["1s_pres_actv_indc"] = prefix .. "dō"
	data.forms["2s_pres_actv_indc"] = prefix .. "dās"
	data.forms["3s_pres_actv_indc"] = prefix .. "dat"
	data.forms["1p_pres_actv_indc"] = prefix .. "damus"
	data.forms["2p_pres_actv_indc"] = prefix .. "datis"
	data.forms["3p_pres_actv_indc"] = prefix .. "dant"
	
	data.forms["1s_impf_actv_indc"] = prefix .. "dabam"
	data.forms["2s_impf_actv_indc"] = prefix .. "dabās"
	data.forms["3s_impf_actv_indc"] = prefix .. "dabat"
	data.forms["1p_impf_actv_indc"] = prefix .. "dabāmus"
	data.forms["2p_impf_actv_indc"] = prefix .. "dabātis"
	data.forms["3p_impf_actv_indc"] = prefix .. "dabant"
	
	data.forms["1s_futr_actv_indc"] = prefix .. "dabō"
	data.forms["2s_futr_actv_indc"] = prefix .. "dabis"
	data.forms["3s_futr_actv_indc"] = prefix .. "dabit"
	data.forms["1p_futr_actv_indc"] = prefix .. "dabimus"
	data.forms["2p_futr_actv_indc"] = prefix .. "dabitis"
	data.forms["3p_futr_actv_indc"] = prefix .. "dabunt"
	
	-- Passive imperfective indicative
	data.forms["1s_pres_pasv_indc"] = prefix .. "dor"
	data.forms["2s_pres_pasv_indc"] = {prefix .. "daris", prefix .. "dare"}
	data.forms["3s_pres_pasv_indc"] = prefix .. "datur"
	data.forms["1p_pres_pasv_indc"] = prefix .. "damur"
	data.forms["2p_pres_pasv_indc"] = prefix .. "daminī"
	data.forms["3p_pres_pasv_indc"] = prefix .. "dantur"
	
	data.forms["1s_impf_pasv_indc"] = prefix .. "dabar"
	data.forms["2s_impf_pasv_indc"] = {prefix .. "dabāris", prefix .. "dabāre"}
	data.forms["3s_impf_pasv_indc"] = prefix .. "dabātur"
	data.forms["1p_impf_pasv_indc"] = prefix .. "dabāmur"
	data.forms["2p_impf_pasv_indc"] = prefix .. "dabāminī"
	data.forms["3p_impf_pasv_indc"] = prefix .. "dabantur"
	
	data.forms["1s_futr_pasv_indc"] = prefix .. "dabor"
	data.forms["2s_futr_pasv_indc"] = {prefix .. "daberis", prefix .. "dabere"}
	data.forms["3s_futr_pasv_indc"] = prefix .. "dabitur"
	data.forms["1p_futr_pasv_indc"] = prefix .. "dabimur"
	data.forms["2p_futr_pasv_indc"] = prefix .. "dabiminī"
	data.forms["3p_futr_pasv_indc"] = prefix .. "dabuntur"
	
	-- Active imperfective subjunctive
	data.forms["1s_pres_actv_subj"] = prefix .. "dem"
	data.forms["2s_pres_actv_subj"] = prefix .. "dēs"
	data.forms["3s_pres_actv_subj"] = prefix .. "det"
	data.forms["1p_pres_actv_subj"] = prefix .. "dēmus"
	data.forms["2p_pres_actv_subj"] = prefix .. "dētis"
	data.forms["3p_pres_actv_subj"] = prefix .. "dent"
	
	data.forms["1s_impf_actv_subj"] = prefix .. "darem"
	data.forms["2s_impf_actv_subj"] = prefix .. "darēs"
	data.forms["3s_impf_actv_subj"] = prefix .. "daret"
	data.forms["1p_impf_actv_subj"] = prefix .. "darēmus"
	data.forms["2p_impf_actv_subj"] = prefix .. "darētis"
	data.forms["3p_impf_actv_subj"] = prefix .. "darent"
	
	-- Passive imperfective subjunctive
	data.forms["1s_pres_pasv_subj"] = prefix .. "der"
	data.forms["2s_pres_pasv_subj"] = {prefix .. "dēris", prefix .. "dēre"}
	data.forms["3s_pres_pasv_subj"] = prefix .. "dētur"
	data.forms["1p_pres_pasv_subj"] = prefix .. "dēmur"
	data.forms["2p_pres_pasv_subj"] = prefix .. "dēminī"
	data.forms["3p_pres_pasv_subj"] = prefix .. "dentur"
	
	data.forms["1s_impf_pasv_subj"] = prefix .. "darer"
	data.forms["2s_impf_pasv_subj"] = {prefix .. "darēris", prefix .. "darēre"}
	data.forms["3s_impf_pasv_subj"] = prefix .. "darētur"
	data.forms["1p_impf_pasv_subj"] = prefix .. "darēmur"
	data.forms["2p_impf_pasv_subj"] = prefix .. "darēminī"
	data.forms["3p_impf_pasv_subj"] = prefix .. "darentur"
	
	-- Imperative
	data.forms["2s_pres_actv_impr"] = prefix .. "dā"
	data.forms["2p_pres_actv_impr"] = prefix .. "date"
	
	data.forms["2s_futr_actv_impr"] = prefix .. "datō"
	data.forms["3s_futr_actv_impr"] = prefix .. "datō"
	data.forms["2p_futr_actv_impr"] = prefix .. "datōte"
	data.forms["3p_futr_actv_impr"] = prefix .. "dantō"
	
	data.forms["2s_pres_pasv_impr"] = prefix .. "dare"
	data.forms["2p_pres_pasv_impr"] = prefix .. "daminī"
	
	data.forms["2s_futr_pasv_impr"] = prefix .. "dator"
	data.forms["3s_futr_pasv_impr"] = prefix .. "dator"
	-- no form
	data.forms["3p_futr_pasv_impr"] = prefix .. "dantor"
	
	-- Present infinitives
	data.forms["pres_actv_inf"] = prefix .. "dare"
	data.forms["pres_pasv_inf"] = prefix .. "darī"
	
	-- Imperfective participles
	data.forms["pres_actv_ptc"] = prefix .. "dāns"
	data.forms["futr_pasv_ptc"] = prefix .. "dandus"
	
	-- Gerund
	data.forms["ger_nom"] = data.forms["pres_actv_inf"]
	data.forms["ger_gen"] = prefix .. "dandī"
	data.forms["ger_dat"] = prefix .. "dandō"
	data.forms["ger_acc"] = prefix .. "dandum"
end

irreg_conjugations["duco"] = function(args, data, typeinfo)
	table.insert(data.title, "[[Appendix:Latin third conjugation|third conjugation]]")
	table.insert(data.title, "[[Appendix:Latin irregular verbs|irregular]] short imperative")
	table.insert(data.categories, "Latin third conjugation verbs")
	table.insert(data.categories, "Latin irregular verbs")
	
	local prefix = typeinfo.prefix or ""
	
	make_pres_3rd(data, prefix .. "dūc")
	make_perf(data, prefix .. "dūx")
	make_supine(data, prefix .. "duct")
	
	data.forms["2s_pres_actv_impr"] = {prefix .. "dūc", data.forms["2s_pres_actv_impr"]}
end

irreg_conjugations["edo"] = function(args, data, typeinfo)
	table.insert(data.title, "[[Appendix:Latin third conjugation|third conjugation]]")
	table.insert(data.title, "some [[Appendix:Latin irregular verbs|irregular]] alternative forms")
	table.insert(data.categories, "Latin third conjugation verbs")
	table.insert(data.categories, "Latin irregular verbs")
	
	make_pres_3rd(data, "ed")
	make_perf(data, "ēd")
	make_supine(data, "ēs")
	
	-- Active imperfective indicative
	data.forms["2s_pres_actv_indc"] = {data.forms["2s_pres_actv_indc"], "ēs"}
	data.forms["3s_pres_actv_indc"] = {data.forms["3s_pres_actv_indc"], "ēst"}
	data.forms["2p_pres_actv_indc"] = {data.forms["2p_pres_actv_indc"], "ēstis"}
	
	-- Passive imperfective indicative
	data.forms["3s_pres_pasv_indc"] = {data.forms["3s_pres_pasv_indc"], "ēstur"}
	
	-- Active imperfective subjunctive
	data.forms["1s_pres_actv_subj"] = {data.forms["1s_pres_actv_subj"], "edim"}
	data.forms["2s_pres_actv_subj"] = {data.forms["2s_pres_actv_subj"], "edīs"}
	data.forms["3s_pres_actv_subj"] = {data.forms["3s_pres_actv_subj"], "edit"}
	data.forms["1p_pres_actv_subj"] = {data.forms["1p_pres_actv_subj"], "edīmus"}
	data.forms["2p_pres_actv_subj"] = {data.forms["2p_pres_actv_subj"], "edītis"}
	data.forms["3p_pres_actv_subj"] = {data.forms["3p_pres_actv_subj"], "edint"}
	
	data.forms["1s_impf_actv_subj"] = {data.forms["1s_impf_actv_subj"], "ēssem"}
	data.forms["2s_impf_actv_subj"] = {data.forms["2s_impf_actv_subj"], "ēssēs"}
	data.forms["3s_impf_actv_subj"] = {data.forms["3s_impf_actv_subj"], "ēsset"}
	data.forms["1p_impf_actv_subj"] = {data.forms["1p_impf_actv_subj"], "ēssēmus"}
	data.forms["2p_impf_actv_subj"] = {data.forms["2p_impf_actv_subj"], "ēssētis"}
	data.forms["3p_impf_actv_subj"] = {data.forms["3p_impf_actv_subj"], "ēssent"}
	
	-- Active imperative
	data.forms["2s_pres_actv_impr"] = {data.forms["2s_pres_actv_impr"], "ēs"}
	data.forms["2p_pres_actv_impr"] = {data.forms["2p_pres_actv_impr"], "ēste"}
	
	data.forms["2s_futr_actv_impr"] = {data.forms["2s_futr_actv_impr"], "ēstō"}
	data.forms["3s_futr_actv_impr"] = {data.forms["3s_futr_actv_impr"], "ēstō"}
	data.forms["2p_futr_actv_impr"] = {data.forms["2p_futr_actv_impr"], "ēstōte"}
	
	-- Present infinitives
	data.forms["pres_actv_inf"] = {data.forms["pres_actv_inf"], "ēsse"}
end

irreg_conjugations["eo"] = function(args, data, typeinfo)
	table.insert(data.title, "[[Appendix:Latin irregular verbs|irregular]]")
	table.insert(data.categories, "Latin irregular verbs")
	
	local prefix = typeinfo.prefix or ""
	
	make_perf(data, prefix .. "i")
	make_supine(data, prefix .. "it")
	
	-- Active imperfective indicative
	data.forms["1s_pres_actv_indc"] = prefix .. "eō"
	data.forms["2s_pres_actv_indc"] = prefix .. "īs"
	data.forms["3s_pres_actv_indc"] = prefix .. "it"
	data.forms["1p_pres_actv_indc"] = prefix .. "īmus"
	data.forms["2p_pres_actv_indc"] = prefix .. "ītis"
	data.forms["3p_pres_actv_indc"] = prefix .. "eunt"
	
	if prefix == "prōd" then data.forms["3p_pres_actv_indc"] = {"prōdeunt","prōdīnunt"} end
	
	data.forms["1s_impf_actv_indc"] = prefix .. "ībam"
	data.forms["2s_impf_actv_indc"] = prefix .. "ībās"
	data.forms["3s_impf_actv_indc"] = prefix .. "ībat"
	data.forms["1p_impf_actv_indc"] = prefix .. "ībāmus"
	data.forms["2p_impf_actv_indc"] = prefix .. "ībātis"
	data.forms["3p_impf_actv_indc"] = prefix .. "ībant"
	
	data.forms["1s_futr_actv_indc"] = prefix .. "ībō"
	data.forms["2s_futr_actv_indc"] = prefix .. "ībis"
	data.forms["3s_futr_actv_indc"] = prefix .. "ībit"
	data.forms["1p_futr_actv_indc"] = prefix .. "ībimus"
	data.forms["2p_futr_actv_indc"] = prefix .. "ībitis"
	data.forms["3p_futr_actv_indc"] = prefix .. "ībunt"
	
	-- Active perfective indicative
	data.forms["1s_perf_actv_indc"] = {data.forms["1s_perf_actv_indc"], prefix .. "īvī"}
	data.forms["2s_perf_actv_indc"] = {prefix .. "īstī", prefix .. "īvistī"}
	data.forms["3s_perf_actv_indc"] = {data.forms["3s_perf_actv_indc"], prefix .. "īvit"}
	data.forms["2p_perf_actv_indc"] = prefix .. "īstis"
	
	-- Passive imperfective indicative
	data.forms["1s_pres_pasv_indc"] = prefix .. "eor"
	data.forms["2s_pres_pasv_indc"] = {prefix .. "īris", prefix .. "īre"}
	data.forms["3s_pres_pasv_indc"] = prefix .. "ītur"
	data.forms["1p_pres_pasv_indc"] = prefix .. "īmur"
	data.forms["2p_pres_pasv_indc"] = prefix .. "īminī"
	data.forms["3p_pres_pasv_indc"] = prefix .. "euntur"
	
	data.forms["1s_impf_pasv_indc"] = prefix .. "ībar"
	data.forms["2s_impf_pasv_indc"] = {prefix .. "ībāris", prefix .. "ībāre"}
	data.forms["3s_impf_pasv_indc"] = prefix .. "ībātur"
	data.forms["1p_impf_pasv_indc"] = prefix .. "ībāmur"
	data.forms["2p_impf_pasv_indc"] = prefix .. "ībāminī"
	data.forms["3p_impf_pasv_indc"] = prefix .. "ībantur"
	
	data.forms["1s_futr_pasv_indc"] = prefix .. "ībor"
	data.forms["2s_futr_pasv_indc"] = {prefix .. "īberis", prefix .. "ībere"}
	data.forms["3s_futr_pasv_indc"] = prefix .. "ībitur"
	data.forms["1p_futr_pasv_indc"] = prefix .. "ībimur"
	data.forms["2p_futr_pasv_indc"] = prefix .. "ībiminī"
	data.forms["3p_futr_pasv_indc"] = prefix .. "ībuntur"
	
	-- Active imperfective subjunctive
	data.forms["1s_pres_actv_subj"] = prefix .. "eam"
	data.forms["2s_pres_actv_subj"] = prefix .. "eās"
	data.forms["3s_pres_actv_subj"] = prefix .. "eat"
	data.forms["1p_pres_actv_subj"] = prefix .. "eāmus"
	data.forms["2p_pres_actv_subj"] = prefix .. "eātis"
	data.forms["3p_pres_actv_subj"] = prefix .. "eant"
	
	data.forms["1s_impf_actv_subj"] = prefix .. "īrem"
	data.forms["2s_impf_actv_subj"] = prefix .. "īrēs"
	data.forms["3s_impf_actv_subj"] = prefix .. "īret"
	data.forms["1p_impf_actv_subj"] = prefix .. "īrēmus"
	data.forms["2p_impf_actv_subj"] = prefix .. "īrētis"
	data.forms["3p_impf_actv_subj"] = prefix .. "īrent"
	
	-- Active perfective subjunctive
	data.forms["1s_plup_actv_subj"] = prefix .. "īssem"
	data.forms["2s_plup_actv_subj"] = prefix .. "īssēs"
	data.forms["3s_plup_actv_subj"] = prefix .. "īsset"
	data.forms["1p_plup_actv_subj"] = prefix .. "īssēmus"
	data.forms["2p_plup_actv_subj"] = prefix .. "īssētis"
	data.forms["3p_plup_actv_subj"] = prefix .. "īssent"
	
	-- Passive imperfective subjunctive
	data.forms["1s_pres_pasv_subj"] = prefix .. "ear"
	data.forms["2s_pres_pasv_subj"] = {prefix .. "eāris", prefix .. "eāre"}
	data.forms["3s_pres_pasv_subj"] = prefix .. "eātur"
	data.forms["1p_pres_pasv_subj"] = prefix .. "eāmur"
	data.forms["2p_pres_pasv_subj"] = prefix .. "eāminī"
	data.forms["3p_pres_pasv_subj"] = prefix .. "eantur"
	
	data.forms["1s_impf_pasv_subj"] = prefix .. "īrer"
	data.forms["2s_impf_pasv_subj"] = {prefix .. "īrēris", prefix .. "īrēre"}
	data.forms["3s_impf_pasv_subj"] = prefix .. "īrētur"
	data.forms["1p_impf_pasv_subj"] = prefix .. "īrēmur"
	data.forms["2p_impf_pasv_subj"] = prefix .. "īrēminī"
	data.forms["3p_impf_pasv_subj"] = prefix .. "īrentur"
	
	-- Imperative
	data.forms["2s_pres_actv_impr"] = prefix .. "ī"
	data.forms["2p_pres_actv_impr"] = prefix .. "īte"
	
	data.forms["2s_futr_actv_impr"] = prefix .. "ītō"
	data.forms["3s_futr_actv_impr"] = prefix .. "ītō"
	data.forms["2p_futr_actv_impr"] = prefix .. "ītōte"
	data.forms["3p_futr_actv_impr"] = prefix .. "euntō"
	
	data.forms["2s_pres_pasv_impr"] = prefix .. "īre"
	data.forms["2p_pres_pasv_impr"] = prefix .. "īminī"
	
	data.forms["2s_futr_pasv_impr"] = prefix .. "ītor"
	data.forms["3s_futr_pasv_impr"] = prefix .. "ītor"
	-- no form
	data.forms["3p_futr_pasv_impr"] = prefix .. "euntor"
	
	-- Present infinitives
	data.forms["pres_actv_inf"] = prefix .. "īre"
	data.forms["pres_pasv_inf"] = prefix .. "īrī"
	
	-- Perfect/future infinitives
	data.forms["perf_actv_inf"] = prefix .. "īsse"
	
	-- Imperfective participles
	data.forms["pres_actv_ptc"] = prefix .. "iēns"
	data.forms["futr_pasv_ptc"] = prefix .. "eundus"
	
	-- Gerund
	data.forms["ger_nom"] = data.forms["pres_actv_inf"]
	data.forms["ger_gen"] = prefix .. "eundī"
	data.forms["ger_dat"] = prefix .. "eundō"
	data.forms["ger_acc"] = prefix .. "eundum"
end

irreg_conjugations["facio"] = function(args, data, typeinfo)
	table.insert(data.title, "[[Appendix:Latin third conjugation|third conjugation]] ''iō''-variant")
	table.insert(data.title, "[[Appendix:Latin irregular verbs|irregular]] and [[suppletive]] in the passive")
	table.insert(data.categories, "Latin third conjugation verbs")
	table.insert(data.categories, "Latin irregular verbs")
	table.insert(data.categories, "Latin suppletive verbs")
	
	local prefix = typeinfo.prefix or ""
	
	make_pres_3rd_io(data, prefix .. "fac")
	make_perf(data, prefix .. "fēc")
	make_supine(data, prefix .. "fact")
	
	-- Passive imperfective indicative
	data.forms["1s_pres_pasv_indc"] = prefix .. "fīō"
	data.forms["2s_pres_pasv_indc"] = prefix .. "fīs"
	data.forms["3s_pres_pasv_indc"] = prefix .. "fit"
	data.forms["1p_pres_pasv_indc"] = prefix .. "fīmus"
	data.forms["2p_pres_pasv_indc"] = prefix .. "fītis"
	data.forms["3p_pres_pasv_indc"] = prefix .. "fīunt"
	
	data.forms["1s_impf_pasv_indc"] = prefix .. "fīēbam"
	data.forms["2s_impf_pasv_indc"] = prefix .. "fīēbās"
	data.forms["3s_impf_pasv_indc"] = prefix .. "fīēbat"
	data.forms["1p_impf_pasv_indc"] = prefix .. "fīēbāmus"
	data.forms["2p_impf_pasv_indc"] = prefix .. "fīēbātis"
	data.forms["3p_impf_pasv_indc"] = prefix .. "fīēbant"
	
	data.forms["1s_futr_pasv_indc"] = prefix .. "fīam"
	data.forms["2s_futr_pasv_indc"] = prefix .. "fīēs"
	data.forms["3s_futr_pasv_indc"] = prefix .. "fīet"
	data.forms["1p_futr_pasv_indc"] = prefix .. "fīēmus"
	data.forms["2p_futr_pasv_indc"] = prefix .. "fīētis"
	data.forms["3p_futr_pasv_indc"] = prefix .. "fīent"
	
	-- Passive imperfective subjunctive
	data.forms["1s_pres_pasv_subj"] = prefix .. "fīam"
	data.forms["2s_pres_pasv_subj"] = prefix .. "fīās"
	data.forms["3s_pres_pasv_subj"] = prefix .. "fīat"
	data.forms["1p_pres_pasv_subj"] = prefix .. "fīāmus"
	data.forms["2p_pres_pasv_subj"] = prefix .. "fīātis"
	data.forms["3p_pres_pasv_subj"] = prefix .. "fīant"
	
	data.forms["1s_impf_pasv_subj"] = prefix .. "fierem"
	data.forms["2s_impf_pasv_subj"] = prefix .. "fierēs"
	data.forms["3s_impf_pasv_subj"] = prefix .. "fieret"
	data.forms["1p_impf_pasv_subj"] = prefix .. "fierēmus"
	data.forms["2p_impf_pasv_subj"] = prefix .. "fierētis"
	data.forms["3p_impf_pasv_subj"] = prefix .. "fierent"
	
	-- Active imperative
	data.forms["2s_pres_actv_impr"] = (prefix == "" and {prefix .. "fac", data.forms["2s_pres_actv_impr"]} or data.forms["2s_pres_actv_impr"])
	
	-- Passive imperative
	data.forms["2s_pres_pasv_impr"] = prefix .. "fī"
	data.forms["2p_pres_pasv_impr"] = prefix .. "fīte"
	
	data.forms["2s_futr_pasv_impr"] = prefix .. "fītō"
	data.forms["3s_futr_pasv_impr"] = prefix .. "fītō"
	data.forms["2p_futr_pasv_impr"] = prefix .. "fītōte"
	data.forms["3p_futr_pasv_impr"] = prefix .. "fīuntō"
	
	-- Present infinitives
	data.forms["pres_pasv_inf"] = prefix .. "fierī"
end

irreg_conjugations["fero"] = function(args, data, typeinfo)
	table.insert(data.title, "[[Appendix:Latin third conjugation|third conjugation]]")
	table.insert(data.title, "[[Appendix:Latin irregular verbs|irregular]]")
	table.insert(data.title, "[[suppletive]]")
	table.insert(data.categories, "Latin third conjugation verbs")
	table.insert(data.categories, "Latin irregular verbs")
	table.insert(data.categories, "Latin suppletive verbs")
	
	local prefix_pres = typeinfo.prefix or ""
	local prefix_perf = args[3]; if prefix_perf == "" then prefix_perf = nil end
	local prefix_supine = args[4]; if prefix_supine == "" then prefix_supine = nil end
	
	prefix_perf = prefix_perf or prefix_pres
	prefix_supine = prefix_supine or prefix_pres
	
	make_pres_3rd(data, prefix_pres .. "fer")
	make_perf(data, prefix_perf .. "tul")
	make_supine(data, prefix_supine .. "lāt")
	
	-- Active imperfective indicative
	data.forms["2s_pres_actv_indc"] = prefix_pres .. "fers"
	data.forms["3s_pres_actv_indc"] = prefix_pres .. "fert"
	data.forms["2p_pres_actv_indc"] = prefix_pres .. "fertis"
	
	-- Passive imperfective indicative
	data.forms["3s_pres_pasv_indc"] = prefix_pres .. "fertur"
	
	-- Active imperfective subjunctive
	data.forms["1s_impf_actv_subj"] = prefix_pres .. "ferrem"
	data.forms["2s_impf_actv_subj"] = prefix_pres .. "ferrēs"
	data.forms["3s_impf_actv_subj"] = prefix_pres .. "ferret"
	data.forms["1p_impf_actv_subj"] = prefix_pres .. "ferrēmus"
	data.forms["2p_impf_actv_subj"] = prefix_pres .. "ferrētis"
	data.forms["3p_impf_actv_subj"] = prefix_pres .. "ferrent"

	-- Passive present indicative
	data.forms["2s_pres_pasv_indc"] = {prefix_pres .. "ferris", prefix_pres .. "ferre"}
	
	-- Passive imperfective subjunctive
	data.forms["1s_impf_pasv_subj"] = prefix_pres .. "ferrer"
	data.forms["2s_impf_pasv_subj"] = {prefix_pres .. "ferrēris", prefix_pres .. "ferrēre"}
	data.forms["3s_impf_pasv_subj"] = prefix_pres .. "ferrētur"
	data.forms["1p_impf_pasv_subj"] = prefix_pres .. "ferrēmur"
	data.forms["2p_impf_pasv_subj"] = prefix_pres .. "ferrēminī"
	data.forms["3p_impf_pasv_subj"] = prefix_pres .. "ferrentur"
	
	-- Imperative
	data.forms["2s_pres_actv_impr"] = prefix_pres .. "fer"
	data.forms["2p_pres_actv_impr"] = prefix_pres .. "ferte"
	
	data.forms["2s_futr_actv_impr"] = prefix_pres .. "fertō"
	data.forms["3s_futr_actv_impr"] = prefix_pres .. "fertō"
	data.forms["2p_futr_actv_impr"] = prefix_pres .. "fertōte"
	
	data.forms["2s_pres_pasv_impr"] = prefix_pres .. "ferre"

	data.forms["2s_futr_pasv_impr"] = prefix_pres .. "fertor"
	data.forms["3s_futr_pasv_impr"] = prefix_pres .. "fertor"
	
	-- Present infinitives
	data.forms["pres_actv_inf"] = prefix_pres .. "ferre"
	data.forms["pres_pasv_inf"] = prefix_pres .. "ferrī"
	
	-- Gerund
	data.forms["ger_nom"] = data.forms["pres_actv_inf"]
end

irreg_conjugations["fio"] = function(args, data, typeinfo)
	table.insert(data.title, "[[Appendix:Latin third conjugation|third conjugation]] ''iō''-variant")
	table.insert(data.title, "[[Appendix:Latin irregular verbs|irregular]] long ''ī''")
	table.insert(data.title, "[[suppletive]] in the supine stem")
	table.insert(data.categories, "Latin third conjugation verbs")
	table.insert(data.categories, "Latin irregular verbs")
	table.insert(data.categories, "Latin suppletive verbs")
	
	local prefix = typeinfo.prefix or ""
	
	typeinfo.subtype = "semi-depon"
	make_pres_3rd(data, prefix .. "fī")
	make_supine(data, prefix .. "fact")
	
	-- Active imperfective indicative
	data.forms["2s_pres_actv_indc"] = prefix .. "fīs"
	data.forms["3s_pres_actv_indc"] = prefix .. "fit"
	data.forms["1p_pres_actv_indc"] = prefix .. "fīmus"
	data.forms["2p_pres_actv_indc"] = prefix .. "fītis"
	
	-- Active imperfective subjunctive
	data.forms["1s_impf_actv_subj"] = prefix .. "fierem"
	data.forms["2s_impf_actv_subj"] = prefix .. "fierēs"
	data.forms["3s_impf_actv_subj"] = prefix .. "fieret"
	data.forms["1p_impf_actv_subj"] = prefix .. "fierēmus"
	data.forms["2p_impf_actv_subj"] = prefix .. "fierētis"
	data.forms["3p_impf_actv_subj"] = prefix .. "fierent"
	
	-- Imperative
	data.forms["2s_pres_actv_impr"] = prefix .. "fī"
	data.forms["2p_pres_actv_impr"] = prefix .. "fīte"
	
	data.forms["2s_futr_actv_impr"] = prefix .. "fītō"
	data.forms["3s_futr_actv_impr"] = prefix .. "fītō"
	data.forms["2p_futr_actv_impr"] = prefix .. "fītōte"
	data.forms["3p_futr_actv_impr"] = prefix .. "fīuntō"
	
	-- Present infinitives
	data.forms["pres_actv_inf"] = prefix .. "fierī"
	
	-- Perfect/future infinitives
	data.forms["futr_actv_inf"] = data.forms["futr_pasv_inf"]
	
	-- Imperfective participles
	data.forms["pres_actv_ptc"] = nil
	data.forms["futr_actv_ptc"] = nil
	
	-- Gerund
	data.forms["ger_nom"] = data.forms["pres_actv_inf"]
	data.forms["ger_gen"] = prefix .. "fiendī"
	data.forms["ger_dat"] = prefix .. "fiendō"
	data.forms["ger_acc"] = prefix .. "fiendum"
end

irreg_conjugations["inquam"] = function(args, data, typeinfo)
	table.insert(data.title, "[[Appendix:Latin irregular verbs|irregular]]")
	table.insert(data.title, "highly [[defective verb|defective]]")
	table.insert(data.categories, "Latin irregular verbs")
	table.insert(data.categories, "Latin defective verbs")
	
	prefix = typeinfo.prefix or ""
	
	data.forms["1s_pres_actv_indc"] = "inquam"
	data.forms["2s_pres_actv_indc"] = "inquis"
	data.forms["3s_pres_actv_indc"] = "inquit"
	data.forms["1p_pres_actv_indc"] = "inquimus"
	data.forms["2p_pres_actv_indc"] = "inquitis"
	data.forms["3p_pres_actv_indc"] = "inquiunt"
	
	data.forms["2s_futr_actv_indc"] = "inquiēs"
	data.forms["3s_futr_actv_indc"] = "inquiet"
	
	data.forms["3s_impf_actv_indc"] = "inquiēbat"
	
	data.forms["1s_perf_actv_indc"] = "inquiī"
	data.forms["2s_perf_actv_indc"] = "inquistī"
	data.forms["3s_perf_actv_indc"] = "inquit"
	
	data.forms["3s_pres_actv_subj"] = "inquiat"
	
	data.forms["2s_pres_actv_impr"] = "inque"
	data.forms["2s_futr_actv_impr"] = "inquitō"
	data.forms["3s_futr_actv_impr"] = "inquitō"
	
	data.forms["pres_actv_ptc"] = "inquiēns"
end

irreg_conjugations["libet"] = function(args, data, typeinfo)
	table.insert(data.title, "[[Appendix:Latin second conjugation|second conjugation]]")
	table.insert(data.title, "mostly [[impersonal]]")
	table.insert(data.categories, "Latin second conjugation verbs")
	table.insert(data.categories, "Latin impersonal verbs")
	
	typeinfo.subtype = "nopass"
	prefix = typeinfo.prefix or ""
	
	-- Active imperfective indicative
	data.forms["3s_pres_actv_indc"] = prefix .. "libet"
	
	data.forms["3s_impf_actv_indc"] = prefix .. "libēbat"
	
	data.forms["3s_futr_actv_indc"] = prefix .. "libēbit"
	
	-- Active perfective indicative
	data.forms["3s_perf_actv_indc"] = {prefix .. "libuit", "[[" .. prefix .. "libitum]] [[est]]"}
	
	data.forms["3s_plup_actv_indc"] = {prefix .. "libuerat", "[[" .. prefix .. "libitum]] [[erat]]"}
	
	data.forms["3s_futp_actv_indc"] = {prefix .. "libuerit", "[[" .. prefix .. "libitum]] [[erit]]"}
	
	-- Active imperfective subjunctive
	data.forms["3s_pres_actv_subj"] = prefix .. "libeat"
	
	data.forms["3s_impf_actv_subj"] = prefix .. "libēret"
	
	-- Active perfective subjunctive
	data.forms["3s_perf_actv_subj"] = {prefix .. "libuerit", "[[" .. prefix .. "libitum]] [[sit]]"}
	
	data.forms["3s_plup_actv_subj"] = {prefix .. "libuisset", "[[" .. prefix .. "libitum]] [[esset]]"}
	data.forms["3p_plup_actv_subj"] = prefix .. "libuissent"
	
	-- Present infinitives
	data.forms["pres_actv_inf"] = prefix .. "libēre"
	
	-- Perfect infinitive
	data.forms["perf_actv_inf"] = {prefix .. "libuisse", "[[" .. prefix .. "libitum]] [[esse]]"}
	
	-- Imperfective participles
	data.forms["pres_actv_ptc"] = prefix .. "libēns"
	data.forms["perf_actv_ptc"] = prefix .. "libitum"
end

irreg_conjugations["licet"] = function(args, data, typeinfo)
	table.insert(data.title, "[[Appendix:Latin second conjugation|second conjugation]]")
	table.insert(data.title, "mostly [[impersonal]]")
	table.insert(data.categories, "Latin second conjugation verbs")
	table.insert(data.categories, "Latin impersonal verbs")
	
	typeinfo.subtype = "nopass"
	
	-- Active imperfective indicative
	data.forms["3s_pres_actv_indc"] = "licet"
	data.forms["3p_pres_actv_indc"] = "licent"
	
	data.forms["3s_impf_actv_indc"] = "licēbat"
	data.forms["3p_impf_actv_indc"] = "licēbant"
	
	data.forms["3s_futr_actv_indc"] = "licēbit"
	
	-- Active perfective indicative
	data.forms["3s_perf_actv_indc"] = {"licuit", "[[licitum]] [[est]]"}
	
	data.forms["3s_plup_actv_indc"] = {"licuerat", "[[licitum]] [[erat]]"}
	
	data.forms["3s_futp_actv_indc"] = {"licuerit", "[[licitum]] [[erat]]"}
	
	-- Active imperfective subjunctive
	data.forms["3s_pres_actv_subj"] = "liceat"
	data.forms["3p_pres_actv_subj"] = "liceant"
	
	data.forms["3s_impf_actv_subj"] = "licēret"
	
	-- Perfective subjunctive
	data.forms["3s_perf_actv_subj"] = {"licuerit", "[[licitum]] [[erit]]"}
	
	data.forms["3s_plup_actv_subj"] = {"licuisset", "[[licitum]] [[esset]]"}
	
	-- Imperative
	data.forms["2s_futr_actv_impr"] = "licētō"
	data.forms["3s_futr_actv_impr"] = "licētō"
	
	-- Infinitives
	data.forms["pres_actv_inf"] = "licēre"
	data.forms["perf_actv_inf"] = {"licuisse", "[[licitum]] [[esse]]"}
	data.forms["futr_actv_inf"] = "[[licitūrum]] [[esse]]"
	
	-- Participles
	data.forms["pres_actv_ptc"] = "licēns"
	data.forms["perf_actv_ptc"] = "licitus"
	data.forms["futr_actv_ptc"] = "licitūrus"
end

irreg_conjugations["lubet"] = function(args, data, typeinfo)
	table.insert(data.title, "[[Appendix:Latin second conjugation|second conjugation]]")
	table.insert(data.title, "mostly [[impersonal]]")
	table.insert(data.categories, "Latin second conjugation verbs")
	table.insert(data.categories, "Latin impersonal verbs")
	
	typeinfo.subtype = "nopass"
	
	-- Active imperfective indicative
	data.forms["3s_pres_actv_indc"] = "lubet"
	
	data.forms["3s_impf_actv_indc"] = "lubēbat"
	
	data.forms["3s_futr_actv_indc"] = "lubēbit"
	
	-- Active perfective indicative
	data.forms["3s_perf_actv_indc"] = {"lubuit", "[[lubitum]] [[est]]"}
	
	data.forms["3s_plup_actv_indc"] = {"lubuerat", "[[lubitum]] [[erat]]"}
	
	data.forms["3s_futp_actv_indc"] = {"lubuerit", "[[lubitum]] [[erit]]"}
	
	-- Active imperfective subjunctive
	data.forms["3s_pres_actv_subj"] = "libeat"
	
	data.forms["3s_impf_actv_subj"] = "libēret"
	
	-- Active perfective subjunctive
	data.forms["3s_perf_actv_subj"] = {"lubuerit", "[[lubitum]] [[sit]]"}
	
	data.forms["3s_plup_actv_subj"] = {"lubuisset", "[[lubitum]] [[esset]]"}
	data.forms["3p_plup_actv_subj"] = "lubuissent"
	
	-- Present infinitives
	data.forms["pres_actv_inf"] = "lubēre"
	
	-- Perfect infinitive
	data.forms["perf_actv_inf"] = {"lubuisse", "[[lubitum]] [[esse]]"}
	
	-- Imperfective participles
	data.forms["pres_actv_ptc"] = "lubēns"
	data.forms["perf_actv_ptc"] = "lubitum"
end

irreg_conjugations["malo"] = function(args, data, typeinfo)
	table.insert(data.title, "[[Appendix:Latin irregular verbs|irregular]]")
	table.insert(data.categories, "Latin irregular verbs")
	
	typeinfo.subtype = "nopass"
	typeinfo.subtype = "noimp"
	make_perf(data, "mālu")
	
	-- Active imperfective indicative
	data.forms["1s_pres_actv_indc"] = "mālō"
	data.forms["2s_pres_actv_indc"] = "māvīs"
	data.forms["3s_pres_actv_indc"] = "māvult"
	data.forms["1p_pres_actv_indc"] = "mālumus"
	data.forms["2p_pres_actv_indc"] = "māvultis"
	data.forms["3p_pres_actv_indc"] = "mālunt"
	
	data.forms["1s_impf_actv_indc"] = "mālēbam"
	data.forms["2s_impf_actv_indc"] = "mālēbās"
	data.forms["3s_impf_actv_indc"] = "mālēbat"
	data.forms["1p_impf_actv_indc"] = "mālēbāmus"
	data.forms["2p_impf_actv_indc"] = "mālēbātis"
	data.forms["3p_impf_actv_indc"] = "mālēbant"

	data.forms["1s_futr_actv_indc"] = "mālam"
	data.forms["2s_futr_actv_indc"] = "mālēs"
	data.forms["3s_futr_actv_indc"] = "mālet"
	data.forms["1p_futr_actv_indc"] = "mālēmus"
	data.forms["2p_futr_actv_indc"] = "mālētis"
	data.forms["3p_futr_actv_indc"] = "mālent"
	
	-- Active imperfective subjunctive
	data.forms["1s_pres_actv_subj"] = "mālim"
	data.forms["2s_pres_actv_subj"] = "mālīs"
	data.forms["3s_pres_actv_subj"] = "mālit"
	data.forms["1p_pres_actv_subj"] = "mālīmus"
	data.forms["2p_pres_actv_subj"] = "mālītis"
	data.forms["3p_pres_actv_subj"] = "mālint"
	
	data.forms["1s_impf_actv_subj"] = "māllem"
	data.forms["2s_impf_actv_subj"] = "māllēs"
	data.forms["3s_impf_actv_subj"] = "māllet"
	data.forms["1p_impf_actv_subj"] = "māllēmus"
	data.forms["2p_impf_actv_subj"] = "māllētis"
	data.forms["3p_impf_actv_subj"] = "māllent"
	
	-- Present infinitives
	data.forms["pres_actv_inf"] = "mālle"
end

irreg_conjugations["nolo"] = function(args, data, typeinfo)
	table.insert(data.title, "[[Appendix:Latin irregular verbs|irregular]]")
	table.insert(data.categories, "Latin irregular verbs")
	
	typeinfo.subtype = "nopass"
	make_perf(data, "nōlu")
	
	-- Active imperfective indicative
	data.forms["1s_pres_actv_indc"] = "nōlō"
	data.forms["2s_pres_actv_indc"] = "nōn vīs"
	data.forms["3s_pres_actv_indc"] = "nōn vult"
	data.forms["1p_pres_actv_indc"] = "nōlumus"
	data.forms["2p_pres_actv_indc"] = "nōn vultis"
	data.forms["3p_pres_actv_indc"] = "nōlunt"
	
	data.forms["1s_impf_actv_indc"] = "nōlēbam"
	data.forms["2s_impf_actv_indc"] = "nōlēbās"
	data.forms["3s_impf_actv_indc"] = "nōlēbat"
	data.forms["1p_impf_actv_indc"] = "nōlēbāmus"
	data.forms["2p_impf_actv_indc"] = "nōlēbātis"
	data.forms["3p_impf_actv_indc"] = "nōlēbant"
	
	data.forms["1s_futr_actv_indc"] = "nōlam"
	data.forms["2s_futr_actv_indc"] = "nōlēs"
	data.forms["3s_futr_actv_indc"] = "nōlet"
	data.forms["1p_futr_actv_indc"] = "nōlēmus"
	data.forms["2p_futr_actv_indc"] = "nōlētis"
	data.forms["3p_futr_actv_indc"] = "nōlent"
	
	-- Active imperfective subjunctive
	data.forms["1s_pres_actv_subj"] = "nōlim"
	data.forms["2s_pres_actv_subj"] = "nōlīs"
	data.forms["3s_pres_actv_subj"] = "nōlit"
	data.forms["1p_pres_actv_subj"] = "nōlīmus"
	data.forms["2p_pres_actv_subj"] = "nōlītis"
	data.forms["3p_pres_actv_subj"] = "nōlint"
	
	data.forms["1s_impf_actv_subj"] = "nōllem"
	data.forms["2s_impf_actv_subj"] = "nōllēs"
	data.forms["3s_impf_actv_subj"] = "nōllet"
	data.forms["1p_impf_actv_subj"] = "nōllēmus"
	data.forms["2p_impf_actv_subj"] = "nōllētis"
	data.forms["3p_impf_actv_subj"] = "nōllent"
	
	-- Imperative
	data.forms["2s_pres_actv_impr"] = "nōlī"
	data.forms["2p_pres_actv_impr"] = "nōlīte"
	
	data.forms["2s_futr_actv_impr"] = "nōlitō"
	data.forms["3s_futr_actv_impr"] = "nōlitō"
	data.forms["2p_futr_actv_impr"] = "nōlitōte"
	data.forms["3p_futr_actv_impr"] = "nōluntō"
	
	-- Present infinitives
	data.forms["pres_actv_inf"] = "nōlle"
	
	-- Imperfective participles
	data.forms["pres_actv_ptc"] = "nōlēns"
end

irreg_conjugations["possum"] = function(args, data, typeinfo)
	table.insert(data.title, "highly [[Appendix:Latin irregular verbs|irregular]]")
	table.insert(data.title, "[[suppletive]]")
	table.insert(data.categories, "Latin irregular verbs")
	table.insert(data.categories, "Latin suppletive verbs")
	
	typeinfo.subtype = "nopass"
	make_perf(data, "potu")
	
	-- Active imperfective indicative
	data.forms["1s_pres_actv_indc"] = "possum"
	data.forms["2s_pres_actv_indc"] = "potes"
	data.forms["3s_pres_actv_indc"] = "potest"
	data.forms["1p_pres_actv_indc"] = "possumus"
	data.forms["2p_pres_actv_indc"] = "potestis"
	data.forms["3p_pres_actv_indc"] = "possunt"
	
	data.forms["1s_impf_actv_indc"] = "poteram"
	data.forms["2s_impf_actv_indc"] = "poterās"
	data.forms["3s_impf_actv_indc"] = "poterat"
	data.forms["1p_impf_actv_indc"] = "poterāmus"
	data.forms["2p_impf_actv_indc"] = "poterātis"
	data.forms["3p_impf_actv_indc"] = "poterant"

	data.forms["1s_futr_actv_indc"] = "poterō"
	data.forms["2s_futr_actv_indc"] = {"poteris", "potere"}
	data.forms["3s_futr_actv_indc"] = "poterit"
	data.forms["1p_futr_actv_indc"] = "poterimus"
	data.forms["2p_futr_actv_indc"] = "poteritis"
	data.forms["3p_futr_actv_indc"] = "poterunt"
	
	-- Active imperfective subjunctive
	data.forms["1s_pres_actv_subj"] = "possim"
	data.forms["2s_pres_actv_subj"] = "possīs"
	data.forms["3s_pres_actv_subj"] = "possit"
	data.forms["1p_pres_actv_subj"] = "possīmus"
	data.forms["2p_pres_actv_subj"] = "possītis"
	data.forms["3p_pres_actv_subj"] = "possint"
	
	data.forms["1s_impf_actv_subj"] = "possem"
	data.forms["2s_impf_actv_subj"] = "possēs"
	data.forms["3s_impf_actv_subj"] = "posset"
	data.forms["1p_impf_actv_subj"] = "possēmus"
	data.forms["2p_impf_actv_subj"] = "possētis"
	data.forms["3p_impf_actv_subj"] = "possent"
	
	-- Present infinitives
	data.forms["pres_actv_inf"] = "posse"
	
	-- Imperfective participles
	data.forms["pres_actv_ptc"] = "potēns"
end

irreg_conjugations["soleo"] = function(args, data, typeinfo)
	table.insert(data.title, "[[Appendix:Latin second conjugation|second conjugation]]")
	table.insert(data.title, "[[semi-deponent]]")
	table.insert(data.title, "no [[future]]")
	table.insert(data.categories, "Latin second conjugation verbs")
	table.insert(data.categories, "Latin semi-deponent verbs")
	table.insert(data.categories, "Latin defective verbs")
	
	prefix = typeinfo.prefix or ""
	
	local ppplink = m_links.full_link({lang = lang, term = prefix .. "solitus"}, "term")
	local sumlink = m_links.full_link({lang = lang, term = "sum"}, "term")

	data.forms["1s_pres_actv_indc"] = prefix .. "soleō"
	data.forms["2s_pres_actv_indc"] = prefix .. "solēs"
	data.forms["3s_pres_actv_indc"] = prefix .. "solet"
	data.forms["1p_pres_actv_indc"] = prefix .. "solēmus"
	data.forms["2p_pres_actv_indc"] = prefix .. "solētis"
	data.forms["3p_pres_actv_indc"] = prefix .. "solent"
	
	data.forms["1s_impf_actv_indc"] = prefix .. "solēbam"
	data.forms["2s_impf_actv_indc"] = prefix .. "solēbās"
	data.forms["3s_impf_actv_indc"] = prefix .. "solēbat"
	data.forms["1p_impf_actv_indc"] = prefix .. "solēbāmus"
	data.forms["2p_impf_actv_indc"] = prefix .. "solēbātis"
	data.forms["3p_impf_actv_indc"] = prefix .. "solēbant"
	
	data.forms["perf_pasv_indc"] = ppplink .. " + present active indicative of " .. sumlink
	data.forms["plup_pasv_indc"] = ppplink .. " + imperfect active indicative of " .. sumlink

	data.forms["1s_pres_actv_subj"] = prefix .. "soleam"
	data.forms["2s_pres_actv_subj"] = prefix .. "soleās"
	data.forms["3s_pres_actv_subj"] = prefix .. "soleat"
	data.forms["1p_pres_actv_subj"] = prefix .. "soleāmus"
	data.forms["2p_pres_actv_subj"] = prefix .. "soleātis"
	data.forms["3p_pres_actv_subj"] = prefix .. "soleant"
	
	data.forms["1s_impf_actv_subj"] = prefix .. "solērem"
	data.forms["2s_impf_actv_subj"] = prefix .. "solērēs"
	data.forms["3s_impf_actv_subj"] = prefix .. "solēret"
	data.forms["1p_impf_actv_subj"] = prefix .. "solērēmus"
	data.forms["2p_impf_actv_subj"] = prefix .. "solērētis"
	data.forms["3p_impf_actv_subj"] = prefix .. "solērent"

	data.forms["perf_pasv_subj"] = ppplink .. " + present active subjunctive of " .. sumlink
	data.forms["plup_pasv_subj"] = ppplink .. " + imperfect active subjunctive of " .. sumlink
	
	data.forms["pres_actv_inf"] = prefix .. "solēre"
	data.forms["perf_actv_inf"] = "[[" .. prefix .. "solitus]] [[esse]]"
	data.forms["pres_actv_ptc"] = prefix .. "solēns"
	data.forms["perf_actv_ptc"] = prefix .. "solitus"
end

irreg_conjugations["sum"] = function(args, data, typeinfo)
	table.insert(data.title, "highly [[Appendix:Latin irregular verbs|irregular]]")
	table.insert(data.title, "[[suppletive]]")
	table.insert(data.categories, "Latin irregular verbs")
	table.insert(data.categories, "Latin suppletive verbs")
	
	local prefix = typeinfo.prefix or ""
	local prefix_d = args[3]; if prefix_d == "" then prefix_d = nil end
	prefix_d = prefix_d or prefix
	local prefix_f = args[4]; if prefix == "ab" then prefix_f = "ā" elseif prefix_f == "" then prefix_f = nil end
	prefix_f = prefix_f or prefix
	-- The vowel of the prefix is lengthened if it ends in -n and the next word begins with f- or s-.
	local prefix_long = prefix:gsub("([aeiou]n)$", {["an"] = "ān", ["en"] = "ēn", ["in"] = "īn", ["on"] = "ōn", ["un"] = "ūn"})
	prefix_f = prefix_f:gsub("([aeiou]n)$", {["an"] = "ān", ["en"] = "ēn", ["in"] = "īn", ["on"] = "ōn", ["un"] = "ūn"})
	
	typeinfo.subtype = "nopass"
	make_perf(data, prefix_f .. "fu")
	make_supine(data, prefix_f .. "fut")
	
	-- Active imperfective indicative
	data.forms["1s_pres_actv_indc"] = prefix_long .. "sum"
	data.forms["2s_pres_actv_indc"] = prefix_d .. "es"
	data.forms["3s_pres_actv_indc"] = prefix_d .. "est"
	data.forms["1p_pres_actv_indc"] = prefix_long .. "sumus"
	data.forms["2p_pres_actv_indc"] = prefix_d .. "estis"
	data.forms["3p_pres_actv_indc"] = prefix_long .. "sunt"
	
	data.forms["1s_impf_actv_indc"] = prefix_d .. "eram"
	data.forms["2s_impf_actv_indc"] = prefix_d .. "erās"
	data.forms["3s_impf_actv_indc"] = prefix_d .. "erat"
	data.forms["1p_impf_actv_indc"] = prefix_d .. "erāmus"
	data.forms["2p_impf_actv_indc"] = prefix_d .. "erātis"
	data.forms["3p_impf_actv_indc"] = prefix_d .. "erant"

	data.forms["1s_futr_actv_indc"] = prefix_d .. "erō"
	data.forms["2s_futr_actv_indc"] = {prefix_d .. "eris", prefix_d .. "ere"}
	data.forms["3s_futr_actv_indc"] = prefix_d .. "erit"
	data.forms["1p_futr_actv_indc"] = prefix_d .. "erimus"
	data.forms["2p_futr_actv_indc"] = prefix_d .. "eritis"
	data.forms["3p_futr_actv_indc"] = prefix_d .. "erunt"
	
	-- Active imperfective subjunctive
	data.forms["1s_pres_actv_subj"] = prefix_long .. "sim"
	data.forms["2s_pres_actv_subj"] = prefix_long .. "sīs"
	data.forms["3s_pres_actv_subj"] = prefix_long .. "sit"
	data.forms["1p_pres_actv_subj"] = prefix_long .. "sīmus"
	data.forms["2p_pres_actv_subj"] = prefix_long .. "sītis"
	data.forms["3p_pres_actv_subj"] = prefix_long .. "sint"
	
	data.forms["1s_impf_actv_subj"] = {prefix_d .. "essem", prefix_f .. "forem"}
	data.forms["2s_impf_actv_subj"] = {prefix_d .. "essēs", prefix_f .. "forēs"}
	data.forms["3s_impf_actv_subj"] = {prefix_d .. "esset", prefix_f .. "foret"}
	data.forms["1p_impf_actv_subj"] = {prefix_d .. "essēmus", prefix_f .. "forēmus"}
	data.forms["2p_impf_actv_subj"] = {prefix_d .. "essētis", prefix_f .. "forētis"}
	data.forms["3p_impf_actv_subj"] = {prefix_d .. "essent", prefix_f .. "forent"}
	
	-- Imperative
	data.forms["2s_pres_actv_impr"] = prefix_d .. "es"
	data.forms["2p_pres_actv_impr"] = prefix_d .. "este"
	
	data.forms["2s_futr_actv_impr"] = prefix_d .. "estō"
	data.forms["3s_futr_actv_impr"] = prefix_d .. "estō"
	data.forms["2p_futr_actv_impr"] = prefix_d .. "estōte"
	data.forms["3p_futr_actv_impr"] = prefix_long .. "suntō"
	
	-- Present infinitives
	data.forms["pres_actv_inf"] = prefix_d .. "esse"
	
	-- Future infinitives
	data.forms["futr_actv_inf"] = {"[[" .. prefix_f .. "futūrus]] [[esse]]", prefix_f .. "fore"}

	-- Imperfective participles
	if prefix == "ab" then
		data.forms["pres_actv_ptc"] = "absēns"
	elseif prefix == "prae" then
		data.forms["pres_actv_ptc"] = "praesēns"
	end
	
	-- Gerund
	data.forms["ger_nom"] = nil
	data.forms["ger_gen"] = nil
	data.forms["ger_dat"] = nil
	data.forms["ger_acc"] = nil
	
	-- Supine
	data.forms["sup_acc"] = nil
	data.forms["sup_abl"] = nil
end

irreg_conjugations["volo"] = function(args, data, typeinfo)
	table.insert(data.title, "[[Appendix:Latin irregular verbs|irregular]]")
	table.insert(data.categories, "Latin irregular verbs")
	
	local prefix = typeinfo.prefix or ""
	
	typeinfo.subtype = "nopass"
	typeinfo.subtype = "noimp"
	make_perf(data, prefix .. "volu")
	
	-- Active imperfective indicative
	data.forms["1s_pres_actv_indc"] = prefix .. "volō"
	data.forms["2s_pres_actv_indc"] = prefix .. "vīs"
	data.forms["3s_pres_actv_indc"] = prefix ~= "" and prefix .. "vult" or {"vult", "volt"}
	data.forms["1p_pres_actv_indc"] = prefix .. "volumus"
	data.forms["2p_pres_actv_indc"] = prefix ~= "" and prefix .. "vultis" or {"vultis", "voltis"}
	data.forms["3p_pres_actv_indc"] = prefix .. "volunt"
	
	data.forms["1s_impf_actv_indc"] = prefix .. "volēbam"
	data.forms["2s_impf_actv_indc"] = prefix .. "volēbās"
	data.forms["3s_impf_actv_indc"] = prefix .. "volēbat"
	data.forms["1p_impf_actv_indc"] = prefix .. "volēbāmus"
	data.forms["2p_impf_actv_indc"] = prefix .. "volēbātis"
	data.forms["3p_impf_actv_indc"] = prefix .. "volēbant"

	data.forms["1s_futr_actv_indc"] = prefix .. "volam"
	data.forms["2s_futr_actv_indc"] = prefix .. "volēs"
	data.forms["3s_futr_actv_indc"] = prefix .. "volet"
	data.forms["1p_futr_actv_indc"] = prefix .. "volēmus"
	data.forms["2p_futr_actv_indc"] = prefix .. "volētis"
	data.forms["3p_futr_actv_indc"] = prefix .. "volent"
	
	-- Active imperfective subjunctive
	data.forms["1s_pres_actv_subj"] = prefix .. "velim"
	data.forms["2s_pres_actv_subj"] = prefix .. "velīs"
	data.forms["3s_pres_actv_subj"] = prefix .. "velit"
	data.forms["1p_pres_actv_subj"] = prefix .. "velīmus"
	data.forms["2p_pres_actv_subj"] = prefix .. "velītis"
	data.forms["3p_pres_actv_subj"] = prefix .. "velint"
	
	data.forms["1s_impf_actv_subj"] = prefix .. "vellem"
	data.forms["2s_impf_actv_subj"] = prefix .. "vellēs"
	data.forms["3s_impf_actv_subj"] = prefix .. "vellet"
	data.forms["1p_impf_actv_subj"] = prefix .. "vellēmus"
	data.forms["2p_impf_actv_subj"] = prefix .. "vellētis"
	data.forms["3p_impf_actv_subj"] = prefix .. "vellent"
	
	-- Present infinitives
	data.forms["pres_actv_inf"] = prefix .. "velle"
	
	-- Imperfective participles
	data.forms["pres_actv_ptc"] = prefix .. "volēns"
end


-- Form-generating functions

function make_pres_1st(data, pres_stem)
	if not pres_stem then
		return
	end

	-- Active imperfective indicative
	data.forms["1s_pres_actv_indc"] = pres_stem .. "ō"
	data.forms["2s_pres_actv_indc"] = pres_stem .. "ās"
	data.forms["3s_pres_actv_indc"] = pres_stem .. "at"
	data.forms["1p_pres_actv_indc"] = pres_stem .. "āmus"
	data.forms["2p_pres_actv_indc"] = pres_stem .. "ātis"
	data.forms["3p_pres_actv_indc"] = pres_stem .. "ant"
	
	data.forms["1s_impf_actv_indc"] = pres_stem .. "ābam"
	data.forms["2s_impf_actv_indc"] = pres_stem .. "ābās"
	data.forms["3s_impf_actv_indc"] = pres_stem .. "ābat"
	data.forms["1p_impf_actv_indc"] = pres_stem .. "ābāmus"
	data.forms["2p_impf_actv_indc"] = pres_stem .. "ābātis"
	data.forms["3p_impf_actv_indc"] = pres_stem .. "ābant"
	
	data.forms["1s_futr_actv_indc"] = pres_stem .. "ābō"
	data.forms["2s_futr_actv_indc"] = pres_stem .. "ābis"
	data.forms["3s_futr_actv_indc"] = pres_stem .. "ābit"
	data.forms["1p_futr_actv_indc"] = pres_stem .. "ābimus"
	data.forms["2p_futr_actv_indc"] = pres_stem .. "ābitis"
	data.forms["3p_futr_actv_indc"] = pres_stem .. "ābunt"
	
	-- Passive imperfective indicative
	data.forms["1s_pres_pasv_indc"] = pres_stem .. "or"
	data.forms["2s_pres_pasv_indc"] = {pres_stem .. "āris", pres_stem .. "āre"}
	data.forms["3s_pres_pasv_indc"] = pres_stem .. "ātur"
	data.forms["1p_pres_pasv_indc"] = pres_stem .. "āmur"
	data.forms["2p_pres_pasv_indc"] = pres_stem .. "āminī"
	data.forms["3p_pres_pasv_indc"] = pres_stem .. "antur"
	
	data.forms["1s_impf_pasv_indc"] = pres_stem .. "ābar"
	data.forms["2s_impf_pasv_indc"] = {pres_stem .. "ābāris", pres_stem .. "ābāre"}
	data.forms["3s_impf_pasv_indc"] = pres_stem .. "ābātur"
	data.forms["1p_impf_pasv_indc"] = pres_stem .. "ābāmur"
	data.forms["2p_impf_pasv_indc"] = pres_stem .. "ābāminī"
	data.forms["3p_impf_pasv_indc"] = pres_stem .. "ābantur"
	
	data.forms["1s_futr_pasv_indc"] = pres_stem .. "ābor"
	data.forms["2s_futr_pasv_indc"] = {pres_stem .. "āberis", pres_stem .. "ābere"}
	data.forms["3s_futr_pasv_indc"] = pres_stem .. "ābitur"
	data.forms["1p_futr_pasv_indc"] = pres_stem .. "ābimur"
	data.forms["2p_futr_pasv_indc"] = pres_stem .. "ābiminī"
	data.forms["3p_futr_pasv_indc"] = pres_stem .. "ābuntur"
	
	-- Active imperfective subjunctive
	data.forms["1s_pres_actv_subj"] = pres_stem .. "em"
	data.forms["2s_pres_actv_subj"] = pres_stem .. "ēs"
	data.forms["3s_pres_actv_subj"] = pres_stem .. "et"
	data.forms["1p_pres_actv_subj"] = pres_stem .. "ēmus"
	data.forms["2p_pres_actv_subj"] = pres_stem .. "ētis"
	data.forms["3p_pres_actv_subj"] = pres_stem .. "ent"
	
	data.forms["1s_impf_actv_subj"] = pres_stem .. "ārem"
	data.forms["2s_impf_actv_subj"] = pres_stem .. "ārēs"
	data.forms["3s_impf_actv_subj"] = pres_stem .. "āret"
	data.forms["1p_impf_actv_subj"] = pres_stem .. "ārēmus"
	data.forms["2p_impf_actv_subj"] = pres_stem .. "ārētis"
	data.forms["3p_impf_actv_subj"] = pres_stem .. "ārent"
	
	-- Passive imperfective subjunctive
	data.forms["1s_pres_pasv_subj"] = pres_stem .. "er"
	data.forms["2s_pres_pasv_subj"] = {pres_stem .. "ēris", pres_stem .. "ēre"}
	data.forms["3s_pres_pasv_subj"] = pres_stem .. "ētur"
	data.forms["1p_pres_pasv_subj"] = pres_stem .. "ēmur"
	data.forms["2p_pres_pasv_subj"] = pres_stem .. "ēminī"
	data.forms["3p_pres_pasv_subj"] = pres_stem .. "entur"
	
	data.forms["1s_impf_pasv_subj"] = pres_stem .. "ārer"
	data.forms["2s_impf_pasv_subj"] = {pres_stem .. "ārēris", pres_stem .. "ārēre"}
	data.forms["3s_impf_pasv_subj"] = pres_stem .. "ārētur"
	data.forms["1p_impf_pasv_subj"] = pres_stem .. "ārēmur"
	data.forms["2p_impf_pasv_subj"] = pres_stem .. "ārēminī"
	data.forms["3p_impf_pasv_subj"] = pres_stem .. "ārentur"
	
	-- Imperative
	data.forms["2s_pres_actv_impr"] = pres_stem .. "ā"
	data.forms["2p_pres_actv_impr"] = pres_stem .. "āte"
	
	data.forms["2s_futr_actv_impr"] = pres_stem .. "ātō"
	data.forms["3s_futr_actv_impr"] = pres_stem .. "ātō"
	data.forms["2p_futr_actv_impr"] = pres_stem .. "ātōte"
	data.forms["3p_futr_actv_impr"] = pres_stem .. "antō"
	
	data.forms["2s_pres_pasv_impr"] = pres_stem .. "āre"
	data.forms["2p_pres_pasv_impr"] = pres_stem .. "āminī"
	
	data.forms["2s_futr_pasv_impr"] = pres_stem .. "ātor"
	data.forms["3s_futr_pasv_impr"] = pres_stem .. "ātor"
	-- no form
	data.forms["3p_futr_pasv_impr"] = pres_stem .. "antor"
	
	-- Present infinitives
	data.forms["pres_actv_inf"] = pres_stem .. "āre"
	data.forms["pres_pasv_inf"] = pres_stem .. "ārī"
	
	-- Imperfective participles
	data.forms["pres_actv_ptc"] = pres_stem .. "āns"
	data.forms["futr_pasv_ptc"] = pres_stem .. "andus"
	
	-- Gerund
	data.forms["ger_nom"] = data.forms["pres_actv_inf"]
	data.forms["ger_gen"] = pres_stem .. "andī"
	data.forms["ger_dat"] = pres_stem .. "andō"
	data.forms["ger_acc"] = pres_stem .. "andum"
end

function make_pres_2nd(data, pres_stem)
	-- Active imperfective indicative
	data.forms["1s_pres_actv_indc"] = pres_stem .. "eō"
	data.forms["2s_pres_actv_indc"] = pres_stem .. "ēs"
	data.forms["3s_pres_actv_indc"] = pres_stem .. "et"
	data.forms["1p_pres_actv_indc"] = pres_stem .. "ēmus"
	data.forms["2p_pres_actv_indc"] = pres_stem .. "ētis"
	data.forms["3p_pres_actv_indc"] = pres_stem .. "ent"
	
	data.forms["1s_impf_actv_indc"] = pres_stem .. "ēbam"
	data.forms["2s_impf_actv_indc"] = pres_stem .. "ēbās"
	data.forms["3s_impf_actv_indc"] = pres_stem .. "ēbat"
	data.forms["1p_impf_actv_indc"] = pres_stem .. "ēbāmus"
	data.forms["2p_impf_actv_indc"] = pres_stem .. "ēbātis"
	data.forms["3p_impf_actv_indc"] = pres_stem .. "ēbant"
	
	data.forms["1s_futr_actv_indc"] = pres_stem .. "ēbō"
	data.forms["2s_futr_actv_indc"] = pres_stem .. "ēbis"
	data.forms["3s_futr_actv_indc"] = pres_stem .. "ēbit"
	data.forms["1p_futr_actv_indc"] = pres_stem .. "ēbimus"
	data.forms["2p_futr_actv_indc"] = pres_stem .. "ēbitis"
	data.forms["3p_futr_actv_indc"] = pres_stem .. "ēbunt"
	
	-- Passive imperfective indicative
	data.forms["1s_pres_pasv_indc"] = pres_stem .. "eor"
	data.forms["2s_pres_pasv_indc"] = {pres_stem .. "ēris", pres_stem .. "ēre"}
	data.forms["3s_pres_pasv_indc"] = pres_stem .. "ētur"
	data.forms["1p_pres_pasv_indc"] = pres_stem .. "ēmur"
	data.forms["2p_pres_pasv_indc"] = pres_stem .. "ēminī"
	data.forms["3p_pres_pasv_indc"] = pres_stem .. "entur"
	
	data.forms["1s_impf_pasv_indc"] = pres_stem .. "ēbar"
	data.forms["2s_impf_pasv_indc"] = {pres_stem .. "ēbāris", pres_stem .. "ēbāre"}
	data.forms["3s_impf_pasv_indc"] = pres_stem .. "ēbātur"
	data.forms["1p_impf_pasv_indc"] = pres_stem .. "ēbāmur"
	data.forms["2p_impf_pasv_indc"] = pres_stem .. "ēbāminī"
	data.forms["3p_impf_pasv_indc"] = pres_stem .. "ēbantur"
	
	data.forms["1s_futr_pasv_indc"] = pres_stem .. "ēbor"
	data.forms["2s_futr_pasv_indc"] = {pres_stem .. "ēberis", pres_stem .. "ēbere"}
	data.forms["3s_futr_pasv_indc"] = pres_stem .. "ēbitur"
	data.forms["1p_futr_pasv_indc"] = pres_stem .. "ēbimur"
	data.forms["2p_futr_pasv_indc"] = pres_stem .. "ēbiminī"
	data.forms["3p_futr_pasv_indc"] = pres_stem .. "ēbuntur"
	
	-- Active imperfective subjunctive
	data.forms["1s_pres_actv_subj"] = pres_stem .. "eam"
	data.forms["2s_pres_actv_subj"] = pres_stem .. "eās"
	data.forms["3s_pres_actv_subj"] = pres_stem .. "eat"
	data.forms["1p_pres_actv_subj"] = pres_stem .. "eāmus"
	data.forms["2p_pres_actv_subj"] = pres_stem .. "eātis"
	data.forms["3p_pres_actv_subj"] = pres_stem .. "eant"
	
	data.forms["1s_impf_actv_subj"] = pres_stem .. "ērem"
	data.forms["2s_impf_actv_subj"] = pres_stem .. "ērēs"
	data.forms["3s_impf_actv_subj"] = pres_stem .. "ēret"
	data.forms["1p_impf_actv_subj"] = pres_stem .. "ērēmus"
	data.forms["2p_impf_actv_subj"] = pres_stem .. "ērētis"
	data.forms["3p_impf_actv_subj"] = pres_stem .. "ērent"
	
	-- Passive imperfective subjunctive
	data.forms["1s_pres_pasv_subj"] = pres_stem .. "ear"
	data.forms["2s_pres_pasv_subj"] = {pres_stem .. "eāris", pres_stem .. "eāre"}
	data.forms["3s_pres_pasv_subj"] = pres_stem .. "eātur"
	data.forms["1p_pres_pasv_subj"] = pres_stem .. "eāmur"
	data.forms["2p_pres_pasv_subj"] = pres_stem .. "eāminī"
	data.forms["3p_pres_pasv_subj"] = pres_stem .. "eantur"
	
	data.forms["1s_impf_pasv_subj"] = pres_stem .. "ērer"
	data.forms["2s_impf_pasv_subj"] = {pres_stem .. "ērēris", pres_stem .. "ērēre"}
	data.forms["3s_impf_pasv_subj"] = pres_stem .. "ērētur"
	data.forms["1p_impf_pasv_subj"] = pres_stem .. "ērēmur"
	data.forms["2p_impf_pasv_subj"] = pres_stem .. "ērēminī"
	data.forms["3p_impf_pasv_subj"] = pres_stem .. "ērentur"
	
	-- Imperative
	data.forms["2s_pres_actv_impr"] = pres_stem .. "ē"
	data.forms["2p_pres_actv_impr"] = pres_stem .. "ēte"
	
	data.forms["2s_futr_actv_impr"] = pres_stem .. "ētō"
	data.forms["3s_futr_actv_impr"] = pres_stem .. "ētō"
	data.forms["2p_futr_actv_impr"] = pres_stem .. "ētōte"
	data.forms["3p_futr_actv_impr"] = pres_stem .. "entō"
	
	data.forms["2s_pres_pasv_impr"] = pres_stem .. "ēre"
	data.forms["2p_pres_pasv_impr"] = pres_stem .. "ēminī"
	
	data.forms["2s_futr_pasv_impr"] = pres_stem .. "ētor"
	data.forms["3s_futr_pasv_impr"] = pres_stem .. "ētor"
	-- no form
	data.forms["3p_futr_pasv_impr"] = pres_stem .. "entor"
	
	-- Present infinitives
	data.forms["pres_actv_inf"] = pres_stem .. "ēre"
	data.forms["pres_pasv_inf"] = pres_stem .. "ērī"

	-- Imperfective participles
	data.forms["pres_actv_ptc"] = pres_stem .. "ēns"
	data.forms["futr_pasv_ptc"] = pres_stem .. "endus"
	
	-- Gerund
	data.forms["ger_nom"] = data.forms["pres_actv_inf"]
	data.forms["ger_gen"] = pres_stem .. "endī"
	data.forms["ger_dat"] = pres_stem .. "endō"
	data.forms["ger_acc"] = pres_stem .. "endum"
end

function make_pres_3rd(data, pres_stem)
	-- Active imperfective indicative
	data.forms["1s_pres_actv_indc"] = pres_stem .. "ō"
	data.forms["2s_pres_actv_indc"] = pres_stem .. "is"
	data.forms["3s_pres_actv_indc"] = pres_stem .. "it"
	data.forms["1p_pres_actv_indc"] = pres_stem .. "imus"
	data.forms["2p_pres_actv_indc"] = pres_stem .. "itis"
	data.forms["3p_pres_actv_indc"] = pres_stem .. "unt"
	
	data.forms["1s_impf_actv_indc"] = pres_stem .. "ēbam"
	data.forms["2s_impf_actv_indc"] = pres_stem .. "ēbās"
	data.forms["3s_impf_actv_indc"] = pres_stem .. "ēbat"
	data.forms["1p_impf_actv_indc"] = pres_stem .. "ēbāmus"
	data.forms["2p_impf_actv_indc"] = pres_stem .. "ēbātis"
	data.forms["3p_impf_actv_indc"] = pres_stem .. "ēbant"
	
	data.forms["1s_futr_actv_indc"] = pres_stem .. "am"
	data.forms["2s_futr_actv_indc"] = pres_stem .. "ēs"
	data.forms["3s_futr_actv_indc"] = pres_stem .. "et"
	data.forms["1p_futr_actv_indc"] = pres_stem .. "ēmus"
	data.forms["2p_futr_actv_indc"] = pres_stem .. "ētis"
	data.forms["3p_futr_actv_indc"] = pres_stem .. "ent"
	
	-- Passive imperfective indicative
	data.forms["1s_pres_pasv_indc"] = pres_stem .. "or"
	data.forms["2s_pres_pasv_indc"] = {pres_stem .. "eris", pres_stem .. "ere"}
	data.forms["3s_pres_pasv_indc"] = pres_stem .. "itur"
	data.forms["1p_pres_pasv_indc"] = pres_stem .. "imur"
	data.forms["2p_pres_pasv_indc"] = pres_stem .. "iminī"
	data.forms["3p_pres_pasv_indc"] = pres_stem .. "untur"
	
	data.forms["1s_impf_pasv_indc"] = pres_stem .. "ēbar"
	data.forms["2s_impf_pasv_indc"] = {pres_stem .. "ēbāris", pres_stem .. "ēbāre"}
	data.forms["3s_impf_pasv_indc"] = pres_stem .. "ēbātur"
	data.forms["1p_impf_pasv_indc"] = pres_stem .. "ēbāmur"
	data.forms["2p_impf_pasv_indc"] = pres_stem .. "ēbāminī"
	data.forms["3p_impf_pasv_indc"] = pres_stem .. "ēbantur"
	
	data.forms["1s_futr_pasv_indc"] = pres_stem .. "ar"
	data.forms["2s_futr_pasv_indc"] = {pres_stem .. "ēris", pres_stem .. "ēre"}
	data.forms["3s_futr_pasv_indc"] = pres_stem .. "ētur"
	data.forms["1p_futr_pasv_indc"] = pres_stem .. "ēmur"
	data.forms["2p_futr_pasv_indc"] = pres_stem .. "ēminī"
	data.forms["3p_futr_pasv_indc"] = pres_stem .. "entur"
	
	-- Active imperfective subjunctive
	data.forms["1s_pres_actv_subj"] = pres_stem .. "am"
	data.forms["2s_pres_actv_subj"] = pres_stem .. "ās"
	data.forms["3s_pres_actv_subj"] = pres_stem .. "at"
	data.forms["1p_pres_actv_subj"] = pres_stem .. "āmus"
	data.forms["2p_pres_actv_subj"] = pres_stem .. "ātis"
	data.forms["3p_pres_actv_subj"] = pres_stem .. "ant"
	
	data.forms["1s_impf_actv_subj"] = pres_stem .. "erem"
	data.forms["2s_impf_actv_subj"] = pres_stem .. "erēs"
	data.forms["3s_impf_actv_subj"] = pres_stem .. "eret"
	data.forms["1p_impf_actv_subj"] = pres_stem .. "erēmus"
	data.forms["2p_impf_actv_subj"] = pres_stem .. "erētis"
	data.forms["3p_impf_actv_subj"] = pres_stem .. "erent"
	
	-- Passive imperfective subjunctive
	data.forms["1s_pres_pasv_subj"] = pres_stem .. "ar"
	data.forms["2s_pres_pasv_subj"] = {pres_stem .. "āris", pres_stem .. "āre"}
	data.forms["3s_pres_pasv_subj"] = pres_stem .. "ātur"
	data.forms["1p_pres_pasv_subj"] = pres_stem .. "āmur"
	data.forms["2p_pres_pasv_subj"] = pres_stem .. "āminī"
	data.forms["3p_pres_pasv_subj"] = pres_stem .. "antur"
	
	data.forms["1s_impf_pasv_subj"] = pres_stem .. "erer"
	data.forms["2s_impf_pasv_subj"] = {pres_stem .. "erēris", pres_stem .. "erēre"}
	data.forms["3s_impf_pasv_subj"] = pres_stem .. "erētur"
	data.forms["1p_impf_pasv_subj"] = pres_stem .. "erēmur"
	data.forms["2p_impf_pasv_subj"] = pres_stem .. "erēminī"
	data.forms["3p_impf_pasv_subj"] = pres_stem .. "erentur"
	
	-- Imperative
	data.forms["2s_pres_actv_impr"] = pres_stem .. "e"
	data.forms["2p_pres_actv_impr"] = pres_stem .. "ite"
	
	data.forms["2s_futr_actv_impr"] = pres_stem .. "itō"
	data.forms["3s_futr_actv_impr"] = pres_stem .. "itō"
	data.forms["2p_futr_actv_impr"] = pres_stem .. "itōte"
	data.forms["3p_futr_actv_impr"] = pres_stem .. "untō"
	
	data.forms["2s_pres_pasv_impr"] = pres_stem .. "ere"
	data.forms["2p_pres_pasv_impr"] = pres_stem .. "iminī"
	
	data.forms["2s_futr_pasv_impr"] = pres_stem .. "itor"
	data.forms["3s_futr_pasv_impr"] = pres_stem .. "itor"
	-- no form
	data.forms["3p_futr_pasv_impr"] = pres_stem .. "untor"
	
	-- Present infinitives
	data.forms["pres_actv_inf"] = pres_stem .. "ere"
	data.forms["pres_pasv_inf"] = pres_stem .. "ī"
	
	-- Imperfective participles
	data.forms["pres_actv_ptc"] = pres_stem .. "ēns"
	data.forms["futr_pasv_ptc"] = pres_stem .. "endus"
	
	-- Gerund
	data.forms["ger_nom"] = data.forms["pres_actv_inf"]
	data.forms["ger_gen"] = pres_stem .. "endī"
	data.forms["ger_dat"] = pres_stem .. "endō"
	data.forms["ger_acc"] = pres_stem .. "endum"
end

function make_pres_3rd_io(data, pres_stem)
	-- Active imperfective indicative
	data.forms["1s_pres_actv_indc"] = pres_stem .. "iō"
	data.forms["2s_pres_actv_indc"] = pres_stem .. "is"
	data.forms["3s_pres_actv_indc"] = pres_stem .. "it"
	data.forms["1p_pres_actv_indc"] = pres_stem .. "imus"
	data.forms["2p_pres_actv_indc"] = pres_stem .. "itis"
	data.forms["3p_pres_actv_indc"] = pres_stem .. "iunt"
	
	data.forms["1s_impf_actv_indc"] = pres_stem .. "iēbam"
	data.forms["2s_impf_actv_indc"] = pres_stem .. "iēbās"
	data.forms["3s_impf_actv_indc"] = pres_stem .. "iēbat"
	data.forms["1p_impf_actv_indc"] = pres_stem .. "iēbāmus"
	data.forms["2p_impf_actv_indc"] = pres_stem .. "iēbātis"
	data.forms["3p_impf_actv_indc"] = pres_stem .. "iēbant"
	
	data.forms["1s_futr_actv_indc"] = pres_stem .. "iam"
	data.forms["2s_futr_actv_indc"] = pres_stem .. "iēs"
	data.forms["3s_futr_actv_indc"] = pres_stem .. "iet"
	data.forms["1p_futr_actv_indc"] = pres_stem .. "iēmus"
	data.forms["2p_futr_actv_indc"] = pres_stem .. "iētis"
	data.forms["3p_futr_actv_indc"] = pres_stem .. "ient"
	
	-- Passive imperfective indicative
	data.forms["1s_pres_pasv_indc"] = pres_stem .. "ior"
	data.forms["2s_pres_pasv_indc"] = {pres_stem .. "eris", pres_stem .. "ere"}
	data.forms["3s_pres_pasv_indc"] = pres_stem .. "itur"
	data.forms["1p_pres_pasv_indc"] = pres_stem .. "imur"
	data.forms["2p_pres_pasv_indc"] = pres_stem .. "iminī"
	data.forms["3p_pres_pasv_indc"] = pres_stem .. "iuntur"
	
	data.forms["1s_impf_pasv_indc"] = pres_stem .. "iēbar"
	data.forms["2s_impf_pasv_indc"] = {pres_stem .. "iēbāris", pres_stem .. "iēbāre"}
	data.forms["3s_impf_pasv_indc"] = pres_stem .. "iēbātur"
	data.forms["1p_impf_pasv_indc"] = pres_stem .. "iēbāmur"
	data.forms["2p_impf_pasv_indc"] = pres_stem .. "iēbāminī"
	data.forms["3p_impf_pasv_indc"] = pres_stem .. "iēbantur"
	
	data.forms["1s_futr_pasv_indc"] = pres_stem .. "iar"
	data.forms["2s_futr_pasv_indc"] = {pres_stem .. "iēris", pres_stem .. "iēre"}
	data.forms["3s_futr_pasv_indc"] = pres_stem .. "iētur"
	data.forms["1p_futr_pasv_indc"] = pres_stem .. "iēmur"
	data.forms["2p_futr_pasv_indc"] = pres_stem .. "iēminī"
	data.forms["3p_futr_pasv_indc"] = pres_stem .. "ientur"
	
	-- Active imperfective subjunctive
	data.forms["1s_pres_actv_subj"] = pres_stem .. "iam"
	data.forms["2s_pres_actv_subj"] = pres_stem .. "iās"
	data.forms["3s_pres_actv_subj"] = pres_stem .. "iat"
	data.forms["1p_pres_actv_subj"] = pres_stem .. "iāmus"
	data.forms["2p_pres_actv_subj"] = pres_stem .. "iātis"
	data.forms["3p_pres_actv_subj"] = pres_stem .. "iant"
	
	data.forms["1s_impf_actv_subj"] = pres_stem .. "erem"
	data.forms["2s_impf_actv_subj"] = pres_stem .. "erēs"
	data.forms["3s_impf_actv_subj"] = pres_stem .. "eret"
	data.forms["1p_impf_actv_subj"] = pres_stem .. "erēmus"
	data.forms["2p_impf_actv_subj"] = pres_stem .. "erētis"
	data.forms["3p_impf_actv_subj"] = pres_stem .. "erent"
	
	-- Passive imperfective subjunctive
	data.forms["1s_pres_pasv_subj"] = pres_stem .. "iar"
	data.forms["2s_pres_pasv_subj"] = {pres_stem .. "iāris", pres_stem .. "iāre"}
	data.forms["3s_pres_pasv_subj"] = pres_stem .. "iātur"
	data.forms["1p_pres_pasv_subj"] = pres_stem .. "iāmur"
	data.forms["2p_pres_pasv_subj"] = pres_stem .. "iāminī"
	data.forms["3p_pres_pasv_subj"] = pres_stem .. "iantur"
	
	data.forms["1s_impf_pasv_subj"] = pres_stem .. "erer"
	data.forms["2s_impf_pasv_subj"] = {pres_stem .. "erēris", pres_stem .. "erēre"}
	data.forms["3s_impf_pasv_subj"] = pres_stem .. "erētur"
	data.forms["1p_impf_pasv_subj"] = pres_stem .. "erēmur"
	data.forms["2p_impf_pasv_subj"] = pres_stem .. "erēminī"
	data.forms["3p_impf_pasv_subj"] = pres_stem .. "erentur"
	
	-- Imperative
	data.forms["2s_pres_actv_impr"] = pres_stem .. "e"
	data.forms["2p_pres_actv_impr"] = pres_stem .. "ite"
	
	data.forms["2s_futr_actv_impr"] = pres_stem .. "itō"
	data.forms["3s_futr_actv_impr"] = pres_stem .. "itō"
	data.forms["2p_futr_actv_impr"] = pres_stem .. "itōte"
	data.forms["3p_futr_actv_impr"] = pres_stem .. "iuntō"
	
	data.forms["2s_pres_pasv_impr"] = pres_stem .. "ere"
	data.forms["2p_pres_pasv_impr"] = pres_stem .. "iminī"
	
	data.forms["2s_futr_pasv_impr"] = pres_stem .. "itor"
	data.forms["3s_futr_pasv_impr"] = pres_stem .. "itor"
	-- no form
	data.forms["3p_futr_pasv_impr"] = pres_stem .. "iuntor"
	
	-- Present infinitives
	data.forms["pres_actv_inf"] = pres_stem .. "ere"
	data.forms["pres_pasv_inf"] = pres_stem .. "ī"
	
	-- Imperfective participles
	data.forms["pres_actv_ptc"] = pres_stem .. "iēns"
	data.forms["futr_pasv_ptc"] = pres_stem .. "iendus"
	
	-- Gerund
	data.forms["ger_nom"] = data.forms["pres_actv_inf"]
	data.forms["ger_gen"] = pres_stem .. "iendī"
	data.forms["ger_dat"] = pres_stem .. "iendō"
	data.forms["ger_acc"] = pres_stem .. "iendum"
end

function make_pres_4th(data, pres_stem)
	-- Active imperfective indicative
	data.forms["1s_pres_actv_indc"] = pres_stem .. "iō"
	data.forms["2s_pres_actv_indc"] = pres_stem .. "īs"
	data.forms["3s_pres_actv_indc"] = pres_stem .. "it"
	data.forms["1p_pres_actv_indc"] = pres_stem .. "īmus"
	data.forms["2p_pres_actv_indc"] = pres_stem .. "ītis"
	data.forms["3p_pres_actv_indc"] = pres_stem .. "iunt"
	
	data.forms["1s_impf_actv_indc"] = pres_stem .. "iēbam"
	data.forms["2s_impf_actv_indc"] = pres_stem .. "iēbās"
	data.forms["3s_impf_actv_indc"] = pres_stem .. "iēbat"
	data.forms["1p_impf_actv_indc"] = pres_stem .. "iēbāmus"
	data.forms["2p_impf_actv_indc"] = pres_stem .. "iēbātis"
	data.forms["3p_impf_actv_indc"] = pres_stem .. "iēbant"
	
	data.forms["1s_futr_actv_indc"] = pres_stem .. "iam"
	data.forms["2s_futr_actv_indc"] = pres_stem .. "iēs"
	data.forms["3s_futr_actv_indc"] = pres_stem .. "iet"
	data.forms["1p_futr_actv_indc"] = pres_stem .. "iēmus"
	data.forms["2p_futr_actv_indc"] = pres_stem .. "iētis"
	data.forms["3p_futr_actv_indc"] = pres_stem .. "ient"
	
	-- Passive imperfective indicative
	data.forms["1s_pres_pasv_indc"] = pres_stem .. "ior"
	data.forms["2s_pres_pasv_indc"] = {pres_stem .. "īris", pres_stem .. "īre"}
	data.forms["3s_pres_pasv_indc"] = pres_stem .. "ītur"
	data.forms["1p_pres_pasv_indc"] = pres_stem .. "īmur"
	data.forms["2p_pres_pasv_indc"] = pres_stem .. "īminī"
	data.forms["3p_pres_pasv_indc"] = pres_stem .. "iuntur"
	
	data.forms["1s_impf_pasv_indc"] = pres_stem .. "iēbar"
	data.forms["2s_impf_pasv_indc"] = {pres_stem .. "iēbāris", pres_stem .. "iēbāre"}
	data.forms["3s_impf_pasv_indc"] = pres_stem .. "iēbātur"
	data.forms["1p_impf_pasv_indc"] = pres_stem .. "iēbāmur"
	data.forms["2p_impf_pasv_indc"] = pres_stem .. "iēbāminī"
	data.forms["3p_impf_pasv_indc"] = pres_stem .. "iēbantur"
	
	data.forms["1s_futr_pasv_indc"] = pres_stem .. "iar"
	data.forms["2s_futr_pasv_indc"] = {pres_stem .. "iēris", pres_stem .. "iēre"}
	data.forms["3s_futr_pasv_indc"] = pres_stem .. "iētur"
	data.forms["1p_futr_pasv_indc"] = pres_stem .. "iēmur"
	data.forms["2p_futr_pasv_indc"] = pres_stem .. "iēminī"
	data.forms["3p_futr_pasv_indc"] = pres_stem .. "ientur"
	
	-- Active imperfective subjunctive
	data.forms["1s_pres_actv_subj"] = pres_stem .. "iam"
	data.forms["2s_pres_actv_subj"] = pres_stem .. "iās"
	data.forms["3s_pres_actv_subj"] = pres_stem .. "iat"
	data.forms["1p_pres_actv_subj"] = pres_stem .. "iāmus"
	data.forms["2p_pres_actv_subj"] = pres_stem .. "iātis"
	data.forms["3p_pres_actv_subj"] = pres_stem .. "iant"
	
	data.forms["1s_impf_actv_subj"] = pres_stem .. "īrem"
	data.forms["2s_impf_actv_subj"] = pres_stem .. "īrēs"
	data.forms["3s_impf_actv_subj"] = pres_stem .. "īret"
	data.forms["1p_impf_actv_subj"] = pres_stem .. "īrēmus"
	data.forms["2p_impf_actv_subj"] = pres_stem .. "īrētis"
	data.forms["3p_impf_actv_subj"] = pres_stem .. "īrent"
	
	-- Passive imperfective subjunctive
	data.forms["1s_pres_pasv_subj"] = pres_stem .. "iar"
	data.forms["2s_pres_pasv_subj"] = {pres_stem .. "iāris", pres_stem .. "iāre"}
	data.forms["3s_pres_pasv_subj"] = pres_stem .. "iātur"
	data.forms["1p_pres_pasv_subj"] = pres_stem .. "iāmur"
	data.forms["2p_pres_pasv_subj"] = pres_stem .. "iāminī"
	data.forms["3p_pres_pasv_subj"] = pres_stem .. "iantur"
	
	data.forms["1s_impf_pasv_subj"] = pres_stem .. "īrer"
	data.forms["2s_impf_pasv_subj"] = {pres_stem .. "īrēris", pres_stem .. "īrēre"}
	data.forms["3s_impf_pasv_subj"] = pres_stem .. "īrētur"
	data.forms["1p_impf_pasv_subj"] = pres_stem .. "īrēmur"
	data.forms["2p_impf_pasv_subj"] = pres_stem .. "īrēminī"
	data.forms["3p_impf_pasv_subj"] = pres_stem .. "īrentur"
	
	-- Imperative
	data.forms["2s_pres_actv_impr"] = pres_stem .. "ī"
	data.forms["2p_pres_actv_impr"] = pres_stem .. "īte"
	
	data.forms["2s_futr_actv_impr"] = pres_stem .. "ītō"
	data.forms["3s_futr_actv_impr"] = pres_stem .. "ītō"
	data.forms["2p_futr_actv_impr"] = pres_stem .. "ītōte"
	data.forms["3p_futr_actv_impr"] = pres_stem .. "iuntō"
	
	data.forms["2s_pres_pasv_impr"] = pres_stem .. "īre"
	data.forms["2p_pres_pasv_impr"] = pres_stem .. "īminī"
	
	data.forms["2s_futr_pasv_impr"] = pres_stem .. "ītor"
	data.forms["3s_futr_pasv_impr"] = pres_stem .. "ītor"
	-- no form
	data.forms["3p_futr_pasv_impr"] = pres_stem .. "iuntor"
	
	-- Present infinitives
	data.forms["pres_actv_inf"] = pres_stem .. "īre"
	data.forms["pres_pasv_inf"] = pres_stem .. "īrī"
	
	-- Imperfective participles
	data.forms["pres_actv_ptc"] = pres_stem .. "iēns"
	data.forms["futr_pasv_ptc"] = pres_stem .. "iendus"
	
	-- Gerund
	data.forms["ger_nom"] = data.forms["pres_actv_inf"]
	data.forms["ger_gen"] = pres_stem .. "iendī"
	data.forms["ger_dat"] = pres_stem .. "iendō"
	data.forms["ger_acc"] = pres_stem .. "iendum"
end

function make_perf(data, perf_stem)
	if not perf_stem then
		return
	end
	
	-- Perfective indicative
	data.forms["1s_perf_actv_indc"] = perf_stem .. "ī"
	data.forms["2s_perf_actv_indc"] = perf_stem .. "istī"
	data.forms["3s_perf_actv_indc"] = perf_stem .. "it"
	data.forms["1p_perf_actv_indc"] = perf_stem .. "imus"
	data.forms["2p_perf_actv_indc"] = perf_stem .. "istis"
	data.forms["3p_perf_actv_indc"] = {perf_stem .. "ērunt", perf_stem .. "ēre"}
	
	data.forms["1s_plup_actv_indc"] = perf_stem .. "eram"
	data.forms["2s_plup_actv_indc"] = perf_stem .. "erās"
	data.forms["3s_plup_actv_indc"] = perf_stem .. "erat"
	data.forms["1p_plup_actv_indc"] = perf_stem .. "erāmus"
	data.forms["2p_plup_actv_indc"] = perf_stem .. "erātis"
	data.forms["3p_plup_actv_indc"] = perf_stem .. "erant"
	
	data.forms["1s_futp_actv_indc"] = perf_stem .. "erō"
	data.forms["2s_futp_actv_indc"] = perf_stem .. "eris"
	data.forms["3s_futp_actv_indc"] = perf_stem .. "erit"
	data.forms["1p_futp_actv_indc"] = perf_stem .. "erimus"
	data.forms["2p_futp_actv_indc"] = perf_stem .. "eritis"
	data.forms["3p_futp_actv_indc"] = perf_stem .. "erint"
	
	-- Perfective subjunctive
	data.forms["1s_perf_actv_subj"] = perf_stem .. "erim"
	data.forms["2s_perf_actv_subj"] = perf_stem .. "erīs"
	data.forms["3s_perf_actv_subj"] = perf_stem .. "erit"
	data.forms["1p_perf_actv_subj"] = perf_stem .. "erīmus"
	data.forms["2p_perf_actv_subj"] = perf_stem .. "erītis"
	data.forms["3p_perf_actv_subj"] = perf_stem .. "erint"
	
	data.forms["1s_plup_actv_subj"] = perf_stem .. "issem"
	data.forms["2s_plup_actv_subj"] = perf_stem .. "issēs"
	data.forms["3s_plup_actv_subj"] = perf_stem .. "isset"
	data.forms["1p_plup_actv_subj"] = perf_stem .. "issēmus"
	data.forms["2p_plup_actv_subj"] = perf_stem .. "issētis"
	data.forms["3p_plup_actv_subj"] = perf_stem .. "issent"
	
	-- Perfect infinitive
	data.forms["perf_actv_inf"] = perf_stem .. "isse"
end

function make_supine(data, supine_stem)
	if not supine_stem then
		return
	end
	
	-- Perfect/future infinitives
	if reconstructed then
		data.forms["futr_actv_inf"] = "[[" .. NAMESPACE .. ":Latin/" .. supine_stem .. "ūrus|" .. supine_stem .. "ūrus]] [[esse]]"
		data.forms["perf_pasv_inf"] = "[[" .. NAMESPACE .. ":Latin/" .. supine_stem .. "us|" .. supine_stem .. "us]] [[esse]]"
		data.forms["futr_pasv_inf"] = "[[" .. NAMESPACE .. ":Latin/" .. supine_stem .. "um|" .. supine_stem .. "um]] [[īrī]]"
	else
		data.forms["futr_actv_inf"] = "[[" .. supine_stem .. "ūrus]] [[esse]]"
		data.forms["perf_pasv_inf"] = "[[" .. supine_stem .. "us]] [[esse]]"
		data.forms["futr_pasv_inf"] = "[[" .. supine_stem .. "um]] [[īrī]]"
	end
	
	-- Perfect/future participles
	data.forms["futr_actv_ptc"] = supine_stem .. "ūrus"
	data.forms["perf_pasv_ptc"] = supine_stem .. "us"
	
	-- Exceptions
	local mortu = {["conmortu"]=true,["commortu"]=true,["dēmortu"]=true,["ēmortu"]=true,["inmortu"]=true,["immortu"]=true,["inēmortu"]=true,["intermortu"]=true,["permortu"]=true,["praemortu"]=true,["superēmortu"]=true}
	local ort = {["ort"]=true,["abort"]=true,["adort"]=true,["coort"]=true,["exort"]=true,["hort"]=true,["obort"]=true}
	if mortu[supine_stem] then
		data.forms["futr_actv_inf"] = "[["..mw.ustring.gsub(supine_stem,"mortu$","moritūrus").."]] [[esse]]"
		data.forms["futr_actv_ptc"] = mw.ustring.gsub(supine_stem,"mortu$","moritūrus")
	elseif ort[supine_stem] then
		data.forms["futr_actv_inf"] = "[["..mw.ustring.gsub(supine_stem,"ort$","oritūrus").."]] [[esse]]"
		data.forms["futr_actv_ptc"] = mw.ustring.gsub(supine_stem,"ort$","oritūrus")
	elseif supine_stem == "mortu" then
		data.forms["futr_actv_inf"] = nil
		data.forms["futr_actv_ptc"] = "moritūrus"
	end
	
	-- Supine itself
	data.forms["sup_acc"] = supine_stem .. "um"
	data.forms["sup_abl"] = supine_stem .. "ū"
end

-- Functions for generating the inflection table

function show_form(form)
	if not form then
		return "&mdash;"
	end
	
	if type(form) == "table" then
		for key, subform in ipairs(form) do
			if subform == "-" or subform == "—" or subform == "&mdash;" then
				form[key] = "&mdash;"
			elseif reconstructed and not mw.ustring.find(subform, NAMESPACE .. ":Latin/")then
				form[key] = m_links.full_link({lang = lang, term = NAMESPACE .. ":Latin/" .. subform, alt = subform})
			else
				form[key] = m_links.full_link({lang = lang, term = subform})
			end
		end
		
		return table.concat(form, ", ")
	else
		if form == "-" or form == "—" or form == "&mdash;" then
			return "&mdash;"
		elseif reconstructed and not mw.ustring.find(form, NAMESPACE .. ":Latin/") then
			return m_links.full_link({lang = lang, term = NAMESPACE .. ":Latin/" .. form, alt = form})
		else
			return m_links.full_link({lang = lang, term = form})
		end
	end
end

-- Make the table
function make_table(data)
	pagename = mw.title.getCurrentTitle().text
	if reconstructed then
		pagename = mw.ustring.gsub(pagename,"Latin/","")
	end
	return [=[
{| style="width: 100%; background: #EEE; border: 1px solid #AAA; font-size: 95%; text-align: center;" class="inflection-table vsSwitcher vsToggleCategory-inflection"
|-
! colspan="8" class="vsToggleElement" style="background: #CCC; text-align: left;" | &nbsp;&nbsp;&nbsp;Conjugation of ]=] .. m_links.full_link({lang = lang, alt = pagename}, "term") .. (#data.title > 0 and " (" .. table.concat(data.title, ", ") .. ")" or "") .. [=[

]=] .. make_indc_rows(data) .. make_subj_rows(data) .. make_impr_rows(data) .. make_nonfin_rows(data) .. make_vn_rows(data) .. [=[ 

|}]=].. make_footnotes(data) 

end

local tenses = {
	["pres"] = "present",
	["impf"] = "imperfect",
	["futr"] = "future",
	["perf"] = "perfect",
	["plup"] = "pluperfect",
	["futp"] = "future&nbsp;perfect",
}

local voices = {
	["actv"] = "active",
	["pasv"] = "passive",
}

local moods = {
	["indc"] = "indicative",
	["subj"] = "subjunctive",
	["impr"] = "imperative",
}

local nonfins = {
	["inf"] = "infinitives",
	["ptc"] = "participles",
}

local verbalnouns = {
	["ger"] = "gerund",
	["sup"] = "supine",
}

local cases = {
	["nom"] = "nominative",
	["gen"] = "genitive",
	["dat"] = "dative",
	["acc"] = "accusative",
	["abl"] = "ablative",
}

function make_indc_rows(data)
	local indc = {}
	
	for _, v in ipairs({"actv", "pasv"}) do
		local group = {}
		local nonempty = false
		
		for _, t in ipairs({"pres", "impf", "futr", "perf", "plup", "futp"}) do
			local row = {}
			local notempty = false
			
			if data.forms[t .. "_" .. v .. "_indc"] then
				row = "\n! colspan=\"6\" style=\"background: #CCC\" |" .. data.forms[t .. "_" .. v .. "_indc"]
				nonempty = true
				notempty = true
			else
				for col, p in ipairs({"1s", "2s", "3s", "1p", "2p", "3p"}) do
					local form = p .. "_" .. t .. "_" .. v .. "_indc"
					row[col] = "\n| " .. show_form(data.forms[form])..(data.form_footnote_indices[form]==nil and "" or '<sup style="color: red">'..data.form_footnote_indices[form].."</sup>")
					
					if data.forms[p .. "_" .. t .. "_" .. v .. "_indc"] then
						nonempty = true
						notempty = true
					end
				end
				
				row = table.concat(row)
			end
			
			if notempty then
				table.insert(group, "\n! style=\"background:#c0cfe4\" | " .. tenses[t] .. row)
			end
		end
		
		if nonempty and #group > 0 then
			table.insert(indc, "\n|- class=\"vsHide\"\n! rowspan=\"" .. tostring(#group) .. "\" style=\"background:#c0cfe4\" | " .. voices[v] .. "\n" .. table.concat(group, "\n|- class=\"vsHide\""))
		end
	end
	
	return
[=[

|- class="vsHide"
! colspan="2" rowspan="2" style="background:#c0cfe4" | indicative
! colspan="3" style="background:#c0cfe4" | ''singular''
! colspan="3" style="background:#c0cfe4" | ''plural''
|- class="vsHide"
! style="background:#c0cfe4;width:12.5%" | [[first person|first]]
! style="background:#c0cfe4;width:12.5%" | [[second person|second]]
! style="background:#c0cfe4;width:12.5%" | [[third person|third]]
! style="background:#c0cfe4;width:12.5%" | [[first person|first]]
! style="background:#c0cfe4;width:12.5%" | [[second person|second]]
! style="background:#c0cfe4;width:12.5%" | [[third person|third]]
]=] .. table.concat(indc)

end

function make_subj_rows(data)
	local subj = {}
	
	for _, v in ipairs({"actv", "pasv"}) do
		local group = {}
		local nonempty = false
		
		for _, t in ipairs({"pres", "impf", "perf", "plup"}) do
			local row = {}
			local notempty = false
			
			if data.forms[t .. "_" .. v .. "_subj"] then
				row = "\n! colspan=\"6\" style=\"background: #CCC\" |" .. data.forms[t .. "_" .. v .. "_subj"]
				nonempty = true
				notempty = true
			else
				for col, p in ipairs({"1s", "2s", "3s", "1p", "2p", "3p"}) do
					local form = p .. "_" .. t .. "_" .. v .. "_subj"
					row[col] = "\n| " .. show_form(data.forms[form])..(data.form_footnote_indices[form]==nil and "" or '<sup style="color: red">'..data.form_footnote_indices[form].."</sup>")
					
					if data.forms[p .. "_" .. t .. "_" .. v .. "_subj"] then
						nonempty = true
						notempty = true
					end
				end
				
				row = table.concat(row)
			end
			
			if notempty then
				table.insert(group, "\n! style=\"background:#c0e4c0\" | " .. tenses[t] .. row)
			end
		end
		
		if nonempty and #group > 0 then
			table.insert(subj, "\n|- class=\"vsHide\"\n! rowspan=\"" .. tostring(#group) .. "\" style=\"background:#c0e4c0\" | " .. voices[v] .. "\n" .. table.concat(group, "\n|- class=\"vsHide\""))
		end
	end
	
	return
[=[

|- class="vsHide"
! colspan="2" rowspan="2" style="background:#c0e4c0" | subjunctive
! colspan="3" style="background:#c0e4c0" | ''singular''
! colspan="3" style="background:#c0e4c0" | ''plural''
|- class="vsHide"
! style="background:#c0e4c0;width:12.5%" | [[first person|first]]
! style="background:#c0e4c0;width:12.5%" | [[second person|second]]
! style="background:#c0e4c0;width:12.5%" | [[third person|third]]
! style="background:#c0e4c0;width:12.5%" | [[first person|first]]
! style="background:#c0e4c0;width:12.5%" | [[second person|second]]
! style="background:#c0e4c0;width:12.5%" | [[third person|third]]
]=] .. table.concat(subj)

end

function make_impr_rows(data)
	local impr = {}
	local has_impr = false

	for _, v in ipairs({"actv", "pasv"}) do
		local group = {}
		local nonempty = false
		
		for _, t in ipairs({"pres", "futr"}) do
			local row = {}
			
			if data.forms[t .. "_" .. v .. "_impr"] then
				row = "\n! colspan=\"6\" style=\"background: #CCC\" |" .. data.forms[t .. "_" .. v .. "_impr"]
				nonempty = true
			else
				for col, p in ipairs({"1s", "2s", "3s", "1p", "2p", "3p"}) do
					row[col] = "\n| " .. show_form(data.forms[p .. "_" .. t .. "_" .. v .. "_impr"])
					
					if data.forms[p .. "_" .. t .. "_" .. v .. "_impr"] then
						nonempty = true
					end
				end
				
				row = table.concat(row)
			end
			
			table.insert(group, "\n! style=\"background:#e4d4c0\" | " .. tenses[t] .. row)
		end
		
		if nonempty and #group > 0 then
			has_impr = true
			table.insert(impr, "\n|- class=\"vsHide\"\n! rowspan=\"" .. tostring(#group) .. "\" style=\"background:#e4d4c0\" | " .. voices[v] .. "\n" .. table.concat(group, "\n|- class=\"vsHide\""))
		end
	end

	if not has_impr then
		return ""
	end
	return
[=[

|- class="vsHide"
! colspan="2" rowspan="2" style="background:#e4d4c0" | imperative
! colspan="3" style="background:#e4d4c0" | ''singular''
! colspan="3" style="background:#e4d4c0" | ''plural''
|- class="vsHide"
! style="background:#e4d4c0;width:12.5%" | [[first person|first]]
! style="background:#e4d4c0;width:12.5%" | [[second person|second]]
! style="background:#e4d4c0;width:12.5%" | [[third person|third]]
! style="background:#e4d4c0;width:12.5%" | [[first person|first]]
! style="background:#e4d4c0;width:12.5%" | [[second person|second]]
! style="background:#e4d4c0;width:12.5%" | [[third person|third]]
]=] .. table.concat(impr)
end

function make_nonfin_rows(data)
	local nonfin = {}
	
	for _, f in ipairs({"inf", "ptc"}) do
		local row = {}
		
		for col, t in ipairs({"pres_actv", "perf_actv", "futr_actv", "pres_pasv", "perf_pasv", "futr_pasv"}) do
			--row[col] = "\n| " .. show_form(data.forms[t .. "_" .. f])
			local form = t .. "_" .. f
			row[col] = "\n| " .. show_form(data.forms[form])..(data.form_footnote_indices[form]==nil and "" or '<sup style="color: red">'..data.form_footnote_indices[form].."</sup>")
			
		end
		
		row = table.concat(row)
		table.insert(nonfin, "\n|- class=\"vsHide\"\n! style=\"background:#e2e4c0\" colspan=\"2\" | " .. nonfins[f] .. row)
	end
	
	return
[=[

|- class="vsHide"
! colspan="2" rowspan="2" style="background:#e2e4c0" | non-finite forms
! colspan="3" style="background:#e2e4c0" | active
! colspan="3" style="background:#e2e4c0" | passive
|- class="vsHide"
! style="background:#e2e4c0;width:12.5%" | present
! style="background:#e2e4c0;width:12.5%" | perfect
! style="background:#e2e4c0;width:12.5%" | future
! style="background:#e2e4c0;width:12.5%" | present
! style="background:#e2e4c0;width:12.5%" | perfect
! style="background:#e2e4c0;width:12.5%" | future
]=] .. table.concat(nonfin)

end

function make_vn_rows(data)
	local vn = {}
	local has_vn = false
	
	local row = {}
		
	for col, n in ipairs({"ger_nom", "ger_gen", "ger_dat", "ger_acc", "sup_acc", "sup_abl"}) do
		if data.forms[n] then
			has_vn = true
		end
		row[col] = "\n| " .. show_form(data.forms[n])..(data.form_footnote_indices[n]==nil and "" or '<sup style="color: red">'..data.form_footnote_indices[n].."</sup>")
	end	
		
	row = table.concat(row)
		
	if has_vn then
		table.insert(vn, "\n|- class=\"vsHide\"" .. row)
	end

	if not has_vn then
		return ""
	end
	return
[=[

|- class="vsHide"
! colspan="2" rowspan="3" style="background:#e0e0b0" | verbal nouns
! colspan="4" style="background:#e0e0b0" | gerund
! colspan="2" style="background:#e0e0b0" | supine
|- class="vsHide"
! style="background:#e0e0b0;width:12.5%" | nominative
! style="background:#e0e0b0;width:12.5%" | genitive
! style="background:#e0e0b0;width:12.5%" | dative/ablative
! style="background:#e0e0b0;width:12.5%" | accusative
! style="background:#e0e0b0;width:12.5%" | accusative
! style="background:#e0e0b0;width:12.5%" | ablative]=] .. table.concat(vn)

end

function make_footnotes(data)
	tbl = {}
	for k,v in pairs(data.footnotes) do
		tbl[#tbl+1] = '<sup style="color: red">'..tostring(k)..'</sup>'..v..'<br>' end
	return table.concat(tbl)
end

function override(data, args)
	for _, v in ipairs({"actv", "pasv"}) do
		for _, t in ipairs({"pres", "impf", "futr", "perf", "plup", "futp"}) do
			if args[t .. "_" .. v .. "_indc"] then
				data.forms[t .. "_" .. v .. "_indc"] = args[t .. "_" .. v .. "_indc"] and show_form(mw.text.split(args[t .. "_" .. v .. "_indc"],"/")) or data.forms[t .. "_" .. v .. "_indc"]
			else
				for _, p in ipairs({"1s", "2s", "3s", "1p", "2p", "3p"}) do
					data.forms[p .. "_" .. t .. "_" .. v .. "_indc"] = args[p .. "_" .. t .. "_" .. v .. "_indc"] and show_form(mw.text.split(args[p .. "_" .. t .. "_" .. v .. "_indc"],"/")) or data.forms[p .. "_" .. t .. "_" .. v .. "_indc"]
				end
			end
		end
		for _, t in ipairs({"pres", "impf", "perf", "plup"}) do
			if data.forms[t .. "_" .. v .. "_subj"] then
				data.forms[t .. "_" .. v .. "_subj"] = args[t .. "_" .. v .. "_subj"] and show_form(mw.text.split(args[t .. "_" .. v .. "_subj"],"/")) or data.forms[t .. "_" .. v .. "_subj"]
			else
				for _, p in ipairs({"1s", "2s", "3s", "1p", "2p", "3p"}) do
					data.forms[p .. "_" .. t .. "_" .. v .. "_subj"] = args[p .. "_" .. t .. "_" .. v .. "_subj"] and show_form(mw.text.split(args[p .. "_" .. t .. "_" .. v .. "_subj"],"/")) or data.forms[p .. "_" .. t .. "_" .. v .. "_subj"]
				end
			end
		end
		for _, t in ipairs({"pres", "futr"}) do
			if data.forms[t .. "_" .. v .. "_impr"] then
				data.forms[t .. "_" .. v .. "_impr"] = args[t .. "_" .. v .. "_impr"] and show_form(mw.text.split(args[t .. "_" .. v .. "_impr"],"/")) or data.forms[t .. "_" .. v .. "_impr"]
			else
				for _, p in ipairs({"1s", "2s", "3s", "1p", "2p", "3p"}) do
					data.forms[p .. "_" .. t .. "_" .. v .. "_impr"] = args[p .. "_" .. t .. "_" .. v .. "_impr"] and show_form(mw.text.split(args[p .. "_" .. t .. "_" .. v .. "_impr"],"/")) or data.forms[p .. "_" .. t .. "_" .. v .. "_impr"]
				end
			end
		end
	end
	for _, f in ipairs({"inf", "ptc"}) do
		for _, t in ipairs({"pres_actv", "perf_actv", "futr_actv", "pres_pasv", "perf_pasv", "futr_pasv"}) do
			data.forms[t .. "_" .. f] = args[t .. "_" .. f] and show_form(mw.text.split(args[t .. "_" .. f],"/")) or data.forms[t .. "_" .. f]
		end
	end
	for _, n in ipairs({"ger_nom", "ger_gen", "ger_dat", "ger_acc", "sup_acc", "sup_abl"}) do
		data.forms[n] = args[n] and show_form(mw.text.split(args[n],"/")) or data.forms[n]
	end	
end

function checkexist(data)
	if NAMESPACE ~= '' then return end
	local result = {}
	for verb_form,conjugation in pairs(data.forms) do
		if conjugation and type(conjugation) == 'string' and not mw.ustring.find(conjugation," ") then
			title = lang:makeEntryName(conjugation)
			local t = mw.title.new(title)
			if t and not t.exists then
				table.insert(data.categories,'Latin verbs with red links in their conjugation tables')
			end
		end
	end
end

function checkirregular(args,data)
	local apocopic = mw.ustring.sub(args[1],1,-2)
	apocopic = mw.ustring.gsub(apocopic,'[^aeiouyāēīōūȳ]+$','')
	if args[1] and args[2] and not mw.ustring.find(args[2],'^'..apocopic) then
		table.insert(data.categories,'Latin stem-changing verbs')
	end
end







-- functions for creating external search hyperlinks

function flatten_values(T)
	function noaccents(x)
		return mw.ustring.gsub(mw.ustring.toNFD(x),'[^%w]+',"")	
	end
	function cleanup(x) 
		return noaccents(string.gsub(string.gsub(string.gsub(x, '%[', ''), '%]', ''), ' ', '+'))
	end
		local tbl = {}
	for k,v in pairs(T) do
		if type(v) == "table" then 
			local FT = flatten_values(v)
			for K,V in pairs(FT) do
				tbl[#tbl+1] = cleanup(V)
			end
		else if not (type(v) == "table") then
			if string.find(v, '<') == nil then
				tbl[#tbl+1] = cleanup(v)
			end
		end end
	end
	return tbl
end

function link_google_books(verb, forms, domain)
	function partition_XS_into_N(XS, N) 
		local count = 0
		local mensae = {}
		for k,v in pairs(XS) do
			if count % N == 0 then mensae[#mensae+1] = {} end
			count = count + 1
			mensae[#mensae][#(mensae[#mensae])+1] = v end
		return mensae end
	function forms_N_to_link(fs, N, args, site)
		return '[https://www.google.com/search?'..args..'&q='..site..'+%22'.. table.concat(fs, "%22+OR+%22") ..'%22 '..N..']' end
	function make_links_txt(fs, N, site)
		local args = site == "Books" and "tbm=bks&lr=lang_la" or ""
		local links = {}
		for k,v in pairs(partition_XS_into_N(fs, N)) do
			links[#links+1] = forms_N_to_link(v,k,args,site=="Books" and "" or site) end
		return table.concat(links, ' - ') end
	return "Google "..domain.." forms of "..verb.." : "..make_links_txt(forms, 30, domain)
end

return export