Module:User:Geographyinitiative/tongyong

From Wiktionary, the free dictionary
Jump to navigation Jump to search

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


function export.py_tongyong(text)
	local tongyong_initial = {
		['b'] = 'b', ['p'] = 'p', ['m'] = 'm', ['f'] = 'f',
		['d'] = 'd', ['t'] = 't', ['n'] = 'n', ['l'] = 'l',
		['g'] = 'g', ['k'] = 'k', ['h'] = 'h',
		['j'] = 'j', ['q'] = 'c', ['x'] = 's',
		['z'] = 'z', ['c'] = 'c', ['s'] = 's', ['r'] = 'r',
		['zh'] = 'jh', ['ch'] = 'ch', ['sh'] = 'sh',
		[''] = ''
	}

	local tongyong_final = {
		['yuan'] = 'yuan', ['iang'] = 'iang', ['yang'] = 'yang', ['uang'] = 'uang', ['wang'] = 'wang', ['ying'] = 'ying', ['weng'] = 'wong', ['iong'] = 'yong', ['yong'] = 'yong',
		['uai'] = 'uai', ['wai'] = 'wai', ['yai'] = 'yai', ['iao'] = 'iao', ['yao'] = 'yao', ['ian'] = 'ian', ['yan'] = 'yan', ['uan'] = 'uan', ['wan'] = 'wan', ['üan'] = 'yuan', ['ang'] = 'ang', ['yue'] = 'yue', ['wei'] = 'wei', ['you'] = 'you', ['yin'] = 'yin', ['wen'] = 'wun', ['yun'] = 'yun', ['eng'] = 'eng', ['ing'] = 'ing', ['ong'] = 'ong',
		['yo'] = 'yo', ['ia'] = 'ia', ['ya'] = 'ya', ['ua'] = 'ua', ['wa'] = 'wa', ['ai'] = 'ai', ['ao'] = 'ao', ['an'] = 'an', ['ie'] = 'ie', ['ye'] = 'ye', ['uo'] = 'uo', ['wo'] = 'wo', ['ue'] = 'yue', ['üe'] = 'yue', ['ei'] = 'ei', ['ui'] = 'uei', ['ou'] = 'ou', ['iu'] = 'iou', ['en'] = 'en', ['in'] = 'in', ['un'] = 'un', ['ün'] = 'yun', ['yi'] = 'yi', ['wu'] = 'wu', ['yu'] = 'yu',
		['a'] = 'a', ['e'] = 'e', ['o'] = 'o', ['i'] = 'i', ['u'] = 'u', ['ü'] = 'yu', ['ê'] = 'e',[''] = 'ih'
	}

	local tongyong_er = {
		['r'] = 'r', [''] = ''
	}
	
local tongyong_tone = {
		['1'] = '', ['2'] = 'ˊ', ['3'] = 'ˇ', ['4'] = 'ˋ', ['5'] = '˙', ['0'] = '˙'
	}

	end


	table.insert(text, "\n*** <small>''[[w:Tongyong Pinyin|Tongyong Pinyin]]''</small>: <tt>")
	if tl or tl2 or tl3 then
		table.insert(text, export.py_tongyong(export.make_tl(pinyin_simple_fmt_nolink, tl_pos, false), pinyin_simple_fmt))
	else
		table.insert(text, export.py_tongyong(pinyin_simple_fmt))
	end