Module:User:iwsfutcmd/ltc-pron/baxter

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


local export = {}
local m_string_utils = require("Module:string utilities")

local gsub = m_string_utils.gsub
local match = m_string_utils.match

local baxter_initial = {
	 = "p",  = "ph",  = "b",  = "m",  = "t",
	 = "th",  = "d",  = "n",  = "tr",  = "trh",
	 = "dr",  = "nr",  = "ts",  = "tsh",  = "dz",
	 = "s",  = "z",  = "tsr",  = "tsrh",  = "dzr",
	 = "sr",  = "zr",  = "tsy",  = "tsyh",  = "dzy",
	 = "sy",  = "zy",  = "k",  = "kh",  = "g",
	 = "ng",  = "x",  = "h",  = "ʔ",  = "h",
	 = "y",  = "l",  = "ny"
}

local baxter_final = {
	 = "uwng",  = "juwng",  = "uwk",  = "juwk",  = "owng", 
	 = "owk",  = "jowng",  = "jowk",  = "æwng",  = "æwk", 
	 = "jie",  = "jwie",  = "je",  = "jwe",  = "jij", 
	 = "jwij",  = "ij",  = "wij",  = "i",  = "jɨj", 
	 = "jwɨj",  = "jo",  = "u",  = "ju",  = "aj", 
	 = "waj",  = "joj",  = "jwoj",  = "æj",  = "wæj", 
	 = "ɛɨ",  = "wɛɨ",  = "ɛj",  = "wɛj",  = "jiej", 
	 = "jwiej",  = "jej",  = "jwej",  = "ej",  = "wej", 
	 = "oj",  = "woj",  = "jin",  = "in",  = "win", 
	 = "in",  = "jwin",  = "jit",  = "it",  = "wit", 
	 = "it",  = "jwit",  = "on",  = "ot",  = "won", 
	 = "wot",  = "jɨn",  = "jɨt",  = "jun",  = "jut", 
	 = "an",  = "wan",  = "at",  = "wat",  = "jon", 
	 = "jwon",  = "jot",  = "jwot",  = "æn",  = "wæn", 
	 = "æt",  = "wæt",  = "ɛn",  = "wɛn",  = "ɛt", 
	 = "wɛt",  = "jien",  = "jwien",  = "jen",  = "jwen", 
	 = "jiet",  = "jwiet",  = "jet",  = "jwet",  = "en", 
	 = "wen",  = "et",  = "wet",  = "aw",  = "æw", 
	 = "jiew",  = "jew",  = "ew",  = "a",  = "wa", 
	 = "ja",  = "jwa",  = "æ",  = "wæ",  = "jæ", 
	 = "ang",  = "wang",  = "ak",  = "wak",  = "jang", 
	 = "jwang",  = "jak",  = "jwak",  = "æng",  = "wæng", 
	 = "jæng",  = "jwæng",  = "æk",  = "wæk",  = "jæk", 
	 = "jwæk",  = "ɛng",  = "wɛng",  = "ɛk",  = "wɛk", 
	 = "jieng",  = "jwieng",  = "jiek",  = "jwiek",  = "eng", 
	 = "weng",  = "ek",  = "wek",  = "ong",  = "wong", 
	 = "ok",  = "wok",  = "ing",  = "ik",  = "wik", 
	 = "juw",  = "uw",  = "jiw",  = "jim",  = "im", 
	 = "jip",  = "ip",  = "am",  = "ap",  = "jæm", 
	 = "jom",  = "jæp",  = "jop",  = "æm",  = "æp", 
	 = "ɛm",  = "ɛp",  = "jiem",  = "jem",  = "jiep", 
	 = "jep",  = "em",  = "ep",  = "om",  = "op"
}

local reverse_drjowngX_nrjuwX = {
	 = "je",  = "jwe",  = "ij",  = "wij",  = "jej", 
	 = "jwej",  = "in",  = "win",  = "it",  = "wit", 
	 = "jen",  = "jwen",  = "jet",  = "jwet",  = "jew", 
	 = "jeng",  = "jweng",  = "jek",  = "jwek",  = "iw", 
	 = "im",  = "ip",  = "jem",  = "jep"
}

local function is_coronal(initial_type)
	return (initial_type >= 5 and initial_type <= 27) or (initial_type >= 36 and initial_type <= 38)
end

local function is_labial(initial_type)
	return (initial_type >= 1 and initial_type <= 4)
end

local function is_palatal(initial_type)
	return (initial_type >= 23 and initial_type <= 27) or (initial_type == 36) or (initial_type == 38)
end

function export.baxter_1992(initial_type, final_type, tone_label)
	local initial = baxter_initial
	local final = baxter_final
	if is_coronal(initial_type) then
		final = reverse_drjowngX_nrjuwX or final
	end
	if is_palatal(initial_type) then
		final = string.gsub(final, "^j", "")
	elseif is_labial(initial_type) then 
		if (final_type ~= 42) and (final_type ~= 55) and (final_type ~= 56) then
			final = string.gsub(final, "^w", "")
			final = string.gsub(final, "^jw", "j")
		end
	end
	return initial .. final .. tone_label
end

local baxter_1992_to_2014_map = {
    {pattern = "ɛɨ", replace = "ɛ"},
    {pattern = "ɛ", replace = "ea"},
    {pattern = "æ", replace = "ae"},
    {pattern = "ɨ", replace = "+"},
    {pattern = "ʔ", replace = "'"},
}

function export.baxter_2014(initial_type, final_type, tone_label)
    local output = export.baxter_1992(initial_type, final_type, tone_label)
    for _, item in ipairs(baxter_1992_to_2014_map) do
		output = output:gsub(item.pattern, item.replace)
    end
    return output
end

export.baxter = export.baxter_2014

return export