Module:rhymes: Difference between revisions

Jump to navigation Jump to search
ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
No edit summary
Line 10: Line 10:
["lfv"] = true
["lfv"] = true
} -- list of language codes which get rhyme from secondary stress as well as primary
} -- list of language codes which get rhyme from secondary stress as well as primary
local no_primary_if_secondary = {
["lfv"] = true
} -- list of language codes which ignore primary stress if secondary stress is present


function de_onset(ipa)
function de_onset(ipa)
Line 58: Line 62:
local rhyme2
local rhyme2
if from_secondary[language.code] and mw.ustring.find(rhyme, "ˌ") then
if from_secondary[language.code] and mw.ustring.find(rhyme, "ˌ") then
rhyme2 = {}
rhyme2 = mw.ustring.match(rhyme, "ˌ(.*)$")
for rhyme_match in mw.ustring.gmatch(rhyme, "ˌ(.*)$") do
table.insert(rhyme2, rhyme_match)
end
end
end
rhyme = mw.ustring.match(rhyme, "ˈ(.*)$") or rhyme
rhyme = mw.ustring.match(rhyme, "ˈ(.*)$") or rhyme
table.insert(rhymes, de_onset(rhyme))
if rhyme2 == nil or no_primary_if_secondary[language.code] ~= true then
table.insert(rhymes, de_onset(rhyme))
end
if rhyme2 then
if rhyme2 then
for _, rhyme2_temp in ipairs(rhyme2) do
table.insert(rhymes, de_onset(rhyme2))
table.insert(rhymes, de_onset(rhyme2_temp))
end
end
end
end
end

Navigation menu