Module:mg-pron: Difference between revisions

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


local function syllabify(term)
local function syllabify(term, pos)
term = gsub(term, "(" .. consonants .. "*)(" .. vowels .. "*)", "%1%2·")
term = gsub(term, "(" .. consonants .. "*)(" .. vowels .. "*)", "%1%2·")
term = gsub(term, "··", "·"); term = gsub(term, "·$", "")
term = gsub(term, "··", "·"); term = gsub(term, "·$", "")
Line 33: Line 33:
term = gsub(term, "·(" .. consonants .. ")·", "%1·")
term = gsub(term, "·(" .. consonants .. ")·", "%1·")
local syll = split(term, "·")
local monosyll = {["n"] = "ˈ", ["pron"] = "", ["particle"] = "(ˈ)", ["prep"] = "(ˈ)", ["conj"] = "(ˈ)"}
if #syll == 1 then
syll[1] = monosyll[pos] .. syll[1]
if monosyll[pos] == "ˈ" and match(syll[1], "[aá]") then gsub(syll[1], "([aá])", "%1(ː)") end
else
syll[#syll - 1] = "ˈ" .. syll[#syll - 1]
if match(syll[#syll - 1], "[aá]") then gsub(syll[#syll - 1], "([aá])", "%1ː") end
end
return term
return term
end
end

Navigation menu