local common = require("Module:akk-common")
local weakness = require("Module:akk-conj/g/weakness")
local function vowels(class)
local vowels = {}
vowels = vowels or "a"
if class == "a-u" then
vowels = vowels or "a"
vowels = vowels or "u"
elseif class == "a-i" then
vowels = vowels or "a"
vowels = vowels or "i"
elseif class == "i" then
vowels = vowels or "i"
vowels = vowels or "i"
elseif class == "u" then
vowels = vowels or "u"
vowels = vowels or "u"
elseif class == "a" then
vowels = vowels or "a"
vowels = vowels or "a"
elseif class == "e" then
vowels = "e"
vowels = vowels or "i"
vowels = vowels or "i"
end
return vowels
end
----------------------------------------------------------
--------------------| sound verbs |--------------------
----------------------------------------------------------
local function sound_stem(R, V, stems)
stems = stems or {}
stems.inf = stems.inf or R..V..R..common.to_long(V)..R
stems.part = stems.part or R..common.to_long(V)..R.."i"..R
stems.adj = stems.adj or R..V..R..R
stems.dur1 = stems.dur1 or R..V..R..R..V..R
stems.dur2 = stems.dur2 or stems.dur1
stems.pret1 = stems.pret1 or R..R..V..R
stems.pret2 = stems.pret2 or stems.pret1
stems.perf1 = stems.perf1 or common.assimilate(R.."t")..V..R..V..R
stems.perf2 = stems.perf2 or common.assimilate(R.."t")..V..R..R
stems.prec = stems.prec or R..R..V..R
stems.imp1 = stems.imp1 or R..V..R..R
stems.imp2 = stems.imp2 or R..V..R..V..R
return stems
end
----------------------------------------------------------
--------------------| I-a verbs |--------------------
----------------------------------------------------------
local function ia_stems(R, V, stems)
R = ""
V = ""
stems = stems or {}
stems.perf1 = stems.perf1 or ("ta"..R..V..R)
stems.perf2 = stems.perf2 or ("ta"..R..R)
stems.inf = stems.inf or ("a"..R.."ā"..R)
stems.part = stems.part or ("ā"..R.."i"..R)
stems.adj = stems.adj or ("a"..R..R)
stems.imp1 = stems.imp1 or ("a"..R..R)
stems.imp2 = stems.imp2 or ("a"..R..V..R)
return sound_stem(R, V, stems)
end
----------------------------------------------------------
--------------------| I-e verbs |--------------------
----------------------------------------------------------
local function ie_stems(R, V, stems)
R = ""
V = ""
if V == "i" then
V = "i"
else
V = "e"
end
stems = stems or {}
stems.perf1 = stems.perf1 or ("te"..R..V..R )
stems.perf2 = stems.perf2 or ("te"..R..R )
stems.inf = stems.inf or ("e"..R.."ē"..R)
stems.part = stems.part or ("ē"..R.."i"..R)
stems.adj = stems.adj or ("e"..R..R)
stems.imp1 = stems.imp1 or ("e"..R..R)
stems.imp2 = stems.imp2 or ("e"..R..V..R)
return sound_stem(R, V, stems)
end
----------------------------------------------------------
---------------------| I-n verbs |--------------------
----------------------------------------------------------
local function n_stems(R, V, stems)
stems = stems or {}
stems.perf1 = stems.perf1 or ("tt"..V..R..V..R)
stems.perf2 = stems.perf2 or ("tt"..V..R..R)
stems.pret1 = stems.pret1 or (R..R..V..R)
stems.imp1 = stems.imp1 or (V..R..R)
stems.imp2 = stems.imp2 or (V..R..V..R)
stems.prec = stems.prec or stems.pret1
return sound_stem(R, V, stems)
end
----------------------------------------------------------
--------------------| I-w verbs |--------------------
----------------------------------------------------------
local function iwa_stems(R, V, stems)
R = ""
V = {"a", "a", "i"}
stems = stems or {}
stems.inf = stems.inf or "wa"..R.."ā"..R
stems.part = stems.part or "wā"..R.."i"..R
stems.adj = stems.adj or "wa"..R..R
stems.dur1 = stems.dur1 or (R..R.."i"..R)
stems.perf1 = stems.perf1 or ("tta"..R.."a"..R)
stems.perf2 = stems.perf2 or ("tta"..R..R)
stems.pret1 = stems.pret1 or (R.."i"..R)
stems.pret2 = stems.pret2 or (R..R)
stems.imp1 = stems.imp1 or (R.."i"..R)
stems.imp2 = stems.imp2 or stems.imp1
stems.prec = stems.prec or ("a"..R.."i"..R)
return sound_stem(R, V, stems)
end
local function iwi_stems(R, V, stems)
R = ""
V = {"", "e", "i"}
stems = stems or {}
stems.inf = stems.inf or "wa"..R.."ā"..R
stems.part = stems.part or "wā"..R.."i"..R
stems.adj = stems.adj or "wa"..R..R
stems.perf1 = stems.perf1 or ("te"..R.."i"..R)
stems.perf2 = stems.perf2 or ("te"..R..R)
stems.pret1 = stems.pret1 or (R.."i"..R)
stems.dur1 = stems.dur1 or (R..R.."i"..R)
stems.imp1 = ""
stems.imp2 = ""
stems.prec = ""
return sound_stem(R, V, stems)
end
----------------------------------------------------------
--------------------| II-a verbs |--------------------
----------------------------------------------------------
local function iia_stems(R, V, stems)
stems = stems or {}
if V == "i" then
V = "īa"
end
V = ""
if V == "u" then
stems.adj = R.."ī"..R
else
stems.adj = R..common.to_long(V)..R
end
stems.dur1 = stems.dur1 or R..common.to_double_long(V)..R
stems.dur2 = stems.dur2 or R..V..R..R
stems.perf1 = stems.perf1 or common.assimilate(R.."t")..common.to_long(V)..R
stems.perf2 = stems.perf2 or stems.perf1
stems.pret1 = stems.pret1 or R..common.to_long(V)..R
stems.pret2 = stems.pret2 or stems.pret1
stems.imp1 = stems.imp1 or stems.pret1
stems.imp2 = stems.imp2 or stems.pret1
stems.prec = stems.prec or stems.pret1
if V == "īa" then
stems.inf = stems.inf or R.."iā"..R
stems.part = stems.part or R.."ā".."i"..R
else
stems.inf = stems.inf or R..common.to_double_long(V)..R
stems.part = stems.part or R..common.to_long(V).."i"..R
end
return sound_stem(R, V, stems)
end
----------------------------------------------------------
--------------------| II-e verbs |--------------------
----------------------------------------------------------
local function iie_stems(R, V, stems)
R = ""
return iia_stems(R, {"e", "e", "e"}, stems)
end
----------------------------------------------------------
--------------------| II-j verbs |--------------------
----------------------------------------------------------
local function iij_stem(R, V, stems)
V = {"ī", "a", "a"}
R = ""
stems.perf1 = stems.perf1 or R.."tī"..R
stems.inf = stems.inf or R.."iā"..R
stems.part = stems.part or R.."āi"..R
stems.adj = stems.adj or R.."ī"..R
return sound_stem(R, V, stems)
end
----------------------------------------------------------
--------------------| II-w verbs |--------------------
----------------------------------------------------------
local iiw = sound_stem
----------------------------------------------------------
--------------------| III-a verbs |-------------------
----------------------------------------------------------
local function iiia_stems(R, V, stems)
R = ""
V = {V or "a", "", ""}
stems.inf = stems.inf or R..V..R
stems.part = stems.part or R..common.to_long(V)..R
stems.adj = stems.adj or R..V..R
stems.imp1 = stems.imp1 or R.."i"..R..R
stems.imp2 = stems.imp2 or R.."i"..R
return sound_stem(R, V, stems)
end
----------------------------------------------------------
--------------------| III-e verbs |-------------------
----------------------------------------------------------
local function iiie_stems(R, V, stems)
R = ""
V = {"e", "", ""}
stems.imp1 = stems.imp1 or R.."e"..R..R
stems.imp2 = stems.imp2 or R.."e"..R
return iiia_stems(R, V, stems)
end
----------------------------------------------------------
--------------------| III-j verbs |-------------------
----------------------------------------------------------
local iiij_stems = iiia_stems
----------------------------------------------------------
--------------------| III-w verbs |-------------------
----------------------------------------------------------
local function iiiw_stems(R, V, stems)
R = ""
V = {"a", "", ""}
stems.imp1 = stems.imp1 or R.."u"..R..R
stems.imp2 = stems.imp2 or R.."u"..R
return iiia_stems(R, V, stems)
end
return function (roots, class, stems)
local weakness = weakness(roots, { class = class})
V = vowels(class)
if weakness == nil then
return sound_stem(roots, V, stems)
elseif weakness == "I-a" then
return ia_stems(roots, V, stems)
elseif weakness == "I-e" then
return ie_stems(roots, V, stems)
elseif weakness == "I-n" then
return n_stems(roots, V, stems)
elseif weakness == "I-w ''a-i''" then
return iwa_stems(roots, V, stems)
elseif weakness == "I-w ''i''" then
return iwi_stems(roots, V, stems)
elseif weakness == "II-a" then
return iia_stems(roots, V, stems)
elseif weakness == "II-e" then
return iie_stems(roots, V, stems)
elseif weakness == "II-w" then
return iiiw_stems(roots, V, stems)
elseif weakness == "III-a" then
return iiia_stems(roots, V, stems)
elseif weakness == "III-e" then
return iiie_stems(roots, V, stems)
elseif weakness == "III-y" then
return iiij_stems(roots, V, stems)
elseif weakness == "III-w" then
return iiiw_stems(roots, V, stems)
elseif weakness == "Sound e-i" then
return sound_stem(roots, V, stems)
end
end