词条 | Module:Sandbox/Nardog/1 |
释义 | local p = {} local getArgs = require('Module:Arguments').getArgs local gsub = mw.ustring.gsub function p._main(args) local ret = local orig =
for i, v in ipairs(args) do orig = orig .. '|' .. v
if v ~= '\\ then if not mw.ustring.find(v, '[_-]') and v == mw.ustring.upper(v) then if i == 1 and not args[i + 1] then v = mw.ustring.lower(v) else v = 'ˈ|' .. mw.ustring.lower(v) end end
v = gsub(v, '-', '|')
v = gsub(v, 't?ch', 'Tʃ|') v = gsub(v, 'dh', 'ð|') v = gsub(v, 'j', 'Dʒ|') v = gsub(v, 'kh', 'X|') v = gsub(v, 'ng', 'ŋ|') v = gsub(v, 'gh?', 'ɡ|') v = gsub(v, 'sh', 'ʃ|') v = gsub(v, 'th', 'θ|') v = gsub(v, 'wh', 'HW|') v = gsub(v, 'zh', 'ʒ|') v = gsub(v, 'bb', 'B|') v = gsub(v, 'ck?', 'K|') v = gsub(v, 'dd', 'D|') v = gsub(v, 'ff', 'F|') v = gsub(v, 'gg', 'ɡ|') v = gsub(v, 'kk', 'K|') v = gsub(v, 'pp', 'P|') v = gsub(v, 'rr', 'R|') v = gsub(v, 'ss', 'S|') v = gsub(v, 'tt', 'T|') v = gsub(v, 'vv', 'V|') v = gsub(v, 'x', 'K|S|') v = gsub(v, 'zz', 'Z|')
v = gsub(v, 'a[iy]r', 'ɛƏR|') v = gsub(v, 'ah?r', 'ɑːR|') v = gsub(v, 'eer', 'ɪƏR|') v = gsub(v, 'ewr', 'JʊƏR|') v = gsub(v, 'yoor', 'JʊƏR|') v = gsub(v, '[iy]re?', 'AɪƏR|') v = gsub(v, 'ohr', 'ɔƏR|') v = gsub(v, 'oor', 'ʊƏR|') v = gsub(v, 'or', 'ɔːR|') v = gsub(v, 'awr', 'ɔːR|') v = gsub(v, 'o[wu]r', 'AʊƏR|') v = gsub(v, 'ur', 'ɜːR|')
v = gsub(v, 'ah', 'ɑː|') v = gsub(v, 'aw', 'ɔː|') v = gsub(v, 'ay', 'Eɪ|') v = gsub(v, 'a(R?)', 'æ%1|') v = gsub(v, 'ih?(R?)', 'ɪ%1|') v = gsub(v, 'o[he]', 'Oʊ|') v = gsub(v, 'o[wu]', 'Aʊ|') v = gsub(v, 'oo', 'Uː|') v = gsub(v, 'oy', 'ɔɪ|') v = gsub(v, 'o(R?)', 'ɒ%1|') v = gsub(v, 'ee', 'Iː|') v = gsub(v, 'ew', 'JUː|') v = gsub(v, '^y', 'J|') v = gsub(v, '|y', '|J|') v = gsub(v, 'eye', 'Aɪ|') v = gsub(v, 'y([BDFHKLMNŊPSTVWZXbdʒðfɡhklmnŋpsʃtθvwzx|]+)e?', 'Aɪ|%1') v = gsub(v, 'e?ye?|', 'Aɪ|') v = gsub(v, 'e?ye?$', 'Aɪ|') v = gsub(v, 'y', 'J|') v = gsub(v, 'eh?(R?)', 'ɛ%1|') v = gsub(v, 'uu(R?)', 'ʊ%1|') v = gsub(v, 'uh?(R?)', 'ʌ%1|')
v = gsub(v, '([bdfghklmnprstvwzə])', '%1|') v = gsub(v, 'ə|([lmnr])', 'ə%1')
ret = ret .. mw.ustring.lower(v) i = i + 1 end end
ret = gsub(ret, '[ _]', '_|') ret = gsub(ret, '|||', '|') ret = gsub(ret, '||', '|') ret = gsub(ret, 'ˈ([^ˈ_]*ˈ[^ˈ]*)$', 'ˌ%1') ret = gsub(ret, 'ˈ([^ˈ_]*ˈ[^ˈ_]*_)', 'ˌ%1')
ret = gsub(ret, '([dlnstzθ])|j|?uː', '%1j|uː') ret = gsub(ret, 'iː|$', 'i|') ret = gsub(ret, 'iː|([,_])', 'i|%1') ret = gsub(ret, '([aeiouɑɒæɛɪɔʊʌəː])|([aeiouɑɒæɛɪɔʊʌə])', '%1|.|%2') ret = gsub(ret, '([iu])ː(|[%.ˈˌ]|[aeiouɑɒæɛɪɔʊʌə])', '%1%2') ret = gsub(ret, '([iu])|%.|ə', '%1|ə') ret = gsub(ret, '|([bdfhjklmnprstvwxzŋɡʃʒθðʔ]+)|([ˈˌ])|([aeiouɑɒæɛɪɔʊʌj])', '|%2|%1|%3') ret = gsub(ret, '([ˈˌ]|[^aeiouɑɒæɛɪɔʊʌəː%.ˈˌ]*[iu])|', '%1ː|') ret = gsub(ret, '([ˈˌ])|_', '_|%1')
if args.audio then ret = 'audio=' .. args.audio .. '|' .. ret end
ret = '{{IPAc-en|' .. gsub(ret, '|$', ) .. '}}'
if not args.nr then ret = ret .. ' {{respell' .. orig .. '}}' end
return ret end function p.main(frame) local args = getArgs(frame, {removeBlanks = false}) return frame:preprocess{ text = p._main(args) } -- return p._main(args)end return p |
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。