Module:User:Victar/iir-nouns

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

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


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

local export = {}

local genders = {
	 = "masculine",
	 = "feminine",
	 = "neuter",
}


-- Inflection functions

function export.a(frame)
	local params = {
		 = {default = mw.title.getCurrentTitle().nsText == "Template" and "{{{1}}}ás" or mw.title.getCurrentTitle().subpageText},

		 = {required = true, default = "m"},
		 = {},
	}

	local args = require("Module:parameters").process(frame:getParent().args, params)

	local data = {
		forms = {},
		info = nil,
		categories = {},
	}

	local stem, suffix = mw.ustring.match(args, "^(.-)(ás)$")

	if suffix ~= "ás" then
		error("a-stems must end in -ás")
	end
	
	data.info = "''a''-stem"
	table.insert(data.categories, lang:getCanonicalName() .. " a-stem nouns")
	
	data.forms = {stem .. "ás"}
	data.forms = {stem .. "á"}
	data.forms = {stem .. "ám"}
	data.forms = {stem .. "ā́"}
	data.forms = {stem .. "ā́t"}
	data.forms = {stem .. "ā́y"}
	data.forms = {stem .. "ásya"}
	data.forms = {stem .. "áy"}
	
	data.forms = {stem .. "ā́"}
	data.forms = data.forms
	data.forms = data.forms
	data.forms = {stem .. "áybʰyaH", stem .. "ā́bʰyām"}
	data.forms = data.forms
	data.forms = data.forms
	data.forms = {stem .. "áyās"}
	data.forms = {stem .. "áyaw"}
	
	data.forms = {stem .. "ā́", stem .. "ā́s(as)"}
	data.forms = data.forms
	data.forms = {stem .. "ā́ns"}
	data.forms = {stem .. "ā́yš"}
	data.forms = {stem .. "áybʰyas"}
	data.forms = data.forms
	data.forms = {stem .. "ā́na(H)m"}
	data.forms = {stem .. "áyšu"}

	postprocess(args, data)
	return make_table(data)
end

function postprocess(args, data)
	data.n = args
	
	if args == "p" then
		table.insert(data.categories, lang:getCanonicalName() .. " pluralia tantum")
	elseif args == "s" then
		table.insert(data.categories, lang:getCanonicalName() .. " singularia tantum")
	elseif args then
		error("args= must be \"s\" or \"p\".")
	end

	for key, form in pairs(data.forms) do
		-- Do not show singular or plural forms for nominals that don't have them
		if (args == "p" and key:find("|s$")) or (args == "s" and key:find("|p$")) then
			form = nil
		end

		data.forms = form
	end
end

-- Make the table
function make_table(data)
	local function repl(param)
		if param == "info" then
			return mw.getContentLanguage():ucfirst(data.info or "")
		end
		
		local forms = data.forms
		
		if not forms then
			return "—"
		end
		
		local ret = {}
		
		for key, subform in ipairs(forms) do
			table.insert(ret, require("Module:links").full_link({lang = lang, alt = "*" .. subform}))
		end
		
		return table.concat(ret, ", ")
	end
	
	local wikicode = {}
	table.insert(wikicode, [=[
{| class="inflection-table vsSwitcher" data-toggle-category="inflection" style="border: solid 1px #CCCCCC;"
|- style="background: #CCCCCC; text-align: left;"
! class="vsToggleElement" colspan="3" | {{{info}}}
|- class="vsShow"
! style="width: 9em;" |
! style="width: 15em; background: #DDDDDD;" colspan="2" | Singular
|- class="vsShow"
! style="background: #EEEEEE" | Nominative
| colspan="2" | {{{nom|s}}}
|- class="vsShow"
! style="background: #EEEEEE" | Genitive
| colspan="2" | {{{gen|s}}}
|- class="vsHide"
| style="width: 9em;" |
! style="width: 15em; background: #DDDDDD;" | Singular
! style="width: 15em; background: #DDDDDD;" | Plural
|- class="vsHide"
! style="background: #EEEEEE" | Nominative
| {{{nom|s}}}
| {{{nom|p}}}
|- class="vsHide"
! style="background: #EEEEEE" | Accusative
| {{{acc|s}}}
| {{{acc|p}}}
|- class="vsHide"
! style="background: #EEEEEE" | Genitive
| {{{gen|s}}}
| {{{gen|p}}}
|- class="vsHide"
! style="background: #EEEEEE" | Dative
| {{{dat|s}}}
| {{{dat|p}}}
|- class="vsHide"
! style="background: #EEEEEE" | Instrumental
| {{{ins|s}}}
| {{{ins|p}}}
|}]=])

	return mw.ustring.gsub(table.concat(wikicode), "{{{(?+)}}}", repl) .. require("Module:utilities").format_categories(data.categories, lang)
end

return export