Module:akk-conj/d/stem

From Wiktionary, the free dictionary
Jump to navigation Jump to search


local common = require("Module:akk-common")


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

local function iii_weak(R, stems)
    stems = stems or {}
    stems.inf   = stems.inf or R[1].."u"..R[2]..R[2].."û"
    stems.part  = stems.part or "mu"..R[1].."a"..R[2]..R[2].."û"
    stems.adj   = stems.adj   or R[1].."u"..R[2]..R[2].."û"
    stems.dur1  = stems.dur1  or R[1].."a"..R[2]..R[2].."a"
    stems.dur2  = stems.dur2  or stems.dur1
    stems.pret1 = stems.pret1 or R[1].."a"..R[2]..R[2].."i"
    stems.pret2 = stems.pret2 or stems.pret1
    stems.perf1 = stems.perf1 or common.assimilate(R[1].."t").."a"..R[2]..R[2].."i"
    stems.perf2 = stems.perf2 or stems.perf1
    stems.prec  = stems.prec  or R[1].."a"..R[2]..R[2].."i"
    stems.imp1  = stems.imp1  or R[1].."u"..R[2]..R[2].."i"
    stems.imp2  = stems.imp2  or stems.imp1
    return stems  
end


return function (roots, stems) 
	local is_weak = {
		["a"] = true,
		["e"] = true,
		["i"] = true,
		["u"] = true,
		["'"] = true,
	}
	
	if is_weak[roots[3]] then 
		return iii_weak(roots, stems)
	end
	
	return sound_stem(roots, stems)
		
end