Module:siwa-noun: Difference between revisions

No edit summary
No edit summary
Line 32: Line 32:


function syll_count(term)
function syll_count(term)
local x = {}
term = m_pron.crux(term, true, false, false)
term = m_pron.crux(term, true, false, false)
term = gsub(term, "[ˌˈ]", "")
term = gsub(term, "[ˌˈ]", "")
Line 38: Line 37:
local pattern = "(" .. xc .. "?" .. vowels .. "+ː?" .. xc .. "*)"
local pattern = "(" .. xc .. "?" .. vowels .. "+ː?" .. xc .. "*)"
term, n = gsub(term, pattern, "%1")
term, n = gsub(term, pattern, "%1")
term = gmatch(term, pattern)
term = mw.ustring.match(term, pattern)
return term, n
return term, n
Line 45: Line 44:
local function detect_quality(word)
local function detect_quality(word)
local stressed, n = syll_count(word)
local stressed, n = syll_count(word)
if gmatch(stressed, vowels .. vowels .. vowels .. "?") or gmatch(stressed, "ː") or n>=3 then
if mw.ustring.match(stressed, vowels .. vowels .. vowels .. "?") or mw.ustring.match(stressed, "ː") or n>=3 then
return "w" -- weak nouns
return "w" -- weak nouns
else return "s" -- strong nouns
else return "s" -- strong nouns