local export = {}
local pos_functions = {}
local legal_gender = {
= true,
= true,
= true,
= true,
= true,
= true,
= true,
= true,
= true,
= true,
= true,
= true,
= true,
= true,
= true,
}
local legal_declension = {
= true,
= true,
= true,
= true,
= true,
= true,
}
local gender_names = {
= "masculine",
= "masculine",
= "masculine",
= "feminine",
= "feminine",
= "feminine",
= "neuter",
= "neuter",
= "neuter",
= "common",
= "common",
= "common",
= "unknown gender",
= "unknown gender",
= "unknown gender",
}
local lang = require("Module:languages").getByCode("la")
local suffix = nil
-- The main entry point.
-- This is the only function that can be invoked from a template.
function export.show(frame)
local args = frame:getParent().args
NAMESPACE = mw.title.getCurrentTitle().nsText
PAGENAME = mw.title.getCurrentTitle().text
local head = args; if head == "" then head = nil end
local poscat = frame.args or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")
local class = frame.args
local suff_type = frame.args.suff_type
local postype = nil
if suff_type then
postype = poscat .. '-' .. suff_type
else
postype = poscat
end
local data = {lang = lang, pos_category = (NAMESPACE == "Reconstruction" and "reconstructed " or "") .. poscat, categories = {}, heads = {head}, genders = {}, inflections = {}}
local infl_classes = {}
local appendix = {}
if poscat == "suffixes" then
table.insert(data.categories, "Latin " .. suff_type .. "-forming suffixes")
suffix = '-'
end
if pos_functions then
pos_functions(class, args, data, infl_classes, appendix)
end
if suffix then
for i, h in ipairs(data.heads) do
data.heads = suffix .. h
end
end
if mw.ustring.find(mw.ustring.gsub(PAGENAME,"qu","kv"),"") then
table.insert(data.categories, "Kenny's testing category 7")
end
return
require("Module:headword").full_headword(data) .. format(infl_classes,"/") .. format(appendix,", ")
end
function format(array, concatenater)
if #array == 0 then
return ""
else
return "; ''" .. table.concat(array, concatenater) .. "''"
end
end
pos_functions = function(class, args, data, infl_classes, appendix)
params = {
= {alias_of = 'head'},
= {alias_of = 'gen'},
= {alias_of = 'g'},
= {alias_of = 'decl'},
head = {list = true, default = mw.title.getCurrentTitle().text},
gen = {list = true},
g = {list = true, default = '?'},
decl = {list = true},
indecl = {type = "boolean"},
}
local args = require("Module:parameters").process(args, params)
data.heads = args.head
for _, g in ipairs(args.g) do
if legal_gender then
table.insert(data.genders, g)
table.insert(data.categories, "Latin " .. gender_names .. " nouns")
else
error("Gender “" .. g .. "” is not an valid Latin gender.")
end
end
if args.indecl then
table.insert(data.inflections, {label = "]"})
table.insert(data.categories, "Latin indeclinable nouns")
for _, g in ipairs(args.g) do
table.insert(data.categories, "Latin " .. gender_names .. " indeclinable nouns")
end
else
if #args.decl > 1 then
table.insert(data.inflections, {label = 'variously declined'})
table.insert(data.categories, "Latin nouns with multiple declensions")
elseif #args.decl == 0 then
if NAMESPACE == "Template" then
table.insert(appendix, "? declension")
else
error("Please provide the declension class.")
end
end
for _, decl_class in ipairs(args.decl) do
if legal_declension then
table.insert(appendix, "]")
if decl_class ~= "irregular" then
table.insert(data.categories, "Latin " .. decl_class .. " declension nouns")
end
for _, g in ipairs(args.g) do
table.insert(data.categories, "Latin " .. gender_names .. " nouns in the " .. decl_class .. " declension")
end
else
error("Declension “" .. decl_class .. "” is not an legal Latin declension.")
end
end
if #args.gen == 0 then
table.insert(data.inflections, {label = "no genitive"})
table.insert(data.categories, "Latin nouns without a genitive singular")
else
args.gen.label = "genitive"
if suffix then
for i, g in ipairs(args.gen) do
args.gen = suffix .. g
end
end
table.insert(data.inflections, args.gen)
end
end
end
pos_functions = pos_functions
pos_functions = pos_functions
pos_functions = function(class, args, data, infl_classes, appendix)
params = {
= {alias_of = 'head'},
= {alias_of = 'inf'},
= {alias_of = 'perf'},
= {alias_of = 'sup'},
= {default = 'supine'},
head = {list = true},
inf = {list = true},
perf = {list = true},
sup = {list = true},
pattern = {},
c = {alias_of = 'conj'},
conj = {}
}
local args = require("Module:parameters").process(args,params)
data.heads = args.head
local conj = args.conj
local pattern = args.pattern
args.inf.label = "present infinitive"
args.perf.label = "perfect active"
args.sup.label = args
for i, array in ipairs({args.head, args.inf, args.perf, args.sup}) do
for j, param in ipairs(array) do
if mw.ustring.gsub(param,"^+$","") ~= "" then
table.insert(data.categories,"la-verb invalid parameters")
end
if i == 3 then
array = {term = mw.ustring.gsub(param," sum$",""), alt = param}
end
end
end
table.insert(data.inflections, args.inf)
if #args.perf > 0 then table.insert(data.inflections, args.perf) end
if #args.sup > 0 then table.insert(data.inflections, args.sup) end
if #args.perf > 0 and #args.sup == 0 then pattern = pattern or "depon" end
if conj == "1" then
table.insert(appendix, "]")
elseif conj == "2" then
table.insert(appendix, "]")
elseif conj == "3" then
table.insert(appendix, "]")
elseif conj == "io" then
table.insert(appendix, "] iō-variant")
elseif conj == "4" then
table.insert(appendix, "]")
elseif conj == "irreg" then --sum
table.insert(appendix, "]")
else
if NAMESPACE == "Template" then
table.insert(appendix, "? declension")
else
table.insert(data.categories, "Latin verbs without the conjugation in their headwords")
end
end
if pattern == "impers" then --decet
table.insert(appendix,"]")
elseif pattern == "impers-nopass" then --advesperāscit
table.insert(appendix,"]")
table.insert(appendix,"no ]")
elseif pattern == "impers-depon" then
table.insert(appendix,"]")
table.insert(appendix,"]")
elseif pattern == "depon" then --dēmōlior
table.insert(appendix,"]")
elseif pattern == "semi-depon" then --fido
table.insert(appendix,"]")
elseif pattern == "depon-noperf" then --calvor
table.insert(appendix,"]")
table.insert(appendix,"no ]")
elseif pattern == "noperf" then --īnsolēscō
table.insert(appendix,"no ]")
elseif pattern == "no-actv-perf" then --interstinguō
table.insert(appendix,"]")
elseif pattern == "no-pasv-perf" then --ārēscō
table.insert(appendix,"]")
elseif pattern == "nopass-noperf" then --albēscō
table.insert(appendix,"no ] or ] forms")
elseif pattern == "nopass" then --coacēscō
table.insert(appendix,"no ]")
elseif pattern == "pass-3only" then --praefundō
table.insert(appendix,"limited ]")
elseif pattern == "3only-nopass" then --decet
table.insert(appendix,"] only")
table.insert(appendix,"no ]")
elseif pattern == "pass-impers" then --abambulō
table.insert(appendix,"] in the passive")
elseif pattern == "perf-as-pres" then --ōdī
table.insert(appendix,"]")
elseif pattern == "def" then --āiō
table.insert(appendix,"]")
elseif pattern == "short-imp" then --dīcō
table.insert(appendix,"irregular short ]")
elseif pattern == "facio" then --faciō
table.insert(appendix,"irregular ]")
elseif pattern == "irreg" then --ferō
table.insert(appendix,"]")
elseif pattern == "noimp" then --no example
--I don't know what to do.
elseif pattern then
table.insert(data.categories, "la-verb invalid parameters")
end
end
pos_functions = function(class, args, data, infl_classes, appendix)
if class == "1&2" or class == "3-3E" then
pos_functions(class, args, data, infl_classes, appendix)
elseif class == "3-1E" then
pos_functions(class, args, data, infl_classes, appendix)
elseif class == "3-2E" then
pos_functions(class, args, data, infl_classes, appendix)
elseif class == "comp" then
pos_functions(class, args, data, infl_classes, appendix)
elseif class == "sup" then
pos_functions(class, args, data, infl_classes, appendix)
end
end
pos_functions = function(class, args, data, infl_classes, appendix)
params = {
= {alias_of = 'head', required = true},
= {alias_of = 'f', required = true},
= {alias_of = 'n', required = true},
= {list = true},
= {list = true},
= {list = true},
= {list = true},
= {list = true}
}
local args = require("Module:parameters").process(args, params)
data.heads = args.head
args.f.label = "feminine"
args.n.label = "neuter"
table.insert(data.genders, "m")
table.insert(data.inflections, args.f)
table.insert(data.inflections, args.n)
if #args.comp > 0 then
args.comp.label = "comparative"
table.insert(data.inflections, args.comp)
end
if #args.sup > 0 then
args.sup.label = "superlative"
table.insert(data.inflections, args.sup)
end
if class == "1&2" then
table.insert(infl_classes, "]")
table.insert(infl_classes, "]")
elseif class == "3-3E" then
table.insert(infl_classes, "]")
end
end
pos_functions = function(class, args, data, infl_classes, appendix)
params = {
= {alias_of = 'head', required = true},
= {alias_of = 'gen', required = true},
= {list = true},
= {list = true},
= {list = true},
= {list = true}
}
local args = require("Module:parameters").process(args, params)
data.heads = args.head
args.gen.label = "genitive"
table.insert(data.genders, "m")
table.insert(data.genders, "f")
table.insert(data.genders, "n")
table.insert(data.inflections, args.gen)
if #args.comp > 0 then
args.comp.label = "comparative"
table.insert(data.inflections, args.comp)
end
if #args.sup > 0 then
args.sup.label = "superlative"
table.insert(data.inflections, args.sup)
end
if class == "3-1E" then
table.insert(infl_classes, "]")
end
end
pos_functions = function(class, args, data, infl_classes, appendix)
params = {
= {alias_of = 'head', required = true},
= {alias_of = 'n', required = true},
= {list = true},
= {list = true},
= {list = true},
= {list = true}
}
local args = require("Module:parameters").process(args, params)
data.heads = args.head
args.n.label = "neuter"
table.insert(data.genders, "m")
table.insert(data.genders, "f")
table.insert(data.inflections, args.n)
if #args.comp > 0 then
args.comp.label = "comparative"
table.insert(data.inflections, args.comp)
end
if #args.sup > 0 then
args.sup.label = "superlative"
table.insert(data.inflections, args.sup)
end
if class == "3-2E" then
table.insert(infl_classes, "]")
end
end
pos_functions = function(class, args, data, infl_classes, appendix)
params = {
= {alias_of = 'head'},
= {alias_of = 'comp'},
= {list = true, default = mw.title.getCurrentTitle().text},
= {},
}
local args = require("Module:parameters").process(args, params)
data.heads = args.head
table.insert(data.categories, "Latin comparative adjectives")
table.insert(infl_classes, "]")
table.insert(data.genders, "m")
table.insert(data.genders, "f")
local n = {label = "neuter"}
for _, head in ipairs(args.head) do
local neuter = mw.ustring.gsub(head, "or$", "us")
table.insert(n, neuter)
end
table.insert(data.inflections, n)
if args.comp then
-- ]
require("Module:debug").track("la-adj-comparative")
end
end
pos_functions = function(class, args, data, infl_classes, appendix)
params = {
= {alias_of = 'head'},
= {alias_of = 'sup'},
= {list = true, default = mw.title.getCurrentTitle().text},
= {},
}
local args = require("Module:parameters").process(args, params)
data.heads = args.head
table.insert(data.categories, "Latin superlative adjectives")
table.insert(infl_classes, "]")
table.insert(infl_classes, "]")
table.insert(data.genders, "m")
local f, n = {label = "feminine"}, {label = "neuter"}
for _, head in ipairs(args.head) do
local stem = mw.ustring.gsub(head, "us$", "")
table.insert(f, stem .. "a")
table.insert(n, stem .. "um")
end
table.insert(data.inflections, f)
table.insert(data.inflections, n)
if args.sup then
-- ]
require("Module:debug").track("la-adj-superlative")
end
end
pos_functions = function(class, args, data, infl_classes, appendix)
params = {
= {alias_of = 'head', required = true},
= {alias_of = 'comp'},
= {alias_of = 'sup'},
= {list = true},
= {list = true},
= {list = true}
}
local args = require("Module:parameters").process(args, params)
data.heads = args.head
if args.comp == "-" then
table.insert(data.inflections, {label = "not ]"})
table.insert(data.categories, "Latin uncomparable adverbs")
else
local hasComp = false
if #args.comp == 0 then
local comp = {}
-- label = "]"
local sup = {}
-- label = "]"
for _, head in ipairs(args.head) do
local stem
for _, suff in ipairs({"iter", "nter", "ter", "er", "iē", "ē", "im", "ō"}) do
stem = mw.ustring.match(head, "(.*)" .. suff .. "$")
if stem then
if suff == "nter" then
stem = stem .. "nt"
suff = "er"
end
hasComp = true
table.insert(comp, stem .. "ius")
table.insert(sup, stem .. "issimē")
break
end
end
if not stem then
error("Unrecognized adverb type, recognized types are “-ē”, “-er”, “-ter”, “-iter”, “-im”, or “-ō” or specify irregular forms or “-” if incomparable.")
end
end
table.insert(data.inflections, comp)
end
if #args.comp or hasComp then
end
end
if #args.comp > 0 then
args.comp.label = "]"
table.insert(data.inflections, args.comp)
if #args.sup > 0 and args.sup ~= "-" then
args.sup.label = "]"
table.insert(data.inflections, args.sup)
else
table.insert(data.inflections, {label = "no ]"})
end
table.insert(data.categories, "Latin irregular adverbs")
elseif args.comp == "-" then
else
if args.sup ~= '-' then
table.insert(data.inflections, sup)
else
table.insert(data.inflections, {label = "no ]"})
table.insert(data.categories, "Latin irregular adverbs")
end
end
end
return export