Module:siwa-pron: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 11: Line 11:
local gsub = mw.ustring.gsub
local gsub = mw.ustring.gsub
local u = mw.ustring.char
local u = mw.ustring.char
local split = mw.text.split


local UNRELEASED = u(0x031A) -- COMBINING LEFT ANGLE ABOVE. ̚
local UNRELEASED = u(0x031A) -- COMBINING LEFT ANGLE ABOVE. ̚
Line 74: Line 75:
}
}


--[[function export.syllable(frame)
function export.syllables(word)
local word = mw.title.getCurrentTitle().text
local morpheme = {}
local pattern = "^[" .. initial .. "]?[" .. vocalic .. "]{1}[" .. internal .. "]?"
--local syll = {}
x = m_su.capturing_split(word, pattern)
return x[1]
--table.insert(morpheme, syll)
end]]
if gmatch(word,"·") then
morpheme = split(word,"·")
end
local pattern = "^(" .. consonant .. "*" .. vowel .. "*" .. consonant .. "*)"
for i, m in ipairs(morpheme) do
if m_sm.prefix[m] then
m = "ˌ" .. m
elseif m_sm.suffix[m] then
else
m = "ˈ" .. m
end
end
return morpheme
end


function export.crux(term)
function export.crux(term)
Line 86: Line 103:
term=mw.ustring.lower(term)
term=mw.ustring.lower(term)
for _, rule in ipairs(rules) do
for _, m in ipairs(export.syllables(term)) do
for regex, replacement in pairs(rule) do
for _, rule in ipairs(rules) do
term = gsub(term, regex, replacement)
for regex, replacement in pairs(rule) do
term = gsub(term, regex, replacement)
end
end
end
end
end
if not find(term, "·") then
--[[if not find(term, "·") then
table.insert(IPA, "ˈ")
table.insert(IPA, "ˈ")
end
end]]
table.insert(IPA, term)
table.insert(IPA, term)