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

local export = {}

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

function export.main(frame)
	local PAGENAME = mw.title.getCurrentTitle().text
	local NAMESPACE = mw.title.getCurrentTitle().nsText
	
	-- Retrieve and process arguments
	
	local params = {
		[1] = {required = true, list = "pres_tense"},
		[2] = {required = true, list = "past_tense"},
		[3] = {required = true, list = "past_part"},
		
		[4] = {default = "", list = "pasv_inf"},
		[5] = {default = "", list = "pres_part"},
		[6] = {default = "", list = "imp"},
		["imp"] = {alias_of = 6},
		
		["second_root"] = {},
		["no_present_part"] = {type = "boolean"},
		["no_passive_inf"] = {type = "boolean"},
		["no_imp"] = {type = "boolean"},
		["first_four"] = {type = "boolean"},
		}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	-- Figure out roots
	
	local length = PAGENAME:len()
	local cons1 = PAGENAME:sub(1, 1):find('[bcdfghjklmnpqrstvxz]')
	local cons2 = PAGENAME:sub(2, 2):find('[bcdfghjklmnpqrstvxz]')
	
	local root = PAGENAME
	
	if not (length == 3 and cons1 and cons2) and PAGENAME:find('[ae]$') and length > 2 then
		root = PAGENAME:sub(1, length-1)
	end
	
	local second_root = args["second_root"] or root
	local root2 = root
	
	if root:sub(length-1, length-1) == 'j' and length > 3 then
		root2 = root:sub(1, length-2)
	end
	
	if PAGENAME:find('ast$') or PAGENAME:find('as$') then
		args["no_present_part"] = true
		args["no_passive_inf"] = true
	end
	
	local data = {lang = lang, pos_category = "verbs", categories = {}, inflections = {}}
	
	-- Add inflections
	args[1].label = "present tense"
	table.insert(data.inflections, args[1])
	
	args[2].label = "past tense"
	table.insert(data.inflections, args[2])
	
	args[3].label = "past participle"
	table.insert(data.inflections, args[3])
	
	if not (args["no_passive_inf"] or args["first_four"]) then
		if args[4][1] == "" then
			args[4][1] = second_root .. "ast"
		end
		
		args[4].label = "passive infinitive"
		table.insert(data.inflections, args[4])
	end
	
	if not (args["no_present_part"] or args["first_four"]) then
		if args[5][1] == "" then
			args[5][1] = second_root .. "ande"
		end
		
		args[5].label = "present participle"
		table.insert(data.inflections, args[5])
	end
	
	if not (args["no_imp"] or args["first_four"]) then
		if args[6][1] == "" then
			if root:sub(length-2, length-1) == 'mm' then
				args[6][1] = root:sub(1, length-2)
			else
				args[6][1] = root2
			end
		end
		
		args[6].label = "imperative"
		table.insert(data.inflections, args[6])
	end
	
	return require('Module:headword').full_headword(data)
end

return export
  NODES
Note 1