48,407
edits
No edit summary |
No edit summary |
||
| (21 intermediate revisions by the same user not shown) | |||
| Line 17: | Line 17: | ||
end | end | ||
local function plural(word, n) | local function plural(word, n, pos) | ||
local w = split(word, " | local w = split(word, " ") | ||
n = tonumber(n) | |||
if n > #w then error("Word index outside bounds.") end | |||
if w[n]:match("[kh]wa$") | if pos == "n" then | ||
if w[n]:match("[kh]wa$") then | |||
w[n] = sub(w[n], 1, -3) .. "úr" | |||
w[n] = w[n] .. " | elseif w[n]:match("a$") then | ||
elseif w[n]:match("[ | w[n] = sub(w[n], 1, -2) .. "úr" | ||
w[n] = w[n] .. " | elseif w[n]:match("ës$") or w[n]:match("uin$") or w[n]:match("[str]$") then | ||
w[n] = w[n] .. "á" | |||
elseif w[n]:match("[nml]$") then | |||
w[n] = w[n] .. "ur" | |||
end | |||
elseif pos == "adj" then | |||
if w[n]:match("[kh]win$") then | |||
w[n] = sub(w[n], 1, -4) .. "ú" | |||
elseif w[n]:match("in$") then | |||
w[n] = sub(w[n], 1, -3) .. "u" | |||
end | |||
end | end | ||
| Line 59: | Line 71: | ||
table.insert(data.inflections, pl) | table.insert(data.inflections, pl) | ||
else | else | ||
table.insert(data.inflections, plural(word, | table.insert(data.inflections, plural(word, args.n, pos)) | ||
end | end | ||
end | end | ||