Module:User:Trooper57/tpw-IPA

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

This is a private module sandbox of Trooper57, for his own experimentation. Items in this module may be added and removed at Trooper57's discretion; do not rely on this module's stability.


--shamelessly copied from Module:crk-IPA
local export = {}

local m_IPA = require("Module:IPA")
local lang = require("Module:languages").getByCode("tpw")
local rsub = mw.ustring.gsub
local rlower = mw.ustring.lower
local rlen = mw.ustring.len
local rlast = require("Module:string/replace last").replace_last
local rfind = mw.ustring.find

local V = ""
local C = ""

local phon = {
	="ʔ", ="β̞", ="k", ="ɡ", ="h", ="m", ="n", ="p", ="ɾ", ="s", ="t", ="ʃ", 
	="w", ="j", ="ɨ̯",
	="a", ="a", ="ɛ", ="ɛ", ="i", ="ɔ", ="u", ="ɨ",
}

local function phonetic(text)
	text = rlower(text)
	-- stress
	local n 
	n = rsub(text, C, "")
	n = rlen(n)
	local i = 1
	while i <= n do
		if i == 3 then 
			text = rlast(text, "(" .. C .. ")(" .. V .. ")", "%1ˈ%2", 1)
		elseif i % 2 ~= 0 then
			text = rlast(text, "(" .. C .. ")(" .. V .. ")", "%1ˌ%2", 1)
		else
			text = rlast(text, "(" .. C .. ")(" .. V .. ")", "%1.%2", 1)
		end
		if i == n and i % 2 ~= 0 then
			if i ==3 then text = rsub(text, "^(" .. V .. ")", "ˈ%1")
			else text = rsub(text, "^(" .. V .. ")", "ˌ%1") end
		end
		i = i + 1
	end
	if rfind(text, "ˈ") == nil then
		text = rsub(text, "ˌ", "ˈ")
	end
	text = rsub(text, "(" .. C .. ")()", ".%2%1")
	text = rsub(text, "(" .. C .. ")%.(" .. V .. ")", ".%1%2")
	text = rsub(text, "^%.", "")
	-- stops
	text = rsub(text, "()(%.??)()()", "%1%3%2%3%4")
	text = rsub(text, "()%1", "%1ː")
	-- general phonology
	text = rsub(text, ".", phon)
	-- labialisation and aspiration
	text = rsub(text, "^(s?)(%.??)û", "%2%1ʷ")
	text = rsub(text, "(s?)(%.??)û", "%2%1ʷ")
	text = rsub(text, "h(s?)$", "ʰ%1")
	text = rsub(text, "t%.s", ".ts")
	text = rsub(text, "ɡ.w", "ɡʷ")
	-- stylistic thingies
	text = rsub(text, "%.()", "%1")
	
	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 = "" })
	end
	
	return m_IPA.format_IPA_full { lang = lang, items = IPA_results }
end

return export