Module:siwa-pron: Difference between revisions

No edit summary
No edit summary
Line 17: Line 17:


--obsolete ligatures and L with stroke used to remove two-character hassle. will replace later
--obsolete ligatures and L with stroke used to remove two-character hassle. will replace later
local consonant = "[mnɲŋpbtdcɟkɡʔvðsɕxɣhʨʥɾlɬłʣjwʦ]" .. UNRELEASED .. "?"
local consonant = "[mnɲŋpbtdcɟkɡʔvðsɕxɣhʨʥɾlɬłʣjwʦʔ]" .. UNRELEASED .. "?"
local pc = "mnɲŋpbtdcɟkɡʔvðsɕxɣhʨʥɾlɬłʣjwʦ"
local front_vowel = "iɪyeøɛœæa"
local front_vowel = "iɪyeøɛœæa"
local back_vowel = "uɔ" .. NASALIZED .. "?ɑʊ"
local back_vowel = "uɔ" .. NASALIZED .. "?ɑʊ"
local vowel = "[" .. front_vowel .. back_vowel .. "]"
local vowel = "[" .. front_vowel .. back_vowel .. "]"
local stpattern = "·?ˈ[mnɲŋpbtdcɟkɡʔvðsɕxɣhʨʥɾlɬłʣjwʦįų⁽ʰ⁾ʔː]*"..UNRELEASED.."?[iɪyeøɛœæauɔɑʊ][mnɲŋpbtdcɟkɡʔvðsɕxɣhʨʥɾlɬłʣjwʦʔ]*"..UNRELEASED.."ː?"


local function open_to_closed(v)
local function open_to_closed(v)
Line 75: Line 76:
},
},
{
{
-- ["·"] = "", --remove morpheme separator
["·"] = "", --remove morpheme separator
},
}
 
local stressed_rules = {
{
["h"] = "ʔ", ["gi"] = "jː", ["hh"] = "hː"
},
},
}
}


function export.morphemes(word)
function export.morphemes(word)
local morpheme = {}
local pss = {}


if gmatch(word,"·") then
if gmatch(word,"·") then
morpheme = split(word,"·")
pss = split(word,"·")
end
end
for i, m in ipairs(morpheme) do
for i, m in ipairs(pss) do
if m_sm.suffix[m] and gmatch(table.concat(morpheme),"[ˈˌ]") then
if m_sm.suffix[m] and gmatch(table.concat(pss),"[ˈˌ]") then
elseif m_sm.prefix[m] then
elseif m_sm.prefix[m] then
morpheme[i] = "ˌ" .. morpheme[i]
pss[i] = "ˌ" .. pss[i]
else
else
morpheme[i] = "ˈ" .. morpheme[i]
pss[i] = "ˈ" .. pss[i]
end
end
end
end
return table.concat(morpheme,"·")
return table.concat(pss,"·")
end
 
function export.syllables(frame)
local parent_args = frame:getParent().args
local params = {
[1] = { default = mw.title.getCurrentTitle().nsText == 'Template' and "uįo·sauṡṡi" or mw.title.getCurrentTitle().text },
}
local args = require("Module:parameters").process(parent_args, params)
local morpheme = export.morphemes(args[1])
local syll = {}
local pattern = "[·ˈˌ]?[" .. pc .. "]" .. UNRELEASED .. "?*ː?" .. vowel .. "*ː?[" .. pc .. "]" .. UNRELEASED .. "?*ː?·?"
--[·ˈˌ]?[mnɲŋpbtdcɟkɡʔvðsɕxɣhʨʥɾlɬłʣjwʦ⁽ʰ⁾]..UNRELEASED..?*ː?[iɪyeøɛœæauɔɑʊ]*ː?[mnɲŋpbtdcɟkɡʔvðsɕxɣhʨʥɾlɬłʣjwʦ]..UNRELEASED..*ː?·?
 
return table.concat(split(m, pattern), "-")
end
end


Line 124: Line 116:
end
end
end
end
for _, srule in ipairs(stressed_rules) do
for regex, replacement in pairs(srule) do
term = gmatch(term, spattern)
term = gsub(term, regex, replacement)
end
end
table.insert(IPA, term)
table.insert(IPA, term)