Module:User:Kalexchu/1

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


local export = {}
local m_ltc_pron = require('Module:ltc-pron')
local m_ltc_predict = require('Module:ltc-pron/predict')
local m_cmn_pron = require('Module:cmn-pron')
local data = mw.loadData('Module:ltc-pron/data')

local function replace_sup(text)
	local a = text
	a = mw.ustring.gsub(a, '<sup>1</sup>', '¹')
	a = mw.ustring.gsub(a, '<sup>2</sup>', '²')
	a = mw.ustring.gsub(a, '<sup>3</sup>', '³')
	a = mw.ustring.gsub(a, '<sup>4</sup>', '⁴')
	a = mw.ustring.gsub(a, '<sup>5</sup>', '⁵')
	a = mw.ustring.gsub(a, '<sup>6</sup>', '⁶')
	a = mw.ustring.gsub(a, '<sup>H</sup>', 'ᴴ')
	a = mw.ustring.gsub(a, '<sup>X</sup>', 'ˣ')
	return a
end

function export.fanqie(text)
	local t = mw.text.split(text, '', true)
	if t then return error('More than two characters detected') end
	
	local out = t .. t .. '切'
	
	local data_1 = mw.loadData('Module:zh/data/ltc-pron/' .. t)
	local data_2 = mw.loadData('Module:zh/data/ltc-pron/' .. t)
	
	local initial_type, final_type, tone_number, tone_symbol, rime_1, rime_2 = {}, {}, {}, {}, {}, {}
	for i,v in ipairs(data_1) do
		initial_type = m_ltc_pron.infer_categories(v)
		table.insert(rime_1, v)
	end
	for i,v in ipairs(data_2) do
		final_type = select(2, m_ltc_pron.infer_categories(v))
		tone_number = data.tone_number
		tone_symbol = data.tone_symbol
		table.insert(rime_2, v)
	end
	
	out = out .. '\n' .. t .. ': ' .. table.concat(rime_1, ', ')
	out = out .. '\n' .. t .. ': ' .. table.concat(rime_2, ', ')
	
	local mc_reading, predicted_cmn, predicted_yue = {}, {}, {}
	for i,v in ipairs(initial_type) do
		for j,w in ipairs(final_type) do
			table.insert(mc_reading, replace_sup(data.initialConv] .. data.finalConv] .. tone_symbol))
			table.insert(predicted_cmn, m_cmn_pron.py_number_to_mark(m_ltc_predict.predict_cmn(initial_type, final_type, tone_number)))
			table.insert(predicted_yue, replace_sup(m_ltc_predict.predict_yue(initial_type, final_type, tone_number)))
		end
	end
	
	out = out .. '\nMiddle Chinese: ' .. table.concat(mc_reading, ', ')
	out = out .. '\nPredicted Mandarin: ' .. table.concat(predicted_cmn, ', ')
	out = out .. '\nPredicted Cantonese: ' .. table.concat(predicted_yue, ', ')
	
	return out
end

return export