Module:it-form of

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

-- This module implements {{it-compound of}}.
local export = {}

local m_table = require("Module:table")
local rmatch = mw.ustring.match

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

local force_cat = false -- for testing; if true, categories appear in non-mainspace pages

local function glossary_link(entry, text)
	text = text or entry
	return "]"
end

local pronoun_suffixes = {
	"mi",
	"me",
	"ti",
	"te",
	"si",
	"se",
	"ci",
	"ce",
	"vi",
	"ve",
	"gli", -- must precede ]
	"glie",
	"lo",
	"la",
	"li",
	"le",
	"ne",
}
local pronoun_suffix_set = m_table.listToSet(pronoun_suffixes)

local conjunctive_pronouns = {
	 = "mi",
	 = "ti",
	 = "si",
	 = "ci",
	 = "vi",
	 = "gli",
}

local fem = glossary_link("gender", "feminine")
local masc = glossary_link("gender", "masculine")
local sing = glossary_link("singular_number", "singular")
local plur = glossary_link("plural_number", "plural")
local p1 = glossary_link("first_person", "first-person")
local p2 = glossary_link("second_person", "second-person")
local p3 = glossary_link("third_person", "third-person")
local imp = glossary_link("imperative") .. " form"
local inf = glossary_link("infinitive")
local ger = glossary_link("gerund")
local pp = glossary_link("past") .. " " .. glossary_link("participle")
local presp = glossary_link("present") .. " " .. glossary_link("participle")
local parts_of_speech = {
	 = "",
	 = ger,
	 = inf,
	 = p2 .. " " .. sing .. " " .. imp,
	 = p1 .. " " .. plur .. " " .. imp,
	 = p2 .. " " .. plur .. " " .. imp,
	 = masc .. " " .. sing .. " " .. pp,
	 = fem .. " " .. sing .. " " .. pp,
	 = masc .. " " .. plur .. " " .. pp,
	 = fem .. " " .. plur .. " " .. pp,
	 = sing .. " " .. presp,
	 = plur .. " " .. presp,
	 = p1 .. " " .. sing .. " " .. inf,
	 = p2 .. " " .. sing .. " " .. inf,
	 = p1 .. " " .. plur .. " " .. inf,
	 = p2 .. " " .. plur .. " " .. inf,
}

local pres = glossary_link("present") .. " " .. glossary_link("indicative") .. " form"
local phis = glossary_link("past historic") .. " form"

local archaic_parts_of_speech = {
	 = p1 .. " " .. sing .. " " .. pres,
	 = p2 .. " " .. sing .. " " .. pres,
	 = p3 .. " " .. sing .. " " .. pres,
	 = p1 .. " " .. plur .. " " .. pres,
	 = p2 .. " " .. plur .. " " .. pres,
	 = p3 .. " " .. plur .. " " .. pres,
	 = p1 .. " " .. sing .. " " .. phis,
	 = p2 .. " " .. sing .. " " .. phis,
	 = p3 .. " " .. sing .. " " .. phis,
	 = p1 .. " " .. plur .. " " .. phis,
	 = p2 .. " " .. plur .. " " .. phis,
	 = p3 .. " " .. plur .. " " .. phis,
}

-- The main entry point.
-- FIXME: Convert itprop to go through this.
function export.it_compound(frame)
	local params = {
		 = {list = true},
		 = {},
		 = {},
		 = {},
		 = {},
		 = {alias_of = "t"},
		 = {type = "boolean"},
		 = {},
		 = {}, -- for testing
	}

	local parargs = frame:getParent().args

	local args = require("Module:parameters").process(parargs, params)
	local curtitle = mw.title.getCurrentTitle()
	local pagename = args.pagename or curtitle.subpageText
	local base
	local prons = {}
	local suff = ""
	if #args == 0 and not args.inf and not args.pos and curtitle.nsText == "Template"
		and curtitle.subpageText == "it-compound of" then
		pagename = "dammela"
		args.pos = "imp2s"
		args = {"me", "la"}
		args.inf = "dare"
	end
	if #args > 0 then
		local ind
		if not pronoun_suffix_set] then
			base = args
			ind = 2
		else
			ind = 1
		end
		while ind <= #args do
			if not pronoun_suffix_set] then
				error("Unrecognized pronoun suffix '" .. args .. "'")
			end
			table.insert(prons, args)
			suff = suff .. args
			ind = ind + 1
		end
		if not base then
			base = rmatch(pagename, "^(.*)" .. suff .. "$")
			if not base and args.pos == "inf" and args.inf then
				-- ], pron = ], inf/base = ]
				base = args.inf
			end
			if not base then
				error("Unable to extract base form from pagename " .. pagename .. "; pagename should end in '" .. suff .. "'")
			end
			base = base:gsub("r$", "%0re"):gsub("r$", "re")
		end
	else
		for _, pronsuf in ipairs(pronoun_suffixes) do
			base = rmatch(pagename, "^(.*)" .. pronsuf .. "$")
			if base then
				table.insert(prons, pronsuf)
				break
			end
		end
		if not base then
			error("Unable to extract pronominal suffix from pagename " .. pagename)
		end
		base = base:gsub("r$", "%0re"):gsub("r$", "re")
	end
	local pos = args.pos
	if pos then
		if not parts_of_speech and not archaic_parts_of_speech then
			error("Unrecognized part of speech '" .. pos .. "'")
		end
	else
		if base:find("ndo$") then
			pos = "ger"
		elseif base:find("re$") then
			pos = "inf"
		elseif base:find("mo$") then
			pos = "imp1p"
		elseif base:find("ecco$") then
			pos = "ecco"
		else
			error("Unable to determine part of speech of base '" .. base .. "'")
		end
	end
	local apocof = args.apocof
	local consonants = "$"
	if pos == "imp2s" then
		base = base:gsub(consonants, "'")
	elseif pos == "phis3s" then
		base = base:gsub("o" .. consonants, "ò")
			:gsub("e" .. consonants, "é")
			:gsub("i" .. consonants, "ì")
	elseif not apocof and pos:find("3p$") and base:find("n$") then
		apocof = base .. "o"
	end
	local inf = args.inf
	if not inf and pos ~= "ecco" then
		if pos == "inf" then
			inf = base
		elseif pos:find("^inf") then
			inf = base:gsub("i$", "si")
		elseif pos == "ger" and base:find("ando$") then
			inf = base:gsub("ando$", "are")
		else
			error("With part of speech '" .. pos .. "', must specify infinitive using inf=")
		end
	end

	local parts = {}
	local posdesc = parts_of_speech
	local function ins(text)
		table.insert(parts, text)
	end
	if not posdesc then
		posdesc = archaic_parts_of_speech
		if not posdesc then
			error("Internal error: Unrecognized part of speech '" .. pos .. "'")
		end
		if not args.noarchaic then
			ins("{{tlb|it|archaic}} ")
		end
	end
	table.insert(parts, "''compound of ")
	if pos == "inf" then
		ins("the infinitive '''{{m|it|" .. inf .. "}}'''")
	else
		ins("'''{{m|it|" .. base .. "}}'''")
		if apocof then
			ins(" (the " .. glossary_link("apocopic") .. " form of '''{{m|it|" .. apocof .. "}}'''")
		end
		if #posdesc > 0 then
			ins(", the " .. posdesc .. " of '''{{m|it|" .. inf .. "}}'''")
		end
		if apocof or #posdesc > 0 then
			ins(apocof and ")" or ",")
		end
	end
	ins(" with ")
	local pronparts = {}
	for _, pron in ipairs(prons) do
		if conjunctive_pronouns then
			table.insert(pronparts, "'''{{m|it|" .. pron .. "}}''' (the conjunctive variant of '''{{m|it|" .. conjunctive_pronouns .. "}}''')")
		else
			table.insert(pronparts, "'''{{m|it|" .. pron .. "}}'''")
		end
	end
	if #pronparts == 1 then
		ins(pronparts)
	else
		ins(m_table.serialCommaJoin(pronparts))
	end
	ins("''")
	if args.t then
		ins(" " .. require("Module:links").format_link_annotations({lang = lang, gloss = args.t}))
	end
	local desc = mw.getCurrentFrame():preprocess(table.concat(parts))
	return desc .. require("Module:utilities").format_categories("Italian combined forms", lang, args.sort, nil, force_cat)
end

return export