Module:siwa-noun: Difference between revisions

No edit summary
No edit summary
Line 8: Line 8:
local find = mw.ustring.find
local find = mw.ustring.find
local gmatch = mw.ustring.gmatch
local gmatch = mw.ustring.gmatch
local rsubn = mw.ustring.gsub
local gsub = mw.ustring.gsub
local u = mw.ustring.char
local u = mw.ustring.char
local split = mw.text.split
local split = mw.text.split
Line 30: Line 30:
["di"] = "", ["nįi"] = "gįi", ["hhį"] = "ṡ", ["[ou]ų"] = "ů",  
["di"] = "", ["nįi"] = "gįi", ["hhį"] = "ṡ", ["[ou]ų"] = "ů",  
}
}
-- version of rsubn() that discards all but the first return value
local function rsub(term, foo, bar, n)
local retval = rsubn(term, foo, bar, n)
return retval
end


function syll_count(term)
function syll_count(term)
term = m_pron.crux(term, true, false, false)
term = m_pron.crux(term, true, false, false)
term = rsub(term, "[ˌˈ]", "")
term = gsub(term, "[ˌˈ]", "")
local xc = "[mnɲŋpbtdcɟkɡvðsɕzʑxɣhrlɬjw⁽ʰ⁾ʔː̥͡"..UNRELEASED.."]"
local xc = "[mnɲŋpbtdcɟkɡvðsɕzʑxɣhrlɬjw⁽ʰ⁾ʔː̥͡"..UNRELEASED.."]"
local pattern = xc .. "?(" .. vowels .. "+ː?)" .. xc .. "*"
local pattern = xc .. "?(" .. vowels .. "+ː?)" .. xc .. "*"
return rsub(term, pattern, "%1")
return gsub(term, pattern, "%1")
end
end