Module:ábḫ-ipa: Difference between revisions

Jump to navigation Jump to search
No edit summary
No edit summary
Line 89: Line 89:
end
end
return table.concat(result)
word = table.concat(result)
end
 
function export.convertOld(frame)
local word = type(frame) == "table" and frame.args[1] or frame
word = mw.text.split(word, "", true)
word = string.gsub(word, "B", "ᵐb")
word = string.gsub(word, "D", "ⁿd")
word = string.gsub(word, "j", "ɲ")
word = string.gsub(word, "G", "ᵑg")
word = string.gsub(word, "P", "mp")
word = string.gsub(word, "T", "nt")
word = string.gsub(word, "K", "nk")
word = string.gsub(word, "b", "β")
word = string.gsub(word, "z", "θ")
word = string.gsub(word, "d", "ð")
word = string.gsub(word, "s", "ɕ")
word = string.gsub(word, "J", "ʑ")
word = string.gsub(word, "H", "x")
word = string.gsub(word, "h", "ɦ")
word = string.gsub(word, "r", "ɺ")
word = string.gsub(word, "y", "j")
word = string.gsub(word, "ī", "iː")
word = string.gsub(word, "î", "îː")
word = string.gsub(word, "ǐ", "ǐː")
word = string.gsub(word, "ē", "eːɪ̯")
word = string.gsub(word, "ê", "êːɪ̯")
word = string.gsub(word, "ě", "ěːɪ̯")
word = string.gsub(word, "o", "ɔ")
word = string.gsub(word, "ó", "ɔ́")
word = string.gsub(word, "ō", "ɔːʊ̯")
word = string.gsub(word, "ô", "ɔ̂ːʊ̯")
word = string.gsub(word, "ǒ", "ɔ̌ːʊ̯")
word = string.gsub(word, "I", "ɔɪ̯")
word = string.gsub(word, "Í", "ɔ́ɪ̯")
word = string.gsub(word, "ā", "aː")
word = string.gsub(word, "â", "âː")
word = string.gsub(word, "ǎ", "ǎː")
word = string.gsub(word, "A", "aɪ̯")
word = string.gsub(word, "Á", "áɪ̯")
word = string.gsub(word, "Ā", "aːɪ̯")
word = string.gsub(word, "Â", "âːɪ̯")
word = string.gsub(word, "Ǎ", "ǎːɪ̯")
word = string.gsub(word, "O", "aɔ̯")
word = string.gsub(word, "Ó", "áɔ̯")
word = string.gsub(word, "Ō", "aːɔ̯")
word = string.gsub(word, "Ô", "âːɔ̯")
word = string.gsub(word, "Ǒ", "ǎːɔ̯")
result = {}
return "/" .. word .. "/"
for i,val in ipairs(word) do
if val == "a" then
if mw.ustring.match(word[i-1], "[áa]") then
table.insert(result, "ː")
elseif mw.ustring.match(word[i+1], "[á]") then
table.insert(result, "ǎ")
else
table.insert(result, "a")
end
elseif val == "á" then
if mw.ustring.match(word[i-1], "[a]") then
table.insert(result, "ː")
elseif mw.ustring.match(word[i+1], "[a]") then
table.insert(result, "â")
else
table.insert(result, "á")
end
elseif val == "b" then
if mw.ustring.match(word[i-1], "[m]") then
table.insert(result, "b")
else
table.insert(result, "β")
end
elseif val == "d" then
table.insert(result, "ð")
elseif val == "e" then
if mw.ustring.match(word[i+1], "[í]") then
table.insert(result, "ě")
else
table.insert(result, "e")
end
elseif val == "é" then
if mw.ustring.match(word[i+1], "[i]") then
table.insert(result, "ê")
else
table.insert(result, "é")
end
elseif val == "h" then
if not mw.ustring.match(word[i-1], "[j]") then
table.insert(result, "ɦ")
end
elseif val == "ḫ" then
table.insert(result, "x")
elseif val == "i" then
if mw.ustring.match(word[i-1], "[ée]") then
table.insert(result, "ːɪ̯")
elseif mw.ustring.match(word[i-1], "[aáoó]") then
table.insert(result, "ɪ̯")
elseif mw.ustring.match(word[i-1], "[ií]") then
table.insert(result, "ː")
elseif mw.ustring.match(word[i+1], "[í]") then
table.insert(result, "ǐ")
end
elseif val == "í" then
if mw.ustring.match(word[i-1], "[e]") then
table.insert(result, "ːɪ̯")
elseif mw.ustring.match(word[i+1], "i") then
table.insert(result, "î")
else
table.insert(result, "í")
end
elseif val == "j" then
if mw.ustring.match(word[i+1], "[h]") then
table.insert(result, "ʑ")
elseif i == 2 then
if mw.ustring.match(word[i+1], "[áéíó]") then
table.insert(result, "ᶮɟ̟")
elseif mw.ustring.match(word[i+1], "[iea]") and mw.ustring.match(word[i+2], "[íéá]") then
table.insert(result, "ᶮɟ̟")
elseif mw.ustring.match(word[i+1], "[o]") and mw.ustring.match(word[i+2], "[úí]") then
table.insert(result, "ᶮɟ̟")
else
table.insert(result, "ɲ̟")
end
else
if mw.ustring.match(word[i+1], "[áéíó]") then
table.insert(result, "ɲ̟ɟ̟")
elseif mw.ustring.match(word[i+1], "[iea]") and mw.ustring.match(word[i+2], "[íéá]") then
table.insert(result, "ɲ̟ɟ̟")
elseif mw.ustring.match(word[i+1], "[o]") and mw.ustring.match(word[i+2], "[úí]") then
table.insert(result, "ɲ̟ɟ̟")
else
table.insert(result, "ɲ̟")
end
end
elseif val == "k" then
if mw.ustring.match(word[i-1], "[n]") then
table.insert(result, "g")
else
table.insert(result, "k")
end
elseif val == "m" then
if i == 2 and mw.ustring.match(word[i+1], "[b]") then
table.insert(result, "ᵐ")
else
table.insert(result, "m")
end
elseif val == "n" then
if i == 2 then
if mw.ustring.match(word[i+1], "[t]") then
table.insert(result, "ⁿ")
elseif mw.ustring.match(word[i+1], "[k]") then
table.insert(result, "ᵑ")
else
table.insert(result, "n̪")
end
else
if mw.ustring.match(word[i+1], "[k]") then
table.insert(result, "ŋ")
else
table.insert(result, "n̪")
end
end
elseif val == "o" then
if mw.ustring.match(word[i-1], "[a]") then
table.insert(result, "o̯")
elseif mw.ustring.match(word[i+1], "[ú]") then
table.insert(result, "ɔ̌")
else
table.insert(result, "ɔ")
end
elseif val == "ó" then
if mw.ustring.match(word[i+1], "[u]") then
table.insert(result, "ô")
else
table.insert(result, "ɔ́")
end
elseif val == "r" then
table.insert(result, "ɺ")
elseif val == "s" then
table.insert(result, "ɕ")
elseif val == "t" then
if mw.ustring.match(word[i-1], "[n]") and not mw.ustring.match(word[i+1], "[t]") then
table.insert(result, "d̪")
else
table.insert(result, "")
end
elseif val == "u" then
table.insert(result, "ːʊ̯")
elseif val == "ú" then
table.insert(result, "ːʊ̯")
elseif val == "y" then
table.insert(result, "j")
elseif val == "z" then
table.insert(result, "θ̱")
else
table.insert(result, val)
end
end
return table.concat(result)
end
end


return export
return export