Module:User:Wyang/yue-char-pron


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


local m_data = require("Module:User:Wyang/yue-char-pron/data")

local export = {}

function export.make(frame)
	local character_readings = {}
	for syllable, characters in pairs(m_data) do
		for _, character in ipairs(characters) do
			if character_readings[character] then
				table.insert(character_readings[character], syllable)
			else
				character_readings[character] = { syllable }
			end
		end
	end
	local output_text = { "<pre>" }
	for character, readings in pairs(character_readings) do
		table.insert(output_text, ("[\"" .. character .. "\"] = \"" .. table.concat(readings, ",") .. "\","))
	end
	table.insert(output_text, "</pre>")
	return table.concat(output_text, "\n")
end

return export