မဝ်ဂျူ:lad-headword
မံက်ပြာကတ်
This module powers all Ladino headword-line templates. All of them support at least the following arguments:
|head=,|head2=,|head3=, ...- Explicitly specified headword(s), for introducing links in multiword expressions. Note that by default each word of a multiword lemma is linked, so you only need to use this when the default links don't suffice (e.g. the multiword expression consists of non-lemma forms, which need to be linked to their lemmas).
|heb=,|heb2=,|heb3=, ...- Hebrew script equivalent(s), for terms written in Latin script.
|lat=,|lat2=,|lat3=, ...- Latin script equivalent(s), for terms written in Hebrew script.
In addition, some templates support additional parameters. Specifically:
For nouns and proper nouns:
|g=,|g2=,|g3=, ...- Gender(s). Allowed values are
m,f,m-pandf-p. |pl=,|pl2=,|pl3=, ...- Plural(s). Specifying
|pl=-for nouns indicates that there is no plural, and adds the term to Category:Ladino uncountable nouns. |f=,|f2=,|f3=, ...- Feminine equivalent(s), for nouns referring to males.
|fpl=,|fpl2=,|fpl3=, ...- Feminine equivalent plural(s).
|m=,|m2=,|m3=, ...- Masculine equivalent(s), for nouns referring to females.
|mpl=,|mpl2=,|mpl3=, ...- Masculine equivalent plural(s).
For adjectives:
|f=,|f2=,|f3=, ...- Feminine form(s).
|mpl=,|mpl2=,|mpl3=, ...- Masculine plural form(s).
|fpl=,|fpl2=,|fpl3=, ...- Feminine plural form(s).
|pl=,|pl2=,|pl3=, ...- Plural form(s), for adjectives with the same form in the masculine and feminine plural.
For pronouns:
|g=,|g2=,|g3=, ...- Gender(s). Allowed values are
m,f,m-pandf-p.
local export = {}
local pos_functions = {}
local m_scripts = require("Module:scripts")
local en_utilities_module = "Module:en-utilities"
local lang = require("Module:languages").getByCode("lad")
local langname = lang:getCanonicalName()
local PAGENAME = mw.loadData("Module:headword/data").pagename
local suffix_categories = {
["နာမဝိသေသန"] = true,
["ကြိယာဝိသေသန"] = true,
["နာမ်"] = true,
["ကြိယာ"] = true,
}
local function track(page)
require("Module:debug").track("lad-headword/" .. page)
return true
end
local function glossary_link(entry, text)
text = text or entry
return "[[အဆက်လက္ကရဴ:မသောၚ်ကၠးဝေါဟာ#" .. entry .. "|" .. text .. "]]"
end
-- The main entry point.
-- This is the only function that can be invoked from a template.
function export.show(frame)
local tracking_categories = {}
local poscat = frame.args[1]
or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")
local params = {
["head"] = {list = true},
["lat"] = {list = true}, --Latin equivalent(s)
["heb"] = {list = true}, --Hebrew equivalent(s)
["suff"] = {type = "boolean"},
}
if pos_functions[poscat] then
for key, val in pairs(pos_functions[poscat].params) do
params[key] = val
end
end
local parargs = frame:getParent().args
local args = require("Module:parameters").process(parargs, params)
local data = {
lang = lang,
pos_category = poscat,
sccat = true, -- add e.g. [[:Category:Ladino nouns in Hebrew script]]
categories = {},
heads = args["head"],
genders = {},
inflections = {},
categories = {}
}
if args["suff"] then
data.pos_category = "အဆက်လက္ကရဴ"
if suffix_categories[poscat] then
local singular_poscat = poscat:gsub("s$", "")
-- table.insert(data.categories, langname .. " " .. singular_poscat .. "-forming suffixes")
else
error("No category exists for suffixes forming " .. poscat .. ".")
end
end
if #args.lat > 0 then
args.lat.label = "ခ္ဍံက်လိက်လပ်တေန်"
args.lat.sc = m_scripts.getByCode("Latn")
table.insert(data.inflections, args.lat)
end
if #args.heb > 0 then
args.heb.label = "ခ္ဍံက်လိက်ဟဳဘရဝ်"
args.heb.sc = m_scripts.getByCode("Hebr")
table.insert(data.inflections, args.heb)
end
if pos_functions[poscat] then
pos_functions[poscat].func(args, data, tracking_categories)
end
return require("Module:headword").full_headword(data)
.. require("Module:utilities").format_categories(tracking_categories, lang)
end
pos_functions["နာမဝိသေသန"] = {
params = {
["pl"] = {list = true}, --plural(s)
["f"] = {list = true}, --feminine form(s)
["fpl"] = {list = true}, --feminine plural(s)
["m"] = {list = true}, --masculine form(s)
["mpl"] = {list = true}, --masculine plural(s)
},
func = function(args, data, tracking_categories)
if #args.m > 0 then
args.m.label = "ပုလ္လိၚ်"
table.insert(data.inflections, args.m)
end
if #args.f > 0 then
args.f.label = "ဣတ္တိလိၚ်"
table.insert(data.inflections, args.f)
end
if #args.pl > 0 then
args.pl.label = "ကိုန်ဗဟုဝစ်"
table.insert(data.inflections, args.pl)
end
if #args.mpl > 0 then
args.mpl.label = "ကိုန်ဗဟုဝစ်ပုလ္လိၚ်"
table.insert(data.inflections, args.mpl)
end
if #args.fpl > 0 then
args.fpl.label = "ကိုန်ဗဟုဝစ်ဣတ္တိလိၚ်"
table.insert(data.inflections, args.fpl)
end
end
}
local noun_params = {
["g"] = {list = true}, --gender(s)
["pl"] = {list = true}, --plural(s)
["f"] = {list = true}, --feminine form(s)
["fpl"] = {list = true}, --feminine plural(s)
["m"] = {list = true}, --masculine form(s)
["mpl"] = {list = true}, --masculine plural(s)
["mf"] = {list = true}, --feminine or masculine
}
local allowed_genders = {
["m"] = true,
["f"] = true,
["mf"] = true,
["m-p"] = true,
["f-p"] = true,
}
local function do_nouns(pos, args, data, tracking_categories)
for _, g in ipairs(args.g) do
if not allowed_genders[g] then
error("Unrecognized gender: " .. g)
end
end
local plpos = require(en_utilities_module).pluralize(pos)
data.genders = args.g
-- Check for special plural signals
local mode = nil
if args.pl[1] == "?" or args.pl[1] == "!" or args.pl[1] == "-" or args.pl[1] == "~" or args.pl[1] == "#" then
mode = args.pl[1]
table.remove(args.pl, 1) -- Remove the mode parameter
end
if mode == "?" then
-- Plural is unknown
table.insert(data.categories, plpos .. langname .. "မနွံကဵုကိုန်ဗဟုဝစ်ဟွံတီကၠး ဝါ ဟွံချိုတ်ပၠိုတ်ဂမၠိုၚ်")
elseif mode == "!" then
-- Plural is not attested
table.insert(data.inflections, {label = "ကိုန်ဗဟုဝစ်မပြာကတ်လဝ်ဟွံသေၚ်"})
table.insert(data.categories, plpos .. langname .. "မနွံကဵုကိုန်ဗဟုဝစ်ညးဂှ်လေဝ်ဟွံစုတ်မဒုၚ်ရပ်စပ်ဂမၠိုၚ်")
return
elseif mode == "-" then
-- Uncountable noun; may occasionally have a plural
table.insert(data.categories, plpos .. langname .. "မတော်ဟွံဂွံဂမၠိုၚ်")
table.insert(data.inflections, {label = "ဗွဲတၟေၚ်" .. glossary_link("မတော်ဟွံမာန်")})
elseif mode == "~" then
-- Mixed countable/uncountable noun, always has a plural
table.insert(data.inflections, {label = glossary_link("တော်မာန်") .. " and " .. glossary_link("မတော်ဟွံမာန်")})
table.insert(data.categories, plpos .. langname .. "မတော်ဟွံဂွံဂမၠိုၚ်")
table.insert(data.categories, plpos .. langname .. "မတော်ဂွံဂမၠိုၚ်")
elseif mode == "#" or pos == "နာမ်" then
-- Countable nouns; the default for regular nouns but not proper nouns
if mode == "#" then
table.insert(data.inflections, {label = glossary_link("မတော်မာန်")})
end
-- Not until we're sure that all nouns properly use pl=-
-- table.insert(data.categories, plpos .. langname .. "မတော်ဂွံဂမၠိုၚ်")
end
if #args.pl > 0 then
args.pl.label = "ကိုန်ဗဟုဝစ်"
args.pl.accel = {form = "p"}
table.insert(data.inflections, args.pl)
end
if #args.f > 0 then
args.f.label = "ဣတ္တိလိၚ်"
table.insert(data.inflections, args.f)
end
if #args.fpl > 0 then
args.fpl.label = "ကိုန်ဗဟုဝစ်ဣတ္တိလိၚ်"
table.insert(data.inflections, args.fpl)
end
if #args.m > 0 then
args.m.label = "ပုလ္လိၚ်"
table.insert(data.inflections, args.m)
end
if #args.mpl > 0 then
args.mpl.label = "ကိုန်ဗဟုဝစ်ပုလ္လိၚ်"
table.insert(data.inflections, args.mpl)
end
if #args.mf > 0 then
args.mf.label = "ပုလ္လိၚ် ဝါ ဣတ္တိလိၚ်"
table.insert(data.inflections, args.mf)
end
end
-- Display additional inflection information for a noun
pos_functions["နာမ်"] = {
params = noun_params,
func = function(args, data, tracking_categories)
return do_nouns("နာမ်", args, data, tracking_categories)
end,
}
pos_functions["နာမ်မကိတ်ညဳ"] = {
params = noun_params,
func = function(args, data, tracking_categories)
return do_nouns("နာမ်မကိတ်ညဳ", args, data, tracking_categories)
end,
}
pos_functions["သဗ္ဗနာမ်"] = {
params = {
["g"] = {list = true}, --gender(s)
},
func = function(args, data, tracking_categories)
for _, g in ipairs(args.g) do
if not allowed_genders[g] then
error("Unrecognized gender: " .. g)
end
end
data.genders = args.g
end
}
return export