Module:ábḫ-ipa: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 92: Line 92:
pos = 0
pos = 0
for i,val in ipairs(stresses) do
for i,val in ipairs(stresses) do
if mw.ustring.match(stresses[i], "ˈ") then
if mw.ustring.match(val, "ˈ") then
pos = i
pos = i
end
end
Line 101: Line 101:
-- mark secondary stress
-- mark secondary stress
for i,val in ipairs(stresses) do
for i,val in ipairs(stresses) do
if mw.ustring.match(stresses[i], ".") and i ~= syllables then
if mw.ustring.match(val, ".") and (i ~= syllables) then
if (i - pos) % 2 == 0 then
if (i - pos) % 2 == 0 then
table.insert(newStresses, "ˌ")
table.insert(newStresses, "ˌ")
else
else
if not (i == 1 and mw.ustring.match(result[1], ".")) then
if not (mw.ustring.match(result[1], ".") and (i == 1)) then
table.insert(newStresses, val)
table.insert(newStresses, val)
end
end
Line 117: Line 117:
newWord = {}
newWord = {}
index = 1
index = 1
for _,val in ipairs(word) do
for _,val in ipairs(result) do
if mw.ustring.match(val, "[.ˈ]") then
if mw.ustring.match(val, "[.ˈ]") then
table.insert(newWord, newStresses[index])
table.insert(newWord, newStresses[index])