Module:gn-IPA

Hello, you have come here looking for the meaning of the word Module:gn-IPA. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:gn-IPA, but we will also tell you about its etymology, its characteristics and you will know how to say Module:gn-IPA in singular and plural. Everything you need to know about the word Module:gn-IPA you have here. The definition of the word Module:gn-IPA will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:gn-IPA, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.


local export = {}

local PAGENAME = mw.title.getCurrentTitle().text

-- single characters that map to IPA sounds   
local phonetic_chars_map = {
	 = "ʃ",
	 = "f",
	 = "ɰ",
	 = "ɰ̃",
	 = "h",
	 = "d͡ʒ",
	 = "k",
	 = "l",
	 = "m",
	 = "ᵐb",
	 = "n",
	 = "ⁿd",
	 = "ᵑɡ",
	 = "ⁿt",
	 = "ɲ",
	 = "p",
	 = "ɾ",
	 = "s",
	 = "t",
	 = "ʋ",
	 = "ʔ",
	 = "a",
	 = "ã",
	 = "e",	
	 = "e",
	 = "i",
	 = "ĩ",
	 = "o",
	 = "õ",
	 = "u",
	 = "ũ",
	 = "ɨ",
	 = "ɨ̃",
}

-- character sequences of two that map to IPA sounds
local phonetic_2chars_map = {
		{ 'rr', 'r' },
}

function export.word_to_IPA(word)
	word = mw.ustring.lower(word)

	local phonetic = word

	-- generating the stress
	phonetic = mw.ustring.gsub(phonetic, "%S+", function(word)
		-- 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(word, "", "%0"))
	
		-- If polysyllabic, add IPA stress mark using the following rules. The stress mainly falls on the last syllable. 
		--In some cases the stress is not on the last syllable. In such cases the stressed vowel
		-- is marked by an acute accent <՛>. 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 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
			word, rcount = mw.ustring.gsub(word, "(*)՛", "ˈ%1")
			if rcount == 0 then
				word = mw.ustring.gsub(word, "(**)$", "ˈ%1")
				word = mw.ustring.gsub(word, "(*?*ə*)$", "ˈ%1")
			end
			-- Including () in the second and third sets will only work
			-- if () never encloses a vowel.
			word = mw.ustring.gsub(word, "()ˈ(+)()", "%1%2ˈ%3")
			word = mw.ustring.gsub(word, "(.)͡ˈ", "ˈ%1͡")
			return word
		end
	end)

	return phonetic
end

function export.pronunciation(frame)
	local params = {
		 = {default = PAGENAME}
	}
	local args, unrecognized_args = require("Module:parameters").process(frame:getParent().args, params, true)
	local pron = export.word_to_IPA(args)
	local lang = require("Module:languages").getByCode("gn")
	local items = {{pron = "/" .. pron .. "/"}}
	return require("Module:IPA").format_IPA_full { lang = lang, items = items }
end
 
return export