Module:bcl-headword

Hello, you have come here looking for the meaning of the word Module:bcl-headword. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:bcl-headword, but we will also tell you about its etymology, its characteristics and you will know how to say Module:bcl-headword in singular and plural. Everything you need to know about the word Module:bcl-headword you have here. The definition of the word Module:bcl-headword will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:bcl-headword, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.
-- This module contains code for Bikol Central headword templates.
-- Templates covered are:
-- * {{bcl-noun}}, {{bcl-proper noun}};
-- * {{bcl-verb}};
-- * {{bcl-adj}};
-- * {{bcl-adv}};
-- * {{bcl-num}};
-- * {{bcl-pron}};
-- * {{bcl-prep}};
-- * {{bcl-head}}.

local export = {}
local pos_functions = {}

local force_cat = false -- for testing; if true, categories appear in non-mainspace pages

local lang = require("Module:languages").getByCode("bcl")
local langname = lang:getCanonicalName()

local rmatch = mw.ustring.match
local rsplit = mw.text.split

local function track(page)
	require("Module:debug/track")("bcl-headword/" .. page)
	return true
end

local function ine(val)
	if val == "" then return nil else return val end
end

local function do_inflection(data, forms, label, accel)
	if #forms > 0 then
		forms.label = label
		if accel then
			forms.accel = accel
		end
		table.insert(data.inflections, forms)
	end
end

-- The main entry point.
-- This is the only function that can be invoked from a template.
function export.show(frame)
	local parargs = frame:getParent().args
	local poscat = frame.args
	local headarg
	if poscat then
		headarg = 1
	else
		headarg = 2
		poscat = ine(parargs) or error("Part of speech must be specified in 1=")
		poscat = require("Module:string utilities").pluralize(poscat)
	end

	local params = {
		 = {list = "head", disallow_holes = true},
		 = {list = true, allow_holes = true},
		 = {},
		 = {list = true},
		 = {type = "boolean"},
		 = {type = "boolean", alias_of = "nolink"},
		 = {type = "boolean"},
		 = {type = "boolean"},
		 = {},
		 = {type = "boolean"},
		 = {}, -- for testing
		 = {list = true},
		-- Yuck, this should be POS-specific but it seems all POS's can be pluralized in Bikol Central?
		 = {list = true},
		 = {list = true},
	}
	if headarg == 2 then
		params = {required = true} -- required but ignored as already processed above
	end

	if pos_functions then
		for key, val in pairs(pos_functions.params) do
			params = val
		end
	end

	local args = require("Module:parameters").process(parargs, params)

	local pagename = args.pagename or mw.title.getCurrentTitle().subpageText

	if args.tr.maxindex > #args then
		error("Too many translits specified; use '+' to indicate a default head")
	end

	local user_specified_heads = args
	local heads = user_specified_heads
	if args.nolink then
		if #heads == 0 then
			heads = {pagename}
		end
	end

	for i, head in ipairs(heads) do
		if head == "+" then
			head = nil
		end
		heads = {
			term = head,
			tr = args.tr,
		}
	end

	local data = {
		lang = lang,
		pos_category = poscat,
		categories = {},
		heads = heads,
		user_specified_heads = user_specified_heads,
		no_redundant_head_cat = #user_specified_heads == 0,
		inflections = {},
		pagename = pagename,
		id = args.id,
		force_cat_output = force_cat,
	}

	data.is_suffix = false
	if args.suffix or (
		not args.nosuffix and pagename:find("^%-") and poscat ~= "suffixes" and poscat ~= "suffix forms"
	) then
		data.is_suffix = true
		data.pos_category = "suffixes"
		local singular_poscat = require("Module:string utilities").singularize(poscat)
		table.insert(data.categories, langname .. " " .. singular_poscat .. "-forming suffixes")
		table.insert(data.inflections, {label = singular_poscat .. "-forming suffix"})
		if args.addlpos then
			for _, addlpos in ipairs(rsplit(args.addlpos, "%s*,%s*")) do
				table.insert(data.categories, langname .. " " .. addlpos .. "-forming suffixes")
				table.insert(data.inflections, {label = addlpos .. "-forming suffix"})
			end
		end
	end

	do_inflection(data, args.intens, "intensified")
	do_inflection(data, args.pl, "plural", {form = "plural"})
	do_inflection(data, args.plintens, "plural intensified")

	if pos_functions then
		pos_functions.func(args, data)
	end
	
	local script = lang:findBestScript(pagename) -- Latn or Tglg
	-- Disable Baybayin spelling parameter if entry is already in Baybayin
	if script:getCode() == "Tglg" then
		args.b = {}
	end

	for i, bay in ipairs(args.b) do
		if bay == "+" then
			bay = pagename
		end
		local baysc = lang:findBestScript(bay)
		if baysc:getCode() == "Latn" then
			bay = frame:expandTemplate { title = "bcl-basahan script", args = { bay }}
		end
		args.b = {term = bay, sc = require("Module:scripts").getByCode("Tglg") }

		-- FIXME! Port to Bikol Central.
		---- See if we need to add a tracking category for missing Baybayin script entry
		--local script_entry_present
		--local title = mw.title.new(bay)
		--if title then
		--	local bay_content = title:getContent()
		--	if bay_content and bay_content:find("==" .. langname .. "==") and
		--		rmatch(bay_content, "{{tl%-bay|*" .. pagename .. "*}}") then
		--		script_entry_present = true
		--	end
		--end
		--if not script_entry_present then
		--	table.insert(data.categories, ("%s terms with missing Baybayin script entries"):format(langname))
		--end
	end
	if #args.b > 0 then
		args.b.label = "Basahan spelling"
		table.insert(data.inflections, args.b)
	end

	if script:getCode() == "Latn" then
		table.insert(data.categories,
			("%s terms %s Baybayin script"):format(langname, #args.b > 0 and "with" or "without"))
	elseif script:getCode() == "Tglg" then
		table.insert(data.categories, ("%s terms in Baybayin script"):format(langname))
	end

	if script:getCode() == "Latn" then
		-- See if we need to add a tracking category for missing {{bcl-IPA}}
		local bcl_IPA_present
		if this_title then
			local content = this_title:getContent()
			if content and rmatch(content, "{{bcl%-IPA*") then
				bcl_IPA_present = true
			end
		end
		if not bcl_IPA_present then
			table.insert(data.categories, ("%s terms without bcl-IPA template"):format(langname))
		end
	end

	if args.json then
		return require("Module:JSON").toJSON(data)
	end

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


pos_functions = {
    params = {
		 = {list = true},
		 = {list = true},
		 = {list = true},
	},
	func = function(args, data)
		do_inflection(data, args.f, "feminine")
		do_inflection(data, args.m, "masculine")
		do_inflection(data, args.sup, "superlative")
	end,
}


pos_functions = {
    params = {
		 = {list = true},
		 = {list = true},
		rootword = {type = "boolean"},
	},
	func = function(args, data)
		do_inflection(data, args.f, "feminine")
		do_inflection(data, args.m, "masculine")

		if args.rootword then
			table.insert(data.infections, {label = "root word"})
			table.insert(data.categories, langname .. " roots")
		end
	end,
}

pos_functions = pos_functions


pos_functions = {
    params = {
		 = {list = true},
	},
	func = function(args, data)
		do_inflection(data, args.pl, "plural", {form = "plural"})
	end,
}

pos_functions = pos_functions


pos_functions = {
    params = {
		 = {alias_of = "comp"},
		 = {alias_of = "prog"},
		 = {alias_of = "cont"},
		 = {alias_of = "vnoun"},
		comp = {list = true},
		prog = {list = true},
		cont = {list = true},
		vnoun = {list = true},
		type = {list = true},
		rootword = {type = "boolean"},
	},
	func = function(args, data)
		do_inflection(data, args.comp, "complete", {form = "comp"})
		do_inflection(data, args.prog, "progressive", {form = "prog"})
		do_inflection(data, args.cont, "contemplative", {form = "cont"})
		do_inflection(data, args.vnoun, "verbal noun", {form = "vnoun"})

		if args.rootword then
			table.insert(data.infections, {label = "root word"})
			table.insert(data.categories, langname .. " roots")
		end

		--Tagging verb trigger
		for i, typ in ipairs(args.type) do
			if not conjugation_types then
				error(("Unrecognized " .. langname .. " verb conjugation type '%s'"):format(typ))
			end
			-- FIXME! `conjugation_types` undefined, so this will throw an error.
			table.insert(data.inflections, {label = conjugation_types})
			table.insert(data.categories, conjugation_types)
		end
	end,
}

return export