45,341
edits
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.syllables(word) | |||
local word = | local morpheme = {} | ||
local pattern = "^ | --local syll = {} | ||
return | --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 _, rule in ipairs(rules) do | |||
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) |