Module:anui-headword: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 2: Line 2:
local u = mw. ustring.char
local u = mw. ustring.char
local gsub = mw.ustring.gsub
local gsub = mw.ustring.gsub
local sub = mw.ustring.sub


local TILDEA = u(0x0303) -- COMBINING TILDE ̃◌
local TILDEA = u(0x0303) -- COMBINING TILDE ̃◌
Line 14: Line 15:
text = text or entry
text = text or entry
return "[[wikt:Appendix:Glossary#" .. entry .. "|" .. text .. "]]"
return "[[wikt:Appendix:Glossary#" .. entry .. "|" .. text .. "]]"
end
local function m(word)
-- as in [[Module:anui-pron]], account for syllabic m
word = word:gsub("([uùm]ʼ?)m", "%1ᴍ")
word = word:gsub("m(ʼᴍ)", "ᴍ%1")
word = word:gsub("([aeiouàèìòù])m", "%1ᴍ")
word = word:gsub("([aeiouàèìòù])ᴍ([aeiou])", "%1m%2")
return word
end
end


local function redup(word)
local function redup(word)
word = word:gsub("([ḛḭṵaɔ]" .. TILDEB .. "?)", {["ḛ"] = "è", ["ḭ"] = "ì", ["ṵ"] = "ù", ["a" .. TILDEB] = "à", ["ɔ" .. TILDEB] = "ò"})
word = word:gsub("([ḛḭṵaɔ]" .. TILDEB .. "?)", {["ḛ"] = "è", ["ḭ"] = "ì", ["ṵ"] = "ù", ["a" .. TILDEB] = "à", ["ɔ" .. TILDEB] = "ò"})
word = m(word)
local consonant = "[ǃǂǁʘʼxqrʛɴɬšṣchjklmptŋṉṭṯ]"
local consonant = "[ǃǂǁʘʼʇxqrʛɴɬšṣschjklmptŋṉṭṯ]"
local vowel = "[aeiouàèìòùʼ]"
local vowel = "[aeiouàèìòùʼᴍ]"
-- CV > C₁(v)C₂V
local C = match(word, consonant .. "*")
local C = match(word, consonant .. "*")
local V = match(word, consonant .. "*(" .. vowel .. "*)")
local r = match(word, C .. V .. "(.*)")
local v = sub(V, 1, 1)
local pref = match(C, "[sšṣ]") ~= nil
local nasal = match(C, "ɴ") ~= nil
local glottal = match(C, "[ʇǃǂǁʘ]ʼ") ~= nil
if pref then word = C .. v .. gsub(C, "[sšṣ]([ʇǃǂǁʘ])", "%1") end
return word
return word

Navigation menu