Module:siwa-headword: Difference between revisions

No edit summary
No edit summary
 
(51 intermediate revisions by the same user not shown)
Line 14: Line 14:
local NAMESPACE = mw.title.getCurrentTitle().nsText
local NAMESPACE = mw.title.getCurrentTitle().nsText
local SUBPAGENAME = mw.title.getCurrentTitle().subpageText
local SUBPAGENAME = mw.title.getCurrentTitle().subpageText
local legal_gender = {
["in"] = true,
["an"] = true,
}


local gender_key = {
local gender_key = {
["i"] = "in",
["i"] = "in",
["a"] = "an",
["a"] = "an",
}
local verb_key = {
["aditr"] = "agentive ditransitive",
["adit"] = "agentive ditransitive",
["ai"] = "agentive intransitive",
["asubj"] = "agentive subjective",
["at"] = "agentive transitive",
["imp"] = "impersonal",
["pass"] = "passive",
["udit"] = "unagentive ditransitive",
["ui"] = "unagentive intransitive",
["usubj"] = "unagentive subjective",
["ut"] = "unagentive transitive",
["utrans"] = "translative",
["?"] = "?",
}
}


Line 64: Line 75:
["decl"] = {},
["decl"] = {},
["cat2"] = {},
["cat2"] = {},
["cat3"] = {},
["sort"] = {},
["affix"] = {list = true},
}
}
local args = require("Module:parameters").process(args, params)
local args = require("Module:parameters").process(args, params)
data.heads = {args["head"]}
data.heads = {args["head"]}
data.affix = args["affix"]
table.insert(data.genders, gender_key[args[1]] or args[1])
table.insert(data.genders, gender_key[args[1]] or args[1])
Line 76: Line 91:
if args.decl then table.insert(data.categories, "Siwa " .. args.decl .. "-declension " .. data.pos_category) end
if args.decl then table.insert(data.categories, "Siwa " .. args.decl .. "-declension " .. data.pos_category) end
table.insert(data.categories, "Siwa " .. args["cat2"])
if args.cat2 then table.insert(data.categories, "Siwa " .. args["cat2"]) end
if args.cat3 then table.insert(data.categories, "Siwa " .. args["cat3"]) end
data.sort_key = args["sort"] or nil
end
end


pos_functions["proper nouns"] = pos_functions.nouns
pos_functions["proper nouns"] = pos_functions.nouns
pos_functions.adjectives = function(class, args, data)
local params = {
[1] = {list = "eq"},
[2] = {list = "comp"},
[3] = {list = "sup"},
["unc"] = {type = "boolean"},
["indecl"] = {type = "boolean"},
["head"] = {},
}
local args = require("Module:parameters").process(args, params)
local isdet = data.pos_category == "determiners"
data.heads = {args["head"]}
table.insert(data.categories, "High Valyrian " .. data.pos_category)
if args["unc"] or isdet then
table.insert(data.inflections, {label = "not " .. glossary_link("comparable")})
if not isdet then table.insert(data.categories, "High Valyrian uncomparable adjectives") end
elseif args["indecl"] then
table.insert(data.inflections, {label = glossary_link("indeclinable")})
table.insert(data.categories, "High Valyrian indeclinable " .. data.pos_category)
else
args[1] = require("Module:qhv-adj/head").fetch("eq")
args[2] = require("Module:qhv-adj/head").fetch("comp")
args[3] = require("Module:qhv-adj/head").fetch("sup")
args[1].label = glossary_link("equative")
args[2].label = glossary_link("comparative")
args[3].label = glossary_link("superlative")
table.insert(data.inflections, args[1])
table.insert(data.inflections, args[2])
table.insert(data.inflections, args[3])
end
end


pos_functions["proper nouns"] = pos_functions.nouns
pos_functions["proper nouns"] = pos_functions.nouns
pos_functions["determiners"] = pos_functions.adjectives


pos_functions.verbs = function(class, args, data)
pos_functions.verbs = function(class, args, data)
local params = {
local params = {
[1] = {list = "pres"},
[1] = {required = true},
[2] = {list = "subj"},
[2] = {list = "inf", required = true},
[3] = {list = "pp"},
[3] = {list = "p", required = true},
[4] = {type = "boolean"},
["head"] = {},
["head"] = {},
["cat2"] = {},
["sort"] = {},
["affix"] = {list = true},
}
}
Line 132: Line 116:
data.heads = {args["head"]}
data.heads = {args["head"]}
table.insert(data.categories, "High Valyrian " .. data.pos_category)
for n, kind in ipairs(mw.text.split(args[1], "/")) do
if kind ~= "?" then
data.inflections[n] = {nil}
data.inflections[n].label = verb_key[kind]
table.insert(data.categories, "Siwa " .. verb_key[kind] .. " verbs")
end
end
args[1] = require("Module:qhv-verb/head").fetch("act_ind_prs_1sg")
args[2].label = "infinitive"
args[2] = require("Module:qhv-verb/head").fetch("act_sub_prs_1sg")
args[3] = require("Module:qhv-verb/head").fetch("act_part_prf")
args[1].label = "first-person singular present indicative"
args[2].label = "first-person singular present subjunctive"
args[3].label = "perfect participle"
table.insert(data.inflections, args[1])
table.insert(data.inflections, args[2])
table.insert(data.inflections, args[2])
args[3].label = "past"
table.insert(data.inflections, args[3])
table.insert(data.inflections, args[3])
if args[4] then table.insert(data.categories, "Siwa irregular verbs") end
if args.cat2 then table.insert(data.categories, "Siwa " .. args["cat2"]) end
if args[1] == "?" or args[2] == "?" or args[3] == "?" then table.insert(data.categories, "Contionary stubs") end
data.sort_key = args["sort"] or nil
data.affix = args["affix"]
end
end


return export
return export