Module:User:Atitarev/ru-verb/2

From Wiktionary, the free dictionary
Jump to navigation Jump to search

This is a private module sandbox of Atitarev, for his own experimentation. Items in this module may be added and removed at Atitarev's discretion; do not rely on this module's stability.


--[=[
	This module contains functions for creating inflection tables for Russian
	verbs.
]=]--

local m_utilities = require("Module:utilities")
local com = require("Module:ru-common")

local export = {}

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

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

-- The main entry point.
-- This is the only function that can be invoked from a template.
function export.show(frame)
	local conj_type = frame.args[1] or error("Conjugation type has not been specified. Please pass parameter 1 to the module invocation")
	local args = frame:getParent().args
	PAGENAME = mw.title.getCurrentTitle().text
	NAMESPACE = mw.title.getCurrentTitle().nsText

	-- Verb type, one of impf, pf, impf-intr, pf-intr, impf-refl, pf-refl.
	-- Default to impf on the template page so that there is no script error.
	local verb_type = args[1] or (NAMESPACE == "Template" and "impf") or error("Verb type (first parameter) has not been provided")
	-- verbs may have reflexive ending stressed in the masculine singular: занялся́, начался́, etc.
	local reflex_stress = args["reflex_stress"] -- "ся́"

	local forms, title, categories

	if conjugations[conj_type] then
		forms, title, categories = conjugations[conj_type](args)
	else
		error("Unknown conjugation type '" .. conj_type .. "'")
	end

	-- This form is not always present on verbs, so it needs to be specified explicitly.
	forms["past_pasv_part"] = args["past_pasv_part"] or ""

	--alternative forms
	forms["impr_sg2"] = forms["impr_sg2"] or args["impr_sg2"]
	forms["impr_pl2"] = forms["impr_pl2"] or args["impr_pl2"]
	forms["pres_actv_part2"] = forms["pres_actv_part2"] or args["pres_actv_part2"]
	forms["past_actv_part2"] = forms["past_actv_part2"] or args["past_actv_part2"]
	forms["pres_pasv_part2"] = forms["pres_pasv_part2"] or args["pres_pasv_part2"]
	forms["past_pasv_part2"] = forms["past_pasv_part2"] or args["past_pasv_part2"]
	forms["pres_adv_part2"] = forms["pres_adv_part2"] or args["pres_adv_part2"]
	forms["past_adv_part2"] = forms["past_adv_part2"] or args["past_adv_part2"]
	forms["past_adv_part_short2"] = forms["past_adv_part_short2"] or args["past_adv_part_short2"]
	forms["past_m2"] = forms["past_m2"] or args["past_m2"]
	forms["past_m3"] = forms["past_m3"] or args["past_m3"]
	forms["past_f2"] = forms["past_f2"] or args["past_f2"]
	forms["past_n2"] = forms["past_n2"] or args["past_n2"]
	forms["past_pl2"] = forms["past_pl2"] or args["past_pl2"]
	forms["pres_futr_1sg2"] = forms["pres_futr_1sg2"] or args["pres_futr_1sg2"]
	forms["pres_futr_2sg2"] = forms["pres_futr_2sg2"] or args["pres_futr_2sg2"]
	forms["pres_futr_3sg2"] = forms["pres_futr_3sg2"] or args["pres_futr_3sg2"]
	forms["pres_futr_1pl2"] = forms["pres_futr_1pl2"] or args["pres_futr_1pl2"]
	forms["pres_futr_2pl2"] = forms["pres_futr_2pl2"] or args["pres_futr_2pl2"]
	forms["pres_futr_3pl2"] = forms["pres_futr_3pl2"] or args["pres_futr_3pl2"]

	local intr = (verb_type == "impf-intr" or verb_type == "pf-intr" or verb_type == "pf-impers" or verb_type == "impf-impers" or verb_type == "pf-impers-refl" or verb_type == "impf-impers-refl")
	local refl = (verb_type == "impf-refl" or verb_type == "pf-refl" or verb_type == "pf-impers-refl" or verb_type == "impf-impers-refl")
	local perf = (verb_type == "pf" or verb_type == "pf-intr" or verb_type == "pf-refl" or verb_type == "pf-impers" or verb_type == "pf-impers-refl")
	--impersonal
	local impers = (verb_type == "pf-impers" or verb_type == "impf-impers" or verb_type == "pf-impers-refl" or verb_type == "impf-impers-refl")

	-- Perfective/imperfective
	if perf then
		table.insert(categories, "Russian perfective verbs")
	else
		table.insert(categories, "Russian imperfective verbs")
	end

	-- call alternative reflexive form to add a stressed "ся́" particle
	if reflex_stress then
		make_reflexive_alt(forms)
	end

	-- Reflexive/intransitive/transitive
	if refl then
		make_reflexive(forms)
		table.insert(categories, "Russian reflexive verbs")
	elseif intr then
		table.insert(categories, "Russian intransitive verbs")
	else
		table.insert(categories, "Russian transitive verbs")
	end

	-- Impersonal
	if impers then
		table.insert(categories, "Russian impersonal verbs")
	end

	return make_table(forms, title, perf, intr or refl, impers) .. m_utilities.format_categories(categories, lang)
end

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

conjugations["6a"] = function(args)
	local forms = {}
	local categories = {"Russian class 6 verbs"}
	local title = "class 6"

	local stem = args[2] or (NAMESPACE == "Template" and "-") or error("Second parameter has not been provided")
	local impr_end = args[3]; if impr_end == "" then impr_end = nil end
	-- irregular imperatives (сыпать  - сыпь is moved to a separate function but the parameter may still be needed)
	local impr_sg = args[4]; if impr_sg == "" then impr_sg = nil end
	-- optional full infinitive form for verbs like колебать
	local full_inf = args[5]; if full_inf == "" then full_inf = nil end
	-- no iotation, e.g. вырвать - вы́рву
	local no_iotation = nil
	if args["no_iotation"] == "1" then
		no_iotation = "1"
	end
	-- вызвать - вы́зову (в́ызов)
	local pres_stem = args["pres_stem"]; if pres_stem == "" or not pres_stem then pres_stem = stem end

	-- replace consonants for 1st person singular present/future
	local iotated_stem = com.iotation(pres_stem)

	if mw.ustring.find(iotated_stem, "[шщжч]$") then
		forms["pres_actv_part"] = iotated_stem .. "ущий"
	else
		forms["pres_actv_part"] = iotated_stem .. "ющий"
	end

	if mw.ustring.find(iotated_stem, "[шщжч]$") then
		forms["pres_adv_part"] = iotated_stem .. "а"
	else
		forms["pres_adv_part"] = iotated_stem .. "я"
	end

	if no_iotation then
		forms["pres_adv_part"] = pres_stem .. "я"
	end

	if mw.ustring.find(stem, "[аэыоуяеиёю́]$") then
		forms["infinitive"] = stem .. "ять"
		forms["past_actv_part"] = stem .. "явший"
		forms["past_adv_part"] = stem .. "явши"; forms["past_adv_part_short"] = stem .. "яв"
		forms["past_m"] = stem .. "ял"
		forms["past_f"] = stem .. "яла"
		forms["past_n"] = stem .. "яло"
		forms["past_pl"] = stem .. "яли"
	else
		forms["infinitive"] = stem .. "ать"
		forms["past_actv_part"] = stem .. "авший"
		forms["past_adv_part"] = stem .. "авши"; forms["past_adv_part_short"] = stem .. "ав"
		forms["past_m"] = stem .. "ал"
		forms["past_f"] = stem .. "ала"
		forms["past_n"] = stem .. "ало"
		forms["past_pl"] = stem .. "али"
	end

	-- if full infinitive is not passed, build from the stem, otherwise use the optional parameter
	if full_inf then
		forms["infinitive"] = full_inf
	end

	if no_iotation then
		forms["pres_pasv_part"] = stem .. "емый"
	else
		forms["pres_pasv_part"] = iotated_stem .. "емый"
	end

	present_je_a(forms, pres_stem, no_iotation)

	if not impr_end and mw.ustring.find(stem, "[аэыоуяеиёю́]$") and not impr_end then
		impr_end = "й"
	elseif not impr_end and not mw.ustring.find(stem, "[аэыоуяеиёю́]$") and not impr_end then
		impr_end = "и"
	end

	if no_iotation then
		forms["impr_sg"] = pres_stem .. impr_end
		forms["impr_pl"] = pres_stem .. impr_end .. "те"
	else
		forms["impr_sg"] = iotated_stem .. impr_end
		forms["impr_pl"] = iotated_stem .. impr_end .. "те"
	end

	-- irreg: сыпать  - сыпь, сыпьте
	if impr_sg then
		forms["impr_sg"] = impr_sg
		forms["impr_pl"] = impr_sg .. "те"
	end

	return forms, title, categories
end

conjugations["6b"] = function(args)
	local forms = {}
	local categories = {"Russian class 6 verbs"}
	local title = "class 6"

	local stem = args[2] or (NAMESPACE == "Template" and "-") or error("Second parameter has not been provided")
	-- звать - зов, драть - дер
	local pres_stem = args[3]; if pres_stem == "" or not pres_stem then pres_stem = stem end
	local past_f = args[4]; if past_f == "" then past_f = nil end
	local past_n2 = args["past_n2"]
	local past_pl2 = args["past_pl2"]

	forms["pres_pasv_part"] = ""

	present_e_b(forms, pres_stem)

	if not impr_end and mw.ustring.find(stem, "[аэыоуяеиёю́]$") and not impr_end then
		impr_end = "́й" -- accent on the preceding vowel
	elseif not impr_end and not mw.ustring.find(stem, "[аэыоуяеиёю́]$") and not impr_end then
		impr_end = "и́"
	end

	forms["impr_sg"] = pres_stem .. impr_end
	forms["impr_pl"] = pres_stem .. impr_end .. "те"

	if mw.ustring.find(pres_stem, "[шщжч]$") then
		forms["pres_adv_part"] = pres_stem .. "а́"
	else
		forms["pres_adv_part"] = pres_stem .. "я́"
	end

	if mw.ustring.find(pres_stem, "[аэыоуяеиёю́]$") then
		forms["pres_actv_part"] = pres_stem .. "ю́щий"
	else
		forms["pres_actv_part"] = pres_stem .. "у́щий"
	end

	if mw.ustring.find(stem, "[аэыоуяеиёю́]$") then
		forms["infinitive"] = stem .. "я́ть"
		forms["past_actv_part"] = stem .. "я́вший"
		forms["past_adv_part"] = stem .. "я́вши"; forms["past_adv_part_short"] = stem .. "́яв"
		forms["past_m"] = stem .. "я́л"
		forms["past_f"] = stem .. "я́ла"
		forms["past_n"] = stem .. "я́ло"
		forms["past_pl"] = stem .. "я́ли"
	else
		forms["infinitive"] = stem .. "а́ть"
		forms["past_actv_part"] = stem .. "а́вший"
		forms["past_adv_part"] = stem .. "а́вши"; forms["past_adv_part_short"] = stem .. "а́в"
		forms["past_m"] = stem .. "а́л"
		forms["past_f"] = stem .. "а́ла"
		forms["past_n"] = stem .. "а́ло"
		forms["past_pl"] = stem .. "а́ли"
	end

	-- ждала́, подождала́
	if past_f then
		forms["past_f"] = past_f
	end
	--разобрало́сь (разобрало́)
	forms["past_n2"] = past_n2
	--разобрали́сь (разобрали́)
	forms["past_pl2"] = past_pl2

	return forms, title, categories
end

conjugations["6c"] = function(args)
	local forms = {}
	local categories = {"Russian class 6 verbs"}
	local title = "class 6"

	local stem = args[2] or (NAMESPACE == "Template" and "-") or error("Second parameter has not been provided")
	-- no iotation, e.g. стонать - стону́
	local no_iotation = nil
	if args["no_iotation"] == "1" then
		no_iotation = "1"
	end
	-- remove accent for some forms
	local stem_noa = com.make_unstressed(stem)
	-- iotate the stem
	local iotated_stem = com.iotation(stem)
	-- iotate the 2nd stem
	local iotated_stem_noa = com.iotation(stem_noa)

	forms["infinitive"] = stem_noa .. "а́ть"

	forms["past_actv_part"] = stem_noa .. "а́вший"
	forms["pres_pasv_part"] = ""
	forms["past_adv_part"] = stem_noa .. "а́вши"; forms["past_adv_part_short"] = stem_noa .. "а́в"

	-- Verbs ending in a hushing consonant do not get j-vowels in the endings.
	if mw.ustring.find(iotated_stem, "[шщжч]$") then
		forms["pres_actv_part"] = iotated_stem ..  "ущий"
	else
		forms["pres_actv_part"] = iotated_stem ..  "ющий"
	end

	-- Verbs ending in a hushing consonant do not get j-vowels in the endings.
	if mw.ustring.find(iotated_stem_noa, "[шщжч]$") then
		forms["pres_adv_part"] = iotated_stem_noa ..  "а́"
	else
		forms["pres_adv_part"] = iotated_stem_noa ..  "я́"
	end
	
	present_je_c(forms, pres_stem, no_iotation)

	forms["impr_sg"] = iotated_stem_noa .. "и́"
	forms["impr_pl"] = iotated_stem_noa .. "и́те"

	forms["past_m"] = stem_noa .. "а́л"
	forms["past_f"] = stem_noa .. "а́ла"
	forms["past_n"] = stem_noa .. "а́ло"
	forms["past_pl"] = stem_noa .. "а́ли"

	return forms, title, categories
end

--[=[
	Partial conjugation functions
]=]--

-- Present forms with -e-, no j-vowels.
function present_e_a(forms, stem)

	forms["pres_futr_1sg"] = stem .. "у"
	forms["pres_futr_2sg"] = stem .. "ешь"
	forms["pres_futr_3sg"] = stem .. "ет"
	forms["pres_futr_1pl"] = stem .. "ем"
	forms["pres_futr_2pl"] = stem .. "ете"
	forms["pres_futr_3pl"] = stem .. "ут"
end

function present_e_b(forms, stem)

	if mw.ustring.find(stem, "[аэыоуяеиёю́]$") then
		forms["pres_futr_1sg"] = stem .. "ю́"
		forms["pres_futr_3pl"] = stem .. "ю́т"
	else
		forms["pres_futr_1sg"] = stem .. "у́"
		forms["pres_futr_3pl"] = stem .. "у́т"
	end

	forms["pres_futr_2sg"] = stem .. "ёшь"
	forms["pres_futr_3sg"] = stem .. "ёт"
	forms["pres_futr_1pl"] = stem .. "ём"
	forms["pres_futr_2pl"] = stem .. "ёте"
end

function present_e_c(forms, stem)
	local stem_noa = com.make_unstressed(stem)

	forms["pres_futr_1sg"] = stem_noa .. "у́"
	forms["pres_futr_2sg"] = stem .. "ешь"
	forms["pres_futr_3sg"] = stem .. "ет"
	forms["pres_futr_1pl"] = stem .. "ем"
	forms["pres_futr_2pl"] = stem .. "ете"
	forms["pres_futr_3pl"] = stem .. "ут"
end

-- Present forms with -e-, with j-vowels.
function present_je_a(forms, stem, no_iotation)
	local iotated_stem = com.iotation(stem, shch)

	-- Verbs ending in a hushing consonant do not get j-vowels in the endings.
	if mw.ustring.find(iotated_stem, "[шщжч]$") then
		forms["pres_futr_1sg"] = iotated_stem .. "у"
	else
		forms["pres_futr_1sg"] = iotated_stem .. "ю"
	end

	if mw.ustring.find(iotated_stem, "[шщжч]$") then
		forms["pres_futr_3pl"] = iotated_stem .. "ут"
	else
		forms["pres_futr_3pl"] = iotated_stem .. "ют"
	end

	forms["pres_futr_2sg"] = iotated_stem .. "ешь"
	forms["pres_futr_3sg"] = iotated_stem .. "ет"
	forms["pres_futr_1pl"] = iotated_stem .. "ем"
	forms["pres_futr_2pl"] = iotated_stem .. "ете"

	if no_iotation then
		forms["pres_futr_1sg"] = stem .. "у"
		forms["pres_futr_3pl"] = stem .. "ут"
		forms["pres_futr_2sg"] = stem .. "ешь"
		forms["pres_futr_3sg"] = stem .. "ет"
		forms["pres_futr_1pl"] = stem .. "ем"
		forms["pres_futr_2pl"] = stem .. "ете"
	end
end

function present_je_b(forms, stem)

	forms["pres_futr_1sg"] = stem .. "ю́"
	forms["pres_futr_2sg"] = stem .. "ёшь"
	forms["pres_futr_3sg"] = stem .. "ёт"
	forms["pres_futr_1pl"] = stem .. "ём"
	forms["pres_futr_2pl"] = stem .. "ёте"
	forms["pres_futr_3pl"] = stem .. "ю́т"
end

function present_je_c(forms, stem, no_iotation)
	local stem_noa = com.make_unstressed(stem)
	-- iotate the stem
	local iotated_stem = com.iotation(stem)
	-- iotate the 2nd stem
	local iotated_stem_noa = com.iotation(stem_noa)

	-- Verbs ending in a hushing consonant do not get j-vowels in the endings.
	if mw.ustring.find(iotated_stem_noa, "[шщжч]$") then
		forms["pres_futr_1sg"] = iotated_stem_noa .. "у́"
	else
		forms["pres_futr_1sg"] = iotated_stem_noa .. "ю́"
	end

	-- Verbs ending in a hushing consonant do not get j-vowels in the endings.
	if mw.ustring.find(iotated_stem, "[шщжч]$") then
		forms["pres_futr_3pl"] = iotated_stem .. "ут"
	else
		forms["pres_futr_3pl"] = iotated_stem .. "ют"
	end

	forms["pres_futr_2sg"] = iotated_stem .. "ешь"
	forms["pres_futr_3sg"] = iotated_stem .. "ет"
	forms["pres_futr_1pl"] = iotated_stem .. "ем"
	forms["pres_futr_2pl"] = iotated_stem .. "ете"

	-- pres_futr_1sg and pres_futr_3pl are uniotated
	if no_iotation then
		forms["pres_futr_1sg"] = stem_noa .. "у́"
		forms["pres_futr_2sg"] = stem .. "ешь"
		forms["pres_futr_3sg"] = stem .. "ет"
		forms["pres_futr_1pl"] = stem .. "ем"
		forms["pres_futr_2pl"] = stem .. "ете"
		forms["pres_futr_3pl"] = stem .. "ут"
	end

end

-- Present forms with -i-.
function present_i_a(forms, stem, shch)
	-- shch - iotatate final т as щ, not ч
	-- iotate the stem
	local iotated_stem = com.iotation(stem, shch)

	-- Verbs ending in a hushing consonant do not get j-vowels in the endings.
	if mw.ustring.find(iotated_stem, "[шщжч]$") then
		forms["pres_futr_1sg"] = iotated_stem .. "у"
	else
		forms["pres_futr_1sg"] = iotated_stem .. "ю"
	end

	if mw.ustring.find(stem, "[шщжч]$") then
		forms["pres_futr_3pl"] = stem .. "ат"
	else
		forms["pres_futr_3pl"] = stem .. "ят"
	end

	forms["pres_futr_2sg"] = stem .. "ишь"
	forms["pres_futr_3sg"] = stem .. "ит"
	forms["pres_futr_1pl"] = stem .. "им"
	forms["pres_futr_2pl"] = stem .. "ите"
end

function present_i_b(forms, stem, no_1sg_futr, shch)
	-- parameter no_1sg_futr - no 1st person singular future if no_1sg_futr = 1
	if not no_1sg_futr then
		no_1sg_futr = 0
	end

	-- parameter shch - iotatate final т as щ, not ч
	if not shch then
		shch = ""
	end

	-- iotate the stem
	local iotated_stem = com.iotation(stem, shch)

	-- Make 1st person future singular blank if no_1sg_futr = 1
	if no_1sg_futr == 1 then
		forms["pres_futr_1sg"] = ""
	-- Verbs ending in a hushing consonant do not get j-vowels in the endings.
	elseif mw.ustring.find(iotated_stem, "[шщжч]$") then
		forms["pres_futr_1sg"] = iotated_stem .. "у́"
	else
		forms["pres_futr_1sg"] = iotated_stem .. "ю́"
	end

	if mw.ustring.find(stem, "[шщжч]$") then
		forms["pres_futr_3pl"] = stem .. "а́т"
	else
		forms["pres_futr_3pl"] = stem .. "я́т"
	end

	forms["pres_futr_2sg"] = stem .. "и́шь"
	forms["pres_futr_3sg"] = stem .. "и́т"
	forms["pres_futr_1pl"] = stem .. "и́м"
	forms["pres_futr_2pl"] = stem .. "и́те"

end

function present_i_c(forms, stem, shch)
	-- shch - iotatate final т as щ, not ч

	local stem_noa = com.make_unstressed(stem)
	-- iotate the stem
	local iotated_stem = com.iotation(stem_noa, shch)

	-- Verbs ending in a hushing consonant do not get j-vowels in the endings.
	if mw.ustring.find(iotated_stem, "[шщжч]$") then
		forms["pres_futr_1sg"] = iotated_stem .. "у́"
	else
		forms["pres_futr_1sg"] = iotated_stem .. "ю́"
	end

	if mw.ustring.find(stem, "[шщжч]$") then
		forms["pres_futr_3pl"] = stem .. "ат"
	else
		forms["pres_futr_3pl"] = stem .. "ят"
	end

	if mw.ustring.find(stem, "[шщжч]$") then
		forms["pres_futr_3pl"] = stem .. "ат"
	else
		forms["pres_futr_3pl"] = stem .. "ят"
	end

	forms["pres_futr_2sg"] = stem .. "ишь"
	forms["pres_futr_3sg"] = stem .. "ит"
	forms["pres_futr_1pl"] = stem .. "им"
	forms["pres_futr_2pl"] = stem .. "ите"
end

-- add alternative form stressed on the reflexive particle
function make_reflexive_alt(forms)

	for key, form in pairs(forms) do
		if form ~= "" then
			-- if a form doesn't contain a stress, add a stressed particle "ся́"
			if not mw.ustring.find(form, "[́]") then
				-- only applies to past masculine forms
				if key == "past_m" or key == "past_m2" or key == "past_m3" then
					forms[key] = form .. "ся́"
				end
			end
		end
	end
end

-- Add the reflexive particle to all verb forms
function make_reflexive(forms)
	for key, form in pairs(forms) do
		-- The particle is "сь" after a vowel, "ся" after a consonant
		-- append "ся" if "ся́" was not attached already
		if form ~= "" and not mw.ustring.find(form, "ся́$") then
			if mw.ustring.find(form, "[аэыоуяеиёю́]$") then
				forms[key] = form .. "сь"
			else
				forms[key] = form .. "ся"
			end
		end
	end

	-- This form does not exist for reflexive verbs.
	forms["past_adv_part_short"] = ""
end

-- Make the table
function make_table(forms, title, perf, intr, impers)
	local title = "Conjugation of <span lang=\"ru\" class=\"Cyrl\">''" .. forms["infinitive"] .. "''</span>" .. (title and " (" .. title .. ")" or "")

	-- Intransitive verbs have no passive participles.
	if intr then
		forms["pres_pasv_part"] = ""
		forms["pres_pasv_part2"] = nil
		forms["past_pasv_part"] = ""
		forms["past_pasv_part2"] = nil
	end

	if impers then
		forms["pres_futr_1sg"] = ""
		forms["pres_futr_2sg"] = ""
		forms["pres_futr_1pl"] = ""
		forms["pres_futr_2pl"] = ""
		forms["pres_futr_3pl"] = ""
		forms["past_m"] = ""
		forms["past_f"] = ""
		forms["past_pl"] = ""
		forms["pres_actv_part"] = ""
		forms["past_actv_part"] = ""
		forms["pres_adv_part"] = ""
		forms["past_adv_part"] = ""
		forms["past_adv_part_short"] = ""
		forms["impr_sg"] = ""
		forms["impr_pl"] = ""
		--alternatives
		forms["pres_futr_1sg2"] = nil
		forms["pres_futr_2sg2"] = nil
		forms["pres_futr_1pl2"] = nil
		forms["pres_futr_2pl2"] = nil
		forms["pres_futr_3pl2"] = nil
		forms["past_m2"] = nil
		forms["past_m3"] = nil
		forms["past_f2"] = nil
		forms["past_pl2"] = nil
		forms["pres_actv_part2"] = nil
		forms["past_actv_part2"] = nil
		forms["pres_adv_part2"] = nil
		forms["past_adv_part2"] = nil
		forms["past_adv_part_short2"] = nil
		forms["impr_sg2"] = nil
		forms["impr_pl2"] = nil
	end

	-- Perfective verbs have no present forms.
	if perf then
		forms["pres_actv_part"] = ""
		forms["pres_pasv_part"] = ""
		forms["pres_adv_part"] = ""
		forms["pres_1sg"] = ""
		forms["pres_2sg"] = ""
		forms["pres_3sg"] = ""
		forms["pres_1pl"] = ""
		forms["pres_2pl"] = ""
		forms["pres_3pl"] = ""
		--alternatives
		forms["pres_actv_part2"] = nil
		forms["pres_pasv_part2"] = nil
		forms["pres_adv_part2"] = nil
		forms["pres_1sg2"] = nil
		forms["pres_2sg2"] = nil
		forms["pres_3sg2"] = nil
		forms["pres_1pl2"] = nil
		forms["pres_2pl2"] = nil
		forms["pres_3pl2"] = nil

		forms["futr_1sg"] = forms["pres_futr_1sg"]
		forms["futr_2sg"] = forms["pres_futr_2sg"]
		forms["futr_3sg"] = forms["pres_futr_3sg"]
		forms["futr_1pl"] = forms["pres_futr_1pl"]
		forms["futr_2pl"] = forms["pres_futr_2pl"]
		forms["futr_3pl"] = forms["pres_futr_3pl"]
		-- alternatives
		forms["futr_1sg2"] = forms["pres_futr_1sg2"]
		forms["futr_2sg2"] = forms["pres_futr_2sg2"]
		forms["futr_3sg2"] = forms["pres_futr_3sg2"]
		forms["futr_1pl2"] = forms["pres_futr_1pl2"]
		forms["futr_2pl2"] = forms["pres_futr_2pl2"]
		forms["futr_3pl2"] = forms["pres_futr_3pl2"]
	else
		forms["pres_1sg"] = forms["pres_futr_1sg"]
		forms["pres_2sg"] = forms["pres_futr_2sg"]
		forms["pres_3sg"] = forms["pres_futr_3sg"]
		forms["pres_1pl"] = forms["pres_futr_1pl"]
		forms["pres_2pl"] = forms["pres_futr_2pl"]
		forms["pres_3pl"] = forms["pres_futr_3pl"]
		forms["pres_2sg"] = forms["pres_futr_2sg"]
		-- alternatives
		forms["pres_1sg2"] = forms["pres_futr_1sg2"]
		forms["pres_2sg2"] = forms["pres_futr_2sg2"]
		forms["pres_3sg2"] = forms["pres_futr_3sg2"]
		forms["pres_1pl2"] = forms["pres_futr_1pl2"]
		forms["pres_2pl2"] = forms["pres_futr_2pl2"]
		forms["pres_3pl2"] = forms["pres_futr_3pl2"]
	end

	local inf = forms["infinitive"]
	local inf_tr = lang:transliterate(forms["infinitive"])

	-- Add transliterations to all forms
	for key, form in pairs(forms) do
		-- check for empty strings and nil's
		if form ~= "" and form then
			forms[key] = "<span lang=\"ru\" class=\"Cyrl\">[[" .. com.remove_accents(form) .. "#Russian|" .. form .. "]]</span><br/><span style=\"color: #888\">" .. lang:transliterate(form) .. "</span>"
		else
			forms[key] = "&mdash;"
		end
	end

	if not perf then
		forms["futr_1sg"] = "<span lang=\"ru\" class=\"Cyrl\">[[буду#Russian|бу́ду]] " .. inf .. "</span><br/><span style=\"color: #888\">búdu " .. inf_tr .. "</span>"
		forms["futr_2sg"] = "<span lang=\"ru\" class=\"Cyrl\">[[будешь#Russian|бу́дешь]] " .. inf .. "</span><br/><span style=\"color: #888\">búdešʹ " .. inf_tr .. "</span>"
		forms["futr_3sg"] = "<span lang=\"ru\" class=\"Cyrl\">[[будет#Russian|бу́дет]] " .. inf .. "</span><br/><span style=\"color: #888\">búdet " .. inf_tr .. "</span>"
		forms["futr_1pl"] = "<span lang=\"ru\" class=\"Cyrl\">[[будем#Russian|бу́дем]] " .. inf .. "</span><br/><span style=\"color: #888\">búdem " .. inf_tr .. "</span>"
		forms["futr_2pl"] = "<span lang=\"ru\" class=\"Cyrl\">[[будете#Russian|бу́дете]] " .. inf .. "</span><br/><span style=\"color: #888\">búdete " .. inf_tr .. "</span>"
		forms["futr_3pl"] = "<span lang=\"ru\" class=\"Cyrl\">[[будут#Russian|бу́дут]] " .. inf .. "</span><br/><span style=\"color: #888\">búdut " .. inf_tr .. "</span>"
	end

	-- only for "бы́ть" the future forms are бу́ду, бу́дешь, etc.
	if inf == "бы́ть" then
		forms["futr_1sg"] = "<span lang=\"ru\" class=\"Cyrl\">[[буду#Russian|бу́ду]] " .. "</span><br/><span style=\"color: #888\">búdu " .. "</span>"
		forms["futr_2sg"] = "<span lang=\"ru\" class=\"Cyrl\">[[будешь#Russian|бу́дешь]] " .. "</span><br/><span style=\"color: #888\">búdešʹ " .. "</span>"
		forms["futr_3sg"] = "<span lang=\"ru\" class=\"Cyrl\">[[будет#Russian|бу́дет]] "  .. "</span><br/><span style=\"color: #888\">búdet " .. "</span>"
		forms["futr_1pl"] = "<span lang=\"ru\" class=\"Cyrl\">[[будем#Russian|бу́дем]] "  .. "</span><br/><span style=\"color: #888\">búdem "  .. "</span>"
		forms["futr_2pl"] = "<span lang=\"ru\" class=\"Cyrl\">[[будете#Russian|бу́дете]] "  .. "</span><br/><span style=\"color: #888\">búdete "  .. "</span>"
		forms["futr_3pl"] = "<span lang=\"ru\" class=\"Cyrl\">[[будут#Russian|бу́дут]] "  .. "</span><br/><span style=\"color: #888\">búdut "  .. "</span>"
	end

	if impers then
		forms["futr_1sg"] = ""
		forms["futr_2sg"] = ""
		forms["futr_1pl"] = ""
		forms["futr_2pl"] = ""
		forms["futr_3pl"] = ""
		--alternatives
		forms["futr_1sg2"] = nil
		forms["futr_2sg2"] = nil
		forms["futr_1pl2"] = nil
		forms["futr_2pl2"] = nil
		forms["futr_3pl2"] = nil
	end

	if forms["past_adv_part_short"] ~= "&mdash;" then
		forms["past_adv_part"] = forms["past_adv_part_short"] .. ",<br/>" .. forms["past_adv_part"]
	end
	-- alternative forms
	local alt_impr_sg = forms["impr_sg"]
	if forms["impr_sg2"] then alt_impr_sg = forms["impr_sg"] .. ",<br/>" .. forms["impr_sg2"] end
	local alt_impr_pl = forms["impr_pl"]
	if forms["impr_pl2"] then alt_impr_pl = forms["impr_pl"] .. ",<br/>" .. forms["impr_pl2"] end
	-- со́здал/созд́ал, п́ередал/переда́л, ́отдал/отд́ал
	local alt_past_m = forms["past_m"]
	if forms["past_m2"] then alt_past_m = forms["past_m"] .. ",<br/>" .. forms["past_m2"] end
	--for verbs with three past masculine sg forms: за́нялся, заня́лся, занялс́я (заня́ться)
	if forms["past_m3"] then alt_past_m = alt_past_m .. ",<br/>" .. forms["past_m3"] end
	-- short forms in 3a (исчез, сох, etc.)
	if forms["past_m_short"] then alt_past_m = forms["past_m_short"] .. ",<br/>" .. alt_past_m end
	local alt_past_f = forms["past_f"]
	if forms["past_f2"] then alt_past_f = forms["past_f"] .. ",<br/>" .. forms["past_f2"] end
	-- short forms in 3a (исчезла, сохла, etc.)
	if forms["past_f_short"] then alt_past_f = forms["past_f_short"] .. ",<br/>" .. alt_past_f end
	-- да́ло, дал́о; вз́яло, взяло́
	local alt_past_n = forms["past_n"]
	if forms["past_n2"] then alt_past_n = forms["past_n"] .. ",<br/>" .. forms["past_n2"] end
	-- short forms in 3a (исчезло, сохло, etc.)
	if forms["past_n_short"] then alt_past_n = forms["past_n_short"] .. ",<br/>" .. alt_past_n end
	-- разобрали́сь (разобрали́)
	local alt_past_pl = forms["past_pl"]
	if forms["past_pl2"] then alt_past_pl = forms["past_pl"] .. ",<br/>" .. forms["past_pl2"] end
	-- short forms in 3a (исчезли, сохли, etc.)
	if forms["past_pl_short"] then alt_past_pl = forms["past_pl_short"] .. ",<br/>" .. alt_past_pl end
	--
	-- тереть: тере́вши, тёрши, short: тере́в
	-- умереть: умере́вши, у́мерши, short: умере́в
	local alt_past_adv_part = forms["past_adv_part"]
	if forms["past_adv_part2"] then alt_past_adv_part = forms["past_adv_part"] .. ",<br/>" .. forms["past_adv_part2"] end
	-- сыпля, сыпя
	local alt_pres_adv_part = forms["pres_adv_part"]
	if forms["pres_adv_part2"] and not perf then alt_pres_adv_part = forms["pres_adv_part"] .. ",<br/>" .. forms["pres_adv_part2"] end

	local alt_pres_1sg = forms["pres_1sg"]
	if forms["pres_1sg2"] and not perf then alt_pres_1sg = forms["pres_1sg"] .. ",<br/>" .. forms["pres_1sg2"] end
	-- сыплешь, сыпешь
	local alt_pres_2sg = forms["pres_2sg"]
	if forms["pres_2sg2"] and not perf then alt_pres_2sg = forms["pres_2sg"] .. ",<br/>" .. forms["pres_2sg2"] end
	-- сыплет, сыпет
	local alt_pres_3sg = forms["pres_3sg"]
	if forms["pres_3sg2"] and not perf then alt_pres_3sg = forms["pres_3sg"] .. ",<br/>" .. forms["pres_3sg2"] end
	-- сыплем, сыпем
	local alt_pres_1pl = forms["pres_1pl"]
	if forms["pres_1pl2"] and not perf then alt_pres_1pl = forms["pres_1pl"] .. ",<br/>" .. forms["pres_1pl2"] end
	-- сыплете, сыпете
	local alt_pres_2pl = forms["pres_2pl"]
	if forms["pres_2pl2"] and not perf then alt_pres_2pl = forms["pres_2pl"] .. ",<br/>" .. forms["pres_2pl2"] end
	-- сыплют, сыпют
	local alt_pres_3pl = forms["pres_3pl"]
	if forms["pres_3pl2"] and not perf then alt_pres_3pl = forms["pres_3pl"] .. ",<br/>" .. forms["pres_3pl2"] end
	local alt_futr_1sg = forms["futr_1sg"]
	if forms["futr_1sg2"] then alt_futr_1sg = forms["futr_1sg"] .. ",<br/>" .. forms["futr_1sg2"] end
	-- насыплешь, насыпешь
	local alt_futr_2sg = forms["futr_2sg"]
	if forms["futr_2sg2"] then alt_futr_2sg = forms["futr_2sg"] .. ",<br/>" .. forms["futr_2sg2"] end
	-- насыплет, насыпет
	local alt_futr_3sg = forms["futr_3sg"]
	if forms["futr_3sg2"] then alt_futr_3sg = forms["futr_3sg"] .. ",<br/>" .. forms["futr_3sg2"] end
	-- насыплем, насыпем
	local alt_futr_1pl = forms["futr_1pl"]
	if forms["futr_1pl2"] then alt_futr_1pl = forms["futr_1pl"] .. ",<br/>" .. forms["futr_1pl2"] end
	-- насыплете, насыпете
	local alt_futr_2pl = forms["futr_2pl"]
	if forms["futr_2pl2"] then alt_futr_2pl = forms["futr_2pl"] .. ",<br/>" .. forms["futr_2pl2"] end
	-- насыплют, насыпют
	local alt_futr_3pl = forms["futr_3pl"]
	if forms["futr_3pl2"] then alt_futr_3pl = forms["futr_3pl"] .. ",<br/>" .. forms["futr_3pl2"] end

	local alt_pres_actv_part = forms["pres_actv_part"]
	if forms["pres_actv_part2"] then alt_pres_actv_part = forms["pres_actv_part"] .. ",<br/>" .. forms["pres_actv_part2"] end

	local alt_past_actv_part = forms["past_actv_part"]
	if forms["past_actv_part2"] then alt_past_actv_part = forms["past_actv_part"] .. ",<br/>" .. forms["past_actv_part2"] end

	local alt_pres_pasv_part = forms["pres_pasv_part"]
	if forms["pres_pasv_part2"] then alt_pres_pasv_part = forms["pres_pasv_part"] .. ",<br/>" .. forms["pres_pasv_part2"] end

	local alt_past_pasv_part = forms["past_pasv_part"]
	if forms["past_pasv_part2"] then alt_past_pasv_part = forms["past_pasv_part"] .. ",<br/>" .. forms["past_pasv_part2"] end

	return [=[<div class="NavFrame" style="width:49.6em;">
<div class="NavHead" style="text-align:left; background:#e0e0ff;">]=] .. title .. [=[</div>
<div class="NavContent">
{| class="inflection inflection-ru inflection-verb inflection-table"
|+ Note 1: for declension of participles, see their entries. Adverbial participles are indeclinable.
|- class="rowgroup"
! colspan="3" | ]=] .. (perf and [=[[[совершенный вид|perfective aspect]]]=] or [=[[[несовершенный вид|imperfective aspect]]]=]) .. [=[

|-
! [[неопределённая форма|infinitive]]
| colspan="2" | ]=] .. forms["infinitive"] .. [=[

|- class="rowgroup"
! style="width:15em" | [[причастие|participles]]
! [[настоящее время|present tense]]
! [[прошедшее время|past tense]]
|-
! [[действительный залог|active]]
| ]=] .. alt_pres_actv_part .. [=[ || ]=] .. alt_past_actv_part .. [=[

|-
! [[страдательный залог|passive]]
| ]=] .. alt_pres_pasv_part .. [=[ || ]=] .. alt_past_pasv_part .. [=[

|-
! [[деепричастие|adverbial]]
| ]=] .. alt_pres_adv_part .. [=[ || ]=] .. alt_past_adv_part .. [=[

|- class="rowgroup"
!
! [[настоящее время|present tense]]
! [[будущее время|future tense]]
|-
! [[первое лицо|1st]] [[единственное число|singular]] (<span lang="ru" class="Cyrl">я</span>)
| ]=] .. alt_pres_1sg .. [=[ || ]=] .. alt_futr_1sg .. [=[

|-
! [[второе лицо|2nd]] [[единственное число|singular]] (<span lang="ru" class="Cyrl">ты</span>)
| ]=] .. alt_pres_2sg .. [=[ || ]=] .. alt_futr_2sg .. [=[

|-
! [[третье лицо|3rd]] [[единственное число|singular]] (<span lang="ru" class="Cyrl">он/она́/оно́</span>)
| ]=] .. alt_pres_3sg .. [=[ || ]=] .. alt_futr_3sg .. [=[

|-
! [[первое лицо|1st]] [[множественное число|plural]] (<span lang="ru" class="Cyrl">мы</span>)
| ]=] .. alt_pres_1pl .. [=[ || ]=] .. alt_futr_1pl .. [=[

|-
! [[второе лицо|2nd]] [[множественное число|plural]] (<span lang="ru" class="Cyrl">вы</span>)
| ]=] .. alt_pres_2pl .. [=[ || ]=] .. alt_futr_2pl .. [=[

|-
! [[третье лицо|3rd]] [[множественное число|plural]] (<span lang="ru" class="Cyrl">они́</span>)
| ]=] .. alt_pres_3pl .. [=[ || ]=] .. alt_futr_3pl .. [=[

|- class="rowgroup"
! [[повелительное наклонение|imperative]]
! [[единственное число|singular]]
! [[множественное число|plural]]
|-
!
| ]=] .. alt_impr_sg .. [=[ || ]=] .. alt_impr_pl .. [=[

|- class="rowgroup"
! [[прошедшее время|past tense]]
! [[единственное число|singular]]
! [[множественное число|plural]]<br/>(<span lang="ru" class="Cyrl">мы/вы/они́</span>)
|-
! [[мужской род|masculine]] (<span lang="ru" class="Cyrl">я/ты/он</span>)
| ]=] .. alt_past_m .. [=[ || rowspan="3" | ]=] .. alt_past_pl .. [=[

|-
! [[женский род|feminine]] (<span lang="ru" class="Cyrl">я/ты/она́</span>)
| ]=] .. alt_past_f .. [=[

|-
! style="background-color:#ffffe0; text-align:left;" | [[средний род|neuter]] (<span lang="ru" class="Cyrl">оно́</span>)
| ]=] .. alt_past_n .. [=[

|}
</div>
</div>]=]
end

return export