Module:onb-pron

--References: 临高汉词典 (Bolian), 临高语研究 (Lincheng, Longtang), 海南临高话 (Dongying, Laocheng, Longqiao), http://ling.hawaii.edu/wp-content/uploads/ChenYenlingFinal.pdf local export = {} local find = mw.ustring.find local gsub = mw.ustring.gsub

local lang = require("Module:languages").getByCode("onb")

local toneConv_Lincheng = { ['¹']  = '˨˩˧', ['²']   = '˥', ['³']   = '˧', ['⁴']   = '˨˩', ['⁷']   = '˧', ['⁸']   = '˥' } local toneConv_Bolian = { ['¹']  = '˩˧', ['²']   = '˥', ['³']   = '˧', ['⁴']   = '˨˩', ['⁷']   = '˧', ['⁸']   = '˥', ['⁹']   = '˨˩' } local toneConv_Dongying = { ['¹']  = '˨˩˧', ['²']   = '˥˧', ['³']   = '˧', ['⁴']   = '˨˩', ['⁷']   = '˧', ['⁸']   = '˥˧', ['⁹']   = '˨˩' } local toneConv_Qiaotou = { ['¹']  = '˨˩˧', ['²']   = '˧˨˦', ['³']   = '˧', ['⁴']   = '˥', ['⁷']   = '˧', ['⁸']   = '˥' } local toneConv_Huangtong = { ['¹']  = '˨˩˧', ['²']   = '˥˩', ['³']   = '˧˩', ['⁴']   = '˨˩', ['⁷']   = '˧', ['⁸']   = '˥' } local toneConv_Xinying = { ['¹']  = '˨˩˧', ['²']   = '˥', ['³']   = '˧', ['⁴']   = '˨˩', ['⁷']   = '˧', ['⁸']   = '˥' } local toneConv_Laocheng = { ['¹']  = '˧˥', ['²']   = '˧', ['³']   = '˩˧', ['⁴']   = '˨˩', ['⁵']   = '˥', ['⁷']   = '˥', ['⁸']   = '˩˧' } local toneConv_Longtang = { ['¹']  = '˩˧', ['1']   = '˦', ['²']   = '˧', ['³']   = '˨˦', ['⁴']   = '˩', ['⁵']   = '˥', ['⁶']   = '˧˥', ['⁷']   = '˩˧', ['7']   = '˦', ['⁸']   = '˩', ['8']   = '˧', ['⁹']   = '˥', ['十']   = '˧˥' --5, 6, 9, 10 are only used in loanwords } local toneConv_Longqiao = { ['¹']  = '˩˧', ['1']   = '˦˥', ['²']   = '˧˨', ['³']   = '˨˦', ['⁴']   = '˨˩', ['⁵']   = '˥', ['⁶']   = '˧˥', ['⁷']   = '˩˧', ['7']   = '˦˥', ['⁸']   = '˨˩', ['8']   = '˧˨', ['⁹']   = '˥', ['十']   = '˧˥' } local toneConv_Yongxing = { ['¹']  = '˨˩˧', ['²']   = '˦', ['³']   = '˨˦', ['⁴']   = '˨˩', ['⁷']   = '˨˩', ['7']   = '˥', ['⁸']   = '˧' } local toneConv_Changliu = { ['¹']  = '˧˥', ['²']   = '˨˦', ['³']   = '˧', ['⁴']   = '˨˩', ['⁷']   = '˥', ['⁸']   = '˨˩' }

function export.show(frame) local params = { [1] = { },		["Lincheng"] = { type = "boolean" }, ["Bolian"] = { type = "boolean" }, ["Dongying"] = { type = "boolean" }, ["Qiaotou"] = { type = "boolean" }, ["Huangtong"] = { type = "boolean" }, ["Xinying"] = { type = "boolean" }, ["Laocheng"] = { type = "boolean" }, ["Longtang"] = { type = "boolean" }, ["Longqiao"] = { type = "boolean" }, ["Yongxing"] = { type = "boolean" }, ["Changliu"] = { type = "boolean" }, }	local args = require("Module:parameters").process(frame:getParent.args, params)

local text = args[1] if not text then text = mw.title.getCurrentTitle.text end text = gsub(text, "ȵ", "n̠ʲ") text = gsub(text, "b", "ɓ") text = gsub(text, "d", "ɗ")

if not find(text, "[¹²³⁴⁵⁶⁷⁸⁹]") then error("Tones are missing") end

local IPAtext = ""

if args["Lincheng"] or args["Bolian"] or args["Dongying"] or args["Qiaotou"] or args["Huangtong"] or args["Xinying"] then IPAtext = IPAtext .. "\n*" .. require("Module:accent qualifier").format_qualifiers(lang, {"Western"}) end

if args["Lincheng"] then if find(text, "[⁰⁵⁶⁹]") then error("Invalid tones in Lincheng accent") end

IPAtext = IPAtext .. "\n** " .. require("Module:accent qualifier").format_qualifiers(lang, {"Lincheng"}) .. " " ..		require("Module:IPA").format_IPA_full { lang = lang, items = , }	end

if args["Bolian"] then if find(text, "[⁰⁵⁶]") then error("Invalid tones in Bolian accent") end

IPAtext = IPAtext .. "\n** " .. require("Module:accent qualifier").format_qualifiers(lang, {"Bolian"}) .. " " ..		require("Module:IPA").format_IPA_full { lang = lang, items = , }	end

if args["Dongying"] then if find(text, "[⁰⁵⁶]") then error("Invalid tones in Dongying accent") end

IPAtext = IPAtext .. "\n** " .. require("Module:accent qualifier").format_qualifiers(lang, {"Dongying"}) .. " " ..		require("Module:IPA").format_IPA_full { lang = lang, items = , }	end

if args["Qiaotou"] then if find(text, "[⁰⁵⁶⁹]") then error("Invalid tones in Qiaotou accent") end

IPAtext = IPAtext .. "\n** " .. require("Module:accent qualifier").format_qualifiers(lang, {"Qiaotou"}) .. " " ..		require("Module:IPA").format_IPA_full { lang = lang, items = , }	end

if args["Huangtong"] then if find(text, "[⁰⁵⁶⁹]") then error("Invalid tones in Huangtong accent") end

IPAtext = IPAtext .. "\n** " .. require("Module:accent qualifier").format_qualifiers(lang, {"Huangtong"}) .. " " ..		require("Module:IPA").format_IPA_full { lang = lang, items = , }	end

if args["Xinying"] then if find(text, "[⁰⁵⁶⁹]") then error("Invalid tones in Xinying accent") end

IPAtext = IPAtext .. "\n** " .. require("Module:accent qualifier").format_qualifiers(lang, {"Xinying"}) .. " " ..		require("Module:IPA").format_IPA_full { lang = lang, items = , }	end

if args["Laocheng"] or args["Longtang"] or args["Longqiao"] or args["Yongxing"] or args["Changliu"] then IPAtext = IPAtext .. "\n*" .. require("Module:accent qualifier").format_qualifiers(lang, {"Eastern"}) end

if args["Laocheng"] then if find(text, "[⁰⁶⁹]") then error("Invalid tones in Laocheng accent") end

IPAtext = IPAtext .. "\n** " .. require("Module:accent qualifier").format_qualifiers(lang, {"Laocheng"}) .. " " ..		require("Module:IPA").format_IPA_full { lang = lang, items = , }	end

if args["Longtang"] then text = gsub(text, "¹⁰", "十") text = gsub(text, "¹'", "1") text = gsub(text, "⁷'", "7") text = gsub(text, "⁸'", "8")

IPAtext = IPAtext .. "\n** " .. require("Module:accent qualifier").format_qualifiers(lang, {"Longtang"}) .. " " ..		require("Module:IPA").format_IPA_full { lang = lang, items = , }	end

if args["Longqiao"] then text = gsub(text, "¹⁰", "十") text = gsub(text, "¹'", "1") text = gsub(text, "⁷'", "7") text = gsub(text, "⁸'", "8")

IPAtext = IPAtext .. "\n** " .. require("Module:accent qualifier").format_qualifiers(lang, {"Longqiao"}) .. " " ..		require("Module:IPA").format_IPA_full { lang = lang, items = , }	end

if args["Yongxing"] then if find(text, "[⁰⁵⁶⁹]") then error("Invalid tones in Yongxing accent") end

text = gsub(text, "⁷'", "7")

IPAtext = IPAtext .. "\n** " .. require("Module:accent qualifier").format_qualifiers(lang, {"Yongxing"}) .. " " ..		require("Module:IPA").format_IPA_full { lang = lang, items = , }	end

if args["Changliu"] then if find(text, "[⁰⁵⁶⁹]") then error("Invalid tones in Changliu accent") end

IPAtext = IPAtext .. "\n** " .. require("Module:accent qualifier").format_qualifiers(lang, {"Changliu"}) .. " " ..		require("Module:IPA").format_IPA_full { lang = lang, items = , }	end

return IPAtext end

return export