Module:phl-noun

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


local export = {}
local lang = require("Module:languages").getByCode("phl")
local m_string_utilities = require("Module:string utilities")
local iut = require("Module:inflection utilities")

local u = require("Module:string/char")
local rsplit = mw.text.split
local rfind = mw.ustring.find
local rmatch = mw.ustring.match
local rgmatch = mw.ustring.gmatch
local rsubn = mw.ustring.gsub
local ulen = mw.ustring.len
local usub = mw.ustring.sub
local uupper = mw.ustring.upper
local ulower = mw.ustring.lower

local function remove_accent(base)
    local accent_map = {
         = "a",  = "e",   = "i",  = "o",  = "u",
         = "A",  = "E",  = "I",  = "O",  = "U"
    }
    base = rsubn(base, ".", function(char)
        return accent_map or char
    end)
    return base
end

local decls = {}
local declprops = {}

-- a-decl (Table 5.10, e.g. ])
decls = function(base, forms)
	local accented = false
	if usub(base, -1) == "ó" then
		accented = true
	end
	stem = base
	stem = rsubn(stem, "u$", "") -- remove final unaccented -u (Table 5.14, e.g. ])
	stem = rsubn(stem, "ó$", "") -- remove final accented -ó (Table 5.15, e.g. ])
	iut.insert_form(forms, "nom_sg", {form=base})
	iut.insert_form(forms, "obl_sg", {form=stem .. (accented and "á" or "a")})
	iut.insert_form(forms, "nom_pl", {form=stem .. (accented and "á" or "a")})
	iut.insert_form(forms, "obl_pl", {form=stem .. (accented and "ám" or "am")})
end

declprops = {
	desc = "a-decl",
	cat = "a-declension nouns",
}

-- a-decl with ending -í or -ú. computed automatically from type a (Table 5.12, e.g. ])
decls = function(base, forms)
	stem = remove_accent(base)
	iut.insert_form(forms, "nom_sg", {form=base})
	iut.insert_form(forms, "obl_sg", {form=base})
	iut.insert_form(forms, "nom_pl", {form=stem .. "á"})
	iut.insert_form(forms, "obl_pl", {form=stem .. "óom"})
end

declprops = {
	desc = "a-decl ending in -í or -ú",
	cat = "a-declension nouns ending in -í or -ú",
}

-- a-decl with ending -ái. computed automatically from type a (Table 5.16, e.g. ])
decls = function(base, forms)
	stem = rsubn(base, "ái$", "")
	iut.insert_form(forms, "nom_sg", {form=base})
	iut.insert_form(forms, "obl_sg", {form=stem .. "ée"})
	iut.insert_form(forms, "obl_sg", {form=stem .. "éea"})
	iut.insert_form(forms, "nom_pl", {form=stem .. "ée"})
	iut.insert_form(forms, "nom_pl", {form=stem .. "éea"})
	iut.insert_form(forms, "obl_pl", {form=stem .. "éem"})
end

declprops = {
	desc = "a-decl ending in -ái",
	cat = "a-declension nouns ending in -ái",
}

-- a-decl but the accent shifts to the ending (Table 5.11, e.g. ])
decls = function(base, forms)
	stem = remove_accent(base)
	iut.insert_form(forms, "nom_sg", {form=base})
	iut.insert_form(forms, "obl_sg", {form=stem .. "á"})
	iut.insert_form(forms, "nom_pl", {form=stem .. "á"})
	iut.insert_form(forms, "obl_pl", {form=stem .. "óom"})
end

declprops = {
	desc = "a-decl w/ accent shift",
	cat = "a-declension nouns with accent shift",
}

-- a-decl with length alternation (Table 5.13, e.g. ])
decls = function(base, forms)
	stem = base
	stem = rsubn(stem, "aá", "a")
	stem = rsubn(stem, "áa", "a")
	iut.insert_form(forms, "nom_sg", {form=base})
	iut.insert_form(forms, "obl_sg", {form=stem .. "á"})
	iut.insert_form(forms, "nom_pl", {form=stem .. "á"})
	iut.insert_form(forms, "obl_pl", {form=stem .. "óom"})
end

declprops = {
	desc = "a-decl w/ length alternation",
	cat = "a-declension nouns with length alternation",
}

-- i-decl (Table 5.17, e.g. ])
decls = function(base, forms)
	stem = remove_accent(base)
	stem = rsubn(stem, "u$", "w") -- e.g. ]
	iut.insert_form(forms, "nom_sg", {form=base})
	iut.insert_form(forms, "obl_sg", {form=stem .. "í"})
	iut.insert_form(forms, "nom_pl", {form=stem .. "í"})
	iut.insert_form(forms, "obl_pl", {form=stem .. "íim"})
end

declprops = {
	desc = "i-decl",
	cat = "i-declension nouns",
}

-- i-decl w/ umlaut (Table 5.18, e.g. ])
decls = function(base, forms)
	stem = rsubn(base, "aá", "ee")
	iut.insert_form(forms, "nom_sg", {form=base})
	iut.insert_form(forms, "obl_sg", {form=stem .. "í"})
	iut.insert_form(forms, "nom_pl", {form=stem .. "í"})
	iut.insert_form(forms, "obl_pl", {form=stem .. "íim"})
end

declprops = {
	desc = "i-decl w/ umlaut",
	cat = "i-declension nouns with umlaut",
}

-- i-decl with length alternation (Table 5.19, e.g. ])
decls = function(base, forms)
	stem = base
	stem = rsubn(stem, "aá", "a")
	stem = rsubn(stem, "áa", "a")
	iut.insert_form(forms, "nom_sg", {form=base})
	iut.insert_form(forms, "obl_sg", {form=stem .. "í"})
	iut.insert_form(forms, "nom_pl", {form=stem .. "í"})
	iut.insert_form(forms, "obl_pl", {form=stem .. "íim"})
end

declprops = {
	desc = "i-decl w/ length alternation",
	cat = "i-declension nouns with length alternation",
}

-- m-decl (Table 5.20, e.g. ])
decls = function(base, forms)
	stem = base
	iut.insert_form(forms, "nom_sg", {form=base})
	iut.insert_form(forms, "obl_sg", {form=base})
	iut.insert_form(forms, "nom_pl", {form=stem .. "m"})
	iut.insert_form(forms, "obl_pl", {form=stem .. "m"})
end

declprops = {
	desc = "m-decl",
	cat = "m-declension nouns",
}

-- ee-decl (Table 5.22, e.g. ])
decls = function(base, forms)
	stem = base
	stem = rsubn(stem, "á$", "") 
	iut.insert_form(forms, "nom_sg", {form=base})
	iut.insert_form(forms, "obl_sg", {form=base})
	iut.insert_form(forms, "nom_pl", {form=stem .. "eé"})
	iut.insert_form(forms, "obl_pl", {form=stem .. "eém"})
end

declprops = {
	desc = "ee-decl",
	cat = "ee-declension nouns",
}

-- ee-decl ending in -oó (Table 5.23, e.g. ])
decls = function(base, forms)
	stem = base
	stem = rsubn(stem, "oó$", "") 
	iut.insert_form(forms, "nom_sg", {form=base})
	iut.insert_form(forms, "obl_sg", {form=stem .. "eé"})
	iut.insert_form(forms, "nom_pl", {form=stem .. "eé"})
	iut.insert_form(forms, "obl_pl", {form=stem .. "eém"})
end

declprops = {
	desc = "ee-decl ending in -oó",
	cat = "ee-declension nouns ending in -oó",
}

-- aan-decl (Table 5.24, e.g. ])
decls = function(base, forms)
	stem = remove_accent(base)
	iut.insert_form(forms, "nom_sg", {form=base})
	iut.insert_form(forms, "obl_sg", {form=stem .. "á"})
	iut.insert_form(forms, "nom_pl", {form=stem .. "aán"})
	iut.insert_form(forms, "nom_pl", {form=stem .. "á"})
	iut.insert_form(forms, "obl_pl", {form=stem .. "oóm"})
	iut.insert_form(forms, "obl_pl", {form=stem .. "aanoóm"})
end

declprops = {
	desc = "aan-decl",
	cat = "aan-declension nouns",
}

-- aan-decl with -g- insertion
decls = function(base, forms)
	stem = remove_accent(base)
	iut.insert_form(forms, "nom_sg", {form=base})
	iut.insert_form(forms, "obl_sg", {form=base})
	iut.insert_form(forms, "nom_pl", {form=stem .. "gaán"})
	iut.insert_form(forms, "obl_pl", {form=stem .. "goóm"})
	iut.insert_form(forms, "obl_pl", {form=stem .. "gaanoóm"})
end

declprops = {
	desc = "aan-decl w/ -g- insertion",
	cat = "aan-declension nouns with -g- insertion",
}

local function decline_noun(base, decltype)
	local data = {forms = {}}
	
	-- fix decltype
	if decltype == "a" then
		if (usub(base, -2) == "ái") then
			decltype = "a-ai"
		elseif (usub(base, -1) == "ú" or usub(base, -1) == "í") then
			decltype = "a-iu"
		end
	elseif decltype == "ee" then
		if (usub(base, -2) == "oó") then
			decltype = "ee-oo"
		end
	end
	
	decls(base, data.forms)
    data.category = declprops.cat
    data.desc = declprops.desc
	return data
end

local function make_table(data)
	result = [=[
{| class="inflection-table vsSwitcher" data-toggle-category="declension" style="background:var(--wikt-palette-lavender, #f8f8ff); text-align:center; min-width:45em; border: 1px solid #9e9e9e;"
|- style="background: var(--wikt-palette-lightblue, #d9ebff);"
! class="vsToggleElement" style="text-align: left;" colspan="4" | Declension of <i lang="phl">{lemma}</i> (<span style="font-size: smaller;">{desc}</span>)
|- class="vsHide"
! style="background:var(--wikt-palette-lightblue, #d9ebff); width:33%" |
! style="background:var(--wikt-palette-lightblue, #d9ebff)" | singular
! style="background:var(--wikt-palette-lightblue, #d9ebff)" | plural
|- class="vsHide"
! style="background:var(--wikt-palette-lighterblue, #ebf4ff)" | nominative
| {nom_sg}
| {nom_pl}
|- class="vsHide"
! style="background:var(--wikt-palette-lighterblue, #ebf4ff)" | oblique
| {obl_sg}
| {obl_pl}
{notes_clause}
|}]=]

	local notes_template = [===[
|- class="vsHide"
| colspan=3 | 
<div class="hi-footnote-outer-div">
<div class="hi-footnote-inner-div">
{footnote}
</div></div>
]===]
	
	-- footnotes
	data.forms.notes_clause = data.forms.footnote ~= "" and
		m_string_utilities.format(notes_template, data.forms) or ""
	data.forms.desc = data.desc
	data.forms.lemma = data.lemma
	result = m_string_utilities.format(result, data.forms)
		
	return result
end

function export.show(frame)
	local args = frame:getParent().args
	local word = args or mw.title.getCurrentTitle().text
	local g = args or args or "m"
	local decltype = args or args or "a"
	
	-- overrides
	local nom_sg = args or word
	local obl_sg = args or nil
	local nom_pl = args or nil
	local obl_pl = args or nil
	
	if word == "Template:phl-noun" then
		word = "kráam"
	end
	
	-- handle irregular declensions separately
	local data = {forms = {}}
	if decltype ~= "irreg" then
		data = decline_noun(word, decltype)
	else
		iut.insert_form(data.forms, "nom_sg", {form=nom_sg})
		iut.insert_form(data.forms, "obl_sg", {form=obl_sg})
		iut.insert_form(data.forms, "nom_pl", {form=nom_pl})
		iut.insert_form(data.forms, "obl_pl", {form=obl_pl})
	    data.category = "irregular nouns"
	    data.desc = "irreg"
	end
	data.lemma = word
	
	local props = {
	  lang = lang,
	  lemmas = {word},
	  slot_list = {{"nom_sg", "nom|sg"}, {"nom_pl", "nom|pl"}, {"obl_sg", "obl|sg"}, {"obl_pl", "obl|pl"}},
	  include_translit = false,
	  create_footnote_obj = nil,
	  canonicalize = nil,
	  preprocess_forms = nil,
	  no_deduplicate_forms = false,
	  combine_metadata_during_dedup = nil,
	  transform_accel_obj = nil,
	  format_forms = nil,
	  generate_link = nil,
	  format_tr = nil,
	  join_spans = nil,
	  allow_footnote_symbols = boolean,
	  footnotes = nil,
	}
	iut.show_forms(data.forms, props)
	
	categories = {"Phalura " .. data.category}
	return make_table(data) .. require("Module:utilities").format_categories(categories, lang)
end

return export