Module:km-headword

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

Khmer headword module, used by {{km-noun}}, etc.


local export = {}
local pos_functions = {}

local lang = require("Module:languages").getByCode("km")
local script = require('Module:scripts').getByCode("Khmr")
local PAGENAME = mw.title.getCurrentTitle().text
local pron = require("Module:km-pron")

function export.show(frame)

	local args = frame:getParent().args
	local poscat = frame.args or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")
	
	local data = {lang = lang, sc = script, pos_category = poscat, categories = {}, heads = {args}, inflections = {}}
	
	if args then
		table.insert(data.categories, "Khmer " .. args)
	end
	if args then
		table.insert(data.categories, "Khmer " .. args)
	end
	
	if pos_functions then
		pos_functions(args, data)
	end
	
	local phon
	local content = mw.title.new(PAGENAME):getContent()
	local code = mw.ustring.match(content, '{{km%-IPA*}}')
	local false_positive = mw.ustring.match(content, 'obsolete spelling of') or mw.ustring.match(content, 'obsolete form of') or mw.ustring.match(content, 'alternative spelling of') or mw.ustring.match(content, 'archaic spelling of') or mw.ustring.match(PAGENAME, 'Unsupported')

	if not code then
		phon = args or args or ""
		if phon ~= "" then
			data.translits = {pron.convert(phon, "tc")}
		elseif args then
			data.translits = { args }
		else
			data.translits = { (lang:transliterate(PAGENAME)) }
		end
		if not false_positive then
			table.insert(data.categories, "Khmer terms without km-IPA template")
		end
	else
		phon = args or args or mw.ustring.match(code, '|(+)') or PAGENAME -- detects only first one
		data.translits = {pron.convert(phon, "tc")}
	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 == "៊" or letter == "៌" or letter == "៍" or letter == "៏" or letter == "័" then
			table.insert(data.categories, "Khmer terms spelled with ◌" .. letter) -- add dotted circle for above/below marks
		else
			table.insert(data.categories, "Khmer terms spelled with " .. letter)
		end
	end
	
	return require("Module:headword").full_headword(data)

end

pos_functions = function(args, data)

	local classifiers = {label = "classifier"}

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

end

pos_functions = function(args, data)

	local par1 = args; if par1 == "" then par1 = nil end
	local par2 = args; if par2 == "" then par2 = nil end
	local par3 = args; if par3 == "" then par3 = nil end
	local abstract_forms = {label = "abstract noun", accel = {pos = "noun", 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)
			table.insert(abstract_forms, par3)
		end
		table.insert(data.inflections, abstract_forms)
	end

end

pos_functions = function(args, data)

	local par1 = args; if par1 == "" then par1 = nil end
	local par2 = args; if par2 == "" then par2 = nil end
	local par3 = args; if par3 == "" then par3 = nil end
	local abstract_forms = {label = "abstract noun", accel = {pos = "noun", 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)
			table.insert(abstract_forms, par3)
		end
		table.insert(data.inflections, abstract_forms)
	end

end

return export