Module:akk-conj/g/stem

local common = require("Module:akk-common") local weakness = require("Module:akk-conj/g/weakness")

local function vowels(class) local vowels = {} vowels[1] = vowels[1] or "a" if class == "a-u" then vowels[2] = vowels[2] or "a" vowels[3] = vowels[3] or "u" elseif class == "a-i" then vowels[2] = vowels[2] or "a" vowels[3] = vowels[3] or "i" elseif class == "i" then vowels[2] = vowels[2] or "i" vowels[3] = vowels[3] or "i" elseif class == "u" then vowels[2] = vowels[2] or "u" vowels[3] = vowels[3] or "u" elseif class == "a" then vowels[2] = vowels[2] or "a" vowels[3] = vowels[3] or "a" elseif class == "e" then vowels[1] = "e" vowels[2] = vowels[2] or "i" vowels[3] = vowels[3] or "i" end return vowels end

-- --
 * sound verbs  |

local function sound_stem(R, V, stems) stems = stems or {} stems.inf  = stems.inf or R[1]..V[1]..R[2]..common.to_long(V[1])..R[3] stems.part = stems.part or R[1]..common.to_long(V[1])..R[2].."i"..R[3] stems.adj  = stems.adj   or R[1]..V[1]..R[2]..R[3] stems.dur1 = stems.dur1  or R[1]..V[1]..R[2]..R[2]..V[2]..R[3] stems.dur2 = stems.dur2  or stems.dur1 stems.pret1 = stems.pret1 or R[1]..R[2]..V[3]..R[3] stems.pret2 = stems.pret2 or stems.pret1 stems.perf1 = stems.perf1 or common.assimilate(R[1].."t")..V[1]..R[2]..V[2]..R[3] stems.perf2 = stems.perf2 or common.assimilate(R[1].."t")..V[1]..R[2]..R[3] stems.prec = stems.prec  or R[1]..R[2]..V[3]..R[3] stems.imp1 = stems.imp1  or R[1]..V[3]..R[2]..R[3] stems.imp2 = stems.imp2  or R[1]..V[3]..R[2]..V[3]..R[3] return stems end

-- -- local function ia_stems(R, V, stems) R[1] = "" V[1] = "" stems = stems or {} stems.perf1 = stems.perf1 or ("ta"..R[2]..V[2]..R[3]) stems.perf2 = stems.perf2 or ("ta"..R[2]..R[3]) stems.inf  = stems.inf   or ("a"..R[2].."ā"..R[3]) stems.part = stems.part  or ("ā"..R[2].."i"..R[3]) stems.adj  = stems.adj   or ("a"..R[2]..R[3]) stems.imp1 = stems.imp1  or ("a"..R[2]..R[3]) stems.imp2 = stems.imp2  or ("a"..R[2]..V[3]..R[3]) return sound_stem(R, V, stems) end
 * I-a verbs   |

-- -- local function ie_stems(R, V, stems) R[1] = "" V[1] = "" if V[3] == "i" then V[2] = "i" else V[2] = "e" end stems = stems or {} stems.perf1 = stems.perf1 or ("te"..R[2]..V[2]..R[3] ) stems.perf2 = stems.perf2 or ("te"..R[2]..R[3] ) stems.inf  = stems.inf   or ("e"..R[2].."ē"..R[3]) stems.part = stems.part  or ("ē"..R[2].."i"..R[3]) stems.adj  = stems.adj   or ("e"..R[2]..R[3]) stems.imp1 = stems.imp1  or ("e"..R[2]..R[3]) stems.imp2 = stems.imp2  or ("e"..R[2]..V[3]..R[3]) return sound_stem(R, V, stems) end
 * I-e verbs   |

-- -|  I-n verbs   | -- local function n_stems(R, V, stems) stems = stems or {} stems.perf1 = stems.perf1 or ("tt"..V[1]..R[2]..V[2]..R[3]) stems.perf2 = stems.perf2 or ("tt"..V[1]..R[2]..R[3]) stems.pret1 = stems.pret1 or (R[2]..R[2]..V[3]..R[3]) stems.imp1 = stems.imp1  or  (V[3]..R[2]..R[3]) stems.imp2 = stems.imp2  or  (V[3]..R[2]..V[3]..R[3]) stems.prec = stems.prec  or  stems.pret1 return sound_stem(R, V, stems) end

-- -- local function iwa_stems(R, V, stems) R[1] = "" V = {"a", "a", "i"} stems = stems or {} stems.inf  = stems.inf or "wa"..R[2].."ā"..R[3] stems.part = stems.part or "wā"..R[2].."i"..R[3] stems.adj  = stems.adj or "wa"..R[2]..R[3] stems.dur1 = stems.dur1  or (R[2]..R[2].."i"..R[3]) stems.perf1 = stems.perf1 or ("tta"..R[2].."a"..R[3]) stems.perf2 = stems.perf2 or ("tta"..R[2]..R[3]) stems.pret1 = stems.pret1 or (R[2].."i"..R[3]) stems.pret2 = stems.pret2 or (R[2]..R[3]) stems.imp1 = stems.imp1  or (R[2].."i"..R[3]) stems.imp2 = stems.imp2  or stems.imp1 stems.prec = stems.prec  or ("a"..R[2].."i"..R[3]) return sound_stem(R, V, stems) end local function iwi_stems(R, V, stems) R[1] = "" V = {"", "e", "i"} stems = stems or {} stems.inf  = stems.inf or "wa"..R[2].."ā"..R[3] stems.part = stems.part or "wā"..R[2].."i"..R[3] stems.adj  = stems.adj or "wa"..R[2]..R[3] stems.perf1 = stems.perf1 or ("te"..R[2].."i"..R[3]) stems.perf2 = stems.perf2 or ("te"..R[2]..R[3]) stems.pret1 = stems.pret1 or (R[2].."i"..R[3]) stems.dur1 = stems.dur1 or (R[2]..R[2].."i"..R[3]) stems.imp1 = "" stems.imp2 = "" stems.prec = "" return sound_stem(R, V, stems) end -- -- local function iia_stems(R, V, stems) stems = stems or {} if V[3] == "i" then V[1] = "īa" end V[2] = "" if V[3] == "u" then stems.adj = R[1].."ī"..R[3] else stems.adj = R[1]..common.to_long(V[3])..R[3] end stems.dur1 = stems.dur1 or R[1]..common.to_double_long(V[1])..R[3] stems.dur2 = stems.dur2 or R[1]..V[3]..R[3]..R[3] stems.perf1 = stems.perf1 or common.assimilate(R[1].."t")..common.to_long(V[3])..R[3] stems.perf2 = stems.perf2 or stems.perf1 stems.pret1 = stems.pret1 or R[1]..common.to_long(V[3])..R[3] 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[1] == "īa" then stems.inf = stems.inf or R[1].."iā"..R[3] stems.part = stems.part or R[1].."ā".."i"..R[3] else stems.inf = stems.inf or R[1]..common.to_double_long(V[1])..R[3] stems.part = stems.part or R[1]..common.to_long(V[1]).."i"..R[3] end return sound_stem(R, V, stems) end -- -- local function iie_stems(R, V, stems) R[2] = "" return iia_stems(R, {"e", "e", "e"}, stems) end
 * I-w verbs   |
 * II-a verbs  |
 * II-e verbs  |

-- -- local function iij_stem(R, V, stems) V = {"ī", "a", "a"} R[2] = "" stems.perf1 = stems.perf1 or R[1].."tī"..R[3] stems.inf = stems.inf or R[1].."iā"..R[3] stems.part = stems.part or R[1].."āi"..R[3] stems.adj = stems.adj or R[1].."ī"..R[3] return sound_stem(R, V, stems) end
 * II-j verbs  |

-- -- local iiw = sound_stem -- -- local function iiia_stems(R, V, stems) R[3] = "" V = {V[1] or "a", "", ""} stems.inf = stems.inf   or  R[1]..V[1]..R[2] stems.part = stems.part or  R[1]..common.to_long(V[1])..R[2] stems.adj = stems.adj   or  R[1]..V[1]..R[2] stems.imp1 = stems.imp1 or  R[1].."i"..R[2]..R[3] stems.imp2 = stems.imp2 or  R[1].."i"..R[2] return sound_stem(R, V, stems) end -- -- local function iiie_stems(R, V, stems) R[3] = "" V = {"e", "", ""} stems.imp1 = stems.imp1 or R[1].."e"..R[2]..R[3] stems.imp2 = stems.imp2 or R[1].."e"..R[2] return iiia_stems(R, V, stems) end -- -- local iiij_stems = iiia_stems
 * II-w verbs  |
 * III-a verbs  |---
 * III-e verbs  |---
 * III-j verbs  |---

-- -- local function iiiw_stems(R, V, stems) R[3] = "" V = {"a", "", ""} stems.imp1 = stems.imp1 or R[1].."u"..R[2]..R[3] stems.imp2 = stems.imp2 or R[1].."u"..R[2] return iiia_stems(R, V, stems) end
 * III-w verbs  |---

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