Jump to content

Module:gem-decl-adj/data

From Wiktionary, the free dictionary

This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

local decl_data = {}

local strong_only = {"ainaz", "allaz", "aljaz", "anþeraz", "bainaz", "fawaz", "ganōgaz", "hwarjaz", "hwaþeraz",
	"inkweraz", "izweraz", "jainaz", "lataz", "mīnaz", "sīnaz", "sumaz", "þīnaz", "unkeraz", "unseraz"}

decl_data.strong_only = {}

for _, word in ipairs(strong_only) do
	decl_data.strong_only[word] = true
end

decl_data.weak_only = {}

local function weak(stem, data, stem_i)
	data.forms["w_nom_sg_m"] = {stem .. "ô"}
	data.forms["w_acc_sg_m"] = {stem .. "anų"}
	data.forms["w_gen_sg_m"] = {stem_i .. (stem_i == stem and "iniz" or "niz")}
	data.forms["w_dat_sg_m"] = {stem_i .. (stem_i == stem and "ini" or "ni")}
	data.forms["w_ins_sg_m"] = {stem_i .. (stem_i == stem and "inē" or "nē")}

	data.forms["w_nom_pl_m"] = {stem .. "aniz"}
	data.forms["w_acc_pl_m"] = {stem .. "anunz"}
	data.forms["w_gen_pl_m"] = {stem .. "anǫ̂"}
	data.forms["w_dat_pl_m"] = {stem .. "ammaz"}
	data.forms["w_ins_pl_m"] = {stem .. "ammiz"}
	
	data.forms["w_nom_sg_f"] = {stem .. "ǭ"}
	data.forms["w_acc_sg_f"] = {stem .. "ōnų"}
	data.forms["w_gen_sg_f"] = {stem .. "ōniz"}
	data.forms["w_dat_sg_f"] = {stem .. "ōni"}
	data.forms["w_ins_sg_f"] = {stem .. "ōnē"}
	
	data.forms["w_nom_pl_f"] = {stem .. "ōniz"}
	data.forms["w_acc_pl_f"] = {stem .. "ōnunz"}
	data.forms["w_gen_pl_f"] = {stem .. "ōnǫ̂"}
	data.forms["w_dat_pl_f"] = {stem .. "ōmaz"}
	data.forms["w_ins_pl_f"] = {stem .. "ōmiz"}
	
	data.forms["w_nom_sg_n"] = {stem .. "ô"}
	data.forms["w_acc_sg_n"] = data.forms["w_nom_sg_n"]
	data.forms["w_gen_sg_n"] = data.forms["w_gen_sg_m"]
	data.forms["w_dat_sg_n"] = data.forms["w_dat_sg_m"] 
	data.forms["w_ins_sg_n"] = data.forms["w_ins_sg_m"] 
		
	data.forms["w_nom_pl_n"] = {stem .. "ōnō"}
	data.forms["w_acc_pl_n"] = data.forms["w_nom_pl_n"]
	data.forms["w_gen_pl_n"] = data.forms["w_gen_pl_m"]
	data.forms["w_dat_pl_n"] = data.forms["w_dat_pl_m"]
	data.forms["w_ins_pl_n"] = data.forms["w_ins_pl_m"]
end

decl_data["a"] = {
	params = {
		[1] = {},
		["j"] = {},
	},
}
setmetatable(decl_data["a"], {__call = function(self, args, data, nocat)
	local stem = args[1]
	local stem_i = ""
	if mw.ustring.sub(stem, -2) == "ij" then
		stem_i = mw.ustring.sub(stem, 1, -3) .. "ī"
		data.decl_type = "ja-stem"
		
		if not nocat then
			table.insert(data.categories, "Proto-Germanic ja-stem adjectives")
		end
	elseif mw.ustring.sub(stem, -1) == "j" then
		stem_i = mw.ustring.sub(stem, 1, -2) .. "i"
		data.decl_type = "ja-stem"
		
		if not nocat then
			table.insert(data.categories, "Proto-Germanic ja-stem adjectives")
		end
	else
		stem_i = stem
		data.decl_type = "a-stem"
		
		if not nocat then
			table.insert(data.categories, "Proto-Germanic a-stem adjectives")
		end
	end
	
	local pagename = mw.title.getCurrentTitle().subpageText

	if not decl_data.weak_only[pagename] then
		data.forms["s_nom_sg_m"] = {stem .. "az"}
		data.forms["s_acc_sg_m"] = {stem .. "anǭ"}
		data.forms["s_gen_sg_m"] = {stem .. "as", stem_i .. (stem_i == stem and "is" or "s")}
		data.forms["s_dat_sg_m"] = {stem .. "ammai"}
		data.forms["s_ins_sg_m"] = {stem .. "anō"}
	
		data.forms["s_nom_pl_m"] = {stem .. "ai"}
		data.forms["s_acc_pl_m"] = {stem .. "anz"}
		data.forms["s_gen_pl_m"] = {stem .. "aizǫ̂"}
		data.forms["s_dat_pl_m"] = {stem .. "aimaz"}
		data.forms["s_ins_pl_m"] = {stem .. "aimiz"}
		
		data.forms["s_nom_sg_f"] = {stem .. "ō"}
		data.forms["s_acc_sg_f"] = {stem .. "ǭ"}
		data.forms["s_gen_sg_f"] = {stem .. "aizōz"}
		data.forms["s_dat_sg_f"] = {stem .. "aizōi"}
		data.forms["s_ins_sg_f"] = {stem .. "aizō"}
		
		data.forms["s_nom_pl_f"] = {stem .. "ôz"}
		data.forms["s_acc_pl_f"] = {stem .. "ōz"}
		data.forms["s_gen_pl_f"] = data.forms["s_gen_pl_m"]
		data.forms["s_dat_pl_f"] = data.forms["s_dat_pl_m"]
		data.forms["s_ins_pl_f"] = data.forms["s_ins_pl_m"]
		
		data.forms["s_nom_sg_n"] = {stem .. "ą", "-at(ō)"}
		data.forms["s_acc_sg_n"] = data.forms["s_nom_sg_n"]
		data.forms["s_gen_sg_n"] = data.forms["s_gen_sg_m"]
		data.forms["s_dat_sg_n"] = data.forms["s_dat_sg_m"] 
		data.forms["s_ins_sg_n"] = data.forms["s_ins_sg_m"] 
		
		data.forms["s_nom_pl_n"] = data.forms["s_nom_sg_f"]
		data.forms["s_acc_pl_n"] = data.forms["s_nom_sg_f"]
		data.forms["s_gen_pl_n"] = data.forms["s_gen_pl_m"]
		data.forms["s_dat_pl_n"] = data.forms["s_dat_pl_m"]
		data.forms["s_ins_pl_n"] = data.forms["s_ins_pl_m"]
	else
		data.decl_type = data.decl_type .. ", weak only"
		data.weak_only = true
	end
	if not decl_data.strong_only[pagename] then
		weak(stem, data, stem_i)
	else
		data.decl_type = data.decl_type .. ", strong only"
		data.strong_only = true
	end
end
})

decl_data["i"] = {
	params = {
		[1] = {},
		["j"] = {},
	},
}
setmetatable(decl_data["i"], {__call = function(self, args, data)
	local j = require("Module:gem-pronunc").determine_sievers(args[1])
	
	decl_data["a"]({args[1] .. j}, data, true)

	data.decl_type = "i-stem"

	data.forms["s_nom_sg_m"] = {args[1] .. "iz"}
	data.forms["s_nom_sg_f"] = {args[1] .. "ī"}
	data.forms["s_nom_sg_n"] = {args[1] .. "į", "-jatō"}
	data.forms["s_acc_sg_n"] = data.forms["s_nom_sg_n"]
	
	table.insert(data.categories, "Proto-Germanic i-stem adjectives")
end
})

decl_data["in"] = {
	params = {
		[1] = {},
	},
}
setmetatable(decl_data["in"], {__call = function(self, args, data)
	data.forms["nom_sg_m"] = {stem .. "ô"}
	data.forms["acc_sg_m"] = {stem .. "anų"}
	data.forms["gen_sg_m"] = {stem_i .. (stem_i == stem and "iniz" or "niz")}
	data.forms["dat_sg_m"] = {stem_i .. (stem_i == stem and "ini" or "ni")}
	data.forms["ins_sg_m"] = {stem_i .. (stem_i == stem and "inē" or "nē")}

	data.forms["nom_pl_m"] = {stem .. "aniz"}
	data.forms["acc_pl_m"] = {stem .. "anunz"}
	data.forms["gen_pl_m"] = {stem .. "anǫ̂"}
	data.forms["dat_pl_m"] = {stem .. "ammaz"}
	data.forms["ins_pl_m"] = {stem .. "ammiz"}
	
	data.forms["nom_sg_f"] = {stem .. "į̄"}
	data.forms["acc_sg_f"] = {stem .. "īnų"}
	data.forms["gen_sg_f"] = {stem .. "īniz"}
	data.forms["dat_sg_f"] = {stem .. "īni"}
	data.forms["ins_sg_f"] = {stem .. "īnē"}
	
	data.forms["nom_pl_f"] = {stem .. "īniz"}
	data.forms["acc_pl_f"] = {stem .. "īnunz"}
	data.forms["gen_pl_f"] = {stem .. "īnǫ̂"}
	data.forms["dat_pl_f"] = {stem .. "īmaz"}
	data.forms["ins_pl_f"] = {stem .. "īmiz"}
	
	data.forms["nom_sg_n"] = {stem .. "ô"}
	data.forms["acc_sg_n"] = data.forms["acc_sg_n"]
	data.forms["gen_sg_n"] = data.forms["gen_sg_m"]
	data.forms["dat_sg_n"] = data.forms["dat_sg_m"] 
	data.forms["ins_sg_n"] = data.forms["ins_sg_m"] 
		
	data.forms["nom_pl_n"] = {stem .. "ōnō"}
	data.forms["acc_pl_n"] = data.forms["nom_pl_n"]
	data.forms["gen_pl_n"] = data.forms["gen_pl_m"]
	data.forms["dat_pl_n"] = data.forms["dat_pl_m"]
	data.forms["ins_pl_n"] = data.forms["ins_pl_m"]
end
})

decl_data["u"] = {
	params = {
		[1] = {},
		["j"] = {},
	},
}
setmetatable(decl_data["u"], {__call = function(self, args, data)
	local j = require("Module:gem-pronunc").determine_sievers(args[1])
	
	decl_data["a"]({args[1] .. j}, data, true)
	
	local stem_u = mw.ustring.find(args[1], "[hgk]w$") and mw.ustring.sub(args[1], 1, -2) or args[1]

	data.decl_type = "u-stem"

	data.forms["s_nom_sg_m"] = {stem_u .. "uz"}
	data.forms["s_nom_sg_f"] = {args[1] .. "ī"}
	data.forms["s_nom_sg_n"] = {stem_u .. "ų", "-jatō"}
	data.forms["s_acc_sg_n"] = data.forms["s_nom_sg_n"]
	
	table.insert(data.categories, "Proto-Germanic u-stem adjectives")
end
})

return decl_data