Jump to content

မေႃႇၵျူး:lo-headword

လုၵ်ႉတီႈ ဝိၵ်ႇသျိၼ်ႇၼရီႇ မႃး
ထႅမ်းပလဵတ်ႉ ဢၼ်ၼႆႉ တိုၵ်ႉလူဝ်ႇ ၽိုၼ်ၵႅမ်မိုဝ်းမၼ်း။
ၶႅၼ်းတေႃႈ တႅမ်ႈပၼ် ၽိုၼ်ၵႅမ်မိုဝ်း ထႅမ်းပလဵတ်ႉ ဢၼ်ၼႆႉ သေ ၼႄပၼ် လွင်ႈယိူင်းဢၢၼ်း လႄႈ လၢႆးၸႂ်ႉတိုဝ်း ၵႃႈတီႈ ၼႃႈလိၵ်ႈ ၽိုၼ်ၵႅမ်မိုဝ်း သေၵမ်း။

local export = {}
local pos_functions = {}

local lang = require("Module:languages").getByCode("lo")
local script = require("Module:scripts").getByCode("Laoo")
local PAGENAME = mw.title.getCurrentTitle().text

function export.show(frame)

	local args = frame:getParent().args
	local poscat = frame.args[1] or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")
	
	local head = args["head"] or PAGENAME
	local tr = args["tr"]
	
	local data = {
		lang = lang,
		pos_category = poscat,
		categories = {},
		heads = {head},
		translits = {tr},
		inflections = {}
	}
	
	if pos_functions[poscat] then
		pos_functions[poscat](args, data)
	end

	local letter = true
	local specialLetter = mw.ustring.gmatch(PAGENAME, '.-([ໃໆ໊…໋]).-')
	while true do
		letter = specialLetter()
		if (not letter) then break end
		if letter == "໊" or letter == "໋" then
			table.insert(data.categories, "ၶေႃႈၵႂၢမ်းလၢဝ်း ဢၼ်လေႃးၵၼ်ဝႆႉတင်း ◌" .. letter) -- add dotted circle for above/below marks
		else
			table.insert(data.categories, "ၶေႃႈၵႂၢမ်းလၢဝ်း ဢၼ်လေႃးၵၼ်ဝႆႉတင်း " .. letter)
		end
	end
	if mw.ustring.match(PAGENAME, '.-([^ຫ]ຼ).-') then
		table.insert(data.categories, "ၶေႃႈၵႂၢမ်းလၢဝ်း ဢၼ်လေႃးၵၼ်ဝႆႉတင်း ◌ຼ ဢမ်ႇၸႂ်ႈၼင်ႇ ຫຼ")
	end

	return require("Module:headword").full_headword(data)

end

pos_functions["nouns"] = function(args, data)

	local classifiers = {label = "classifier"}

	if args[1] then
		for _,par in ipairs(args) do
			if par == "*" then
				table.insert(classifiers, PAGENAME) -- shorthand
				table.insert(data.categories, "Lao classifiers")
				table.insert(data.categories, "Lao nouns classified by " .. PAGENAME)
			else
				table.insert(classifiers, par)
				table.insert(data.categories, "Lao nouns classified by " .. par)
			end
		end
		table.insert(data.inflections, classifiers)
	end

end

pos_functions["verbs"] = function(args, data)

	local par1 = args[1]; if par1 == "" then par1 = nil end
	local par2 = args[2]; if par2 == "" then par2 = nil end
	local abstract_forms = {label = "abstract noun", accel = {form = "abstract-noun"}}

	if par1 ~= "-" then
		if not par1 then
			table.insert(abstract_forms, "ການ" .. PAGENAME)
		else
			if par1 == "~" then
				table.insert(abstract_forms, "ການ" .. PAGENAME)
				table.insert(abstract_forms, "ຄວາມ" .. PAGENAME)
			else
				table.insert(abstract_forms, par1)
				table.insert(abstract_forms, par2)
			end
		end
		table.insert(data.inflections, abstract_forms)
	end

end

pos_functions["adjectives"] = function(args, data)

	local par1 = args[1]; if par1 == "" then par1 = nil end
	local par2 = args[2]; if par2 == "" then par2 = nil end
	local abstract_forms = {label = "abstract noun", accel = {form = "abstract-noun"}}

	if par1 ~= "-" then
		if not par1 then
			table.insert(abstract_forms, "ຄວາມ" .. PAGENAME)
		else
			table.insert(abstract_forms, par1)
			table.insert(abstract_forms, par2)
		end
		table.insert(data.inflections, abstract_forms)
	end

end

-- same logic
pos_functions["adverbs"] = pos_functions["adjectives"]
-- same logic
pos_functions["proper nouns"] = pos_functions["nouns"]

return export