Module:qhv-verb: Difference between revisions

Jump to navigation Jump to search
no edit summary
(Created page with "local sub = mw.ustring.sub local gsub = mw.ustring.gsub local find = mw.ustring.find local gmatch = mw.ustring.gmatch local u = mw.ustring.char local m_utils = require("Modul...")
 
No edit summary
Line 15: Line 15:


local endings = {
local endings = {
["a"] = "I", ["e"] = "II", ["z"] = "IIr", ["ie"] = "III",
["[lr]"] = "liquid",
["[ptkq]"] = "voiceless-stop",
["[mn]"] = "nasal",
["[bdg]"] = "voiced-stop",
["lj"] = "voiceless-stop", ["ñ"] = "voiceless-stop",
["[^l][hszvj]"] = "fricative", ["gh"] = "fricative",
["egon"] = "e", ["igon"] = "i", ["ogon"] = "o", ["ugon"] = "u",
}
}


function export.detect_decl(word, class)
function export.detect_decl(word, class)
local root = sub(word, 1, -5)
if class then
if class then
local decl = class
local decl = class
return decl, {sub(word, 1, (decl == "III" 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)}
else
else
for ending, decl in pairs(endings) do
for ending, decl in pairs(endings) do
if find(word, ending .. "$") then
if find(root, ending .. "$") then
return decl, {sub(word, 1, -(#ending + 1))}
return decl, {sub(root, 1, -(#ending + 1))}
elseif find(word, ending .. "$") then
return decl, {sub(root, 1, -2)}
else return "fricative", {root}
end
end
end
end
Line 36: Line 47:
local decl = {}
local decl = {}
local word = NAMESPACE == "Template" and "rōva" or parent_args.word or PAGENAME
local word = NAMESPACE == "Template" and "elēnagon" or parent_args.word or PAGENAME
local args = {}
local args = {}


Navigation menu