Module:hi-pa-headword

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

This module contains common code used for Hindi and Punjabi headword-line templates.


-- Common code between ] and ].

local export = {}
local m_links = require("Module:links")

export.pos_functions = {}

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

local function glossary_link(anchor, text)
	text = text or anchor
	return "]"
end

local function process_genders(data, genders)
	for _, g in ipairs(genders) do
		if g == "m" or g == "f" or g == "m-p" or g == "f-p" or g == "mf" or g == "mf-p" or g == "mfbysense" or g == "mfbysense-p" or g == "?" then
			table.insert(data.genders, g)
		else
			error("Invalid gender: " .. (g or "(nil)"))
		end
	end
end

export.pos_functions.adjectives = {
	params = {
		 = {},
		 = {},
		 = {alias_of = "comparative"},
		 = {alias_of = "superlative"},
		 = {list = true},
		 = {list = true},
		 = {type = "boolean"},
	},
	func = function(args, data)
		if args then
			table.insert(data.inflections, {label = glossary_link("indeclinable")})
			table.insert(data.categories, data.langname .. " indeclinable adjectives")
		end
		if args then
			table.insert(data.inflections, {label = "comparative", args})
		end
		if args then
			table.insert(data.inflections, {label = "superlative", args})
		end
		if #args > 0 then
			args.label = "masculine"
			table.insert(data.inflections, args)
		end
		if #args > 0 then
			args.label = "feminine"
			table.insert(data.inflections, args)
		end
	end,
}

export.pos_functions.ordinals = {
	params = {
		 = {list = true},
		 = {list = true},
		 = {type = "boolean"},
	},
	func = function(args, data)
		data.pos_category = "adjectives"
		table.insert(data.categories, data.langname .. " numerals")
		if args then
			table.insert(data.inflections, {label = glossary_link("indeclinable")})
			table.insert(data.categories, data.langname .. " indeclinable numerals")
		end
		if #args > 0 then
			args.label = "masculine"
			table.insert(data.inflections, args)
		end
		if #args > 0 then
			args.label = "feminine"
			table.insert(data.inflections, args)
		end
	end,
}

export.pos_functions.cardinals = {
	params = {
		 = {list = true},
		 = {list = true},
	},
	func = function(args, data)
		data.pos_category = "numerals"
		process_genders(data, args)
		if #args > 0 then
			args.label = "native script symbol"
			table.insert(data.inflections, args)
		end
	end,
}

local function nouns(plpos)
	return {
		params = {
			 = {list = true, default = "?"},
			 = {list = true},
			 = {list = true},
			 = {list = true},
			 = {type = "boolean"},
		},
		func = function(args, data)
			process_genders(data, args)
			if args then
				if #args > 0 then
					error("Can't specify both ind= and pl=")
				end
				table.insert(data.inflections, {label = glossary_link("indeclinable")})
				table.insert(data.categories, data.langname .. " indeclinable " .. plpos)
			elseif #args > 0 then
				args.label = "plural"
				table.insert(data.inflections, args)
			end
			if #args > 0 then
				args.label = "masculine"
				table.insert(data.inflections, args)
			end
			if #args > 0 then
				args.label = "feminine"
				table.insert(data.inflections, args)
			end
			if #args > 0 or #args > 0 then
				table.insert(data.categories, data.langname .. " " .. plpos .. " with other-gender equivalents")
			end
		end,
	}
end

export.pos_functions.nouns = nouns("nouns")
export.pos_functions = nouns("proper nouns")

export.pos_functions.pronouns = {
	params = {
		 = {list = true},
	},
	func = function(args, data)
		process_genders(data, args)
	end,
}

export.pos_functions.verbs = {
	params = {
		 = {},
		 = {list = true},
	},
	func = function(args, data)
		data.genders = args

		if args then
			local label, cat
			if args == "t" then
				label = "transitive"
				table.insert(data.categories, data.langname .. " transitive verbs")
			elseif args == "i" then
				label = "intransitive"
				table.insert(data.categories, data.langname .. " intransitive verbs")
			elseif args == "d" then
				label = "ditransitive"
				table.insert(data.categories, data.langname .. " ditransitive verbs")
			elseif args == "it" or args == "ti" then
				label = "ambitransitive"
				table.insert(data.categories, data.langname .. " transitive verbs")
				table.insert(data.categories, data.langname .. " intransitive verbs")
			else
				error("Unrecognized param 1=" .. args .. ": Should be 'i' = intransitive, 't' = transitive, or 'it'/'ti' = ambitransitive")
			end
			table.insert(data.inflections, {label = glossary_link(label)})
		end

		local head = data.heads
		if head:find(" ") then
			local base_verb = m_links.remove_links(head):gsub("^.* ", "")
			table.insert(data.categories, data.langname .. " compound verbs formed with " .. base_verb)
		end
	end,
}

local function pos_with_gender()
	return {
		params = {
			 = {list = true},
		},
		func = function(args, data)
			data.genders = args
		end,
	}
end

export.pos_functions.numerals = pos_with_gender()
export.pos_functions.suffixes = pos_with_gender()
export.pos_functions = pos_with_gender()
export.pos_functions = pos_with_gender()
export.pos_functions = pos_with_gender()
export.pos_functions = pos_with_gender()
export.pos_functions = pos_with_gender()
export.pos_functions = pos_with_gender()

return export