Module:User:Benwing2/it-form of

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


-- 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 = true -- 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 imp = glossary_link("imperative") .. " form"
local inf = glossary_link("infinitive")
local parts_of_speech = {
	 = glossary_link("gerund"),
	 = inf,
	 = "first-person singular ({{l|it|io}}) " .. inf,
	 = "second-person singular ({{l|it|tu}}) " .. inf,
	 = "first-person plural ({{l|it|noi}}) " .. inf,
	 = "second-person plural ({{l|it|voi}}) " .. inf,
	 = "second-person singular ({{l|it|tu}}) " .. imp,
	 = "first-person plural ({{l|it|noi}}) " .. imp,
	 = "second-person plural ({{l|it|voi}}) " .. imp,
}

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

local archaic_parts_of_speech = {
	 = "masculine singular " .. pp,
	 = "feminine singular " .. pp,
	 = "masculine plural " .. pp,
	 = "feminine plural " .. pp,
	 = glossary_link("present") .. " " .. glossary_link("participle"),
	 = "first-person singular ({{l|it|io}}) " .. pres,
	 = "second-person singular ({{l|it|tu}}) " .. pres,
	 = "third-person singular ({{l|it|lui}}, {{l|it|lei}}) " .. pres,
	 = "first-person plural ({{l|it|noi}}) " .. pres,
	 = "first-person plural ({{l|it|voi}}) " .. pres,
	 = "first-person plural ({{l|it|loro}}) " .. pres,
	 = "first-person singular ({{l|it|io}}) " .. phis,
	 = "second-person singular ({{l|it|tu}}) " .. phis,
	 = "third-person singular ({{l|it|lui}}, {{l|it|lei}}) " .. phis,
	 = "first-person plural ({{l|it|noi}}) " .. phis,
	 = "first-person plural ({{l|it|voi}}) " .. phis,
	 = "first-person plural ({{l|it|loro}}) " .. phis,
}

-- The main entry point.
-- FIXME: Convert itprop to go through this.
function export.it_compound(frame)
	local params = {
		 = {list = true},
		 = {},
		 = {},
		 = {},
		 = {alias_of = "t"},
		 = {},
		 = {}, -- 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 = "abbracciatela"
		args.pos = "imp2p"
		args.inf = "abbracciare"
	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
			if base:find("r$") then
				base = base .. "e"
			end
		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
		if base:find("r$") then
			base = base .. "e"
		end
	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"
		else
			error("Unable to determine part of speech of base '" .. base .. "'")
		end
	end
	local inf = args.inf
	if not inf 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
		ins("{{tlb|it|archaic}} ")
	end
	table.insert(parts, "''compound of ")
	if pos == "inf" then
		ins("the infinitive '''{{m|it|" .. inf .. "}}'''")
	else
		ins("'''{{m|it|" .. base .. "}}''', the ")
		ins(posdesc .. " of '''{{m|it|" .. inf .. "}}''',")
	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