Module:User:Awesomemeeos/li-pron

From Wiktionary, the free dictionary
Jump to navigation Jump to search

This is a private module sandbox of Awesomemeeos, for their own experimentation. Items in this module may be added and removed at Awesomemeeos's discretion; do not rely on this module's stability.


local export = {}
local m_IPA = require("Module:IPA")

-- This is starting with the Maastrichtian dialect

local cons = {
	["ch"]	=	"x",	["dj"]	=	"ɟ",	["g"]	=	"ɣ",	["gk"]	=	"ɡ",	["lj"]	=	"ʎ", ["nj"]	=	"ɲ",	["nj"]	=	"ɲ",	["q"]	=	"k",	["q"]	=	"k",	["r"]	=	"ʁ",	["sj"]	=	"ʃ",	["tj"]	=	"ć",	["x"]	=	"ks",	["zj"]	=	"ʒ",
-- ð seems to be an allophone of d and s, but where?
}

local vowels = {
	["aaë"]	=	"aːə",	["aaj"]	=	"aːj",	["aaw"]	=	"aːw",	["aej"]	=	"æːj",	["aew"]	=	"æːw",	["àèë"]	=	"ɛːə",	["àèw"]	=	"ɛːe",	["aoë"]	=	"ɒːə",	["aoj"]	=	"ɒːj",	["aow"]	=	"ɒːw",	["äöj"]	=	"œːj",	["äöw"]	=	"œːw",	["eej"]	=	"eːj",	["eew"]	=	"eːw",	["euë"]	=	"øːə",	["euj"]	=	"øːj",	["euw"]	=	"øːw",	["ieè"]	=	"iːɛ",	["ieë"]	=	"iːə",	["iej"]	=	"iːj",	["iew"]	=	"iːw",	["oea"]	=	"uːɑ",	["oeè"]	=	"uːɛ",	["oeë"]	=	"uːə",	["oej"]	=	"uːj",	["oew"]	=	"uːw",		["ooë"]	=	"oːə",	["ooj"]	=	"oːj",	["oow"]	=	"oːw",	["uuè"]	=	"yːɛ",	["uuë"]	=	"yːə",	["uuj"]	=	"yːj",	["uuw"]	=	"yːw",
	["aa"]	=	"aː",	["ae"]	=	"æː",	["aë"]	=	"aə",	["aj"]	=	"aj",	["ao"]	=	"ɒː",	["àè"]	=	"ɛː",	["äö"]	=	"œː",	["äö"]	=	"œː",	["au"]	=	"ɑu",	["aw"]	=	"ɑw",	["ee"]	=	"æ",	["eë"]	=	"æə",	["ei"]	=	"ɛː",	["ej"]	=	"æj",	["eu"]	=	"øː",	["ew"]	=	"æw",	["èè"]	=	"ɛː",	["èë"]	=	"ɛə",	["èw"]	=	"ɛw",	["ie"]	=	"i",	["iê"]	=	"iː",	["iè"]	=	"iː",	["ië"]	=	"ɪə",	["i-j"]	=	"ɪj",	["iw"]	=	"ɪw",
["oa"]	=	"ɔɑ",	["oe"]	=	"u",	["oê"]	=	"uː",	["oë"]	=	"ɔə",	["oj"]	=	"ɔj",	["oo"]	=	"oː",	["ou"]	=	"ɔu",	["óa"]	=	"oɑ",	["óë"]	=	"oə",	["ój"]	=	"oj",	["ów"]	=	"ow",	["öä"]	=	"œɑ",	["öë"]	=	"œə",	["öw"]	=	"œw",	["uë"]	=	"yːə",	["uè"]	=	"yːɛ",	["ui"]	=	"œy",	["uj"]	=	"œɥ",	["uw"]	=	"œw",	["uu"]	=	"y",
	["a"]	=	"ɑ",	["á"]	=	"a",	["â"]	=	"aː",	["e"]	=	"æ",	["è"]	=	"ɛ",	["ë"]	=	"ə",	["i"]	=	"ɪ",	["o"]	=	"ɔ",	["ó"]	=	"o",	["ö"]	=	"œ",	["u"]	=	"ʏ",
}

local devoice = {
	["b"]	=	"p",	["d"]	=	"t",	["g"]	=	"ch",	["z"]	=	"s",
}

local vowel_conv = {
	["ɑ"]	=	"aː",	["ɒː"]	=	"ɔː",	["ɒːj"]	=	"ɔːj",	["ɒːw"]	=	"ɔːw",	["æ"]	=	"eː",	["æə"]	= "eːə",	["æw"]	= "ew",	["ɪ"]	= "iː",	["i"]	= "iː",	["ɔ"]	= "oː",	["u"]	= "uː",	["ɔu"]	= "ɑu",	["ʏ"]	= "yː",	["y"]	= "yː",
}

local vowel_sounds = 'iyɪʏeøɛœæaəɑɒuɔo'
local front_vowel = 'iyɪʏeøɛœæaə'
local ortho_cons = 'bcdfghjklmnpqrstvwxz'

function export.pronunciation(text, lang, sc)
	if type(text) == "table" then
		text, lang, sc = text.args[1], text.args[2], text.args[3]
	end

-- NEXT STEP! APPLY 'vowel_conv'
	text = mw.ustring.gsub(text, 'qu', "qw")
	-- if mw.ustring.find(term, '[' .. vowel_sounds .. ']') then
	text = mw.ustring.gsub(text, '\'([' .. ortho_cons .. '])', "ə%1")
	text = mw.ustring.gsub(text, '[aeiouáóâàèäö][aeiouêèëjw]?[aeiouèëjw]?', vowels)
	text = mw.ustring.gsub(text, '-', "")
	text = mw.ustring.gsub(text, '[' .. ortho_cons .. '][hjk]?', cons)
	text = mw.ustring.gsub(text, 'c([' .. front_vowel .. '])', "s%1")
	text = mw.ustring.gsub(text, 'ć([' .. front_vowel .. '])', "tʃ%1")
	text = mw.ustring.gsub(text, 'ch([' .. front_vowel .. '])', "ç%1")
	text = mw.ustring.gsub(text, 'ɟ([' .. front_vowel .. '])', "dʒ%1")
	text = mw.ustring.gsub(text, 'ɣ([' .. front_vowel .. '])', "ʝ%1")
	text = mw.ustring.gsub(text, 'c', "k")

	if narrow then

	end

	return text
end

return export