Module:anui-headword: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 26: Line 26:
end
end


local function redup(word, grave)
local function redup(word)
word = m(word)
word = m(word)
Line 33: Line 33:
-- CV > C₁(v)C₂V
-- CV > C₁(v)C₂V
local C = match(word, "^" .. vowel .. "?(" .. consonant .. "*)")
local C = match(word, "^" .. vowel .. "?(" .. consonant .. "*)")
local V = match(word, consonant .. "*(" .. vowel .. "*)")
local V = mw.ustring.toNFD(match(word, consonant .. "*(" .. vowel .. "*)"))
V = V:gsub("ḛ", "e"); V = V:gsub("ḭ", "i"); V = V:gsub("ṵ", "u")
local r2 = match(word, C .. "(.*)")
local r2 = match(word, C .. "(.*)")
local v = sub(mw.ustring.toNFD(V), 1, 1)
local v = sub(V, 1, 1)
local pref = match(C, "[sšṣɬ][ʇǃǂǁʘ]") ~= nil
local fricative = match(C, "[sšṣɬ][ʇǃǂǁʘ]") ~= nil
local nasal = match(C, "ɴ") ~= nil
local nasal = match(C, "ɴ") ~= nil
local glottal = match(C, "[ʇǃǂǁʘṭcɬq]ʼ") ~= nil
local glottal = match(C, "[ʇǃǂǁʘṭcɬq]ʼ") ~= nil
local uvular = match(C, "x") ~= nil
local uvular = match(C, "x") ~= nil
if (nasal or pref) or glottal then word = C .. (glottal and "" or v) .. gsub(C, "[sšṣɬ]([ʇǃǂǁʘ])", "%1") .. r2
if (nasal or fricative) or glottal then word = C .. (glottal and "" or v) .. gsub(C, "[sšṣɬ]([ʇǃǂǁʘ])", "%1") .. r2
elseif uvular then word = gsub(C, "([ʇǃǂǁʘ])x", "%1") .. v .. C .. r2
elseif uvular then word = gsub(C, "([ʇǃǂǁʘ])x", "%1") .. v .. C .. r2
else word = C .. v .. C .. r2 end
else word = C .. v .. C .. r2 end
word = word:gsub("ᴍ", "m")
word = word:gsub("ᴍ", "m")
if not grave then
word = word:gsub("[àèìòù]", {["è"] = "ḛ", ["ì"] = "ḭ", ["ù"] = "ṵ", ["à"] = "a" .. TILDEB, ["ò"] = "o" .. TILDEB})
end
return word
return word
Line 67: Line 65:
end
end
elseif pos ~= "v" then
elseif pos ~= "v" then
table.insert(data.inflections, {label = glossary_link("comparative"), redup(word, args["grave"])})
table.insert(data.inflections, {label = glossary_link("comparative"), redup(word)})
if pos == "adverbs" then table.insert(data.categories, lang:getCanonicalName() .. " comparative " .. pos) end
if pos == "adverbs" then table.insert(data.categories, lang:getCanonicalName() .. " comparative " .. pos) end
else
else
table.insert(data.inflections, {label = "[[w:applicative voice|applicative]]", redup(word, args["grave"])})
table.insert(data.inflections, {label = "[[w:applicative voice|applicative]]", redup(word)})
end
end

Navigation menu