Mòdul:ca-verb

De Viccionari
Salta a la navegació Salta a la cerca
Icona de documentació de mòdul Documentació del mòdul[mostra] [modifica] [refresca]

A continuació es mostra la documentació transclosa de la subpàgina /ús. [salta a la caixa de codi]


Mòdul de suport per la plantilla {{ca-conj}} per a generar la taula de conjugació d’un verb en català. Vegeu la plantilla per al seu ús.

El casos irregulars estan tracta en submòduls: Especial:Cerca per prefix/Mòdul:ca-verb/.

Addicionalment, amb el paràmetre bot=1, o qualsevol valor, genera una llista per a facilitar la lectura per un bot.

--[=[
	Creació de taules de conjugació de verbs en català. 
	
	Terminologia:
		forma   = cant + à + ve + m
		radical = cant
		vocal   = à
		temps   = ve
		persona = m
		tema    = cantà
		desinència = vem
		terminació = àvem
]=]--

local m_util = require("Mòdul:utilitats")
local m_lema = require("Mòdul:ca-lema")

local p = {}

-- The main entry point.
-- This is the only function that can be invoked from a template.
function p.show(frame)
	local args = frame:getParent().args
	pagename = args.pagename or mw.title.getCurrentTitle().subpageText
	NAMESPACE = mw.title.getCurrentTitle().nsText
	infinitiu = args.inf or ''
	
	if infinitiu == "" then
		infinitiu = pagename:find("[-']") and mw.text.split(pagename, "[-']")[1] or pagename
	end
	local conj_type = args[1] or ""
	if conj_type == "" and NAMESPACE ~= "" then conj_type = "ar" end
	if conj_type == "" then conj_type = (infinitiu:find("[ln]dre$") or infinitiu:find("ure$")) and "re_velar" or string.sub(infinitiu, -2) end
	if infinitiu:find("[tv]enir$") then conj_type = "re_velar" end

	local zona = {}
	zona.ori = args["or"] ~= "no"
	zona.centr = zona.ori and args.centr ~= "no"
	zona.sept = zona.ori and args.sept ~= "no"
	zona.bal = zona.ori and args.bal ~= "no"
	zona.eiv = zona.bal
	zona.alg = zona.ori and args.alg ~= "no"
	zona.occ = args.occ ~= "no" and (args.nocc ~= "no" or args.val ~= "no")
	zona.nocc = zona.occ and args.nocc ~= "no"
	zona.val = zona.occ and args.val ~= "no"
	zona.alt = args.alt ~= "no"

	local forma, title, categories
	
	if conj_type == "ar" or conj_type == "1" then
		forma, title, categories = conj_1(zona)
	elseif conj_type == "er" or conj_type == "re" or conj_type == "2" then
		forma, title, categories = conj_2(zona)
	elseif conj_type == "re_velar" or conj_type == "2velar" then
		forma, title, categories = conj_2_velar(zona)
	elseif conj_type == "ir" or conj_type == "3" then
		forma, title, categories = conj_3(zona, false)
	elseif conj_type == "ir_pur" or conj_type == "3pura" then
		forma, title, categories = conj_3(zona, true)
	else
		error("Tipus de conjugació desconegut '" .. conj_type .. "'")
	end
	
	forma.rizo = args.rizo
	
	if args.bot then
		return require("Mòdul:ca-verb/taula").make_bot_list(forma, args.def)
	else
		return require("Mòdul:ca-verb/taula").make_table(forma, title, args.def) .. m_util.format_categories(categories, lang)
	end
end

-- Primera conjugació (-ar)
function conj_1(zona)
	local forma = {}
	local categories = {}
	local title = "Primera conjugació regular"
	
	local radical = {}
	radical.simple = NAMESPACE == "Plantilla" and "-" or string.sub(infinitiu, 1, -3)
	make_radical(radical, "ar")

	forma["inf"] = radical.simple .. "ar"
	make_ger(forma, radical, "a", zona)
	
	local part2 = "" -- participis alternatius
	local part2_zona = ""
	if radical.simple == "mat" then
		part2 = "mort"
	elseif radical.simple == "despert" then
		part2 = "despert"
		part2_zona = "bal"
	end
	make_part(forma, radical.simple .. "at", zona, part2, part2_zona)
	
	make_pres_ind_1(forma, radical, zona)
	make_imperf_ind(forma, radical, "a", zona)
	make_pass(forma, radical, "a", zona)
	make_fut_i_cond(forma, radical.simple .. "a")
	make_pres_subj_12(forma, radical, "a", zona)
	make_imperf_subj(forma, radical, "a", zona)
	make_imp(forma)
	
	make_imperf_ind_no_1(forma, radical, zona)
	make_cond_no_13(forma, radical.simple .. "a", zona)
	make_pres_subj_no(forma, radical, "a", zona)
	make_imperf_subj_no(forma, radical, zona)

	forma["nota"] = (zona.bal or zona.val) and "Notes: (1) en baleàric en àmbits restringits i en valencià en registres molt formals." or ""

	local irregulars = m_util.llista({"aguar", "anar", "dar", "donar", "estar"})
	if irregulars[forma.inf] then
		forma = require("Mòdul:ca-verb/" .. forma.inf).make_irregulars(forma)
		if forma.inf == "donar" then
			title = title .. ", amb accents diacrítics"
		elseif forma.inf == "aguar" then
			title = "Primera conjugació amb hiat rizotònic irregular"
		else
			title = "Primera conjugació irregular"
		end
	elseif radical.davant_e ~= radical.simple then
		title = title .. ", amb alternança consonàntica en el radical"
	elseif radical.simple:find("[eio]$") or radical.simple:find("[^aeiougq]u$")then
		title = title .. ", amb hiat entre el radical i la desinència"
	elseif radical.desinencia0 and radical.desinencia0 ~= radical.simple then
		title = title .. ", amb radical modificat sense desinència"
	end
	
	return forma, title, categories
end

-- Segona conjugació (-re o -er)
function conj_2(zona)
	local forma = {}
	local categories = {}
	local title = "Segona conjugació regular"
	
	local radical = {}
	local vocal = string.sub(infinitiu, -2) == "er" and "e" or ""
	if string.sub(infinitiu, -4) == "ndre" then -- excepcions en formes velaritzades
		radical.simple = sense_accents(string.sub(infinitiu, 1, -4))
		vocal = "d"
	elseif mw.ustring.find(infinitiu, "[np]éixer$") and not mw.ustring.find(infinitiu, "conéixer$") then
		radical.simple = mw.ustring.gsub(infinitiu, "éixer$", "aix")
	elseif infinitiu == "ésser" or infinitiu == "esser" then
		radical.simple = "s"
	else
		radical.simple = sense_accents(string.sub(infinitiu, 1, -3))
	end

	make_radical(radical, "er")

	forma["inf"] = infinitiu
	make_ger(forma, radical, "e", zona)
	
	local part = radical.davant_aou .. "ut"
	-- Participis irregulars
	local part2 = ""
	local part2_zona = ""
	if radical.simple:find("met$") then
		if radical.monosil then
			part = radical.simple:gsub("et$", "es")
		else
			part = radical.simple:gsub("et$", "ès")
			part2 = radical.simple:gsub("et$", "és")
			part2_zona = "val"
		end
		title = title .. ", participi irregular"
	elseif radical.simple:find("torc$") then
		part2 = radical.simple:gsub("torc$", "tort")
		part2_zona = "eiv"
	end
	make_part(forma, part, zona, part2, part2_zona)
	
	make_pres_ind_2(forma, radical, "e", zona)
	make_imperf_ind(forma, radical, "e", zona)
	make_pass(forma, radical, "e", zona)
	make_fut_i_cond(forma, radical.simple .. vocal)
	make_pres_subj_12(forma, radical, "e", zona)
	make_imperf_subj(forma, radical, "e", zona)
	make_imp(forma)
	
	make_pres_ind_no_2(forma, radical, zona)
	make_imperf_ind_no_2(forma, radical, zona)
	if vocal == "" then
		make_fut_no(forma, radical.davant_e .. "e", zona)
		make_cond_no_2(forma, radical.davant_e .. "e", zona)
	end
	make_pres_subj_no(forma, radical, "e", zona)
	make_imperf_subj_no(forma, radical, zona)

	if radical.simple:find("[np]aix$") then
		forma = require("Mòdul:ca-verb/néixer").make_irregulars(forma, zona)
		title = "Segona conjugació irregular"
	elseif radical.simple:find("coneix$") then
		forma = require("Mòdul:ca-verb/conèixer").make_irregulars(forma, zona)
		title = "Segona conjugació amb alternança consonàntica en el radical"
	elseif radical.simple:find("pareix$") then
		forma = require("Mòdul:ca-verb/aparèixer").make_irregulars(forma, zona)
		title = "Segona conjugació amb alternança consonàntica en el radical"
	elseif radical.simple:find("eix$") then
		forma = require("Mòdul:ca-verb/eixer").make_irregulars(forma, zona)
		title = "Segona conjugació amb alternança consonàntica en el radical"
	elseif radical.simple:find("any$") or radical.simple:find("feny$") then
		forma = require("Mòdul:ca-verb/pertànyer").make_irregulars(forma, zona)
		title = "Segona conjugació amb algunes formes velaritzades"
	elseif radical.simple:find("eny$") then
		forma = require("Mòdul:ca-verb/empènyer").make_irregulars(forma, zona)
		title = "Segona conjugació amb algunes formes velaritzades"
	elseif radical.simple == "cab" then
		forma = require("Mòdul:ca-verb/cabre").make_irregulars(forma)
		title = "Segona conjugació irregular"
	elseif radical.simple:find("corr$") then
		forma = require("Mòdul:ca-verb/córrer").make_irregulars(forma)
		title = "Segona conjugació irregular"
	elseif radical.simple:find("f$") then
		forma = require("Mòdul:ca-verb/fer").make_irregulars(forma, zona)
		title = "Segona conjugació irregular"
	elseif radical.simple == "ess" or radical.simple == "s" then
		forma = require("Mòdul:ca-verb/ésser").make_irregulars(forma)
		title = "Segona conjugació irregular"
	elseif radical.simple == "pod" then
		forma = require("Mòdul:ca-verb/poder").make_irregulars(forma)
		title = "Segona conjugació irregular"
	elseif radical.simple == "hav" then
		forma = require("Mòdul:ca-verb/haver").make_irregulars(forma)
		title = "Verb auxiliar"
	elseif radical.simple:find("c$") or radical.simple:find("b$") then
		title = title .. ", amb alternança consonàntica en el radical"
	elseif infinitiu == "nòmer" then
		forma = require("Mòdul:ca-verb/nòmer").make_irregulars(forma)
		title = title .. " defectiva"
	end
	
	return forma, title, categories
end

-- Segona conjugació (-dre, -ure) velaritzada
function conj_2_velar(zona)
	local forma = {}
	local categories = {}
	local title = "Segona conjugació amb formes velaritzades"
	
	local radical = {}
	local radical_velar = {}
	if infinitiu:find("ir$") then
		radical.simple = infinitiu:gsub("([tv])enir$", "%1in"):gsub("dir$", "di"):gsub("ir$", "") -- infinitius irregulars
	else
		radical.simple = string.sub(infinitiu, 1, infinitiu:find("er$") and -3 or -4) -- exc. caler, valer, voler
	end
	radical_velar.simple = radical.simple .. "g"
	radical.aton = radical.simple
	if radical.simple:find("tre$") or radical.simple:find("[hj]e$") then
		radical.aton = radical.simple:gsub("e$", "a")
		radical_velar.aton = radical.aton .. "g"
	end

	if radical.simple:find("[aeio]$") then
		radical.gradual = radical.simple .. "u"
		radical.gradual_aton = radical.aton .. "u"
		if radical.simple:find("[bdl]e$") or radical.simple:find("[lm]o$") or radical.simple:find("h[ae]$")  or radical.simple:find("cri$") then
			if not radical.simple:find("clo$") then
				radical.sonor = radical.aton .. "v"
				title = title .. " amb alternaça consonàntica"
			end
		end
		if radical.simple:find("[^bdhl][ae]$") and radical.simple ~= "ra" then
			radical.antihiat = radical.aton .. "i" -- caient
			radical.antihiat_i = radical.antihiat:gsub("[ae]i$", "e"):gsub("ce$", "que") -- queia
			title = title .. " i vocal antihiàtica"
			if radical.simple:find("ca$") then
				radical_velar.simple = radical.simple .. "ig"
			end
		elseif radical.simple:find("ri$") and not radical.simple:find("cri$") then
			radical.antihiat_i = radical.simple:gsub("i$", "e")
		end
	end

	make_radical(radical, "er")
	make_radical(radical_velar, "velar")
	radical.desinencia0 = radical_velar.simple:gsub("g$", "c")
	
	forma["inf"] = infinitiu
	make_ger(forma, radical, "e", zona)
	
	-- Participis irregulars
	local part = radical_velar.aton_e .. "t"
	local part2 = ""
	local part2_zona = ""
	if radical.simple:find("[cst]ol$") then
		if radical.simple ~= "sol" then
			part = radical.simple .. "t"
		end
	elseif radical.simple:find("mol$") then
		part = radical.simple:gsub("mol$", "mòlt")
	elseif radical.simple:find("ven$") then
		part = radical.simple .. "ut"
		part2 = radical_velar.simple .. "ut"
	elseif radical.simple == "roman" then
		part = "romàs"
	elseif radical.simple:find("[^v]en$") then
		if radical.monosil then
			part = radical.simple:gsub("en$", "es")
		else
			part = radical.simple:gsub("en$", "ès")
			part2 = radical.simple:gsub("en$", "és")
			part2_zona = "val"
		end
	elseif radical.simple:find("pon$") then
		part = radical.simple:gsub("n$", "st")
	elseif radical.simple == "fon" then
		part = "fos"
		part2 = "fus"
		part2_zona = "bal"
	elseif radical.simple == "enfon" then
		part = "enfús"
	elseif radical.simple:find("on$") then
		part = radical.monosil and radical.simple:gsub("on$", "os") or radical.simple:gsub("on$", "ós")
	elseif radical.simple == "ra" then
		part2 = "ras"
	elseif radical.simple:find("ri$") and not radical.simple:find("cri$") then
		part2 = radical.simple .. "st"
		part2_zona = "val"
	elseif radical.simple == "commo" then
		part2 = "commòs"
	elseif radical.simple:find("co$") then
		part2 = part
		part = radical.simple:gsub("co$", "cuit")
	elseif radical.simple:find("clo$") then
		part = radical.monosil and radical.simple .. "s" or radical.simple:gsub("o$", "òs")
	elseif radical.simple:find("tr[ae]$") then
		part = radical.simple:gsub("[ae]$", "et")
	elseif radical.simple:find("ve$") then
		part = radical.simple:gsub("ve$", "vist")
	end
	make_part(forma, part, zona, part2, part2_zona)
	
	make_pres_ind_2(forma, radical, "g", zona)
	make_imperf_ind(forma, radical, "e", zona)
	make_pass(forma, radical_velar, "e", zona)
	make_fut_i_cond(forma, radical.gradual_aton .. (radical.gradual_aton:find("u$") and "" or "d"))
	make_pres_subj_12(forma, radical_velar, "e", zona)
	make_imperf_subj(forma, radical_velar, "e", zona)
	make_imp(forma)
	
	if zona.alt then
		forma["no-ger"] = radical_velar.aton_e .. "ent"
		if part ~= radical_velar.aton_e .. "t" and part2 ~= radical_velar.aton_e .. "t" then
			make_part_no(forma, radical_velar, zona)
			title = title .. ", participi irregular"
		end
	end
	if radical.simple:find("pren$") then
		make_pres_ind_no_2(forma, radical, zona)
	end
	make_imperf_ind_no_2(forma, radical, zona)
	if radical.simple:find("[ln]") then
		make_fut_no(forma, radical_velar.davant_e .. "e", zona)
		make_cond_no_2(forma, radical_velar.davant_e .. "e", zona)
	else
		make_cond_no_2(forma, radical.gradual_aton, zona)
	end
	make_pres_subj_no_velar(forma, radical_velar, zona)
	make_imperf_subj_no_velar(forma, radical, zona)
	
	-- formes irregulars
	if radical.simple:find("[bdl]e$") or radical.simple:find("[lm]o$") then
		forma = require("Mòdul:ca-verb/beure").make_irregulars(forma)
	elseif radical.simple:find("ve$") then
		forma = require("Mòdul:ca-verb/veure").make_irregulars(forma)
		title = "Segona conjugació irregular"
	elseif radical.simple:find("scri$") then
		forma = require("Mòdul:ca-verb/escriure").make_irregulars(forma)
		title = "Segona conjugació irregular"
	elseif radical.simple:find("vi$") then
		forma = require("Mòdul:ca-verb/viure").make_irregulars(forma, zona)
		title = "Segona conjugació irregular"
	elseif radical.simple == "vol" then
		forma = require("Mòdul:ca-verb/voler").make_irregulars(forma)
		title = "Segona conjugació irregular"
	elseif radical.simple:find("[tv]in$") then
		forma = require("Mòdul:ca-verb/mantenir").make_irregulars(forma, zona, infinitiu)
		if infinitiu:find("[tv]enir$") then
			title = "Tercera conjugació irregular amb formes velaritzades i alternança vocàlica"
		else
			title = title .. " i alternança vocàlica"
		end
	elseif infinitiu:find("dir$") then
		forma = require("Mòdul:ca-verb/dir").make_irregulars(forma, zona)
		title = title .. " amb infinitiu irregular"
	elseif radical.simple == "sol" then
		forma = require("Mòdul:ca-verb/soler").make_irregulars(forma)
		title = "Segona conjugació defectiva"
	elseif infinitiu:find("^h[ea]ure$") then
		forma = require("Mòdul:ca-verb/heure").make_irregulars(forma)
		title = "Segona conjugació irregular"
	end
	
	return forma, title, categories
end

-- Tercera conjugació
function conj_3(zona, conj_pura)
	local forma = {}
	local categories = {}
	local tipus_conj = conj_pura and "pura" or "incoativa"
	local title = "Tercera conjugació " .. tipus_conj

	local radical = {}
	radical.simple = NAMESPACE == "Plantilla" and "-" or string.sub(infinitiu, 1, -3)
	
	if radical.simple == "brunz" or radical.simple:find("cud$") or radical.simple:find("ru[mp]$") or radical.simple:find("[en]sum$") or radical.simple:find("ment$") then
		tipus_conj = "mixta"
		title = title .. " i també pura"
	end
	
	make_radical(radical, "ir")
	radical.tonic = radical.simple
	if radical.simple:find("[bc]oll$") or (radical.simple:find("sort$") and radical.simple ~= "assort") or radical.simple == "escop" then
		radical.tonic = radical.simple:reverse():gsub("o", "u", 1):reverse()
		title = title .. " amb alternança vocàlica en el radical"
	end
	radical.desinencia0 = radical.tonic:gsub("fug$", "fuig"):gsub("d$", "t")
	
	forma["inf"] = radical.simple .. "ir"
	make_ger(forma, radical, "i", zona)
	
	local part = ""
	local part2 = ""
	local part2_zona = ""
	if radical.simple:find("cobr$") or radical.simple == "sofr" or radical.simple == "ofer" then
		part = radical.simple:gsub("e?r$", "ert")
		if radical.simple:find("fe?r$") then
			part2 = radical.simple .. "it"
			part2_zona = {"bal", "val", "alg"}
		end
	elseif radical.simple:find("compl$") or radical.simple:find("establ$") or radical.simple == "rebl" or radical.simple == "supl" then
		part = radical.simple .. "ert"
		part2 = radical.simple .. "it"
		part2_zona = {"bal", "val", "alg"}
	elseif radical.simple:find("imprim$") then
		part = radical.simple:gsub("im$", "ès")
		part2 = radical.simple:gsub("im$", "és")
		part2_zona = {"val"}
	elseif radical.simple:find("freg$") then
		part2 = radical.simple:gsub("freg$", "frit")
		part2_zona = {"bal"}
	elseif radical.simple:find("fug$") then
		part2 = radical.simple:gsub("fug$", "fuit")
		part2_zona = {"bal"}
		title = title .. " amb alternances en el radical"
	end
	if part == "" then
		if radical.simple:find("[aeo]$") or radical.simple:find("[^gq]u$") then
			part = radical.simple .. "ït"
			title = title .. " amb hiat entre el radical i la desinència"
		else
			part = radical.simple .. "it"
		end
	else
		title = title .. ", amb participi irregular"
	end
	make_part(forma, part, zona, part2, part2_zona)

	make_pres_ind_3(forma, radical, tipus_conj, zona)
	make_imperf_ind(forma, radical, "i", zona)
	make_pass(forma, radical, "i", zona)
	make_fut_i_cond(forma, radical.simple .. "i")
	make_pres_subj_3(forma, radical, tipus_conj, zona)
	make_imperf_subj(forma, radical, "i", zona)
	make_imp(forma)
	
	if tipus_conj ~= "pura" then
		make_pres_ind_no_3(forma, radical, zona)
	end
	make_imperf_ind_no_3(forma, radical, tipus_conj, zona)
	if tipus_conj == "incoativa" then
		make_pass_no(forma, radical, zona)
	end
	make_cond_no_13(forma, radical.simple .. "i", zona)
	if tipus_conj == "pura" and radical.tonic == radical.simple then
		make_pres_subj_no(forma, radical, "i", zona)
	elseif tipus_conj == "incoativa" or tipus_conj == "mixta" then
		make_pres_subj_no_3(forma, radical, zona)
	end
	make_imperf_subj_no_3(forma, radical, zona)

	if mw.ustring.find(radical.simple, "ü$") then
		forma = require("Mòdul:ca-verb/argüir").make_irregulars(forma)
		title = title .. " amb hiat entre el radical i la desinència"
	elseif radical.simple:find("fr?eg$") or radical.simple:find("lleg$") or radical.simple:find("teix$") or radical.simple:find("teny$") then
		forma = require("Mòdul:ca-verb/llegir").make_irregulars(forma, zona)
		title = title .. " amb variants pures amb alternança vocàlica"
	elseif radical.simple == "fer" or radical.simple == "corfer" or radical.simple == "entrefer" or radical.simple == "malfer" or radical.simple == "pened" then
		forma = require("Mòdul:ca-verb/ferir").make_irregulars(forma, zona)
		title = title .. " amb variants pures"
	elseif radical.simple:find("vest$") or radical.simple == "engol" or radical.simple == "reny" then
		forma = require("Mòdul:ca-verb/vestir").make_irregulars(forma, zona)
		title = title .. " amb variants pures amb alternança vocàlica"
	elseif (radical.simple:find("ompl$") and not radical.simple:find("compl$")) or (radical.simple:find("obr$") and not radical.simple:find("[cpx]obr$")) then
		forma = require("Mòdul:ca-verb/omplir").make_irregulars(forma, zona)
		title = title .. " amb algunes formes velaritzades"
	elseif radical.simple:find("mor$") and tipus_conj == "pura" then
		forma = require("Mòdul:ca-verb/morir").make_irregulars(forma, zona)
	elseif radical.simple:find("cos$") or radical.simple == "toss" then
		forma = require("Mòdul:ca-verb/cosir").make_irregulars(forma, zona)
		title = title .. " amb alternança vocàlica en el radical"
	elseif radical.simple:find("llu$") and not radical.simple:find("e[ns]$") then
		forma = require("Mòdul:ca-verb/lluir").make_irregulars(forma, zona)
		title = title .. ", i formes incoatives quan s'empra figuradament"
	elseif radical.simple == "eix" or radical.simple:find("[es]eix$") then
		forma = require("Mòdul:ca-verb/eixir").make_irregulars(forma, zona)
		title = "Tercera conjugació irregular"
	end
	
	return forma, title, categories
end

-- Alternança consonàntica del radical per canvi de vocal posterior (aou) a vocal anterior (ei)
-- TODO: traslladar a mòdul:ca-general
function radical_aou_ei(stem)
	return (stem:gsub("qu$", "qü"):gsub("c$", "qu"):gsub("ç$", "c"):gsub("gu$", "gü"):gsub("g$", "gu"):gsub("j$", "g"))
end
 
-- Alternança consonàntica del radical per canvi de vocal anterior (ei) a vocal posterior (aou)
-- TODO: traslladar a mòdul:ca-general
function radical_ei_aou(stem)
	return (stem:gsub("c$", "ç"):gsub("qu$", "c"):gsub("qü$", "qu"):gsub("g$", "j"):gsub("gu$", "g"):gsub("gü$", "gu"))
end

-- TODO: traslladar a mòdul:ca-general
function sense_accents(word)
	word = mw.ustring.gsub(word, "à", "a")	
	word = mw.ustring.gsub(word, "[èé]", "e")
	word = mw.ustring.gsub(word, "([gq]u)í", "%1i")
	word = mw.ustring.gsub(word, "([aeiou])í", "%1ï")
	word = mw.ustring.gsub(word, "í", "i")
	word = mw.ustring.gsub(word, "[òó]", "o")
	word = mw.ustring.gsub(word, "ú", "u")
 
	return word
end

-- Create the various base stems that endings are attached to.
function make_radical(radical, conj)
	radical.monosil = not require("Mòdul:ca-general").sil(radical.simple):find("·")
	radical.desinencia0 = radical.simple
	if conj == "ar" then
		if radical.desinencia0:find("[eiï]n$") then
			if not radical.monosil then -- accent excepte monosíl·labs
				local accent_e_tancat = m_util.llista({"afaen", "beren", "gangren", "entren", "desentren", "estren", "destren",
					"reestren", "orden", "desorden", "contraorden", "reorden"})
				if accent_e_tancat[radical.simple] then
					radical.desinencia0 = radical.desinencia0:gsub("en$", "én")
				else
					radical.desinencia0 = radical.desinencia0:gsub("en$", "èn")
					radical.desinencia0 = mw.ustring.gsub(radical.desinencia0, "[iï]n$", "ín")
				end
			end
		elseif mw.ustring.find(radical.desinencia0, "[aeiïou]s+$") then
			if not radical.monosil then -- accent excepte monosíl·labs
				local accent_e_tancat = m_util.llista({"aves", "contrapes", "malaves", "repes", "sospes"})
				local accent_o_tancat = m_util.llista({"desemboss", "reemboss", "endoss"})
				if accent_e_tancat[radical.desinencia0] then
					radical.desinencia0 = radical.desinencia0:gsub("es+$", "és")
				elseif mw.ustring.find(radical.desinencia0, "ess$") and radical.desinencia0 ~= "disfress" then
					radical.desinencia0 = radical.desinencia0:gsub("ess$", "és")
				elseif accent_o_tancat[radical.desinencia0] then
					radical.desinencia0 = radical.desinencia0:gsub("os+$", "ós")
				else
					radical.desinencia0 = radical.desinencia0:gsub("as+$", "às")
					radical.desinencia0 = radical.desinencia0:gsub("es+$", "ès")
					radical.desinencia0 = mw.ustring.gsub(radical.desinencia0, "[iï]s+$", "ís")
					radical.desinencia0 = radical.desinencia0:gsub("os+$", "òs")
					radical.desinencia0 = radical.desinencia0:gsub("us+$", "ús")
				end
			elseif radical.desinencia0 == "us" or radical.desinencia0 == "caus" then
				radical.desinencia0 = radical.desinencia0:gsub("us$", "ús")
			else
				radical.desinencia0 = radical.desinencia0:gsub("tres", "très") -- accent diacrític
				radical.desinencia0 = radical.desinencia0:gsub("res$", "rés") -- accent diacrític
				radical.desinencia0 = radical.desinencia0:gsub("([aeiou])ss$", "%1s")
			end
		elseif radical.desinencia0:find("[^aeiou][ei]$") or radical.desinencia0:find("[gq]ui$") then
			radical.desinencia0alt = radical.desinencia0 .. "i" -- model crei, canvii, guii, però esglai
			radical.desinencia0 = nil -- regular en alguerès: canvio pronunciat canvic
		elseif radical.desinencia0:find("[aeiou]j$") then
			radical.desinencia0 = radical.desinencia0:gsub("i?j$", "ig") -- model puig, però enfastig, viatj
		elseif radical.desinencia0:find("o$") or radical.desinencia0:find("[^aeiougq]u$") then
			radical.desinencia0 = radical.desinencia0 .. "u" -- model llou però creu, adequo
		elseif radical.desinencia0:find("[gq]u$") then
			radical.desinencia0 = nil
		elseif radical.desinencia0:find("[aeiou]v$") then
			radical.desinencia0alt = radical.desinencia0:gsub("v$", "u") -- forma alternativa
		else
			radical.desinencia0 = mw.ustring.gsub(radical.desinencia0, "l·l$", "l")
			radical.desinencia0 = radical.desinencia0:gsub("nn$", "n")
		end
	end
	
	radical.aton = radical.aton or radical.simple
	if conj == "ar" or conj == "velar" then
		radical.davant_aou = radical.simple
		radical.davant_e = radical_aou_ei(radical.simple) -- alternança consonàntica davant vocal anterior (ei)
		if radical.davant_e:find("[gq]ui$") then
			radical.davant_i = radical.davant_e
		else
			radical.davant_i = radical.davant_e:gsub("([aeiou])i$", "%1") -- reducció i final davant i
		end
		radical.aton_e = radical.davant_e
		radical.aton_i = radical.davant_i
		if radical.davant_e:find("tregu$") or radical.davant_e:find("[hj]egu$") then
			radical.aton_e = radical.davant_e:gsub("egu$", "agu") -- velar àton de -jeure, -treure
			radical.aton_i = radical.aton_e
		end
	else
		radical.davant_aou = radical_ei_aou(radical.simple) -- alternança consonàntica davant vocal posterior (aou)
		radical.davant_e = radical.simple
		radical.davant_i = radical.simple
		radical.aton_e = radical.simple
		radical.aton_i = radical.simple
	end
	
	radical.gradual = radical.gradual or radical.simple -- beu-
	radical.gradual_aton = radical.gradual_aton or radical.gradual -- jau-, trau-
	radical.sonor = radical.sonor or radical.simple -- bev-
	radical.antihiat = radical.antihiat or radical.simple -- cai-ent
	radical.antihiat_iA = (radical.antihiat_i and radical.antihiat_i:gsub("e$", "è") or radical.sonor) -- què-iem
	radical.antihiat_i = radical.antihiat_i or radical.sonor -- que-ia

	radical.sord = radical.gradual:gsub("b$", "p"):gsub("c$", "ç")
	radical.sord_A = radical.sord
	if not radical.monosil and radical.simple:find("en$")  then
		if radical.simple:find("[ct]en") then
			radical.sord_A = radical.simple:gsub("en$", "én")
		else
			radical.sord_A = radical.simple:gsub("en$", "èn")
		end
	end
end

function make_ger(forma, radical, vocal, zona)
	forma.ger = {}
	forma.ger[1] = {}
	if radical.antihiat ~= radical.simple then
		forma.ger[1][1] = radical.antihiat .. vocal .. "nt"
		if zona.val then
			forma.ger[2] = {}
			forma.ger[2][1] = radical.simple .. vocal .. "nt"
			forma.ger[2]["nota"] = "val"
		end
	else
		forma.ger[1][1] = radical.sonor .. vocal .. "nt"
	end
end

function make_part(forma, part_ms, zona, part_2, zona_2)
	local part_fs = m_lema.forma_femenina(part_ms):gsub("ssa$", "sa"):gsub("([^gq])uida$", "%1uita")
	local part_mp, part_mp2 = m_lema.forma_plural(part_ms)
	part_mp = part_mp2 ~= "" and part_mp2 or part_mp:gsub("ssos$", "sos"):gsub("es$", "esos")
	forma.part = {}
	forma.part[1] = {}
	forma.part[1]["m-s"] = part_ms
	forma.part[1]["f-s"] = part_fs
	forma.part[1]["m-p"] = part_mp
	forma.part[1]["f-p"] = m_lema.forma_plural(part_fs)
	-- Participis alternatius
	if (part_2 or "") ~= "" then
		if type(zona_2) == "table" or (zona_2 or "") == "" or zona[zona_2 or "x"] then
			forma.part[2] = {}
			forma.part[2]["m-s"] = part_2
			if sense_accents(part_ms) ~= sense_accents(part_2) then
				part_fs = m_lema.forma_femenina(part_2):gsub("ssa$", "sa"):gsub("uida$", "uita"):gsub("frida$", "frita")
				forma.part[2]["f-s"] = part_fs
				forma.part[2]["m-p"] = m_lema.forma_plural(part_2):gsub("ssos$", "sos"):gsub("es$", "esos")
				forma.part[2]["f-p"] = m_lema.forma_plural(part_fs)
			end
			if type(zona_2) == "table" then
				forma.part[2]["nota"] = llista_zones(zona_2, zona)
			elseif (zona_2 or "") ~= "" then
				forma.part[2]["nota"] = zona_2
			end
		end
	end
end

function make_pres_ind_1(forma, radical, zona)

	local hiat = radical.davant_e:find("[eio]$") or radical.davant_e:find("[^aeiougq]u$") or (radical.davant_i ~= radical.davant_e)
	
	forma["pres-ind"] = {}
	
	forma["pres-ind"][1] = {}
	if zona.centr or zona.nocc or radical.desinencia0 == nil then
		forma["pres-ind"][1][1] = radical.simple .. "o"
	end
	forma["pres-ind"][1][2] = radical.davant_e .. "es"
	forma["pres-ind"][1][3] = radical.simple .. "a"
	if zona.occ or zona.sept or zona.centr or zona.alg then
		forma["pres-ind"][1][4] = radical.davant_e .. "em"
	end
	if zona.occ or zona.sept or zona.centr then
		forma["pres-ind"][1][5] = radical.davant_e .. "eu"
	end
	forma["pres-ind"][1][6] = radical.davant_e .. "en"
	
	local fila = 2
	if zona.val then
		forma["pres-ind"][fila] = {}
		forma["pres-ind"][fila][1] = radical.davant_e .. "e"
		forma["pres-ind"][fila]["nota"] = "val"
		fila = fila + 1
	end
	
	if zona.sept then
		forma["pres-ind"][fila] = {}
		forma["pres-ind"][fila][1] = radical.davant_i .. (hiat and "ï" or "i")
		forma["pres-ind"][fila]["nota"] = "sept"
		fila = fila + 1
	end
	
	if zona.bal or zona.alg then
		forma["pres-ind"][fila] = {}
		if radical.desinencia0 then
			forma["pres-ind"][fila][1] = radical.desinencia0
		end
		forma["pres-ind"][fila][5] = radical.simple .. "au"
		if zona.bal and zona.alg then
			forma["pres-ind"][fila]["nota"] = "bal, alg"
			
			forma["pres-ind"][fila+1] = {}
			if radical.desinencia0alt then
				forma["pres-ind"][fila+1][1] = radical.desinencia0alt
			end
			forma["pres-ind"][fila+1][4] = radical.simple .. "am"
			forma["pres-ind"][fila+1]["nota"] = "bal"
		elseif zona.bal then
			forma["pres-ind"][fila][4] = radical.simple .. "am"
			forma["pres-ind"][fila]["nota"] = "bal"
			
			if radical.desinencia0alt then
				forma["pres-ind"][fila+1] = {}
				forma["pres-ind"][fila+1][1] = radical.desinencia0alt
				forma["pres-ind"][fila+1]["nota"] = "bal"
			end
		else
			forma["pres-ind"][fila]["nota"] = "alg"
		end
	end
end

function make_pres_ind_2(forma, radical, vocal, zona)
	forma["pres-ind"] = {}
	
	forma["pres-ind"][1] = {}
	if (zona.centr or zona.nocc) then
		forma["pres-ind"][1][1] = radical.davant_aou .. "o"
	end
	forma["pres-ind"][1][2] = mw.ustring.gsub(radical.sord, "ç$", "ce") .. "s"
	forma["pres-ind"][1][3] = radical.sord_A
	forma["pres-ind"][1][4] = radical.sonor .. "em"
	forma["pres-ind"][1][5] = radical.sonor .. "eu"
	forma["pres-ind"][1][6] = radical.gradual .. "en"
	local fila = 2
	
	if vocal == "g" then
		forma["pres-ind"][1][1] = radical.desinencia0
		if radical.antihiat ~= radical.simple then
			forma["pres-ind"][1][4] = radical.antihiat .. "em"
			forma["pres-ind"][1][5] = radical.antihiat .. "eu"
			if zona.val then
				forma["pres-ind"][2] = {}
				forma["pres-ind"][2][4] = radical.simple .. "em"
				forma["pres-ind"][2][5] = radical.simple .. "eu"
				forma["pres-ind"][2]["nota"] = "val"
				fila = fila + 1
			end
		elseif zona.val and mw.ustring.find(radical.sord_A, "èn$") then
			forma["pres-ind"][2] = {}
			forma["pres-ind"][2][3] = mw.ustring.gsub(radical.sord_A, "èn$", "én")
			forma["pres-ind"][2]["nota"] = "val"
		end
		if radical.antihiat_i ~= radical.antihiat and zona.bal then
			forma["pres-ind"][fila] = {}
			forma["pres-ind"][fila][4] = radical.antihiat_i .. "im"
			forma["pres-ind"][fila][5] = radical.antihiat_i .. "is"
			forma["pres-ind"][fila]["nota"] = "bal"
		end
	else
		if zona.val or zona.bal or zona.alg then
			forma["pres-ind"][fila] = {}
			forma["pres-ind"][fila][1] = radical.sord
			forma["pres-ind"][fila]["nota"] = llista_zones({"val", "bal", "alg"}, zona)
			fila = fila + 1
		end
		
		if zona.sept then
			forma["pres-ind"][fila] = {}
			forma["pres-ind"][fila][1] = radical.simple .. "i"
			forma["pres-ind"][fila]["nota"] = "sept"
		end
	end
end

function make_pres_ind_3(forma, radical, tipus, zona)
	local hiat = radical.simple:find("[aeio]$") or radical.simple:find("[^gq]u$")
	forma["pres-ind"] = {}
	local fila = 1
	
	if tipus == "incoativa" or tipus == "mixta" then
		forma["pres-ind"][1] = {}
		if zona.centr then
			forma["pres-ind"][1][1] = radical.simple .. "eixo"
		end
		if zona.ori then
			forma["pres-ind"][1][2] = radical.simple .. "eixes"
			forma["pres-ind"][1][3] = radical.simple .. "eix"
			forma["pres-ind"][1][6] = radical.simple .. "eixen"
		end
		forma["pres-ind"][1][4] = radical.simple .. (hiat and "ïm" or "im")
		forma["pres-ind"][1][5] = radical.simple .. (hiat and "ïu" or "iu")
		
		fila = 2
		if zona.bal then
			forma["pres-ind"][fila] = {}
			forma["pres-ind"][fila][1] = radical.simple .. "esc"
			forma["pres-ind"][fila]["nota"] = "bal"
			fila = fila + 1
		end
		if zona.sept then
			forma["pres-ind"][fila] = {}
			forma["pres-ind"][fila][1] = radical.simple .. "eixi"
			forma["pres-ind"][fila]["nota"] = "sept"
			fila = fila + 1
		end
		
		if zona.occ then
			forma["pres-ind"][fila] = {}
			if zona.val then
				forma["pres-ind"][fila][1] = radical.simple .. (hiat and "ïsc" or "isc")
			end
			forma["pres-ind"][fila][2] = radical.simple .. (hiat and "ïxes" or "ixes")
			forma["pres-ind"][fila][3] = radical.simple .. (hiat and "ïx" or "ix")
			forma["pres-ind"][fila][6] = radical.simple .. (hiat and "ïxen" or "ixen")
			forma["pres-ind"][fila]["nota"] = "occ"
			
			fila = fila + 1
			if zona.nocc then
				forma["pres-ind"][fila] = {}
				forma["pres-ind"][fila][1] = radical.simple .. (hiat and "ïxo" or "ixo")
				forma["pres-ind"][fila]["nota"] = "n-occ"
				fila = fila + 1
			end
		end
		
		if (zona.val or zona.sept) and radical.simple:find("o$") and not radical.simple:find("ro$") then -- oir i derivats
			forma["pres-ind"][fila] = {}
			forma["pres-ind"][fila][2] = radical.simple .. "us"
			forma["pres-ind"][fila][3] = radical.simple .. "u"
			forma["pres-ind"][fila][6] = radical.simple .. "uen"
			forma["pres-ind"][fila]["nota"] = llista_zones({"val", "sept"}, zona)
			fila = fila + 1
		end
	end
	
	if tipus == "pura" or tipus == "mixta" then
		local radical0 = radical.tonic:gsub("d$" , "t") .. (hiat and "u" or "")
		local radical_accent = (radical.simple == "llu" or radical.simple == "pru") and radical.simple or radical.simple:gsub("u$", "ú")
		forma["pres-ind"][fila] = {}
		if zona.centr or zona.nocc then
			forma["pres-ind"][fila][1] = radical_ei_aou(radical.tonic) .. "o"
		end
		forma["pres-ind"][fila][2] = radical0 .. ((radical0 == "brunz" or radical0:find("fug$")) and "es" or "s")
		forma["pres-ind"][fila][3] = radical.desinencia0 .. (hiat and "u" or "")
		if tipus == "pura" then
			forma["pres-ind"][fila][4] = radical.simple .. (hiat and "ïm" or "im")
			forma["pres-ind"][fila][5] = radical.simple .. (hiat and "ïu" or "iu")
		end
		forma["pres-ind"][fila][6] = radical.tonic .. "en"
		fila = fila + 1
		
		if hiat then
			forma["pres-ind"][fila] = {}
			forma["pres-ind"][fila][1] = radical.simple .. "u"
			forma["pres-ind"][fila][2] = radical_accent .. "s"
			forma["pres-ind"][fila][3] = radical_accent
			fila = fila + 1
		elseif zona.val or zona.bal or (zona.alg and tipus == "pura") then
			forma["pres-ind"][fila] = {}
			forma["pres-ind"][fila][1] = radical.desinencia0
			if tipus == "pura" then
				forma["pres-ind"][fila]["nota"] = llista_zones({"bal", "val", "alg"}, zona)
			else
				forma["pres-ind"][fila]["nota"] = llista_zones({"bal", "val"}, zona)
			end
			fila = fila + 1
		end
		
		if zona.sept then
			forma["pres-ind"][fila] = {}
			forma["pres-ind"][fila][1] = radical.tonic .. (hiat and "ï" or "i")
			forma["pres-ind"][fila]["nota"] = "sept"
		end
	end
end

function make_imperf_ind(forma, radical, vocal, zona)
	local arrel = radical.simple .. "av"
	local arrelA = radical.simple .. "àv"
	if vocal == "e" then
		arrel = radical.antihiat_i .. ((radical.antihiat_i:find("[ao]$") or radical.antihiat_i:find("[^gq]u$")) and "ï" or "i")
		arrelA = radical.antihiat_iA .. (radical.antihiat_iA == radical.antihiat_i and "í" or "i")
	elseif vocal == "i" then
		arrel = radical.antihiat_i .. ((radical.antihiat_i:find("[aeo]$") or radical.antihiat_i:find("[^gq]u$")) and "ï" or "i")
		arrelA = radical.antihiat_iA .. (radical.antihiat_iA == radical.antihiat_i and "í" or "i")
	end
	forma["imperf-ind"] = {}
	forma["imperf-ind"][1] = {}
	forma["imperf-ind"][1][1] = arrel .. "a"
	forma["imperf-ind"][1][2] = arrel .. "es"
	forma["imperf-ind"][1][3] = arrel .. "a"
	forma["imperf-ind"][1][4] = arrelA .. "em"
	forma["imperf-ind"][1][5] = arrelA .. "eu"
	forma["imperf-ind"][1][6] = arrel .. "en"
	
	if mw.ustring.find(arrelA, "èi$") and zona.val then
		arrelA = mw.ustring.gsub(arrelA, "èi$", "éi")
		forma["imperf-ind"][2] = {}
		forma["imperf-ind"][2][4] = arrelA .. "em"
		forma["imperf-ind"][2][5] = arrelA .. "eu"
		forma["imperf-ind"][2]["nota"] = "val"
	end
end

function make_pass(forma, radical, vocal, zona)
	local tema = radical.simple .. "a"
	local temaA = radical.simple .. "à"

	if vocal == "e" then
		tema = radical.aton_e .. "e"
		temaA = radical.aton_e .. "é"
	elseif vocal == "i" then
		tema = radical.simple .. ((radical.simple:find("[aeo]$") or radical.simple:find("[^gq]u$"))and "ï" or "i")
		temaA = radical.simple .. "í"
	end

	forma.pass = {}
	forma.pass[1] = {}
	forma.pass[1][1] = radical.aton_i .. "í"
	forma.pass[1][2] = tema .. "res"
	forma.pass[1][3] = temaA
	forma.pass[1][4] = temaA .. "rem"
	forma.pass[1][5] = temaA .. "reu"
	forma.pass[1][6] = tema .. "ren"
	
	if tema:find("vengue$") and zona.bal then
		local radical_alt = tema:gsub("gue$", "")
		forma.pass[2] = {}
		forma.pass[2][1] = radical_alt .. "í"
		forma.pass[2][2] = radical_alt .. "eres"
		forma.pass[2][3] = radical_alt .. "é"
		forma.pass[2][4] = radical_alt .. "érem"
		forma.pass[2][5] = radical_alt .. "éreu"
		forma.pass[2][6] = radical_alt .. "eren"
		forma.pass[2]["nota"] = "bal"
	end
end

function make_fut_i_cond(forma, tema)
	
	forma.fut = {}
	
	forma.fut[1] = {}
	forma.fut[1][1] = tema .. "ré"
	forma.fut[1][2] = tema .. "ràs"
	forma.fut[1][3] = tema .. "rà"
	forma.fut[1][4] = tema .. "rem"
	forma.fut[1][5] = tema .. "reu"
	forma.fut[1][6] = tema .. "ran"
	
	forma.cond = {}
	
	forma.cond[1] = {}
	forma.cond[1][1] = tema .. "ria"
	forma.cond[1][2] = tema .. "ries"
	forma.cond[1][3] = tema .. "ria"
	forma.cond[1][4] = tema .. "ríem"
	forma.cond[1][5] = tema .. "ríeu"
	forma.cond[1][6] = tema .. "rien"
end

function make_pres_subj_12(forma, radical, vocal, zona)
	local tema = radical.davant_e .. "e"
	if vocal == "e" then
		tema = radical.davant_aou .. "a"
	end
	local hiat = radical.davant_e:find("[eio]$") or radical.davant_e:find("[^aeiougq]u$") or (radical.davant_i ~= radical.davant_e)
	
	forma["pres-subj"] = {}
	
	local fila = 1
	forma["pres-subj"][1] = {}
	forma["pres-subj"][1][4] = radical.davant_e .. "em"
	forma["pres-subj"][1][5] = radical.davant_e .. "eu"
	if zona.ori then
		forma["pres-subj"][1][1] = radical.davant_i .. (hiat and "ï" or "i")
		forma["pres-subj"][1][2] = radical.davant_i .. (hiat and "ïs" or "is")
		forma["pres-subj"][1][3] = radical.davant_i .. (hiat and "ï" or "i")
		forma["pres-subj"][1][6] = radical.davant_i .. (hiat and "ïn" or "in")
		fila = fila + 1
	end
	
	if zona.occ or (vocal == "e" and zona.bal) then
		if fila ~= 1 then
			forma["pres-subj"][fila] = {}
		end
		forma["pres-subj"][fila][1] = tema
		forma["pres-subj"][fila][2] = radical.davant_e .. "es"
		forma["pres-subj"][fila][3] = tema
		forma["pres-subj"][fila][6] = radical.davant_e .. "en"
		forma["pres-subj"][fila]["nota"] = llista_zones({"occ", "bal"}, zona)
	end
end

function make_pres_subj_3(forma, radical, tipus, zona)
	local tema = radical.simple .. ((radical.simple:find("[aeo]$") or radical.simple:find("[^gq]u$"))and "ï" or "i")
	
	forma["pres-subj"] = {}
	local fila = 1
	
	if tipus == "incoativa" or tipus == "mixta" then
		if zona.centr or zona.sept or zona.alg or zona.occ then
			forma["pres-subj"][fila] = {}
			forma["pres-subj"][fila][4] = tema .. "m"
			forma["pres-subj"][fila][5] = tema .. "u"
			if zona.centr or zona.sept or zona.alg then
				forma["pres-subj"][fila][1] = radical.simple .. "eixi"
				forma["pres-subj"][fila][2] = radical.simple .. "eixis"
				forma["pres-subj"][fila][3] = radical.simple .. "eixi"
				forma["pres-subj"][fila][6] = radical.simple .. "eixin"
			end
			fila = fila + 1
		end
		
		if zona.occ then
			forma["pres-subj"][fila] = {}
			forma["pres-subj"][fila][1] = tema .. "sca"
			forma["pres-subj"][fila][2] = tema .. "sques"
			forma["pres-subj"][fila][3] = tema .. "sca"
			forma["pres-subj"][fila][6] = tema .. "squen"
			forma["pres-subj"][fila]["nota"] = "occ"
			fila = fila + 1
		end
		
		if zona.bal then
			forma["pres-subj"][fila] = {}
			forma["pres-subj"][fila][1] = radical.simple .. "esqui"
			forma["pres-subj"][fila][2] = radical.simple .. "esquis"
			forma["pres-subj"][fila][3] = radical.simple .. "esqui"
			forma["pres-subj"][fila][4] = tema .. "guem"
			forma["pres-subj"][fila][5] = tema .. "gueu"
			forma["pres-subj"][fila][6] = radical.simple .. "esquin"
			forma["pres-subj"][fila]["nota"] = "bal"
			fila = fila + 1
		end
		
		if tipus == "mixta" then
			if zona.centr or zona.sept or zona.bal then
				forma["pres-subj"][fila] = {}
				forma["pres-subj"][fila][1] = radical.simple .. "i"
				forma["pres-subj"][fila][2] = radical.simple .. "is"
				forma["pres-subj"][fila][3] = radical.simple .. "i"
				forma["pres-subj"][fila][6] = radical.simple .. "in"
				forma["pres-subj"][fila]["nota"] = llista_zones({"centr", "bal", "sept"}, zona)
				fila = fila + 1
			end
			
			if zona.nocc or zona.bal then
				forma["pres-subj"][fila] = {}
				forma["pres-subj"][fila][1] = radical.simple .. "a"
				forma["pres-subj"][fila][2] = radical.simple .. "es"
				forma["pres-subj"][fila][3] = radical.simple .. "a"
				forma["pres-subj"][fila][6] = radical.simple .. "en"
				forma["pres-subj"][fila]["nota"] = llista_zones({"n-occ", "bal"}, zona)
			end
		end
	
	elseif tipus == "pura" then
		local hiat = radical.simple:find("u$")
		forma["pres-subj"][fila] = {}
		if zona.ori then
			forma["pres-subj"][fila][1] = radical.tonic .. (hiat and "ï" or "i")
			forma["pres-subj"][fila][2] = radical.tonic .. (hiat and "ïs" or "is")
			forma["pres-subj"][fila][3] = radical.tonic .. (hiat and "ï" or "i")
			forma["pres-subj"][fila][6] = radical.tonic .. (hiat and "ïn" or "in")
		end
		if zona.occ or zona.centr or zona.sept or zona.alg then
			forma["pres-subj"][fila][4] = radical.simple .. (hiat and "ïm" or "im")
			forma["pres-subj"][fila][5] = radical.simple .. (hiat and "ïu" or "iu")
		end
		fila = fila + 1
		
		if zona.occ then
			forma["pres-subj"][fila] = {}
			forma["pres-subj"][fila][1] = radical_ei_aou(radical.tonic) .. "a"
			forma["pres-subj"][fila][2] = radical.tonic .. "es"
			forma["pres-subj"][fila][3] = radical_ei_aou(radical.tonic) .. "a"
			forma["pres-subj"][fila][6] = radical.tonic .. "en"
			forma["pres-subj"][fila]["nota"] = "occ"
			fila = fila + 1
		end
		
		if zona.bal then
			forma["pres-subj"][fila] = {}
			forma["pres-subj"][fila][4] = radical.simple .. (hiat and "ïguem" or "iguem")
			forma["pres-subj"][fila][5] = radical.simple .. (hiat and "ïgueu" or "igueu")
			forma["pres-subj"][fila]["nota"] = "bal"
			fila = fila + 1
		end
	end
end

function make_imperf_subj(forma, radical, vocal, zona)
	local tema = radical.aton_e .. "e"
	local temaA = radical.aton_e .. "é"
	local temaval = radical.simple .. "a"
	local temavalA = radical.simple .. "à"
	if vocal == "e" then
		temaval = radical.davant_e .. "e"
		temavalA = radical.davant_e .. "é"
	elseif vocal == "i" then
		tema = radical.simple .. ((radical.simple:find("[aeo]$") or radical.simple:find("[^gq]u$")) and "ï" or "i")
		temaA = radical.simple .. "í"
		temaval = tema
		temavalA = temaA
	end

	forma["imperf-subj"] = {}
	
	local fila = 1
	if zona.ori or zona.nocc then
		forma["imperf-subj"][fila] = {}
		if zona.sept or zona.centr or zona.bal or zona.nocc then
			forma["imperf-subj"][fila][1] = temaA .. "s"
			forma["imperf-subj"][fila][3] = temaA .. "s"
		end
		if zona.ori then
			forma["imperf-subj"][fila][2] = tema .. "ssis"
			forma["imperf-subj"][fila][4] = temaA .. "ssim"
			forma["imperf-subj"][fila][5] = temaA .. "ssiu"
			forma["imperf-subj"][fila][6] = tema .. "ssin"
		end
		fila = fila + 1
	end
	
	if zona.sept or zona.centr or zona.nocc or (zona.bal and (vocal == "e" or vocal == "i")) then
		forma["imperf-subj"][fila] = {}
		forma["imperf-subj"][fila][2] = tema .. "sses"
		forma["imperf-subj"][fila][4] = temaA .. "ssem"
		forma["imperf-subj"][fila][5] = temaA .. "sseu"
		forma["imperf-subj"][fila][6] = tema .. "ssen"
		fila = fila + 1
	end
	
	if zona.bal and vocal == "a" then
		forma["imperf-subj"][fila] = {}
		forma["imperf-subj"][fila][1] = radical.simple .. "às"
		forma["imperf-subj"][fila][2] = radical.simple .. "assis"
		forma["imperf-subj"][fila][3] = radical.simple .. "às"
		forma["imperf-subj"][fila][4] = radical.simple .. "àssim"
		forma["imperf-subj"][fila][5] = radical.simple .. "àssiu"
		forma["imperf-subj"][fila][6] = radical.simple .. "assin"
		forma["imperf-subj"][fila]["nota"] = "bal"
		fila = fila + 1
	end
	
	if (zona.bal or zona.val) and vocal == "a" then
		forma["imperf-subj"][fila] = {}
		forma["imperf-subj"][fila][2] = radical.simple .. "asses"
		forma["imperf-subj"][fila][4] = radical.simple .. "àssem"
		forma["imperf-subj"][fila][5] = radical.simple .. "àsseu"
		forma["imperf-subj"][fila][6] = radical.simple .. "assen"
		forma["imperf-subj"][fila]["nota"] = llista_zones({"val", "bal"}, zona) .. " (1)"
		fila = fila + 1
	end
	
	if zona.val then
		forma["imperf-subj"][fila] = {}
		forma["imperf-subj"][fila][1] = temaval .. "ra"
		forma["imperf-subj"][fila][2] = temaval .. "res"
		forma["imperf-subj"][fila][3] = temaval .. "ra"
		forma["imperf-subj"][fila][4] = temavalA .. "rem"
		forma["imperf-subj"][fila][5] = temavalA .. "reu"
		forma["imperf-subj"][fila][6] = temaval .. "ren"
		forma["imperf-subj"][fila]["nota"] = "val"
		fila = fila + 1
	end
	
	if tema:find("vengue$") and zona.bal then
		local radical_alt = tema:gsub("gue$", "")
		forma["imperf-subj"][fila] = {}
		forma["imperf-subj"][fila][1] = radical_alt .. "és"
		forma["imperf-subj"][fila][2] = radical_alt .. "essis"
		forma["imperf-subj"][fila][3] = radical_alt .. "és"
		forma["imperf-subj"][fila][4] = radical_alt .. "éssim"
		forma["imperf-subj"][fila][5] = radical_alt .. "éssiu"
		forma["imperf-subj"][fila][6] = radical_alt .. "essin"
		forma["imperf-subj"][fila]["nota"] = "bal"
	end
end

function make_imp(forma)
	local imp = {}
	for fila in ipairs(forma["pres-ind"]) do
		if forma["pres-ind"][fila][3] or forma["pres-ind"][fila][5] then
			if not imp[forma["pres-ind"][fila]["nota"] or "aa"] then
				imp[forma["pres-ind"][fila]["nota"] or "aa"] = {}
			end
			imp[forma["pres-ind"][fila]["nota"] or "aa"][2] = imp[forma["pres-ind"][fila]["nota"] or "aa"][2] or forma["pres-ind"][fila][3]
			imp[forma["pres-ind"][fila]["nota"] or "aa"][5] = imp[forma["pres-ind"][fila]["nota"] or "aa"][5] or forma["pres-ind"][fila][5]
		end
	end
	for fila in ipairs(forma["pres-subj"]) do
		if forma["pres-subj"][fila][3] or forma["pres-subj"][fila][4] or forma["pres-subj"][fila][6] then
			if not imp[forma["pres-subj"][fila]["nota"] or "aa"] then
				imp[forma["pres-subj"][fila]["nota"] or "aa"] = {}
			end
			imp[forma["pres-subj"][fila]["nota"] or "aa"][3] = imp[forma["pres-subj"][fila]["nota"] or "aa"][3] or forma["pres-subj"][fila][3]
			imp[forma["pres-subj"][fila]["nota"] or "aa"][4] = imp[forma["pres-subj"][fila]["nota"] or "aa"][4] or forma["pres-subj"][fila][4]
			imp[forma["pres-subj"][fila]["nota"] or "aa"][6] = imp[forma["pres-subj"][fila]["nota"] or "aa"][6] or forma["pres-subj"][fila][6]
		end
	end
	
	forma.imp = {}
	local fila = 1
	for k in m_util.spairs(imp) do
		forma.imp[fila] = {}
		for j = 2, 6 do
			if imp[k][j] then
				forma.imp[fila][j] = imp[k][j]
			end
		end
		if k ~= "aa" then
			forma.imp[fila]["nota"] = k
		end
		fila = fila + 1
	end
end

function make_part_no(forma, radical, zona)
	if zona.alt and (zona.centr or zona.bal or zona.occ) then
		forma["no-part"] = {}
		forma["no-part"]["m-s"] = radical.aton .. "ut"
		forma["no-part"]["f-s"] = radical.aton .. "uda"
		forma["no-part"]["m-p"] = radical.aton .. "uts"
		forma["no-part"]["f-p"] = radical.aton .. "udes"
		forma["no-part"]["nota"] = llista_zones({"centr", "occ", "bal"}, zona)
	end
end

function make_pres_ind_no_2(forma, radical, zona)
	if radical.simple:find("pren$") then
		if (zona.alt and (zona.sept or zona.bal or zona.val)) or zona.alg then
			forma["no-pres-ind"] = {}
			forma["no-pres-ind"][1] = {}
			forma["no-pres-ind"][1][4] = radical.simple .. "im"
			forma["no-pres-ind"][1][5] = radical.simple .. "iu"
			if zona.alt then
				forma["no-pres-ind"][1]["nota"] = llista_zones({"val", "bal", "sept", "alg"}, zona)
			else
				forma["no-pres-ind"][1]["nota"] = llista_zones({"alg"}, zona)
			end
		end
	elseif zona.alt and (zona.sept or zona.centr or zona.nocc) then
		forma["no-pres-ind"] = {}
		forma["no-pres-ind"][1] = {}
		forma["no-pres-ind"][1][2] = radical.simple .. "es"
		forma["no-pres-ind"][1][3] = radical.simple .. "e"
		forma["no-pres-ind"][1]["nota"] = llista_zones({"centr", "n-occ", "sept"}, zona)
		if forma["no-pres-ind"][1][2] == forma["pres-ind"][1][2] then forma["no-pres-ind"][1][2] = nil end
	end
end

function make_pres_ind_no_3(forma, radical, zona)
	if (zona.alt and zona.bal) or zona.alg then
		forma["no-pres-ind"] = {}
		forma["no-pres-ind"][1] = {}
		forma["no-pres-ind"][1][1] = radical.simple .. "eix"
		if zona.alt then
			forma["no-pres-ind"][1]["nota"] = llista_zones({"bal", "alg"}, zona)
		else
			forma["no-pres-ind"][1]["nota"] = llista_zones({"alg"}, zona)
		end
	end
end

function make_imperf_ind_no_1(forma, radical, zona)
	if zona.alt and (zona.sept or zona.centr or zona.nocc) then
		forma["no-imperf-ind"] = {}
		
		local fila = 1
		if zona.centr or zona.nocc then
			forma["no-imperf-ind"][fila] = {}
			forma["no-imperf-ind"][fila][4] = radical.simple .. "àvom"
			forma["no-imperf-ind"][fila][5] = radical.simple .. "avo"
			forma["no-imperf-ind"][fila]["nota"] = llista_zones({"centr", "n-occ"}, zona)
			fila = fila + 1
		end
		
		if zona.sept then
			forma["no-imperf-ind"][fila] = {}
			forma["no-imperf-ind"][fila][1] = radical.simple .. "avi"
			forma["no-imperf-ind"][fila]["nota"] = "sept"
			fila = fila + 1
		end
		
		if zona.nocc then
			forma["no-imperf-ind"][fila] = {}
			forma["no-imperf-ind"][fila][1] = radical.simple .. "aia"
			forma["no-imperf-ind"][fila][2] = radical.simple .. "aies"
			forma["no-imperf-ind"][fila][3] = radical.simple .. "aia"
			forma["no-imperf-ind"][fila][4] = radical.simple .. "àiem"
			forma["no-imperf-ind"][fila][5] = radical.simple .. "aieu"
			forma["no-imperf-ind"][fila][6] = radical.simple .. "aien"
			forma["no-imperf-ind"][fila]["nota"] = "n-occ"
		end
	end
end

function make_imperf_ind_no_2(forma, radical, zona)
	if (zona.alt and zona.nocc) or zona.alg then
		forma["no-imperf-ind"] = {}
		
		local tema = radical.sonor .. (radical.sonor:find("[aeio]$") and "ï" or "i")
		local fila = 1
		if zona.alt and zona.nocc then
			forma["no-imperf-ind"][1] = {}
			forma["no-imperf-ind"][1][1] = tema .. "va"
			forma["no-imperf-ind"][1][2] = tema .. "ves"
			forma["no-imperf-ind"][1][3] = tema .. "va"
			forma["no-imperf-ind"][1][4] = radical.sonor .. "ívem"
			forma["no-imperf-ind"][1][5] = radical.sonor .. "íveu"
			forma["no-imperf-ind"][1][6] = tema .. "ven"
			forma["no-imperf-ind"][1]["nota"] = "n-occ"
			forma["no-imperf-ind"][2] = {}
			forma["no-imperf-ind"][2][4] = radical.sonor .. "ívom"
			forma["no-imperf-ind"][2][5] = radical.sonor .. "ívou"
			forma["no-imperf-ind"][2]["nota"] = "n-occ"
			fila = 3
		end
		
		local radical = radical.antihiat .. (radical.antihiat:find("e$") and "i" or "")
		forma["no-imperf-ind"][fila] = {}
		forma["no-imperf-ind"][fila][1] = radical .. "eva"
		forma["no-imperf-ind"][fila][2] = radical .. "eves"
		forma["no-imperf-ind"][fila][3] = radical .. "eva"
		forma["no-imperf-ind"][fila][4] = radical .. "évem"
		forma["no-imperf-ind"][fila][5] = radical .. "éveu"
		forma["no-imperf-ind"][fila][6] = radical .. "even"
		if zona.alt then
			forma["no-imperf-ind"][fila]["nota"] = llista_zones({"n-occ", "alg"}, zona)
		else
			forma["no-imperf-ind"][fila]["nota"] = llista_zones({"alg"}, zona)
		end
	end
end

function make_imperf_ind_no_3(forma, radical, conj, zona)
	local tema = radical.simple .. ((radical.simple:find("[aeio]$") or radical.simple:find("[^gq]u$")) and "ï" or "i")
	
	if (zona.alt and zona.nocc) or zona.alg then
		forma["no-imperf-ind"] = {}
		forma["no-imperf-ind"][1] = {}
		forma["no-imperf-ind"][1][1] = tema .. "va"
		forma["no-imperf-ind"][1][2] = tema .. "ves"
		forma["no-imperf-ind"][1][3] = tema .. "va"
		forma["no-imperf-ind"][1][4] = radical.simple .. "ívem"
		forma["no-imperf-ind"][1][5] = radical.simple .. "íveu"
		forma["no-imperf-ind"][1][6] = tema .. "ven"
		if zona.alt then
			forma["no-imperf-ind"][1]["nota"] = llista_zones({"n-occ", "alg"}, zona)
		else
			forma["no-imperf-ind"][1]["nota"] = llista_zones({"alg"}, zona)
		end
		
		if zona.alt and zona.nocc and conj == "incoativa" then
			forma["no-imperf-ind"][2] = {}
			forma["no-imperf-ind"][2][1] = radical.simple .. "igueva"
			forma["no-imperf-ind"][2][2] = radical.simple .. "igueves"
			forma["no-imperf-ind"][2][3] = radical.simple .. "igueva"
			forma["no-imperf-ind"][2][4] = radical.simple .. "iguévem"
			forma["no-imperf-ind"][2][5] = radical.simple .. "iguéveu"
			forma["no-imperf-ind"][2][6] = radical.simple .. "igueven"
			forma["no-imperf-ind"][2]["nota"] = "n-occ"
		end
	end
end

function make_pass_no(forma, radical, zona)
	if zona.alt and zona.bal then
		forma["no-pass"] = {}
		forma["no-pass"][1] = {}
		forma["no-pass"][1][1] = radical.simple .. "igué"
		forma["no-pass"][1][2] = radical.simple .. "igueres"
		forma["no-pass"][1][3] = radical.simple .. "igué"
		forma["no-pass"][1][4] = radical.simple .. "iguérem"
		forma["no-pass"][1][5] = radical.simple .. "iguéreu"
		forma["no-pass"][1][6] = radical.simple .. "igueren"
		forma["no-pass"][1]["nota"] = "bal"
	end
end

function make_fut_no(forma, tema, zona)
	-- Usat en 2a conj., velar només en alguerès
	local velar = tema:find("gue$")
	if zona.alg or (not velar and zona.alt and (zona.sept or zona.centr or zona.nocc)) then
		forma["no-fut"] = {}
		forma["no-fut"][1] = {}
		forma["no-fut"][1][1] = tema .. "ré"
		forma["no-fut"][1][2] = tema .. "ràs"
		forma["no-fut"][1][3] = tema .. "rà"
		forma["no-fut"][1][4] = tema .. "rem"
		forma["no-fut"][1][5] = tema .. "reu"
		forma["no-fut"][1][6] = tema .. "ran"
		if velar then
			forma["no-fut"][1]["nota"] = "alg"
		else
			forma["no-fut"][1]["nota"] = llista_zones({"centr", "n-occ", "sept", "alg"}, zona)
		end
	end
end

function make_cond_no_13(forma, tema, zona)
	if zona.alg then
		forma["no-cond"] = {}
		forma["no-cond"][1] = {}
		forma["no-cond"][1][1] = tema .. "riva"
		forma["no-cond"][1][2] = tema .. "rives"
		forma["no-cond"][1][3] = tema .. "riva"
		forma["no-cond"][1][4] = tema .. "rívem"
		forma["no-cond"][1][5] = tema .. "ríveu"
		forma["no-cond"][1][6] = tema .. "riven"
		forma["no-cond"][1]["nota"] = "alg"
	end
end

function make_cond_no_2(forma, tema, zona)
	local vocal = tema:find("gue$") and "g" or string.sub(tema, -1)
	if zona.alg or (vocal == "e" and zona.alt and (zona.sept or zona.centr or zona.nocc)) then
		forma["no-cond"] = {}
		local fila = 1
		if vocal == "g" and zona.alg or (vocal == "e" and zona.alt and (zona.sept or zona.centr or zona.nocc)) then
			forma["no-cond"][fila] = {}
			forma["no-cond"][fila][1] = tema .. "ria"
			forma["no-cond"][fila][2] = tema .. "ries"
			forma["no-cond"][fila][3] = tema .. "ria"
			forma["no-cond"][fila][4] = tema .. "ríem"
			forma["no-cond"][fila][5] = tema .. "ríeu"
			forma["no-cond"][fila][6] = tema .. "rien"
			if vocal == "g" then
				forma["no-cond"][fila]["nota"] = "alg"
			else
				forma["no-cond"][fila]["nota"] = llista_zones({"centr", "n-occ", "sept"}, zona)
			end
			fila = fila + 1
		end
		if zona.alg then
			forma["no-cond"][fila] = {}
			forma["no-cond"][fila][1] = tema .. "riva"
			forma["no-cond"][fila][2] = tema .. "rives"
			forma["no-cond"][fila][3] = tema .. "riva"
			forma["no-cond"][fila][4] = tema .. "rívem"
			forma["no-cond"][fila][5] = tema .. "ríveu"
			forma["no-cond"][fila][6] = tema .. "riven"
			forma["no-cond"][fila]["nota"] = "alg"
		end
	end
end

function make_pres_subj_no(forma, radical, vocal, zona)
	local tema = radical.davant_aou
	if zona.alt and zona.nocc then
		forma["no-pres-subj"] = {}
		forma["no-pres-subj"][1] = {}
		forma["no-pres-subj"][1][2] = tema .. "os"
		forma["no-pres-subj"][1][3] = tema .. "o"
		if vocal == "a" then
			forma["no-pres-subj"][1][1] = radical.simple .. "o"
			forma["no-pres-subj"][1][4] = radical.davant_e .. "eguem"
			forma["no-pres-subj"][1][5] = radical.davant_e .. "egueu"
		end
		forma["no-pres-subj"][1]["nota"] = "n-occ"
	end
end

function make_pres_subj_no_velar(forma, radical, zona)
	if zona.alt and (zona.centr or zona.occ) then
		forma["no-pres-subj"] = {}
		local fila = 1
		if zona.centr or zona.nocc then
			forma["no-pres-subj"][fila] = {}
			forma["no-pres-subj"][fila][2] = radical.simple .. "os"
			forma["no-pres-subj"][fila][3] = radical.simple .. "o"
			forma["no-pres-subj"][fila]["nota"] = llista_zones({"centr", "n-occ"}, zona)
			fila = fila + 1
		end
		if zona.occ then
			forma["no-pres-subj"][fila] = {}
			forma["no-pres-subj"][fila][4] = radical.simple .. "am"
			forma["no-pres-subj"][fila][5] = radical.simple .. "au"
			forma["no-pres-subj"][fila]["nota"] = "occ"
		end
	end
end

function make_pres_subj_no_3(forma, radical, zona)
	if zona.alt and (zona.nocc or zona.bal) then
		forma["no-pres-subj"] = {}
		local fila = 1
		if zona.nocc then
			local tema = radical.simple .. ((radical.simple:find("[aeo]$") or radical.simple:find("[^gq]u$")) and "ï" or "i")
			forma["no-pres-subj"][1] = {}
			forma["no-pres-subj"][1][1] = tema .. "xa"
			forma["no-pres-subj"][1][2] = tema .. "xes"
			forma["no-pres-subj"][1][3] = tema .. "xa"
			forma["no-pres-subj"][1][4] = radical.simple .. "isquem"
			forma["no-pres-subj"][1][5] = radical.simple .. "isqueu"
			forma["no-pres-subj"][1][6] = tema .. "xen"
			forma["no-pres-subj"][1]["nota"] = "n-occ"
				
			forma["no-pres-subj"][2] = {}
			forma["no-pres-subj"][2][2] = tema .. "xos"
			forma["no-pres-subj"][2][3] = tema .. "xo"
			forma["no-pres-subj"][2]["nota"] = "n-occ"
			fila = 3
		end
		
		if zona.bal then
			forma["no-pres-subj"][fila] = {}
			forma["no-pres-subj"][fila][1] = radical.simple .. "esca"
			forma["no-pres-subj"][fila][2] = radical.simple .. "esques"
			forma["no-pres-subj"][fila][3] = radical.simple .. "esca"
			forma["no-pres-subj"][fila][6] = radical.simple .. "esquen"
			forma["no-pres-subj"][fila]["nota"] = "bal"
		end
	end
end

function make_imperf_subj_no(forma, radical, zona)
	if zona.alg or (zona.alt and (zona.sept or zona.centr or zona.nocc)) then
		forma["no-imperf-subj"] = {}
		
		local fila = 1
		if (zona.alt and zona.sept) or zona.alg then
			forma["no-imperf-subj"][fila] = {}
			forma["no-imperf-subj"][fila][1] = radical.davant_e .. "essi"
			if zona.alg then
				forma["no-imperf-subj"][fila][3] = radical.davant_e .. "essi"
			end
			forma["no-imperf-subj"][fila]["nota"] = llista_zones({"sept", "alg"}, zona)
			fila = fila + 1
		end
		
		if zona.alt and (zona.centr or zona.nocc) then
			forma["no-imperf-subj"][fila] = {}
			forma["no-imperf-subj"][fila][1] = radical.davant_e .. "essa"
			forma["no-imperf-subj"][fila]["nota"] = llista_zones({"centr", "n-occ"}, zona)
			fila = fila + 1
		end
		
		if zona.alt and zona.nocc then
			forma["no-imperf-subj"][fila] = {}
			forma["no-imperf-subj"][fila][1] = radical.davant_e .. "eguessa"
			forma["no-imperf-subj"][fila][2] = radical.davant_e .. "eguesses"
			forma["no-imperf-subj"][fila][3] = radical.davant_e .. "egués"
			forma["no-imperf-subj"][fila][4] = radical.davant_e .. "eguéssom"
			forma["no-imperf-subj"][fila][5] = radical.davant_e .. "eguéssou"
			forma["no-imperf-subj"][fila][6] = radical.davant_e .. "eguessen"
			forma["no-imperf-subj"][fila]["nota"] = "n-occ"
		end
	end
end

function make_imperf_subj_no_velar(forma, radical, zona)
	if (zona.alt and (zona.centr or zona.nocc)) or zona.alg then
		forma["no-imperf-subj"] = {}
		local fila = 1
		if zona.alt and zona.centr then
			local radical = (radical.antihiat ~= radical.simple and radical.antihiat or radical.sonor)
			forma["no-imperf-subj"][fila] = {}
			forma["no-imperf-subj"][fila][1] = radical .. "és"
			forma["no-imperf-subj"][fila][2] = radical .. "esses"
			forma["no-imperf-subj"][fila][3] = radical .. "és"
			forma["no-imperf-subj"][fila][4] = radical .. "éssem"
			forma["no-imperf-subj"][fila][5] = radical .. "ésseu"
			forma["no-imperf-subj"][fila][6] = radical .. "essen"
			forma["no-imperf-subj"][fila]["nota"] = "centr"
			fila = fila + 1
		end
		
		if zona.alt and zona.nocc then
			local radical = radical.desinencia0:gsub("c$", "")
			forma["no-imperf-subj"][fila] = {}
			forma["no-imperf-subj"][fila][1] = radical .. "guessa"
			forma["no-imperf-subj"][fila][4] = radical .. "guéssom"
			forma["no-imperf-subj"][fila][5] = radical .. "guéssou"
			forma["no-imperf-subj"][fila]["nota"] = "n-occ"
			fila = fila + 1
		end
		
		if zona.alg then
			local radical = (radical.aton == radical.simple and radical.desinencia0:gsub("c$", "") or radical.aton)
			forma["no-imperf-subj"][fila] = {}
			forma["no-imperf-subj"][fila][1] = radical .. "guessi"
			forma["no-imperf-subj"][fila][3] = radical .. "guessi"
			forma["no-imperf-subj"][fila]["nota"] = "alg"
		end
	end
end

function make_imperf_subj_no_3(forma, radical, zona)
	if zona.alt or zona.alg then
		forma["no-imperf-subj"] = {}
		
		local fila = 1
		if zona.alt and (zona.sept or zona.centr or zona.nocc or zona.bal) then
			forma["no-imperf-subj"][fila] = {}
			forma["no-imperf-subj"][fila][1] = radical.simple .. "igués"
			forma["no-imperf-subj"][fila][2] = radical.simple .. "iguesses"
			forma["no-imperf-subj"][fila][3] = radical.simple .. "igués"
			forma["no-imperf-subj"][fila][4] = radical.simple .. "iguéssem"
			forma["no-imperf-subj"][fila][5] = radical.simple .. "iguésseu"
			forma["no-imperf-subj"][fila][6] = radical.simple .. "iguessen"
			forma["no-imperf-subj"][fila]["nota"] = llista_zones({"centr", "bal", "sept", "n-occ"}, zona)
			fila = fila + 1
		end
		
		if (zona.alt and zona.sept) or zona.alg then
			local tema = radical.simple .. ((radical.simple:find("[aeo]$") or radical.simple:find("[^gq]u$")) and "ï" or "i")
			forma["no-imperf-subj"][fila] = {}
			forma["no-imperf-subj"][fila][1] = tema .. "ssi"
			if zona.alg then
				forma["no-imperf-subj"][fila][3] = tema .. "ssi"
			end
			forma["no-imperf-subj"][fila]["nota"] = llista_zones({"sept", "alg"}, zona)
			fila = fila + 1
		end
		
		if zona.alt and zona.val then
			forma["no-imperf-subj"][fila] = {}
			forma["no-imperf-subj"][fila][1] = radical.simple .. "iguera"
			forma["no-imperf-subj"][fila][2] = radical.simple .. "igueres"
			forma["no-imperf-subj"][fila][3] = radical.simple .. "iguera"
			forma["no-imperf-subj"][fila][4] = radical.simple .. "iguérem"
			forma["no-imperf-subj"][fila][5] = radical.simple .. "iguéreu"
			forma["no-imperf-subj"][fila][6] = radical.simple .. "igueren"
			forma["no-imperf-subj"][fila]["nota"] = "val"
		end
	end
end

function llista_zones(llista, zona)
	local zones = {}
	for k, v in pairs(llista) do
		if zona[v == "or" and "ori" or v == "n-occ" and "nocc" or v] then
			table.insert(zones, v)
		end
	end
	return #zones > 3 and "" or table.concat(zones, ", ")
end

return p