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 gsub = mw.ustring.gsub
local gsubn = 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 gsubn() that discards all but the first return value
local function gsub(term, foo, bar, n)
local retval = rsubn(term, foo, bar, n)
return retval
end


function syll_count(term)
function syll_count(term)
Line 37: Line 43:
local pattern = xc .. "?(" .. vowels .. "+ː?)" .. xc .. "*"
local pattern = xc .. "?(" .. vowels .. "+ː?)" .. xc .. "*"
return gsub(term, pattern, "%1", 1)
return gsub(term, pattern, "%1")
end
end