Module:kilta-headword: Difference between revisions

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


local function plural(word)
local function plural(word, n)
local pl = {}
local w = split(word, "%s")
if word:match("[kh]wa$") or word:match("a$") then
if w[n]:match("[kh]wa$") or w[n]:match("a$") then
pl = {sub(word, 1, -1) .. "úr"}
w[n] = sub(word, 1, -1) .. "úr"
elseif word:match("ës$") or word:match("uin$") or word:match("[str]$") then
elseif w[n]:match("ës$") or w[n]:match("uin$") or w[n]:match("[str]$") then
pl = {word .. "á"}
w[n] = word .. "á"
elseif word:match("[nml]$") then
elseif word:match("[nml]$") then
pl = {word .. "ur"}
w[n] = word .. "ur"
end
end
pl.label = "plural"
return {label = "plural", table.concat(w)}
return pl
end
end


Line 45: Line 44:
local pos = args[1]; local pl = args.pl
local pos = args[1]; local pl = args.pl
local data = {lang = lang, pos_category = deabb[pos], heads = {word}, categories = {}, inflections = {},}
local data = {lang = lang, pos_category = deabb[pos], heads = {word}, categories = {}, inflections = {},}
 
local w = split(word, "%s")
if pl[1] == '-' then
if pl[1] == '-' then
Line 61: Line 59:
table.insert(data.inflections, pl)
table.insert(data.inflections, pl)
else
else
table.insert(data.inflections, plural(w[args.n or 1]))
table.insert(data.inflections, plural(word, args.n))
end
end
end
end

Navigation menu