10,794
edits
TheNightAvl (talk | contribs) (Added u resolution function.) |
TheNightAvl (talk | contribs) m (Optimisation) |
||
Line 1: | Line 1: | ||
local export = {} | |||
local getArgs = require('Module:Arguments').getArgs | local getArgs = require('Module:Arguments').getArgs | ||
local data = { | local data = { | ||
Line 37: | Line 37: | ||
["e"] = { | ["e"] = { | ||
["a"] = "ia", | ["a"] = "ia", | ||
["j"] = "iːj", | |||
[false] = "ie", | [false] = "ie", | ||
}, | }, | ||
Line 74: | Line 75: | ||
["o"] = { | ["o"] = { | ||
["a"] = "ua", | ["a"] = "ua", | ||
["j"] = "uːj", | |||
[false] = "uo", | [false] = "uo", | ||
}, | }, | ||
Line 101: | Line 103: | ||
data["ò"] = data["o"] | data["ò"] = data["o"] | ||
data["y"] = data["i"] | data["y"] = data["i"] | ||
data["y"]["e"]["j"] = "yːj" | |||
data["ý"] = data["í"] | data["ý"] = data["í"] | ||
data["ỷ"] = data["ỉ"] | data["ỷ"] = data["ỉ"] | ||
data[","] = data["."] | data[","] = data["."] | ||
data["!"] = data["."] | data["!"] = data["."] | ||
Line 116: | Line 120: | ||
["ʃ"] = true, ["t"] = true, ["u"] = true, ["uː"] = true, ["uːː"] = true, ["uːo"] = true, ["ua"] = true, | ["ʃ"] = true, ["t"] = true, ["u"] = true, ["uː"] = true, ["uːː"] = true, ["uːo"] = true, ["ua"] = true, | ||
["uo"] = true, ["v"] = true, ["w"] = true, ["y"] = true, ["z"] = true, ["ʒ"] = true, ["θ"] = true, | ["uo"] = true, ["v"] = true, ["w"] = true, ["y"] = true, ["z"] = true, ["ʒ"] = true, ["θ"] = true, | ||
-- Temporary phones -- | |||
["iːj"] = true, ["uːj"] = true, ["yːj"] = true, | |||
} | } | ||
Line 133: | Line 141: | ||
["ɔi"] = true, ["u"] = true, ["uː"] = true, ["uːː"] = true, ["uːo"] = true, ["ua"] = true, | ["ɔi"] = true, ["u"] = true, ["uː"] = true, ["uːː"] = true, ["uːo"] = true, ["ua"] = true, | ||
["uo"] = true, | ["uo"] = true, | ||
-- Temporary phones -- | |||
["iːj"] = true, ["uːj"] = true, ["yːj"] = true, | |||
} | } | ||
Line 145: | Line 157: | ||
local IPA = {} | local IPA = {} | ||
-- PROCESS FUNCTIONS -- | |||
function generate_IPA(word) | function generate_IPA(word) | ||
Line 253: | Line 254: | ||
if type(getData) == "string" and (i == 0 or multiMatch == true) then | if type(getData) == "string" and (i == 0 or multiMatch == true) then | ||
-- generate_IPA: mw.log("Target acquired of length " .. 1 - i .. ", converting to [" .. getData .. "].") | -- generate_IPA: mw.log("Target acquired of length " .. 1 - i .. ", converting to [" .. getData .. "].") | ||
table.insert(IPA, 1, getData) | |||
s = mw.ustring.sub(s, 1, s_len + i - 1) | s = mw.ustring.sub(s, 1, s_len + i - 1) | ||
s_len = mw.ustring.len(s) | s_len = mw.ustring.len(s) | ||
Line 315: | Line 316: | ||
function export.generate(frame) | function export.generate(frame) | ||
local args = getArgs(frame) | local args = getArgs(frame) | ||
local | local outputIPA = generate_IPA(args[1]) | ||
outputIPA = resolve_u(outputIPA) | |||
outputIPA = table.concat(outputIPA,"][") | outputIPA = table.concat(outputIPA,"][") | ||