Module:qhv-verb: Difference between revisions

No edit summary
No edit summary
 
(20 intermediate revisions by the same user not shown)
Line 10: Line 10:
local PAGENAME = mw.title.getCurrentTitle().text
local PAGENAME = mw.title.getCurrentTitle().text
local NAMESPACE = mw.title.getCurrentTitle().nsText
local NAMESPACE = mw.title.getCurrentTitle().nsText
local consonants = "[bdghjklmnpqrstvzñ]"


local lang = require("Module:languages").getByCode("qhv")
local lang = require("Module:languages").getByCode("qhv")
Line 17: Line 18:
local endings = {
local endings = {
["[lr]"] = "liquid",
["[lr]"] = "liquid",
["[ptkq]"] = "voiceless-stop",
["[ptkqbdg]"] = "stop",
["[mn]"] = "nasal",
["[mn]"] = "nasal",
["[bdg]"] = "voiced-stop",
["ñ"] = "palatal",
["lj"] = "palatal", ["ñ"] = "palatal",
["[hszvj]"] = "fricative",
["[hszvj]"] = "fricative", ["gh"] = "fricative",
}
}


function export.detect_decl(word, class)
function export.detect_decl(word, class)
local root  = sub(word, 1, -5)
root  = sub(word, 1, -5)
tv = sub(word, -4, -4)
tv = sub(word, -4, -4)
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 match(word, "urnegon$") or root == "urn" then
return "-urnegon", {root}
elseif find(tv, "[eiou]") or m_data.astems[word] then
elseif find(tv, "[eiou]") or m_data.astems[word] then
return "vowel", {root}
return "vowel", {root}
elseif match(word, "[^l]ilagon$") or root == "il" then
return "-ilagon", {root}
elseif match(word, "[āeē]mm?agon$") and word ~= "jemagon" and word ~= "uēmagon" then
return "-emagon", {root}
elseif match(root, "lj$") then return "palatal", {root}
elseif match(root, "gh$") then return "fricative", {root}
elseif match(root, consonants .. "+" .. consonants .. "$") then return "cluster", {root}
else
else
for ending, decl in pairs(endings) do
for ending, decl in pairs(endings) do
Line 61: Line 70:
end
end
if not decl_type then
-- if not decl_type then decl_type, numbers = "fricative", {root} end
error("Unknown declension '" .. decl_type .. "'")
end
args = require("Module:parameters").process(parent_args, m_data[decl_type].params, true)
args = require("Module:parameters").process(parent_args, m_data[decl_type].params, true)
Line 79: Line 86:
data.no_cat = parent_args["nocat"] or parent_args["det"] or nil
data.no_cat = parent_args["nocat"] or parent_args["det"] or nil
data.thematic_vowel = tv
data.thematic_vowel = tv
data.intr = parent_args["intr"] or parent_args[1] or nil
if data.intr and not data.no_cat then table.insert(data.categories, "High Valyrian intransitive verbs") end
-- Generate the forms
-- Generate the forms
Line 278: Line 287:
]=]
]=]
local wikicode = divframe_active .. active .. divframe_passive .. passive
local wikicode = divframe_active .. active .. (not data.intr and divframe_passive .. passive or "")
return (gsub(wikicode, "{{{([a-z0-9_]+)}}}", repl)) .. (data.no_cat and "" or require("Module:utilities").format_categories(data.categories, lang))
return (gsub(wikicode, "{{{([a-z0-9_]+)}}}", repl)) .. (data.no_cat and "" or require("Module:utilities").format_categories(data.categories, lang))