Modulu:Declension
Itxura
Documentation for this module may be created at Modulu:Declension/dok
local p = {}
-- Input: absolutive indefinite form
-- Output: absolutive singular form
-- Rules: -a > -a; -r > -rra; plural > nothing; else +a
function p.absolutive_singular(word)
if type(word) == "table" then word = word.args[1] end
if word == nil or word == '' then return end
local suffix = ''
if string.sub(word, -1) == 'r' then
suffix = 'ra'
elseif string.sub(word, -1) == 'k' then
suffix = ''
elseif string.sub(word, -1) ~= 'a' then
suffix = 'a'
end
return word .. suffix
end
-- Input: absolutive indefinite form
-- Output: absolutive plural form
-- Rules: -a > -ak; -r > -rrak; else +ak
function p.absolutive_plural(word)
if type(word) == "table" then word = word.args[1] end
if word == nil or word == '' then return end
local suffix = 'k'
if string.sub(word, -1) == 'r' then
suffix = 'rak'
elseif string.sub(word, -1) ~= 'a' then
suffix = 'ak'
end
return word .. suffix
end
-- Input: absolutive indefinite form
-- Output: ergative indefinite form
-- Rules: vowels > +k; -r > -rrek; else +ek
function p.ergative(word)
if type(word) == "table" then word = word.args[1] end
if word == nil or word == '' then return end
local suffix = 'ek'
local ending = string.sub(word, -1)
if ending == 'r' then
suffix = 'rek'
elseif string.find(ending, "[aeiouy]") then
suffix = 'k'
end
return word .. suffix
end
-- Input: absolutive indefinite form
-- Output: sociative adjectival form
-- Rules: vowels > +ren; -r > -rren; else +en
function p.zerekiko(word)
if type(word) == "table" then word = word.args[1] end
if word == nil or word == '' then return end
local suffix = 'ekiko'
local ending = string.sub(word, -1)
if ending == 'r' then
suffix = 'rekiko'
elseif string.find(ending, "[aeiouy]") then
suffix = 'rekiko'
end
return word .. suffix
end
-- Input: absolutive indefinite form
-- Output: genitive indefinite form
-- Rules: vowels > +ren; -r > -rren; else +en
function p.genitive(word)
if type(word) == "table" then word = word.args[1] end
if word == nil or word == '' then return end
local suffix = 'en'
local ending = string.sub(word, -1)
if ending == 'r' then
suffix = 'ren'
elseif string.find(ending, "[aeiouy]") then
suffix = 'ren'
end
return word .. suffix
end
-- Input: absolutive indefinite form
-- Output: locative indefinite form
-- Rules: vowels > +ko; else +eko
function p.locative(word)
if type(word) == "table" then word = word.args[1] end
if word == nil or word == '' then return end
local suffix = 'eko'
local ending = string.sub(word, -1)
if ending == 'r' then
suffix = 'ko'
elseif string.find(ending, "[aeiouy]") then
suffix = 'ko'
end
return word .. suffix
end
return p