Module:kilta-pron: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 50: Line 50:
local last_rules = {
local last_rules = {
{"ʞ", "kʷ"}, {"ƕ", "xʷ"}, {"ʧ", "t͡ʃ"},
{"ʞ", "kʷ"}, {"ƕ", "xʷ"}, {"ʧ", "t͡ʃ"},
{"ꜷ", "au"}, {"ꜽ", "ai"},
{"ꜷ", "au"}, {"ꜽ", "ai"}, {"·ˈ", "ˈ"}, {"·", "."},
}
}


local function syllabify(term)
local function syllabify(term)
local syllable = "(" .. consonants .. "*" .. vowels .. "ː?" .. consonants .. "-)"
local syllable = "(" .. consonants .. "*" .. vowels .. "ː?" .. consonants .. "-)"
term = term:gsub("(" .. consonants .. ")ː", "%1.%1")
term = term:gsub("(" .. consonants .. ")ː", "%%1")
term = term:gsub(syllable, ".%1.")
term = term:gsub(syllable, "·%")
term = term:gsub("^%.", "")
term = term:gsub("^·", "")
term = term:gsub("%.$", "")
term = term:gsub("·$", "")
term = term:gsub("%.+", ".")
term = term:gsub("·+", "·")
term = term:gsub("%.([nlɾs])([pβmtʧkxʷʞƕː])", "%1.%2")
term = term:gsub("·([nlɾs])([pβmtʧkxʷʞƕː])", "%%2")
term = term:gsub("%.([tmnlɾs])$", "%1")
term = term:gsub("·([tmnlɾs])$", "%1")
term = term:gsub("%.(" .. consonants .. ")%.", "%1.")
term = term:gsub("·(" .. consonants .. ")·", "%")
local syllables = split(term, ".")
local syllables = split(term, "·")
table.insert(syllables, #syllables-1, "ˈ") -- penultimate stress
syllables[#syllables - 1] = "ˈ" .. syllables[#syllables - 1] -- penultimate stress
term = table.concat(syllables, "."):gsub("%.ˈ%.","ˈ")
return term
return table.concat(syllables, ".")
end
end


Navigation menu