Module:lb-headword

Hello, you have come here looking for the meaning of the word Module:lb-headword. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:lb-headword, but we will also tell you about its etymology, its characteristics and you will know how to say Module:lb-headword in singular and plural. Everything you need to know about the word Module:lb-headword you have here. The definition of the word Module:lb-headword will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:lb-headword, 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 export = {}
local pos_functions = {}

local legal_gender = {
	 = true,
	 = true,
	 = true,
	 = true,
	 = true,
	 = true,
	 = true,
	 = true,
	 = true,
	 = true,
	 = true,
	 = true,
	 = true,
}

local gender_names = {
	 = "unknown gender",
	 = "unknown gender",
	 = "unknown gender",
	 = "unknown gender",
}

local plural_genders = {
	 = true,
	 = true,
	 = true,
	 = true,
	 = true,
}

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

-- 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
	PAGENAME = mw.title.getCurrentTitle().text
	
	local head = args; if head == "" then head = nil end
	
	local poscat = frame.args or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")
	
	local data = {lang = lang, pos_category = poscat, categories = {}, heads = {args}, genders = {}, inflections = {}}
	
	if pos_functions then
		pos_functions(class, args, data)
	end
	
	return
		require("Module:headword").full_headword(data)
end

pos_functions.adjectives = function(class, args, data)
	params = {
		 = {list = "m",
			default = mw.ustring.match(PAGENAME, "ee$") ~= nil
					and PAGENAME .. "ën" 
				or PAGENAME .. "en"},
		 = {list = "n",
			default = mw.ustring.match(PAGENAME, "$") ~= nil
					and PAGENAME
				or mw.ustring.gsub(PAGENAME,
					"()()()$",
					"%1%2%2%3") .. "t"},
		 = {list = true},
		 = {list = true},
		 = {list = true,
			default = mw.ustring.match(PAGENAME, "$") ~= nil
					and mw.ustring.gsub(PAGENAME,
					"()()()$",
					"%1%2%2%3") .. "ten"
				or mw.ustring.gsub(PAGENAME,
					"()()(?)$",
					"%1%2%2%3") .. "sten"
			},
		 = {type = "boolean"},
		 = {},
		 = {type = "boolean"},
	}
	local args = require("Module:parameters").process(args, params)
	data.heads = {args.head}
	
	if args then
		table.insert(data.inflections, {label = 'predicate-only'})
		table.insert(data.categories, 'Luxembourgish predicate only adjectives')
	else
		for i, form in ipairs(args) do
			args = {term = form}
		end
		args.label = "masculine"
		table.insert(data.inflections, args)
		
		if #args.f > 0 then
			for i, form in ipairs(args) do
				args = {term = form}
			end
			args.label = "feminine"
			table.insert(data.inflections, args)
		end
		
		for i, form in ipairs(args) do
			args = {term = form}
		end
		args.label = "neuter"
		table.insert(data.inflections, args)
	end
	
	if args == '-' then
		table.insert(data.inflections, {label = 'not comparable'})
		table.insert(data.categories, 'Luxembourgish uncomparable adjectives')
	else
		if #args > 0 then
			for i, form in ipairs(args) do
				args = {term = form}
			end
			if not args then
				table.insert(args, 1, "] " .. PAGENAME)
			end
		else
			args = {"] " .. PAGENAME}
		end
		args.label = "]"
		table.insert(data.inflections, args)
		
		for i, form in ipairs(args) do
			args = {term = 'am ]'}
		end
		args.label = "]"
		table.insert(data.inflections, args)
	end
end

pos_functions.nouns = function(class, args, data)
	params = {
		 = {list = 'g', default = '?'},
		 = {list = 'pl'},
		 = {list = true},
		 = {},
		 = {list = true},
		 = {list = true},
	}
	if data.pos_category == 'nouns' then
		params.default = mw.ustring.match(PAGENAME, "ee$") ~= nil
					and PAGENAME .. "ën" 
				or PAGENAME .. "en"
	end
	local args = require("Module:parameters").process(args, params)
	data.heads = {args.head}
	
	local plur_tant = false
	
	for _, g in ipairs(args) do
		if legal_gender then
			table.insert(data.genders, g)
			if gender_names then
				table.insert(data.categories, "Luxembourgish " .. gender_names .. " nouns")
			end
		else
			error("Gender “" .. g .. "” is not an valid Luxembourgish gender.")
		end
		
		if plural_genders then
			plur_tant = true
		end
	end
	
	if plur_tant then
		table.insert(data.inflections, {label = ']'})
	elseif args == '-' then
		table.insert(data.inflections, {label = ']'})
		table.insert(data.categories, 'Luxembourgish uncountable nouns')
	elseif #args > 0 then
		for i, form in ipairs(args) do
			args = {term = form}
		end
		args.label = "plural"
		table.insert(data.inflections, args)
		
		if #args > 1 then
			table.insert(data.categories, 'Luxembourgish nouns with multiple plurals')
		end
	end
	
	if #args > 0 then
		for i, form in ipairs(args) do
			args = {term = form}
		end
		args.label = "diminutive"
		table.insert(data.inflections, args)
	end
	
	if #args.f > 0 then
		args.f.label = "feminine"
		table.insert(data.inflections, args.f)
	end
	
	if #args.m > 0 then
		args.m.label = "masculine"
		table.insert(data.inflections, args.m)
	end
end

pos_functions = pos_functions.nouns

local function make_verb_forms(prefix)
	if prefix == nil then prefix = "" end
	
	if mw.ustring.match(prefix, "n$") then
		prefix = mw.ustring.gsub(
			prefix,
			"(.*)()(n+)$",
			"%1%2"
			) .. "n*"
	end
	
	local stem = mw.ustring.gsub(PAGENAME, "^(" .. prefix .. ")(.*)(n)$", "%2")
	local dent_suff = mw.ustring.match(stem, "(+)$")

	local conjugated = ""
	if dent_suff then
		conjugated = mw.ustring.gsub(stem, "(+)$", mw.ustring.rep("t", #dent_suff))
	else
		local lengthened = mw.ustring.gsub(stem,
			"()()()$",
			"%1%2%2%3")
		conjugated = mw.ustring.match(lengthened, "(w)$") and mw.ustring.sub(lengthened, 1, -2) .. "ft" or lengthened .. "t"
	end
	
	return conjugated, (mw.ustring.match(conjugated, "^") and "gë" or "ge") .. conjugated
end

pos_functions.verbs = function(class, args, data)
	third, pp = make_verb_forms(args.sep)
	
	params = {
		 = {list = '3s pres', default = third},
		 = {list = 'pp', default = pp},
		 = {default = 'hunn'},
		 = {list = true},
		 = {list = true},
		 = {},
		 = {default = ""},
	}
	
	local args = require("Module:parameters").process(args, params)
	data.heads = {args.head}
	
	local denasalized_prefix = mw.ustring.gsub(
		args.sep,
		"(.*)()(n+)$",
		"%1%2"
		)
	
	for i, form in ipairs(args) do
		args = {
			term = form .. (#args.sep > 0 and " " .. args.sep or ""),
			}
	end
	args.label = 'third-person singular present'
	table.insert(data.inflections, args)
	
	if #args.pret > 0 then
		for i, form in ipairs(args.pret) do
			args.pret = {
				term = form .. (#args.sep > 0 and " " .. args.sep or ""),
				}
		end
		args.pret.label = 'preterite'
		table.insert(data.inflections, args.pret)
	end
	
	for i, form in ipairs(args) do
		args = {
			term = (mw.ustring.match(form, "^") and denasalized_prefix or args.sep) .. form,
			}
	end
	args.label = 'past participle'
	table.insert(data.inflections, args)
	
	if #args.subj > 0 then
		for i, form in ipairs(args.subj) do
			args.subj = {
				term = form .. (#args.sep > 0 and " " .. args.sep or ""),
				}
		end
		args.subj.label = 'past subjunctive'
		table.insert(data.inflections, args.subj)
	end
	
	if args == 'hunn' then
		args = {'hunn'}
		table.insert(data.categories, 'Luxembourgish verbs using hunn as auxiliary')
	elseif args == 'sinn' then
		args = {'sinn'}
		table.insert(data.categories, 'Luxembourgish verbs using sinn as auxiliary')
	elseif args == 'both' then
		args = {'hunn', 'sinn'}
		table.insert(data.categories, 'Luxembourgish verbs using hunn and sinn as auxiliary')
	else
		error("Verb auxiliary “" .. args .. "” is not an valid Luxembourgish auxiliary (“hunn”, “sinn”, or “both”).")
	end
	args.label = "auxiliary verb"
	table.insert(data.inflections, args)
end

return export