বিষয়বস্তুতে চলুন

মডিউল:ckb-pron

উইকিঅভিধান, মুক্ত অভিধান থেকে

এই মডিউলের জন্য মডিউল:ckb-pron/নথি-এ নথিপত্র তৈরি করা হয়ে থাকতে পারে

-- Authors: Ghybu, Calak
local m_IPA = require("Module:IPA")
local lang = require("Module:languages").getByCode("ckb")
local translit = require("Module:ckb-translit").tr

local export = {}

local letters1_phonemes = {
	["a"] = "aː",
    ["b"] = "b",
	["c"] = "d͡ʒ",
    ["ç"] = "t͡ʃ",
	["d"] = "d",
	["e"] = "a",
	["ê"] = "e̞ː",
	["f"] = "f",
	["g"] = "ɡ",
	["h"] = "h",
	["ḧ"] = "ħ",
	["i"] = "ə",
	["î"] = "iː",
	["j"] = "ʒ",
	["k"] = "k",
	["l"] = "l",
	["m"] = "m",
	["n"] = "n",
	["o"] = "o̞ː",
	["p"] = "p",
	["q"] = "q",
	["r"] = "ɾ",
	["s"] = "s",
	["ş"] = "ʃ",
	["t"] = "t",
	["u"] = "ʊ",
	["û"] = "uː",
	["v"] = "v",
	["w"] = "w",
	["x"] = "x",
	["ẍ"] = "ɣ",
	["y"] = "j",
	["z"] = "z",
	["'"] = "ʕ",
}

local function IPA_word(word)
	word = mw.ustring.gsub(word, '.', letters1_phonemes)

	word = mw.ustring.gsub(word, '([ːaʊə])j([^aəʊiueo])', "%1i̯%2") -- diphthongs: ay, oy, ûy, êy, ey
	word = mw.ustring.gsub(word, '([ːaʊə])j$', "%1i̯") -- diphthongs: ay, oy, ûy, êy, ey
	word = mw.ustring.gsub(word, '([ːaʊə])w([^aəʊiueo])', "%1u̯%2") -- diphthongs: aw, ow, îw, êw, ew
	word = mw.ustring.gsub(word, '([ːaʊə])w$', "%1u̯") -- diphthongs: aw, ow, îw, êw, ew
	
	word = mw.ustring.gsub(word, 'ai̯', "ɛi̯") -- diphthong ey
	word = mw.ustring.gsub(word, '̞ː([iu])', "ː%1") -- removing ̞
	word = mw.ustring.gsub(word, '([bʒdɡknqsʃt])weː([iu])', "%1øe%2") -- diphthong öy, öw
	word = mw.ustring.gsub(word, '([bʒdɡknqsʃt])we̞ː', "%1øe̯") -- diphthong ö
	
	word = mw.ustring.gsub(word,'n([ɡk])',"ŋ%1") -- velarized n before velar plosive consonants
	word = mw.ustring.gsub(word, 'k([ieøj])', "c%1") -- palataized k before y and front vowels
	word = mw.ustring.gsub(word, 'ɡ([ieøj])', "ɟ%1") -- palataized g before y and front vowels
    word = mw.ustring.gsub(word, '^ɾ', "r") -- initial r should be trill
    word = mw.ustring.gsub(word,'ɾɾ',"r") -- trill r
    word = mw.ustring.gsub(word, 'll', "ɫ") -- velarized l
	
	word = mw.ustring.gsub(word, 'ja([^ː])', "jɛ%1") -- ye
	word = mw.ustring.gsub(word, 'o̞ː([rɾ])', "ɔː%1") -- or(r)	
	
	return word
end

function export.toIPA(text)
	local wordTab = {}
	
	-- recovery of the text and transliteration by t.tr() function (recovered in [[Modul:ckb-translit]])
	for _, word in ipairs(text) do
		-- exception to the transliteration
		word = mw.ustring.gsub(word,'ئ','ʔ')
		-- table with transliteration
		table.insert(wordTab, translit(word))
	end
	
	-- recovery the page title and transliteration
	if #wordTab == 0 then
		wordTab = {translit(mw.title.getCurrentTitle().text)}
	end
	
	-- IPA
	for key, word in ipairs(wordTab) do
		wordTab[key] = IPA_word(word)
	end
	
	return "/" .. table.concat(wordTab, '/, /') .. "/"
end

function export.ckb_IPA(frame)
	return m_IPA.format_IPA_full(lang, {{pron = export.toIPA(frame:getParent().args)}})
end

return export