Module:qhv-pron: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 28: Line 28:
local function write_stress(term)
local function write_stress(term)
local pattern = "(" .. consonants .. "*".. vowels .. "*" .. consonants .. "-)"
local pattern = "(" .. consonants .. "*".. vowels .. "*" .. consonants .. "-)"
local syll = {}
local syllables, weight = {}, {}
term = gsub(term, pattern, "·%1")
term = gsub(term, pattern, "·%1")
term = gsub(term, "^·", "")
term = gsub(term, "^·", "")
Line 35: Line 35:
term = gsub(term, "·(" .. consonants .. ")(" .. consonants .. ")", "%1·%2")
term = gsub(term, "·(" .. consonants .. ")(" .. consonants .. ")", "%1·%2")
syll = split(term, "·")
syllables = split(term, "·")
for i, syllable in ipairs(syllables) do
weight[i] = match(syllable, "[aeiouy" .. NONSYLLABIC .. "]$") and "l" or "h"
end
return table.getn(syll)
return weight[1]
end
end


Navigation menu