Module:siwa-noun: Difference between revisions

No edit summary
No edit summary
Line 16: Line 16:
local vowels = "[iɪyeøɛœæauɔ̃ɑʊ]"
local vowels = "[iɪyeøɛœæauɔ̃ɑʊ]"
local pagename = mw.title.getCurrentTitle().text
local pagename = mw.title.getCurrentTitle().text
local xc = "[mnɲŋpbtdcɟkɡvðsɕzʑxɣhrlɬjw⁽ʰ⁾ʔː̥͡"..UNRELEASED.."]"


local stressedvowels = {
local stressedvowels = {
Line 31: Line 33:
}
}


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


local function detect_quality(word)
local function detect_quality(word)
Line 77: Line 83:
local x, y = gsub(syll_count(word), pattern, "%1", 1)
local x, y = gsub(syll_count(word), pattern, "%1", 1)
return syll_count(word)
return stressed_components(word)
end
end


return export
return export