Module:qhv-headword: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 57: Line 57:
end
end


local function generate_gen_sg(word)
local function generate_gen_sg(word, gen)
local genitive = {}
local genitive = {}
for alt in gmatch(require("Module:qhv-noun/head").pass_to_module("gen_sg", word), "[^,]+") do
for alt in gmatch(require("Module:qhv-noun/head").pass_to_module("gen_sg", word), "[^,]+") do
Line 65: Line 65:
end
end


local function generate_nom_pl(word)
local function generate_nom_pl(word, pl)
local plural = {}
local plural = {}
for alt in gmatch(require("Module:qhv-noun/head").pass_to_module("nom_pl", word), "[^,]+") do
for alt in gmatch(require("Module:qhv-noun/head").pass_to_module("nom_pl", word), "[^,]+") do
Line 119: Line 119:
if not args["noinf"] then
if not args["noinf"] then
args["gen"] = generate_gen_sg(args[2])
if args["gen"] then
table.insert(data.inflections, args["gen"])
else
table.insert(data.inflections, generate_gen_sg(args[2]))
end
for i, form in ipairs(args["gen"]) do
for i, form in ipairs(args["gen"]) do
Line 126: Line 130:
args["gen"].label = "genitive"
args["gen"].label = "genitive"
table.insert(data.inflections, args["gen"])
end
end
if data.pos_category == "nouns" and not args["noinf"] then
if data.pos_category == "nouns" and not args["noinf"] then
if not args["nopl"] then
if not args["nopl"] then
args["pl"] = generate_nom_pl(args[2])
if args["pl"] then
table.insert(data.inflections, args["pl"])
else
table.insert(data.inflections, generate_nom_pl(args[2]))
end
for i, form in ipairs(args["pl"]) do
for i, form in ipairs(args["pl"]) do
Line 138: Line 145:
args["pl"].label = "plural"
args["pl"].label = "plural"
table.insert(data.inflections, args["pl"])
end
end
end
end

Navigation menu