Module:sish-pronunc

From Linguifex
Revision as of 01:21, 12 June 2026 by Melinoë (talk | contribs)
Jump to navigation Jump to search


local export = {}
local gsub = require("Module:string utilities").gsub

local mapping = {
	["ա"]="a", 
	["բ"]="b", 
	["գ"]="g", 
	["դ"]="d", 
	["ե"]="ɛ", 
	["զ"]="z",
	["է"]="e", 
	["ը"]="ə",
	["թ"]="tʰ", 
	["ժ"]="ʒ", 
	["ի"]="i", 
	["լ"]="l", 
	["խ"]="x", 
	["ծ"]="t͡s", 
	["կ"]="k", 
	["հ"]="ː",
	["ձ"]="d͡z", 
	["ղ"]="ɣ", 
	["ճ"]="t͡ʃ", 
	["մ"]="m", 
	["յ"]="j", 
	["ն"]="n", 
	["շ"]="ʃ", 
	["ո"]="ɔ",
	["չ"]="t͡ʃʰ", 
	["պ"]="p", 
	["ջ"]="d͡ʒ", 
	["ռ"]="r", 
	["ս"]="s", 
	["վ"]="v", 
	["տ"]="t", 
	["ր"]="r",
	["ց"]="t͡s", 
	["փ"]="pʰ", 
	["ք"]="kʰ", 
	["օ"]="o", 
	["ֆ"]="f",
	["իւ"]="y",
	["էւ"]="ø",
	["եւ"]="œ",
	["Ա"]="A", 
	["Բ"]="B", 
	["Գ"]="G", 
	["Դ"]="D", 
	["Ե"]="E", 
	["Զ"]="Z", 
	["Է"]="Ē", 
	["Ը"]="Ə",
	["Թ"]="Tʻ", 
	["Ժ"]="Ž", 
	["Ի"]="I", 
	["Լ"]="L", 
	["Խ"]="X", 
	["Ծ"]="C", 
	["Կ"]="K", 
	["Հ"]="H",
	["Ձ"]="J", 
	["Ղ"]="Ġ", 
	["Ճ"]="Č", 
	["Մ"]="M", 
	["Յ"]="Y", 
	["Ն"]="N", 
	["Շ"]="Š", 
	["Ո"]="O",
	["Չ"]="Čʻ", 
	["Պ"]="P", 
	["Ջ"]="J̌", 
	["Ռ"]="Ṙ", 
	["Ս"]="S", 
	["Վ"]="V", 
	["Տ"]="T", 
	["Ր"]="R",
	["Ց"]="Cʻ", 
	["Ւ"]="W", 
	["Փ"]="Pʻ", 
	["Ք"]="Kʻ", 
	["Օ"]="Ō", 
	["Ֆ"]="F", 
	["ﬓ"]="mn", 
	["ﬔ"]="me",
	["ﬕ"]="mi", 
	["ﬖ"]="vn", 
	["ﬗ"]="mx", 
	["ՠ"]="ä", 
	["ֈ"]="hª",
	-- punctuation
	["՝"]=",", ["։"]=".", ["․"]=";", ["՛"]="́", ["՜"]="<sup>!</sup>", ["՞"]="<sup>?</sup>",
	["՟"]=".", ["֊"]="-", ["՚"]="’", ['«']='“', ['»']='”', ['ՙ']='ʻ'
}

local replacements = {
	-- desirable, but doesn't work: ['<sup>յ</sup>'] = 'ʸ',
	['յ̵'] = mapping['ֈ'],
	['ղʻ'] = 'q',
	['Ո[ւՒ]'] = 'U',
	['ու'] = 'u',
	['Ո՛[ւՒ]'] = 'Ú',
	['ո՛ւ'] = 'ú',
	['Ո՜[ւՒ]'] = 'U<sup>!</sup>',
	['ո՜ւ'] = 'u<sup>!</sup>',
	['Ո՞[ւՒ]'] = 'U<sup>?</sup>',
	['ո՞ւ'] = 'u<sup>?</sup>',
	['ո̈ւ'] = 'ü',
	['Ո̈[ւՒ]'] = 'Ü',
	['օ̈'] = 'ö',
	['Օ̈'] = 'Ö',
}

function export.show(frame)
	local parent_args = frame:getParent().args
	local params = {
		[1] = { default = mw.title.getCurrentTitle().nsText == 'Template' and "Niṡkullit" or mw.title.getCurrentTitle().text },
	}
	local args = require("Module:parameters").process(parent_args, params)
	local term = mw.ustring.lower(args[1])
	
	local pronunciations = {
		{pron = "[" .. export.crux(term) .. "]"}
	}

	return "* " .. m_IPA.format_IPA_full{lang = lang, items = pronunciations}
end

return export