Module:qay-headword: Difference between revisions
No edit summary |
No edit summary |
||
| (19 intermediate revisions by the same user not shown) | |||
| Line 18: | Line 18: | ||
["in"] = true, ["i"] = true, | ["in"] = true, ["i"] = true, | ||
["an"] = true, ["a"] = true, | ["an"] = true, ["a"] = true, | ||
["in-p"] = true, ["an-p"] = true, | |||
["?"] = true, | ["?"] = true, | ||
} | } | ||
local gender_names = { | local gender_names = { | ||
["in"] = " | ["in"] = "in", ["i"] = "in", ["in-p"] = "in-p", | ||
["an"] = " | ["an"] = "an", ["a"] = "an", ["an-p"] = "an-p", | ||
["?"] = "unknown", | ["?"] = "unknown", | ||
} | } | ||
local lang = require("Module:languages").getByCode("qay") | local lang = require("Module:languages").getByCode("qay") | ||
local sc = require("Module:scripts").getByCode("Ayer") | |||
local m_data = require("Module:qay-noun/data") | local m_data = require("Module:qay-noun/data") | ||
| Line 49: | Line 51: | ||
local parent_args = frame:getParent().args | local parent_args = frame:getParent().args | ||
local head = | local head = parent_args[2] or PAGENAME | ||
local poscat = frame.args[1] or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.") | local poscat = frame.args[1] or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.") | ||
| Line 57: | Line 58: | ||
local data = { | local data = { | ||
lang = lang, | lang = lang, | ||
heads = head | heads = {head}, | ||
inflections = {}, | inflections = {}, | ||
genders = {}, | genders = {}, | ||
pos_category = poscat, | pos_category = poscat, | ||
categories = {"Contionary"}, | categories = {"Contionary"}, | ||
affix = frame.args["affix"] | |||
} | } | ||
| Line 77: | Line 78: | ||
[2] = {required = true}, | [2] = {required = true}, | ||
["nopl"] = {}, | ["nopl"] = {}, | ||
["pl"] = {}, | ["pl"] = {list=true}, | ||
["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, args[1]) | table.insert(data.genders, gender_names[args[1]]) | ||
table.insert(data.categories, " | --table.insert(data.categories, lang:getCanonicalName() .. " " .. (args[1] == "?" and "" or gender_names[args[1]]) .. " " .. data.pos_category) | ||
if not args["nopl"] then | local plurals = {} | ||
args | |||
if not args["nopl"] and not match(gender_names[args[1]],"p") then | |||
plurals = #args.pl ~= 0 and args.pl or generate_plural(PAGENAME, gender_names[args[1]]) | |||
for i, form in ipairs( | for i, form in ipairs(plurals) do | ||
plurals[i] = {term = form} | |||
plurals[i].sc = require("Module:scripts").getByCode("Latn") | |||
end | end | ||
plurals.label = "plural" | |||
table.insert(data.inflections, | |||
table.insert(data.inflections, plurals) | |||
else | |||
table.insert(data.categories, lang:getCanonicalName() .. " uncountable nouns") | |||
table.insert(data.inflections, {label = glossary_link("uncountable")}) | |||
end | end | ||
end | end | ||
pos_functions.adjectives = function(class, args, data) | |||
local params = { | local params = { | ||
[1] = { | [1] = {}, | ||
["unc"] = {type = "boolean"}, | ["unc"] = {type = "boolean"}, | ||
["head"] = {}, | ["head"] = {}, | ||
["affix"] = {list=true}, | |||
} | } | ||
local args = require("Module:parameters").process(args, params) | local args = require("Module:parameters").process(args, params) | ||
data.heads = {args["head"] or args[1]} | |||
data.heads = {args["head"]} | data.affix = args.affix | ||
table.insert(data.categories, " | table.insert(data.categories, "Ayeri " .. data.pos_category) | ||
end | end | ||
pos_functions["proper nouns"] = pos_functions.nouns | --[[pos_functions["proper nouns"] = pos_functions.nouns | ||
pos_functions["determiners"] = pos_functions.adjectives | pos_functions["determiners"] = pos_functions.adjectives | ||