Module:ko-headword

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

This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

local PAGENAME = mw.title.getCurrentTitle().text

local export = {}
local pos_functions = {}

local lang = require("Module:languages").getByCode("ko")

pos_functions = function(args, data)
	-- infinitive(s)
	local m_conj = require("Module:ko-conj").verb
	local hae = args or m_conj(nil, { PAGENAME, irreg = args, form = "hae" })
	if hae == "" then hae = nil end
	local hae2 = args or m_conj(nil, { PAGENAME, irreg = args, form = "hae2" })
	if hae2 == "" then hae2 = nil end
	
	local infinitives = {label = "infinitive"}
	if hae then table.insert(infinitives, hae) end
	if hae2 then table.insert(infinitives, hae2) end
	if #infinitives > 0 then table.insert(data.inflections, infinitives) end
	
	-- sequential
	local hani = args or m_conj(nil, { PAGENAME, irreg = args, form = "hani" })
	if hani == "" then hani = nil end
	
	if hani then table.insert(data.inflections, {label = "sequential", hani}) end
end

pos_functions = function(args, data)
	local m_conj = require("Module:ko-conj").adjective
	local hae = args or m_conj(nil, { PAGENAME, irreg = args, form = "hae" })
	if hae == "" then hae = nil end
	local hae2 = args or m_conj(nil, { PAGENAME, irreg = args, form = "hae2" })
	if hae2 == "" then hae2 = nil end
	
	local infinitives = {label = "infinitive"}
	if hae then table.insert(infinitives, hae) end
	if hae2 then table.insert(infinitives, hae2) end
	if #infinitives > 0 then table.insert(data.inflections, infinitives) end
	
	-- sequential
	local hani = args or m_conj(nil, { PAGENAME, irreg = args, form = "hani" })
	
	if hani then table.insert(data.inflections, {label = "sequential", hani}) end
end

pos_functions = function(args, data)
	local hae = args; if hae == "" then hae = nil end
	local hae2 = args; if hae2 == "" then hae2 = nil end
	
	local infinitives = {label = "infinitive"}
	if hae then table.insert(infinitives, hae) end
	if hae2 then table.insert(infinitives, hae2) end
	if #infinitives > 0 then table.insert(data.inflections, infinitives) end
	
	-- sequential
	local hani = args; if hani == "" then hani = nil end
	
	if hani then table.insert(data.inflections, {label = "sequential", hani}) end
end

pos_functions = function(args, data)
	local root = args; if root == "" then root = nil end
	local form = args; if form == "" then form = nil end
	
	if form and root then
		table.insert(data.inflections, {label = form .. " of", root})
	end
end

pos_functions = pos_functions

pos_functions = function(args, data)
	local root = args; if root == "" then root = nil end

	if root then table.insert(data.inflections, {label = "determinative form of", root}) end
end

pos_functions = function(args, data)
	local count = args; if count == "" then count = nil end
	
	if count == '-' then 
		table.insert(data.inflections, "uncountable")
	elseif count then
		table.insert(data.inflections, {label = "counter", count})
	end
end

-- other parts of speech: nothing special is done for adverbs, interjections, suffixes

-- The main entry point.
-- This is the only function that can be invoked from a template.
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 hangeul_pattern = '' -- includes other punctuation that could appear in |head=
	local hanja_pattern = ''
	
	local params = {
		 = {},

		 = {list = true},
		 = {},
		 = {},
		 = {},

		 = {},
		 = {alias_of = "rv"},
		 = {},
		 = {},

		 = {},
		 = {},
		 = {},
		 = {},
		 = {},
		 = {},
		 = {},
	}
	args = require("Module:parameters").process(args, params)
	
	local data = {lang = lang, pos_category = poscat, categories = {}, heads = {args}, translits = {}, inflections = {}, sort_key = args, sc = require("Module:scripts").getByCode("Kore")}
	
	-- categorize by part of speech
	if poscat == "auxiliary verbs" then
		data.pos_category = "verbs"
		table.insert(data.categories, "Korean auxiliary verbs")
	end
	
	if args then table.insert(data.inflections, { label = "irregular" }) end
	
	-- grammatical forms etc. for each respective part of speech
	if pos_functions then
		pos_functions(args, data)
	end	
	
	-- >>> transliterations <<<
	-- if this entry is hangeul and no transliteration is provided, add auto transliteration
	-- if this entry is NOT hangeul and no translit is provided, add auto translit if there is hangeul
	local head_or_PAGENAME_no_links = require("Module:links").remove_links(args or PAGENAME)
	if args then
		-- no need to do anything
	elseif mw.ustring.gsub(head_or_PAGENAME_no_links, hangeul_pattern, '') == "" then
		args = lang:transliterate(head_or_PAGENAME_no_links)
	elseif args then
		args = lang:transliterate(args)
	else
		error('Could not produce transliteration. There may be non-hangeul characters in the entry title.')
	end
	if poscat == 'proper nouns' then
		args = mw.ustring.upper(mw.ustring.sub(args,1,1)) .. mw.ustring.sub(args,2,-1)
	end
	
	-- 2021 August 2: transition from unhyphenated *fix page titles to hyphenated *fix page titles
	if not string.match(PAGENAME, '%-') then
		if poscat == "suffixes" then
			args = "-" .. args
			data.heads = "—" .. (args or PAGENAME)
		elseif poscat == "prefixes" then
			args = args .. "-"
			data.heads = (args or PAGENAME) .. "—"
		end
	end
	
	if args then table.insert(data.translits, args) end
	if args then table.insert(data.translits, "McCune-Reischauer: " .. args) end
	if args then table.insert(data.translits, "Yale: " .. args) end
	
	if args then
		table.insert(data.inflections, {label = "hangeul", { term = args, sc = require("Module:scripts").getByCode("Kore") }})
	end
	
	if args then
		table.insert(data.inflections, {label = "hanja", { term = args, sc = require("Module:scripts").getByCode("Kore") }})
	end
	
	if args then
		table.insert(data.inflections, {label = "usually no hanja; sometimes", { term = args, sc = require("Module:scripts").getByCode("Kore") }})
	end
	
	-- and categorize hanja terms
	if mw.ustring.match(PAGENAME, hanja_pattern) then
		if poscat == "nouns" then 
			table.insert(data.categories, "Korean nouns in Han script") 
		elseif poscat == "proper nouns" then 
			table.insert(data.categories, "Korean proper nouns in Han script") 
		end
	elseif mw.ustring.match(PAGENAME, hangeul_pattern) then
		local content = mw.title.new(PAGENAME):getContent()
		if content then
			local code = mw.ustring.match(content, '{{ko%-IPA*}}')
			if not code then code = mw.ustring.match(content, '{{ko%-ipa*}}') end
			if not code then code = mw.ustring.match(content, '{{ko%-pron') end
			if not code then table.insert(data.categories, "Korean terms without ko-IPA template") end
		end
	end
	
	-- maintenance category for hanja terms without hangeul
	if mw.ustring.match(PAGENAME, hanja_pattern) and args == nil then 
		table.insert(data.categories, "Korean hanja terms lacking hangeul")
	end
	
	return require("Module:headword").full_headword(data)
end

return export