Module:qhv-pron: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 31: Line 31:
}
}


local function write_stress(term)
function export.write_stress(term, from_module)
local pattern = "(" .. consonants .. "*".. vowels .. "*" .. consonants .. "-)"
local pattern = "(" .. consonants .. "*".. vowels .. "*" .. consonants .. "-)"
local weight = {}
local weight = {}
Line 43: Line 43:
local syllables = split(term, "·")
local syllables = split(term, "·")
if from_module then return #syllables end -- allow other modules to know the number of syllables
if #syllables == 1 then return table.concat(syllables) end -- account for monosyllables
if #syllables == 1 then return table.concat(syllables) end -- account for monosyllables
for i, syllable in ipairs(syllables) do
for i, syllable in ipairs(syllables) do
Line 72: Line 75:
end
end
return write_stress(term)
return export.write_stress(term, false)
end
end