Module:kilta-pron: Difference between revisions

No edit summary
No edit summary
 
(15 intermediate revisions by the same user not shown)
Line 14: Line 14:
local m_IPA = require("Module:IPA")
local m_IPA = require("Module:IPA")


local consonants = "[pβmtsnɾlʧkxqhyʤɡbvd]"
local consonants = "[pβmtsnɾlʧkxqhyʤɡbvdƕ]"
local vowels = "[aeiouáéíóúəïüëæ]"
local vowels = "[aeiouáéíóúəïüëæ]"


Line 59: Line 59:
{"ï", "ai̯"},
{"ï", "ai̯"},
{"[·%.]ˈ", "ˈ"}, {"·", "."}, {"([áéíóú])", function(v) return deacuter[v] .. "ː" end},
{"[·%.]ˈ", "ˈ"}, {"·", "."}, {"([áéíóú])", function(v) return deacuter[v] .. "ː" end},
}
local sandhi_rules = {
{"(" .. consonants .. ")u%sˈ?ʔ?(" .. vowels .. ")", "%1w%2"},
{"(" .. consonants .. ")i%sˈ?ʔ?(" .. vowels .. ")", "%1j%2"},
{"([mnŋ])(%sˈ?)βə", "%1%2bə"},
{"[mnŋ]%s(ˈ?[mpbβ])", "m %1"}, {"[mnŋ]%s(ˈ?v)", "ɱ %1"},
{"[mnŋ]%s(ˈ?[tdɾlsn])", "n %1"}, {"[mnŋ]%s(ˈ?[ʧʤ])", "n̠ %1"},
{"[mnŋ]%s(ˈ?[ŋkɡqƕy])", "ŋ %1"},
}
}


local function syllabify(term)
local function syllabify(term)
local first = term == "áxəpːi"
local last = (term == "kolán" or term == "türá")
local syllable = "(" .. consonants .. "*)(" .. vowels .. "ː?)(" .. consonants .. "-)"
local syllable = "(" .. consonants .. "*)(" .. vowels .. "ː?)(" .. consonants .. "-)"
Line 78: Line 89:
local syllables = split(term, "·")
local syllables = split(term, "·")
if term:match("'") then
if first then
for _, s in ipairs(syllables) do
syllables[1] = "ˈ" .. syllables[1]
s = s:gsub("'", "ˈ")
elseif last then
end
syllables[#syllables] = "ˈ" .. syllables[#syllables]
elseif #syllables > 1 then
elseif #syllables > 1 then
syllables[#syllables - 1] = "ˈ" .. syllables[#syllables - 1] -- penultimate stress
syllables[#syllables - 1] = "ˈ" .. syllables[#syllables - 1] -- penultimate stress
Line 101: Line 112:
for _, rule in ipairs(phonetic_rules) do
for _, rule in ipairs(phonetic_rules) do
phonetic = gsub(phonetic, rule[1], rule[2])
end
for _, rule in ipairs(last_rules) do
phonemic = gsub(phonemic, rule[1], rule[2])
phonetic = gsub(phonetic, rule[1], rule[2])
phonetic = gsub(phonetic, rule[1], rule[2])
end
end
Line 121: Line 127:
end
end
return table.concat(phonemic, " "), table.concat(phonetic, " ")
local phonemicAll = table.concat(phonemic, " ")
local phoneticAll = table.concat(phonetic, " ")
for _, rule in ipairs(sandhi_rules) do
phoneticAll = gsub(phoneticAll, rule[1], rule[2])
end
for _, rule in ipairs(last_rules) do
phonemicAll = gsub(phonemicAll, rule[1], rule[2])
phoneticAll = gsub(phoneticAll, rule[1], rule[2])
end
return phonemicAll, phoneticAll
end
end


Line 133: Line 151:


local phonemic, phonetic = separate_word(term)
local phonemic, phonetic = separate_word(term)
local IPA_args = {{pron = '/' .. phonemic .. '/'}, {pron = '[' .. phonetic .. ']'}}
local IPA_args = {{pron = '[' .. phonetic .. ']'}}
if phonemic ~= phonetic then table.insert(IPA_args, 1, {pron = '/' .. phonemic .. '/'}) end


return "* " .. m_IPA.format_IPA_full(lang, IPA_args)
return "* " .. m_IPA.format_IPA_full({lang = lang, items = IPA_args})
end
end


return export
return export