182
edits
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
local export = {} | local export = {} | ||
function export.convert(frame) | function export.convert(frame) | ||
Line 121: | Line 113: | ||
end | end | ||
newWord = {} | newWord = {} | ||
index = 1 | index = 1 | ||
for i,val in ipairs(result) do | for i,val in ipairs(result) do | ||
stress = newStresses[index] | |||
-- look through word and replace the correct .'s with ˌ's | |||
if (i == 1) and val == "." and newStresses[1] == "." then | if (i == 1) and val == "." and newStresses[1] == "." then | ||
index = index + 1 | index = index + 1 | ||
elseif val == "." or val == "ˈ" then | elseif val == "." or val == "ˈ" then | ||
table.insert(newWord, | table.insert(newWord, stress) | ||
index = index + 1 | index = index + 1 | ||
-- allophonic rules, i.e., from a one-to-one phonemic map to a one-to- | |||
-- one phonetic map: vowels first | |||
elseif val == "a" then | |||
if stress == "." then | |||
table.insert(newWord, "w") | |||
else | |||
if | |||
table.insert(newWord, "a") | table.insert(newWord, "a") | ||
end | end | ||
elseif val == "e" then | elseif val == "e" then | ||
if | if stress == "." then | ||
if result[i+1] ~= nil then | |||
table.insert(newWord, " | if mw.ustring.match(result[i+1], "[ntzdr]") then | ||
table.insert(newWord, "3") | |||
elseif result[i+2] ~= nil then | |||
if mw.ustring.match(result[i+1], "[%.ˌˈ]") and mw.ustring.match(result[i+2], "[ntzdr]") then | |||
table.insert(newWord, "3") | |||
else | |||
table.insert(newWord, "e") | |||
end | |||
else | |||
table.insert(newWord, "e") | |||
end | |||
else | else | ||
table.insert(newWord, "e") | table.insert(newWord, "e") | ||
Line 160: | Line 153: | ||
-- now let's do consonants | -- now let's do consonants | ||
elseif val == "b" then | elseif val == "b" then | ||
if (( | if ((result[i-1] == ".") or (result[i-1] == "ˌ") or (result[i-1] == "ˈ")) and (result[i-2] == "m") then | ||
table.insert(newWord, "8") | table.insert(newWord, "8") | ||
else | else |
edits