Module:ss-headword

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

This module is used for Swazi headword-line templates.


local export = {}

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


-- A list of valid noun classes
-- The value is the corresponding plural class.
-- True means the class is uncountable.
local singular_classes = {
	 = "2",
	 = "2a",
	 = "4",
	 = "6",
	 = "8",
	 = "10",
	 = "10",
	 = true,
	 = true,
	 = true,
}

local plural_classes = {
	 = true,
	 = true,
	 = true,
	 = true,
	 = true,
	 = true,
}


local prefixes = {
	 = {"umu()", "um(.)"},
	 = {"", "u"},
	 = {"ba()", "be()"},
	 = {"bo()"},
	 = {"umu()", "um(.)"},
	 = {"imi()", "im()"},
	 = {"li()"},
	 = {"ema()", "em()"},
	 = {"si()", "s()"},
	 = {"ti()", "t()"},
	 = {"in()", "im()", "i()", "i"},
	 = {"tin()", "tim()", "ti()"},
	 = {"lu()", "lw()"},
	 = {"bu()", "tjw(a)", "tj(a)"},
	 = {"ku()", "kw()"},
	 = {"ku()", "kw()"},
}

local function remove_prefix(word, class)
	if not class or not prefixes then
		return nil
	end
	
	-- If there is a capital letter in the word,
	-- assume that it's the first letter of the stem and remove everything before it
	if word:find("") then
		return word:gsub("^+", "")
	else
		for key, prefix in ipairs(prefixes) do
			word = word:gsub("^" .. prefix, "%1")
		end
		
		return word:gsub("^-", "")
	end
end


function export.noun(frame)
	local params = {
		 = {},
		 = {},
		 = {},
		 = {list = true},
		}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	local data = {lang = lang, pos_category = "nouns", categories = {}, heads = {args}, genders = {}, inflections = {}}
	
	if not args then
		data.heads = mw.title.getCurrentTitle().subpageText:gsub("^-", "") .. "<sup title=\"tones missing\">?</sup>"
		table.insert(data.categories, "Requests for tone in " .. lang:getCanonicalName() .. " noun entries")
	end
	
	-- Singular
	if not singular_classes] and not plural_classes] then
		args = nil
	end
	
	table.insert(data.genders, "c" .. (args or "?"))
	
	-- Plural
	if args ~= "-" and (#args > 0 or type(singular_classes] ~= true) == "string") then
		if not plural_classes] then
			args = nil
		end
		
		local plural = {label = "plural", request = true}
		
		for _, form in ipairs(args) do
			table.insert(plural, {term = form, genders = {"c" .. (args or "?")}})
		end
		
		table.insert(data.inflections, plural)
	end
	
	data.sort_key = remove_prefix(mw.title.getCurrentTitle().subpageText, args)
	
	return require("Module:headword").full_headword(data)
end


function export.adjective(frame)
	local params = {
		 = {},
		}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	local data = {lang = lang, pos_category = "adjectives", categories = {}, heads = {args}, inflections = {}}
	
	if not args then
		data.heads = mw.title.getCurrentTitle().subpageText:gsub("^-", "") .. "<sup title=\"tones missing\">?</sup>"
		table.insert(data.categories, "Requests for tone in " .. lang:getCanonicalName() .. " adjective entries")
	end
	
	data.heads = "-" .. data.heads
	
	return require("Module:headword").full_headword(data)
end


function export.relative(frame)
	local params = {
		 = {},
		}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	local data = {lang = lang, pos_category = "relatives", categories = {}, heads = {args}, inflections = {}}
	
	if not args then
		data.heads = mw.title.getCurrentTitle().subpageText:gsub("^-", "") .. "<sup title=\"tones missing\">?</sup>"
		table.insert(data.categories, "Requests for tone in " .. lang:getCanonicalName() .. " relative entries")
	end
	
	data.heads = "-" .. data.heads
	
	return require("Module:headword").full_headword(data)
end

function export.ideophone(frame)
	local params = {
		 = {},
		}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	local data = {lang = lang, pos_category = "ideophones", categories = {}, heads = {args}, inflections = {}}
	
	if not args then
		data.heads = mw.title.getCurrentTitle().subpageText:gsub("^-", "") .. "<sup title=\"tones missing\">?</sup>"
		table.insert(data.categories, "Requests for tone in " .. lang:getCanonicalName() .. " ideophone entries")
	end
	
	return require("Module:headword").full_headword(data)
end


function export.verb(frame)
	local params = {
		 = {},
		}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	local data = {lang = lang, pos_category = "verbs", categories = {}, heads = {args}, inflections = {}}
	
	if not args then
		data.heads = mw.title.getCurrentTitle().subpageText:gsub("^-", "") .. "<sup title=\"tones missing\">?</sup>"
		table.insert(data.categories, "Requests for tone in " .. lang:getCanonicalName() .. " verb entries")
	end
	
	data.heads = "-" .. data.heads
	
	return require("Module:headword").full_headword(data)
end


return export