Modul:hy-pronunciation

Üdvözlöm, Ön a Modul:hy-pronunciation szó jelentését keresi. A DICTIOUS-ban nem csak a Modul:hy-pronunciation szó összes szótári jelentését megtalálod, hanem megismerheted az etimológiáját, a jellemzőit és azt is, hogyan kell a Modul:hy-pronunciation szót egyes és többes számban mondani. Minden, amit a Modul:hy-pronunciation szóról tudni kell, itt található. A Modul:hy-pronunciation szó meghatározása segít abban, hogy pontosabban és helyesebben fogalmazz, amikor beszélsz vagy írsz. AModul:hy-pronunciation és más szavak definíciójának ismerete gazdagítja a szókincsedet, és több és jobb nyelvi forráshoz juttat.

A modult a Modul:hy-pronunciation/doc lapon tudod dokumentálni

local export = {}

-- single characters that map to IPA sounds   
local phonetic_chars_map = {
	="ɑ", ="b", ="ɡ", ="d", ="ɛ", ="z",
	="ɛ", ="ə", ="tʰ", ="ʒ", ="i", ="l",
	="χ", ="t͡s", ="k", ="h", ="d͡z", ="ʁ", 
	="t͡ʃ", ="m", ="j", ="n", ="ʃ", ="ɔ",
	="t͡ʃʰ", ="p", ="d͡ʒ", ="r", ="s", ="v", 
	="t", ="ɾ", ="t͡sʰ", ="v", ="pʰ", ="kʰ",
	="ɔ", ="f", =" ", ="", =""
}

-- character sequences of two that map to IPA sounds
local phonetic_2chars_map = {
	 = 'u',
	-- diphthongization in the following combinations:  = ,  = 
	 = 'jɛ',
	 = 'jɑ'
}

function export.pronunciation(word)
	if type(word) == "table" then
		word = word.args or word:getParent().args
	end
	if not word or (word == "") then
		error("Please put the word as the first positional parameter!")
	end
	word = mw.ustring.lower(word)

	local phonetic = word

	-- then long consonants that are orthographically geminated.
	phonetic = mw.ustring.gsub(phonetic, "(.)%1", "%1ː")

	for pat, repl in pairs(phonetic_2chars_map) do
		phonetic = mw.ustring.gsub(phonetic, pat, repl)
	end

	-- ե and ո are pronounced as jɛ and vɔ word-initially.
	phonetic = mw.ustring.gsub(phonetic, "^ե", "յէ")
	phonetic = mw.ustring.gsub(phonetic, "^ո", "վօ")
	-- except when followed by another վ.
	phonetic = mw.ustring.gsub(phonetic, "^վօվ", "օվ")

	phonetic = mw.ustring.gsub(phonetic, '.', phonetic_chars_map)

	-- assimilation: nasal + velar plosives = velar nasal + velar plosives
	phonetic = mw.ustring.gsub(phonetic, "n(+)", "ŋ%1")

	-- pseudo-palatalization under the influence of Russian 
	--phonetic = mw.ustring.gsub(phonetic, "tj", "t͡sj")
	--phonetic = mw.ustring.gsub(phonetic, "tʰj", "t͡sʰj")
	--phonetic = mw.ustring.gsub(phonetic, "dj", "d͡zj")

	-- trilling of ɾ in some positions 
	--phonetic = mw.ustring.gsub(phonetic, "ɾt", "rt")

	-- Do not add a stress mark for monosyllabic words. Check to see if the word contains only a single instance of +.
	local numberOfVowels = select(2, mw.ustring.gsub(phonetic, "", ""))

	-- If polysyllabic, add IPA stress mark using the following rules. The stress is always on the last syllable not 
	-- formed by schwa . In some rare cases the stress is not on the last syllable. In such cases the stressed vowel
	-- is marked by the Armenian stress character <՛>, e.g. մի՛թե. So:
	--      1) Find the vowel followed by <՛>․ If none, jump to step 2. Else check if it is the first vowel of the word.
	--         If true, put the IPA stress at the beginning, else do step 3.
	--      2) Find the last non-schwa vowel, i.e. ,
	--      3) If the IPA symbol preceding it is , i.e. a vowel, put the stress symbol between them, 
	--         if it is NOT , i.e. it is a consonant, 
	--         put the stress before that consonant.
	if numberOfVowels > 1 then
		local rcount
		phonetic, rcount = mw.ustring.gsub(phonetic, "(*)՛", "ˈ%1")
		if rcount == 0 then
			phonetic = mw.ustring.gsub(phonetic, "(**)$", "ˈ%1")
			phonetic = mw.ustring.gsub(phonetic, "(*?*ə*)$", "ˈ%1")
		end
		phonetic = mw.ustring.gsub(phonetic, "()ˈ(+)()", "%1%2ˈ%3")
		phonetic = mw.ustring.gsub(phonetic, "(.)͡ˈ", "ˈ%1͡")
	end

	return phonetic
end
 
return export