Module:frm-headword

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

This module is used for some Middle French headword-line templates.

The module is always invoked the same way, by passing a single parameter to the "show" function. This parameter is the name of the part of speech, but in plural (examples given are for nouns, and for adjective forms respectively):

{{#invoke:frm-headword|show|nouns}}
{{#invoke:frm-headword|show|adjective forms}}

There is no parameter for the sort key, because this is not necessary. The sort key is automatically generated according to the normal alphabetical ordering in Middle French.


local export = {}
local pos_functions = {}

local lang = require("Module:languages").getByCode("frm")
local m_headword = require("Module:headword")

-- Clone parent's args while also assigning nil to empty strings.
-- Taken from module ru-headword.
local function clone_args(frame)
	local args = {}
	for pname, param in pairs(frame:getParent().args) do
		if param == "" then args = nil
		else args = param
		end
	end
	return args
end

-- The main entry point.
-- This is the only function that can be invoked from a template.
function export.show(frame)
	local args = clone_args(frame)
	local poscat = frame.args or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")
	HEAD = args or mw.title.getCurrentTitle().subpageText

	local genders = {}
	local inflections = {}
	local categories = {"Middle French " .. poscat}

	if pos_functions then
		pos_functions(args, genders, inflections, categories, wv)
	end

	return m_headword.full_headword{
		lang = lang,
		heads = {HEAD},
		genders = genders,
		inflections = inflections,
		categories = categories,
		sort_key = sort
	}
end

-- Apply ts > s and és > ez changes.
local function mp_morph(string)
	string = mw.ustring.gsub(string, "ts$", "s")
	string = mw.ustring.gsub(string, "és$", "ez")
	return string
end

local function make_mp()
	local plurals = {}
	if mw.ustring.match(HEAD, "$") then
		table.insert(plurals, HEAD)
	elseif mw.ustring.match(HEAD, "eau$") ~= nil then
		table.insert(plurals, HEAD .. "x")
		table.insert(plurals, HEAD .. "lx") -- -eaulx is as common as -eaux
	elseif mw.ustring.match(HEAD, "al$") ~= nil then
		local al = mw.ustring.gsub(HEAD, "al$", "aux")
		table.insert(plurals, al) -- -aulx is less common then -alx
	else
		table.insert(plurals, mp_morph(HEAD .. "s"))
	end
	return plurals
end

pos_functions = function(args, genders, inflections, categories)
	local g = args or args
	local f = args or args
	local plurals = {}
		table.insert(plurals, args or args)
		table.insert(plurals, 2, args)
	local fp = args or args
	local mfp = args

	table.insert(genders, "m")

	if g == "m-f" or g == "mf" then
		table.insert(genders, "f")

		mfp = mp_morph(HEAD .. "s")

		table.insert(inflections, {label = "plural", accel = {form = "p"}, mfp})
	else
		if not fs then
			if mw.ustring.match(HEAD, "é$") ~= nil then
				fs = mw.ustring.gsub(HEAD, "é$", "ee")
			elseif mw.ustring.match(HEAD, "és$") ~= nil then
				fs = mw.ustring.gsub(HEAD, "és$", "esse")
			elseif mw.ustring.match(HEAD, "if$") ~= nil then
				fs = mw.ustring.gsub(HEAD, "if$", "ifve")
			elseif mw.ustring.match(HEAD, "eux") ~= nil then
				fs = mw.ustring.gsub(HEAD, "eux$", "euse")
			else
				fs = HEAD .. "e"
			end
		end

		if not plurals then plurals = make_mp() end

		if not fp then
			fp = fs .. "s"
		end

		table.insert(inflections, {label = "feminine singular", accel = {form = "f|s"}, fs})
		table.insert(inflections, {label = "masculine plural", accel = {form = "m|p"}, plurals})
		if plurals then table.insert(inflections, plurals) end
		table.insert(inflections, {label = "feminine plural", accel = {form = "f|p"}, fp})
	end
end

pos_functions = function(args, genders, inflections, categories)
	local g = args or args
	local plurals = {}
	if args ~= "-" then
		table.insert(plurals, args or args)
	else
		table.insert(plurals, args)
	end
	table.insert(plurals, args or nil)
	local fs = args
	local fp = args

	if not g then
		table.insert(genders, "?")
	else
		table.insert(genders, g)
		if args then table.insert(genders, args) end
	end

	if not plurals then plurals = make_mp() end

	local function uncoutable_label_gen(p)
		export = "]"
		if args then export = "usually " .. export end
		return export
	end

	if args == "-" then
		table.insert(inflections, {label = uncoutable_label_gen(plurals)})
		pl_inflection_number = 1
		if args then
			table.insert(inflections, {label = "plural", accel = {form = "p"}, args})
		end
	else
		table.insert(inflections, {label = "plural", accel = {form = "p"}, plurals})
		if plurals then table.insert(inflections, plurals) end
	end

	if fs then
		table.insert(inflections, {label = "feminine singular", accel = {form = "f|s"}, fs})
		fp = fp or (fs .. "s")
		table.insert(inflections, {label = "feminine plural", accel = {form = "f|p"}, fp})
	end
end

return export