Module:User:Surjection/urj-pro-util

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


local export = {}

local function convert_to_eve(form)
	form = mw.ustring.gsub(form, "[^-]*[aëïou][^-]+", function(m) return mw.ustring.gsub(m, "ə", "ə̑") end)
	return form
end

local function convert_to_ued(form)
	form = mw.ustring.gsub(form, "[ćëəï]", {["ə"] = "i", ["ï"] = "i", ["ć"] = "ś", ["ë"] = "i̮"})
	return form
end

local function convert_to_uew(form)
	form = mw.ustring.gsub(form, "[xëəïdď]", {["x"] = "γ", ["ə"] = "e", ["ï"] = "i", ["d"] = "δ", ["ď"] = "δ̕"})
	return form
end

-- Converts 'pseudo-EVE' (same as EVE except for *ə representing both *ə and *ə̑)
--		"eve": true EVE
--		"ued": UED/Aikio
--		"uew": UEW
-- note: schwas must be U+0259, not U+01DD
function export.get_alternative_transcriptions(form)
	return {
		eve = convert_to_eve(form),
		ued = convert_to_ued(form),
		uew = convert_to_uew(form),
	}
end

return export