Module:qhv-verb: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 16: Line 16:


local endings = {
local endings = {
["[lr]a"] = "liquid",
["[lr]"] = "liquid",
["[ptkq]a"] = "voiceless-stop",
["[ptkq]"] = "voiceless-stop",
["[mn]a"] = "nasal",
["[mn]"] = "nasal",
["[bdg]a"] = "voiced-stop",
["[bdg]"] = "voiced-stop",
["lja"] = "palatal", ["ña"] = "palatal",
["lj"] = "palatal", ["ñ"] = "palatal",
["[aeiou]"] = "vowel",
["[aeiou]"] = "vowel",
["[^l][hszvj]a"] = "fricative", ["gha"] = "fricative",
["[^l][hszvj]"] = "fricative", ["gh"] = "fricative",
}
}


function export.detect_decl(word, class)
function export.detect_decl(word, class)
local root = sub(word, 1, -4)
local root = sub(word, 1, -5)
if class then
if class then
local decl = class
local decl = class
return decl, {sub(root, 1, (sub(root, -2) == ("lj" or "gh") and -3 or -2))}
return decl, {sub(root, 1, (sub(root, -2) == ("lj" or "gh") and -3 or -2))}
elseif m_data.astems[word] then return "a", {sub(root, -2)}
elseif m_data.astems[word] then return "a", {sub(root, -2)}
elseif find(root, "[eiou]$") then return "vowel", {sub(root, 1, -2)}
else
else
for ending, decl in pairs(endings) do
for ending, decl in pairs(endings) do