Module:urj-fin-nominals

Hello, you have come here looking for the meaning of the word Module:urj-fin-nominals. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:urj-fin-nominals, but we will also tell you about its etymology, its characteristics and you will know how to say Module:urj-fin-nominals in singular and plural. Everything you need to know about the word Module:urj-fin-nominals you have here. The definition of the word Module:urj-fin-nominals will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:urj-fin-nominals, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

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

local export = {}

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

-- Functions that do the actual inflecting by creating the forms of a basic term.
local inflections = {}

-- 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 = m_common.apply_gradation(form)
		end
	end
	
	-- Check if the lemma form matches the page name
	if data.forms and (lang:makeEntryName(data.forms)) ~= mw.title.getCurrentTitle().subpageText then
		table.insert(data.categories, lang:getCanonicalName() .. " entries with inflection not matching pagename")
	end
	
	return make_table(data) .. require("Module:TemplateStyles")("Module:urj-fin-nominals/style.css") .. m_utilities.format_categories(data.categories, lang)
end

function inflect(args, data)
	local prefix = args or ""
	local stem = args or ""
	
	if stem == "" then
		stem = prefix
		prefix = ""
	end
	
	if stem == "" then
		if mw.title.getCurrentTitle().nsText == "Template" then
			stem = "-"
		else
			error("Parameter 1 (stem) must be provided")
		end
	end
	
	local vowels = m_common.detect_harmony(stem)
	local stems = m_common.make_stems((mw.ustring.gsub(stem, "()nn$", "%1c")))
	
	if mw.ustring.find(stem, "nn$") then
		stems.final = stem
	end
	
	make_forms(stems, vowels, data)
	
	if mw.ustring.find(stem, "^inu$") then
		data.forms = {(mw.ustring.gsub(stem, "u$", "ä"))}
		
		for key, form in pairs(data.forms) do
			if key:find("_pl") then
				data.forms = nil
			end
		end
	elseif mw.ustring.find(stem, "^e$") then
		data.forms = {stem, (mw.ustring.gsub(stem, "e$", "öö"))}
		data.forms = {stem .. "det", stem .. "idet"}
		
		for key, form in pairs(data.forms) do
			if key:find("_sg") then
				data.forms = nil
			end
		end
	elseif stem == "hän" then
		data.forms = {"hän"}
		
		for key, form in pairs(data.forms) do
			if key:find("_pl") then
				data.forms = nil
			end
		end
	end
	
	for key, subforms in pairs(data.forms) do
		for i, form in ipairs(subforms) do
			subforms = prefix .. form
		end
	end
	
	for _, t in ipairs(stems.types) do
		table.insert(data.categories, "Proto-Finnic nominals by type/" .. t)
	end
end

function make_forms(stems, vowels, data)
	data.forms = {stems.final}
	data.forms = {stems.normal .. "n"}
	data.forms = {stems.normal .. "n"}
	data.forms = {stems.t .. vowels.a}
	data.forms = {stems.normal .. "ss" .. vowels.a, stems.normal .. "hn" .. vowels.a}
	data.forms = {stems.normal .. "st" .. vowels.a}
	data.forms = {stems.normal .. "s" .. vowels.e .. "n"}
	data.forms = {stems.normal .. "ll" .. vowels.a}
	data.forms = {stems.normal .. "lt" .. vowels.a}
	data.forms = {stems.normal .. "l" .. vowels.e .. "n", stems.normal .. "l" .. vowels.e .. "k"}
	data.forms = {stems.n .. vowels.a}
	data.forms = {stems.normal .. "ksi"}
	data.forms = {stems.n .. vowels.e .. "k"}
	data.forms = {stems.normal .. "n"}
	data.forms = {stems.normal .. "tt" .. vowels.a}
	
	data.forms = {stems.normal .. "t"}
	data.forms = {stems.normal .. "t"}
	data.forms = {stems.t .. vowels.e .. "n", stems.i .. "t" .. vowels.e .. "n"}
	data.forms = {stems.i .. "t" .. vowels.a}
	data.forms = {stems.i .. "ss" .. vowels.a, stems.i .. "hn" .. vowels.a}
	data.forms = {stems.i .. "st" .. vowels.a}
	data.forms = {stems.i .. "s" .. vowels.e .. "n"}
	data.forms = {stems.i .. "ll" .. vowels.a}
	data.forms = {stems.i .. "lt" .. vowels.a}
	data.forms = {stems.i .. "l" .. vowels.e .. "n", stems.i .. "l" .. vowels.e .. "k"}
	data.forms = {stems.i .. "n" .. vowels.a}
	data.forms = {stems.i .. "ksi"}
	data.forms = {stems.i .. "n" .. vowels.e .. "k"}
	data.forms = {stems.i .. "n"}
	data.forms = {stems.i .. "tt" .. vowels.a}
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 urj-fin-decl-frame">
<div class="NavHead urj-fin-decl-header-row">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 urj-fin-decl"
| colspan="4" | '''Note''': The Proto-Finnic declension system is yet to be reconstructed in detail. What is presented here is only one possibility.
|-
|-
! class="thnum" colspan="2" |
! class="thnum" | singular
! class="thnum" | plural
|-
! colspan="2" | nominative
| ]=] .. show_form(data.forms) .. [=[

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

|- 
! colspan="2" | accusative
| ]=] .. show_form(data.forms) .. [=[

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

|-
! colspan="2" | genitive
| ]=] .. show_form(data.forms) .. [=[

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

|-
! colspan="2" | partitive
| ]=] .. show_form(data.forms) .. [=[

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

|-
! colspan="2" | inessive
| ]=] .. show_form(data.forms) .. [=[

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

|-
! colspan="2" | elative
| ]=] .. show_form(data.forms) .. [=[

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

|-
! colspan="2" | illative
| ]=] .. show_form(data.forms) .. [=[

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

|-
! colspan="2" | adessive
| ]=] .. show_form(data.forms) .. [=[

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

|-
! colspan="2" | ablative
| ]=] .. show_form(data.forms) .. [=[

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

|-
! colspan="2" | allative
| ]=] .. show_form(data.forms) .. [=[

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

|-
! colspan="2" | essive
| ]=] .. show_form(data.forms) .. [=[

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

|-
! colspan="2" | translative
| ]=] .. show_form(data.forms) .. [=[

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

|-
! colspan="2" | instructive
| ]=] .. show_form(data.forms) .. [=[

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

|-
! colspan="2" | comitative
| ]=] .. show_form(data.forms) .. [=[

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

|-
! colspan="2" | abessive
| ]=] .. show_form(data.forms) .. [=[

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

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

end

return export