Module:klj-common

local export = {}

local rfind = mw.ustring.find

local vowels = "aâəə̂eêiîıuûöö̂üü̂oô" local vowel = "[" .. vowels .. "]"

function export.getType(term) local last = mw.ustring.sub(term, -1) local second_to_last = mw.ustring.sub(term, -2, -2) local third_to_last = mw.ustring.sub(term, -3, -3) if rfind(last, vowel) then return last, nil elseif rfind(second_to_last, vowel) then if rfind(last, "[kq]") then return second_to_last, last else return second_to_last, "c" end elseif second_to_last == last then return third_to_last, "cc" else return third_to_last, "c" end end

return export