বিষয়বস্তুতে চলুন

মডিউল:fiu-fin-verbs

উইকিঅভিধান, মুক্ত অভিধান থেকে

এই মডিউলের জন্য মডিউল:fiu-fin-verbs/নথি-এ নথিপত্র তৈরি করা হয়ে থাকতে পারে

local m_utilities = require("Module:utilities")
local m_links = require("Module:links")
local m_common = require("Module:fiu-fin-common")

local export = {}

local lang = require("Module:languages").getByCode("fiu-fin-pro")

-- The main entry point.
-- This is the only function that can be invoked from a template.
function export.show(frame)
	local args = frame:getParent().args
	
	local data = {forms = {}, title = nil, categories = {}}
	
	-- Generate the forms
	inflect(args, data)
	
	-- Apply gradation
	for key, forms in pairs(data.forms) do
		for i, form in ipairs(forms) do
			forms[i] = m_common.apply_gradation(form)
		end
	end
	
	-- Check if the lemma form matches the page name
	if data.forms["inf1"] and lang:makeEntryName(data.forms["inf1"][1]) ~= mw.title.getCurrentTitle().subpageText then
		table.insert(data.categories, lang:getCanonicalName() .. " entries with inflection not matching pagename")
	end
	
	return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end

function inflect(args, data)
	local stem = args[1]; if stem == "" then stem = nil end
	
	if not stem then
		if mw.title.getCurrentTitle().nsText == "টেমপ্লেট" then
			stem = "-"
		else
			error("Parameter 1 (stem) must be provided")
		end
	end
	
	local stems = m_common.make_stems(stem, false)
	local vowels = m_common.detect_harmony(stem)
	
	for _, t in ipairs(stems.types) do
		table.insert(data.categories, "Proto-Finnic verbs by type/" .. t)
	end
	
	-- Make forms
	data.forms["pres_1sg"] = {stems.normal .. "n"}
	data.forms["pres_2sg"] = {stems.normal .. "t"}
	data.forms["pres_3sg"] = {stems.normal .. "pi", stems.final}
	data.forms["pres_1pl"] = {stems.normal .. "kmek", stems.normal .. "km" .. vowels.a .. "k"}
	data.forms["pres_2pl"] = {stems.normal .. "ktek", stems.normal .. "kt" .. vowels.a .. "k"}
	data.forms["pres_3pl"] = {stems.normal .. "p" .. vowels.a .. "t", stems.final}
	data.forms["pres_pasv"] = {stems.normal .. "ksen"}
	
	data.forms["pres_conn"] = {stems.normal .. "k"}
	data.forms["pres_pasv_conn"] = {stems.normal .. "kt" .. vowels.a .. "k"}
	
	data.forms["past_1sg"] = {stems.i .. "n"}
	data.forms["past_2sg"] = {stems.i .. "t"}
	data.forms["past_3sg"] = {stems.i}
	data.forms["past_1pl"] = {stems.i .. "mek", stems.i .. "m" .. vowels.a .. "k"}
	data.forms["past_2pl"] = {stems.i .. "tek", stems.i .. "t" .. vowels.a .. "k"}
	data.forms["past_3pl"] = {stems.i}
	data.forms["past_pasv"] = {stems.t .. "isen", stems.normal .. "ttisen"}
	
	data.forms["impr_2sg"] = {stems.normal .. "k"}
	data.forms["impr_3sg"] = {stems.k .. vowels.a .. "sen"}
	data.forms["impr_1pl"] = {stems.k .. vowels.a .. "temek", stems.k .. vowels.a .. "t" .. vowels.a .. "m" .. vowels.a .. "k"}
	data.forms["impr_2pl"] = {stems.k .. vowels.a .. "te", stems.k .. vowels.a .. "t" .. vowels.a}
	data.forms["impr_3pl"] = {stems.k .. vowels.a .. "sen"}
	data.forms["impr_pasv"] = {stems.t .. vowels.a .. "k" .. vowels.a .. "sen", stems.normal .. "tt" .. vowels.a .. "k" .. vowels.a .. "sen"}
	
	data.forms["impr_conn"] = {stems.k .. vowels.a .. "k"}
	data.forms["impr_pasv_conn"] = {stems.t .. vowels.a .. "k" .. vowels.a .. "k", stems.normal .. "tt" .. vowels.a .. "k" .. vowels.a .. "k"}
	
	data.forms["opta_1sg"] = {stems.k .. "on"}
	data.forms["opta_2sg"] = {stems.k .. "os"}
	data.forms["opta_3sg"] = {stems.k .. "osen"}
	data.forms["opta_1pl"] = {stems.k .. "otemek", stems.k .. "ot" .. vowels.a .. "m" .. vowels.a .. "k"}
	data.forms["opta_2pl"] = {stems.k .. "ottek", stems.k .. "ot" .. vowels.a .. "t" .. vowels.a .. "k"}
	data.forms["opta_3pl"] = {stems.k .. "osen"}
	data.forms["opta_pasv"] = {stems.t .. vowels.a .. "kosen", stems.normal .. "tt" .. vowels.a .. "kosen"}
	
	data.forms["opta_conn"] = {stems.k .. "ok"}
	data.forms["opta_pasv_conn"] = {stems.t .. vowels.a .. "kok", stems.normal .. "tt" .. vowels.a .. "kok"}
	
	data.forms["cond1_1sg"] = {stems.normal .. "kcin"}
	data.forms["cond1_2sg"] = {stems.normal .. "kcit"}
	data.forms["cond1_3sg"] = {stems.normal .. "kci"}
	data.forms["cond1_1pl"] = {stems.normal .. "kcimek", stems.normal .. "kcim" .. vowels.a .. "k"}
	data.forms["cond1_2pl"] = {stems.normal .. "kcitek", stems.normal .. "kcit" .. vowels.a .. "k"}
	data.forms["cond1_3pl"] = {stems.normal .. "kci"}
	data.forms["cond1_pasv"] = {stems.t .. vowels.a .. "kcisen", stems.normal .. "tt" .. vowels.a .. "kcisen"}
	
	data.forms["cond1_conn"] = {stems.normal .. "kcik"}
	data.forms["cond1_pasv_conn"] = {stems.t .. vowels.a .. "kcik", stems.normal .. "tt" .. vowels.a .. "kcik"}
	
	data.forms["cond2_1sg"] = {stems.i .. "cin"}
	data.forms["cond2_2sg"] = {stems.i .. "cit"}
	data.forms["cond2_3sg"] = {stems.i .. "ci"}
	data.forms["cond2_1pl"] = {stems.i .. "cimek", stems.i .. "cim" .. vowels.a .. "k"}
	data.forms["cond2_2pl"] = {stems.i .. "citek", stems.i .. "cit" .. vowels.a .. "k"}
	data.forms["cond2_3pl"] = {stems.i .. "ci"}
	data.forms["cond2_pasv"] = {stems.t .. "icisen", stems.normal .. "tticisen"}
	
	data.forms["cond2_conn"] = {stems.i .. "cik"}
	data.forms["cond2_pasv_conn"] = {stems.t .. "icik", stems.normal .. "tticik"}
	
	data.forms["potn_1sg"] = {stems.n .. "en"}
	data.forms["potn_2sg"] = {stems.n .. "et"}
	data.forms["potn_3sg"] = {stems.n .. "i"}
	data.forms["potn_1pl"] = {stems.n .. "emek", stems.n .. "em" .. vowels.a .. "k"}
	data.forms["potn_2pl"] = {stems.n .. "etek", stems.n .. "et" .. vowels.a .. "k"}
	data.forms["potn_3pl"] = {stems.n .. "i"}
	data.forms["potn_pasv"] = {stems.t .. vowels.a .. "nesen", stems.normal .. "tt" .. vowels.a .. "nesen"}
	
	data.forms["potn_conn"] = {stems.n .. "ek"}
	data.forms["potn_pasv_conn"] = {stems.t .. vowels.a .. "nek", stems.normal .. "tt" .. vowels.a .. "nek"}
	
	data.forms["inf1"] = {stems.t .. vowels.a .. "k"}
	data.forms["inf2"] = {stems.t .. "e-"}
	data.forms["grnd"] = {stems.normal .. "m" .. vowels.a}
	data.forms["actn"] = {stems.normal .. "minen"}
	
	data.forms["pres_actv_ptc"] = {stems.normal .. "p" .. vowels.a}
	data.forms["pres_pasv_ptc"] = {stems.t .. vowels.a .. "p" .. vowels.a, stems.normal .. "tt" .. vowels.a .. "p" .. vowels.a}
	data.forms["past_actv_ptc"] = {stems.n .. vowels.u .. "t"}
	data.forms["past_pasv_ptc"] = {stems.t .. vowels.u, stems.normal .. "tt" .. vowels.u}
	
	if stems.normal == "ole" then
		data.forms["pres_3sg"] = {"omi", "on"}
		data.forms["pres_3pl"] = {"omat"}
	end
end


-- Functions for generating the inflection table

function show_form(form)
	if not form then
		return "—"
	elseif type(form) ~= "table" then
		error("a non-table value was given in the list of inflected forms.")
	end
	
	local ret = {}
	
	for key, subform in ipairs(form) do
		table.insert(ret, m_links.full_link({lang = lang, alt = "*" .. subform}))
	end
	
	return table.concat(ret, "<br/>")
end

-- Make the table
function make_table(data)
	return [=[<div class="NavFrame" style="width: 72em">
<div class="NavHead" style="background:rgb(80%,80%,100%);">Inflection of ]=] .. m_links.full_link({lang = lang, alt = "*" .. mw.title.getCurrentTitle().subpageText}, "term") .. (data.title and " (" .. data.title .. ")" or "") .. [=[</div>
<div class="NavContent">
{| class="inflection-table" style="width:100%; color:rgb(0%,0%,30%); border:solid 1px rgb(80%,80%,100%); text-align:left;" cellspacing="1" cellpadding="2"
|- style="background:rgb(80%,80%,100%);vertical-align:top;"
! style="width:20%;" |
! style="width:20%;" | present
! style="width:20%;" | past
! style="width:20%;" | imperative
! style="width:20%;" | optative
|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" | 1st&nbsp;sing.
| ]=] .. show_form(data.forms["pres_1sg"]) .. [=[

| ]=] .. show_form(data.forms["past_1sg"]) .. [=[

| ]=] .. show_form(data.forms["impr_1sg"]) .. [=[

| ]=] .. show_form(data.forms["opta_1sg"]) .. [=[

|- style="background:rgb(95%,95%,100%);vertical-align:top;" | 
! style="background:rgb(80%,80%,100%);" | 2nd&nbsp;sing.
| ]=] .. show_form(data.forms["pres_2sg"]) .. [=[

| ]=] .. show_form(data.forms["past_2sg"]) .. [=[

| ]=] .. show_form(data.forms["impr_2sg"]) .. [=[

| ]=] .. show_form(data.forms["opta_2sg"]) .. [=[

|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" | 3rd&nbsp;sing.
| ]=] .. show_form(data.forms["pres_3sg"]) .. [=[

| ]=] .. show_form(data.forms["past_3sg"]) .. [=[

| ]=] .. show_form(data.forms["impr_3sg"]) .. [=[

| ]=] .. show_form(data.forms["opta_3sg"]) .. [=[

|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" | 1st&nbsp;plur.
| ]=] .. show_form(data.forms["pres_1pl"]) .. [=[

| ]=] .. show_form(data.forms["past_1pl"]) .. [=[

| ]=] .. show_form(data.forms["impr_1pl"]) .. [=[

| ]=] .. show_form(data.forms["opta_1pl"]) .. [=[

|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" | 2nd&nbsp;plur.
| ]=] .. show_form(data.forms["pres_2pl"]) .. [=[

| ]=] .. show_form(data.forms["past_2pl"]) .. [=[

| ]=] .. show_form(data.forms["impr_2pl"]) .. [=[

| ]=] .. show_form(data.forms["opta_2pl"]) .. [=[

|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" | 3rd&nbsp;plur.
| ]=] .. show_form(data.forms["pres_3pl"]) .. [=[

| ]=] .. show_form(data.forms["past_3pl"]) .. [=[

| ]=] .. show_form(data.forms["impr_3pl"]) .. [=[

| ]=] .. show_form(data.forms["opta_3pl"]) .. [=[

|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" | passive
| ]=] .. show_form(data.forms["pres_pasv"]) .. [=[

| ]=] .. show_form(data.forms["past_pasv"]) .. [=[

| ]=] .. show_form(data.forms["impr_pasv"]) .. [=[

| ]=] .. show_form(data.forms["opta_pasv"]) .. [=[

|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" | connegative
| ]=] .. show_form(data.forms["pres_conn"]) .. [=[

| ]=] .. show_form(data.forms["past_conn"]) .. [=[

| ]=] .. show_form(data.forms["impr_conn"]) .. [=[

| ]=] .. show_form(data.forms["opta_conn"]) .. [=[

|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" | passive&nbsp;connegative
| ]=] .. show_form(data.forms["pres_pasv_conn"]) .. [=[

| ]=] .. show_form(data.forms["past_pasv_conn"]) .. [=[

| ]=] .. show_form(data.forms["impr_pasv_conn"]) .. [=[

| ]=] .. show_form(data.forms["opta_pasv_conn"]) .. [=[

|- style="background:rgb(80%,80%,100%);vertical-align:top;"
!
! conditional&nbsp;1
! conditional&nbsp;2
! potential
| rowspan="10" |
|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" | 1st&nbsp;sing.
| ]=] .. show_form(data.forms["cond1_1sg"]) .. [=[

| ]=] .. show_form(data.forms["cond2_1sg"]) .. [=[

| ]=] .. show_form(data.forms["potn_1sg"]) .. [=[

|- style="background:rgb(95%,95%,100%);vertical-align:top;" | 
! style="background:rgb(80%,80%,100%);" | 2nd&nbsp;sing.
| ]=] .. show_form(data.forms["cond1_2sg"]) .. [=[

| ]=] .. show_form(data.forms["cond2_2sg"]) .. [=[

| ]=] .. show_form(data.forms["potn_2sg"]) .. [=[

|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" | 3rd&nbsp;sing.
| ]=] .. show_form(data.forms["cond1_3sg"]) .. [=[

| ]=] .. show_form(data.forms["cond2_3sg"]) .. [=[

| ]=] .. show_form(data.forms["potn_3sg"]) .. [=[

|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" | 1st&nbsp;plur.
| ]=] .. show_form(data.forms["cond1_1pl"]) .. [=[

| ]=] .. show_form(data.forms["cond2_1pl"]) .. [=[

| ]=] .. show_form(data.forms["potn_1pl"]) .. [=[

|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" | 2nd&nbsp;plur.
| ]=] .. show_form(data.forms["cond1_2pl"]) .. [=[

| ]=] .. show_form(data.forms["cond2_2pl"]) .. [=[

| ]=] .. show_form(data.forms["potn_2pl"]) .. [=[

|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" | 3rd&nbsp;plur.
| ]=] .. show_form(data.forms["cond1_3pl"]) .. [=[

| ]=] .. show_form(data.forms["cond2_3pl"]) .. [=[

| ]=] .. show_form(data.forms["potn_3pl"]) .. [=[

|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" | passive
| ]=] .. show_form(data.forms["cond1_pasv"]) .. [=[

| ]=] .. show_form(data.forms["cond2_pasv"]) .. [=[

| ]=] .. show_form(data.forms["potn_pasv"]) .. [=[

|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" | connegative
| ]=] .. show_form(data.forms["cond1_conn"]) .. [=[

| ]=] .. show_form(data.forms["cond2_conn"]) .. [=[

| ]=] .. show_form(data.forms["potn_conn"]) .. [=[

|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" | passive&nbsp;connegative
| ]=] .. show_form(data.forms["cond1_pasv_conn"]) .. [=[

| ]=] .. show_form(data.forms["cond2_pasv_conn"]) .. [=[

| ]=] .. show_form(data.forms["potn_pasv_conn"]) .. [=[

|- style="background:rgb(80%,80%,100%);vertical-align:top;"
! rowspan="2" | non-finite forms
! rowspan="2" | infinitives/nouns
! rowspan="2" |
! colspan="2" | participles
|- style="background:rgb(90%,90%,100%)"
! active
! passive
|-
|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" | infinitive 1
| ]=] .. show_form(data.forms["inf1"]) .. [=[

! style="background:rgb(80%,80%,100%);" | present
| ]=] .. show_form(data.forms["pres_actv_ptc"]) .. [=[

| ]=] .. show_form(data.forms["pres_pasv_ptc"]) .. [=[

|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" | infinitive 2
| ]=] .. show_form(data.forms["inf2"]) .. [=[

! style="background:rgb(80%,80%,100%);" | past
| ]=] .. show_form(data.forms["past_actv_ptc"]) .. [=[

| ]=] .. show_form(data.forms["past_pasv_ptc"]) .. [=[

|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" | gerund/supine
| ]=] .. show_form(data.forms["grnd"]) .. [=[

| style="background:rgb(80%,80%,100%);" rowspan="2" colspan="3" |
|- style="background:rgb(95%,95%,100%);vertical-align:top;" |
! style="background:rgb(80%,80%,100%);" | action&nbsp;noun
| ]=] .. show_form(data.forms["actn"]) .. [=[

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

end

return export