Module:kilta-pron: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
 
(19 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 39: Line 39:
{"a(·?ˈ?)([nm])", "æ%1%2"}, {"á(·?ˈ?)([nm])", "æː%1%2"},
{"a(·?ˈ?)([nm])", "æ%1%2"}, {"á(·?ˈ?)([nm])", "æː%1%2"},
{"n(ː?·?ˈ?)([kxqƕ])", "ŋ%1%2"},
{"n(ː?·?ˈ?)([kxqƕ])", "ŋ%1%2"},
{"([nm]·?)k", "%1ɡ"}, {"([nm]·?)q", "%1y"}, {"([nm]·?)p", "%1b"}, {"([nm]·?)ʧ", "%1ʤ"},
{"([nŋm]·?)k", "%1ɡ"}, {"([nŋm]·?)q", "%1y"}, {"([nŋm]·?)p", "%1b"}, {"([nŋm]·?)ʧ", "%1ʤ"},
{"([nm]·?)t", "%1d"},  
{"([nŋm]·?)t", "%1d"},  
{"([nm])(ː?·?ˈ?)β", "%1%2b"},
{"([nŋm])(ː?·?ˈ?)β", "%1%2b"},
{"β([iíeé])", "v%1"},
{"β([iíeé])", "v%1"},
{"^(ˈ?)(" .. vowels .. ")", "%1ʔ%2"},
{"^(ˈ?)(" .. vowels .. ")", "%1ʔ%2"},
{"ü", "aʊ̯"},
{"ï", "aɪ̯"},
}
}


Line 57: 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 iskolan = term == "kolaːn"
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 77: Line 89:
local syllables = split(term, "·")
local syllables = split(term, "·")
if iskolan then
if first then
syllables[#syllables] = "ˈ" .. syllables[#syllables] -- ultimate stress
syllables[1] = "ˈ" .. syllables[1]
elseif last then
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 98: 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 118: 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 130: 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

Navigation menu