Module:et-IPA

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

This module implements {{et-IPA}}.


local find = mw.ustring.find
local gsub = mw.ustring.gsub
local glen = mw.ustring.len
local u = require("Module:string/char")

local export = {}

local m_IPA = require("Module:IPA")
local lang = require("Module:languages").getByCode("et")

local A = u(0x002A) 		-- halflength marker (asterisk)
local C = ""			-- consonants
local D = u(0x0308)		-- centralisation marker (diaeresis)
local L = "" 						-- length markers
local R = u(0x0325)		-- voicelessness marker (ring below)
local S = u(0x032F) 		-- diphthong marker
local T = u(0x031E)		-- lowering marker (downtack)
local V = "?" .. D .. "?" .. T .. "?"
local W = "??" .. D .. "?" .. T .. "?" .. S .. "?"
local X = ""

local lowerc = {
	="a",	="b",	="d",	="e",	="f",	="g",
	="h",	="i",	="j",	="k",	="l",	="m",
	="n",	="o",	="p",	="r",	="s",	="t",
	="u",	="v",	="z",	="ä",	="ü",	="ö",
	="š",	="ž",	="õ",
}

local phon = {
	-- consonants
	="b̥",	="d̥",	="ɡ̊",
	="p", ="t", ="k",
	="v",	="ʒ̊", ="z̥",
	="f",	="ʃ",
	="ʲ",
	-- vowels
	="ɑ",	="e",	="i",
	="o",	="u",	="æ",
	="ɤ",	="ø",	="y",
}

local function phonemic(text)
	text = gsub(text, '.', lowerc)
	-- general phonology
	text = gsub(text, '.', phon)
	-- long consonants
	text = gsub(text, "()" .. A, "%1")
	text = gsub(text, "(" .. C .. ")" .. L .. "?%1", "%1ː")
	text = gsub(text, "(" .. C .. ")" .. L .. "?" .. A, "%1ˑ")
	-- palatalised long consonants
	text = gsub(text, "(" .. C .. ")(" .. L .. ")ʲ", "%1ʲ%2")
	-- long vowels
	text = gsub(text, "(" .. V .. ")%1", "%1ː")
	text = gsub(text, "(" .. V .. ")" .. A, "%1ˑ")
	-- üüV
	text = gsub(text, "y" .. L .. "(" .. V .. ")", "yiːj%1")
	-- diphthongs
	text = gsub(text, "()()", "%1%2" .. S)
	text = gsub(text, "æ()", "æ%1" .. S)
	text = gsub(text, "ø()", "ø%1" .. S)
	text = gsub(text, "y()", "y%1" .. S)
	-- stress
	if find(text, "ˈ") == nil then
		text = "ˈ" .. text
	end
	if find(text, "ˌ") == nil then
		text = gsub(text, "+", "ˌ")
	end
	text = gsub(text, "(" .. L .. ")" .. L, "%1")
	
	return text
end

local function phonetic(text)
	text = gsub(text, '.', lowerc)
	-- velar nasal
	text = gsub(text, "n%f", "ŋ")
	-- glide insertion
	text = gsub(text, "(" .. V .. ")i(" .. V .. ")", "%1ij%2")
	text = gsub(text, "(" .. V .. ")u(" .. V .. ")", "%1uw%2")
	-- flash forward to after phonemic transcription
	text = phonemic(text)
	-- palatalisation
	text = gsub(text, "(" .. R .. "?)(?)", "%1ʲ%2")
	-- optional initial h-
	text = gsub(text, "^ˈh", "ˈ(h)")
	-- h-voicing
	text = gsub(text, "(" .. V .. S .. "??)h(" .. V .. ")", "%1ɦ%2")
	-- long gemination
	text = gsub(text, "(" .. V .. ")ː()(" .. V .. ")", "%1ː%2ː%3")
	-- short gemination
	text = gsub(text, "(" .. V .. S .. "?)(ʲ?)(" .. V .. ")", "%1%2ˑ%3")
	text = gsub(text, "(ʲ?)$", "%1ˑ")
	text = gsub(text, "(ʲ?)()", "%1ˑ%2")
	text = gsub(text, "(" .. R .. "?" .. L .. "?)(ʲ?)ˑ", "%1%2")
	-- final devoicing
	text = gsub(text, "(ʲ?)()$", "%1ˑ%2" .. R)
	-- vowel articulation
	text = gsub(text, "e$", "e" .. T)
	text = gsub(text, "jɑ", "jɑ" .. D)
	text = gsub(text, "ɑj", "ɑ" .. D .. "j")
	text = gsub(text, "ju", "ju" .. D)
	text = gsub(text, "uj", "u" .. D .. "j")
	-- secondary stress
	local i = 1
	local n = gsub(text, X, "")
	n = glen(n)
	while i <= n do
		text = gsub(text, "(" .. X .. "*" .. V .. W .. X .. "*" .. V .. W .. X .. "*)(" .. V .. W .. X .. "*" .. V .. ")", "%1S%2")
		text = gsub(text, "(" .. X .. "*" .. V .. W .. X .. "*" .. V .. W .. X .. "*)(" .. V .. W .. "?)$", "%1S%2")
		text = gsub(text, "(" .. X .. "*" .. V .. W .. X .. "*" .. V .. W .. X .. "*)(" .. V .. W .. "?)ˌ", "%1S%2")
		i = i + 1
	end
	text = gsub(text, "(" .. C .. R .. "?ʲ?)S(" .. V .. ")", "ˌ%1%2")
	text = gsub(text, "(" .. C .. "ʲ?)ːS(" .. V .. ")", "%1ˌ%1%2")
	text = gsub(text, "(" .. C .. "ʲ?)ˑS(" .. V .. ")", "%1̚ˌ%1%2")
	text = gsub(text, "S", "ˌ")
	
	return text
end

function export.IPA(frame)
	local words = {}
	
	for _, word in ipairs(frame:getParent().args) do
		table.insert(words, word)
	end
	
	if #words == 0 then
		words = {mw.title.getCurrentTitle().text}
	end
	
	local IPA_results = {}
	
	for _, word in ipairs(words) do
		table.insert(IPA_results, { pron = "/" .. phonemic(word) .. "/" })
		table.insert(IPA_results, { pron = "" })
	end
	
	return m_IPA.format_IPA_full { lang = lang, items = IPA_results }
end

return export