Module:nb-verb-reg

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

local export = {}

function export.main(frame)
	local PAGENAME = mw.title.getCurrentTitle().text
	local args = frame:getParent().args
	local class = tonumber(frame.args)

	local root = PAGENAME:gsub('e$', '')
	arg1 = nil
	if args ~= root then
		arg1 = args
	end
	
	local data = {lang = lang, pos_category = 'verbs', categories = {}, inflections = {}}

	-- Generate inflected forms
	local presentTense = {label = 'present tense'}
	local pastTense = {label = 'past tense'}
	local pastParticiple = {label = 'past participle'}

	if class == 1 then
		table.insert(presentTense, root .. 'er')
		table.insert(pastTense, root .. 'a')
		table.insert(pastTense, root .. 'et')
		table.insert(pastParticiple, root .. 'a')
		table.insert(pastParticiple, root .. 'et')
	end
	if class == 2 then
		table.insert(presentTense, root .. 'er')
		table.insert(pastTense, (arg1 or root) .. 'te')
		table.insert(pastParticiple, (arg1 or root) .. 't')
	end
	if class == 3 then
		table.insert(presentTense, root .. 'er')
		table.insert(pastTense, (arg1 or root) .. 'de')
		table.insert(pastParticiple, (arg1 or root) .. 'd')
	end
	
	-- Add inflections
	table.insert(data.inflections, presentTense)
	table.insert(data.inflections, pastTense)
	table.insert(data.inflections, pastParticiple)
	
	return require('Module:headword').full_headword(data)
end

return export