Module:siwa-pron: Difference between revisions

No edit summary
No edit summary
Line 78: Line 78:
}
}


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


if gmatch(word,"·") then
if gmatch(word,"·") then
morpheme = split(word,"·")
morpheme = split(word,"·")
end
end
local pattern = "^([ˈˌ]?" .. consonant .. "*" .. vowel .. "*" .. consonant .. "*)"
local pattern = "([·ˈˌ]?" .. consonant .. "*" .. vowel .. "*" .. consonant .. "*·?)"
for i, m in ipairs(morpheme) do
for i, m in ipairs(morpheme) do
Line 94: Line 93:
morpheme[i] = "ˈ" .. morpheme[i]
morpheme[i] = "ˈ" .. morpheme[i]
end
end
syll = split(morpheme[i], pattern)
end
end
table.insert(morpheme, syll)
table.concat(syll, "-")
return table.concat(morpheme,"·")
return table.concat(morpheme,"·")
end
function export.syllables()
end
end


Line 107: Line 106:
term=mw.ustring.lower(term)
term=mw.ustring.lower(term)
term=export.syllables(term)
term=export.morphemes(term)
for _, rule in ipairs(rules) do
for _, rule in ipairs(rules) do