Module:nn-verb-irreg

Hello, you have come here looking for the meaning of the word Module:nn-verb-irreg. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:nn-verb-irreg, but we will also tell you about its etymology, its characteristics and you will know how to say Module:nn-verb-irreg in singular and plural. Everything you need to know about the word Module:nn-verb-irreg you have here. The definition of the word Module:nn-verb-irreg will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:nn-verb-irreg, 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 export = {}

local insert = table.insert
local remove = table.remove
local ulen = require("Module:string utilities").len

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

local function process_inflection(inflections, inflection, label)
	local i = 1
	while true do
		local form = inflection
		if form == nil then
			break
		elseif form == "-" then
			remove(inflection, i)
		else
			i = i + 1
		end
	end
	if inflection then
		inflection.label = label
		insert(inflections, inflection)
	end
end

function export.main(frame)
	local PAGENAME = mw.loadData("Module:headword/data").pagename

	-- Retrieve and process arguments
	local boolean = {type = "boolean"}
	local params = {
		 = {required = true, list = "pres_tense"},
		 = {required = true, list = "past_tense"},
		 = {required = true, list = "past_part"},

		 = true,
		 = {list = "pasv_inf"},
		 = {list = "pres_part"},
		 = {list = "imp"},
		 = {alias_of = 6, list = false},
	}

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

	-- Figure out roots
	local length = ulen(PAGENAME)
	local root = PAGENAME

	if length > 2 and not (length == 3 and PAGENAME:match("^")) then
		root = PAGENAME:gsub("$", "")
	end

	local data = {lang = lang, pos_category = "verbs", categories = {}}
	local inflections = {}
	
	-- Add inflections
	process_inflection(inflections, args, "present tense")
	process_inflection(inflections, args, "past tense")
	process_inflection(inflections, args, "past participle")

	local root2 = args or root
	local final_as_or_ast = PAGENAME:match("ast?$")

	if not (args or final_as_or_ast) then
		args = root2 .. "ast"
	end
	process_inflection(inflections, args, "passive infinitive")

	if not (args or final_as_or_ast) then
		args = root2 .. "ande"
	end
	process_inflection(inflections, args, "present participle")

	if not args then
		local imp = root
		if length > 3 then
			imp = imp:gsub("mm$", "m"):gsub("j$", "")
		end
		args = imp
	end
	process_inflection(inflections, args, "imperative")

	data.inflections = inflections

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

return export