Home
Random
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sandbox/Nardog/1
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
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, 'uy', '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, '([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
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Sandbox/Nardog/1/doc
(
edit
)