Module:anui-pron

From Linguifex
Revision as of 18:53, 1 July 2021 by Sware (talk | contribs)
Jump to navigation Jump to search


local sub = mw.ustring.sub
local find = mw.ustring.find
local gmatch = mw.ustring.gmatch
local gsub = mw.ustring.gsub
local u = mw.ustring.char
local split = mw.text.split
local gsplit = mw.text.gsplit

-- To avoid weird annoying cursor behavior
local TILDE, NASAL = u(0x0303), u(0x0303) -- COMBINING TILDE ̃
local TILDEBELOW, CREAKY = u(0x0330), u(0x0330) -- COMBINING TILDE BELOW ̰
local GRAVE = u(0x0300) -- COMBINING GRAVE ACCENT ̀
local HIGH = u(0x02E6) -- MODIFIER LETTER HIGH TONE BAR ˦
local HIGHFALL = "˥˦"
local LOW = u(0x02E8) -- MODIFIER LETTER LOW TONE BAR ˨
local MID = u(0x02E7) -- MODIFIER LETTER MID TONE BAR ˧
local SYLLABIC = u(0x0329) -- COMBINING VERTICAL LINE BELOW ̩
local SYLLABICA = u(0x030D) -- COMBINING VERTICAL LINE ABOVE ̍

local back_vowel = "uɯɔɑ"
local front_vowel = "iea"
local vowel = "[" .. back_vowel .. front_vowel .. "]"

local export = {}

local rules = {
	{"ʇ", "ǀ"}, {"([)", mw.ustring.toNFC("%1")}, {"([ao])" .. TILDEBELOW, mw.ustring.toNFC("%1" .. GRAVE)},
	
	
}

function export.crux(term)
	term=mw.ustring.lower(term)
	
	for _, rule in ipairs(rules) do
		term = gsub(term, rule[1], rule[2])
	end
	
	return term
end

return export