Module:snon-headword: Difference between revisions
No edit summary |
No edit summary |
||
| Line 74: | Line 74: | ||
----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ||
local allowed_genders = { | local allowed_genders = m_table.listToSet( | ||
{"m", "f", "mf", "mfbysense", "mfequiv", "gneut", "n", "m-p", "f-p", "mf-p", "mfbysense-p", "mfequiv-p", "gneut-p", "n-p", "?", "?-p"} | |||
) | |||
local function validate_genders(genders) | |||
for _, g in ipairs(genders) do | |||
if type(g) == "table" then | |||
g = g.spec | |||
end | |||
if not allowed_genders[g] then | |||
error("Unrecognized gender: " .. g) | |||
end | |||
end | |||
end | |||
local function do_noun(args, data, is_proper) | local function do_noun(args, data, is_proper) | ||
| Line 84: | Line 93: | ||
local category_pos = m_en_util.singularize(data.pos_category) | local category_pos = m_en_util.singularize(data.pos_category) | ||
validate_genders(args[1]) | |||
data.genders = args[1] | data.genders = args[1] | ||
-- Check for specific genders and pluralia tantum. | -- Check for specific genders and pluralia tantum. | ||
| Line 213: | Line 223: | ||
local function get_noun_params(is_proper) | local function get_noun_params(is_proper) | ||
return { | return { | ||
[1] = { | [1] = {list = "g", disallow_holes = true, required = not is_proper, default = "?", type = "genders", flatten = true}, | ||
[2] = {list = "pl", disallow_holes = true}, | [2] = {list = "pl", disallow_holes = true}, | ||
["mut"] = {set = {"r", "l", "e"}} | ["mut"] = {set = {"r", "l", "e"}} | ||
} | } | ||
end | end | ||