Module:User:Njardarlogar/nn-verb-reg

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


-- TODO: allow arbitrary class combinations

local export = {}

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

local function link(word, form)
	return "]"
end

local function make_root2(root)
	root = root:gsub("j$", "")
	return root:gsub("(.)%1$", "%1"), root
end
 
function export.main(frame)
	local PAGENAME = mw.title.getCurrentTitle().text
	local args = frame:getParent().args
	local class = frame.args  
	local length = PAGENAME:len()
	local root = PAGENAME:gsub("$", "")
	
	local inflections = {}
	local root2, root2_imp
	
	if class == '1' then
		present_tense = root .. 'ar'
		past_tense = root .. 'a'
		past_participle = root .. 'a'
		passive_infinitive = root .. 'ast'
		present_participle =  root .. 'ande'
		imperative = PAGENAME .. '/]'
	end    
	if class == '2' then
		root2, root2_imp = make_root2(root)

		present_tense = root .. 'er'
		past_tense = root2 .. 'te'
		past_participle = root2 .. 't'
		passive_infinitive = root .. 'ast'
		present_participle = root .. 'ande'
		imperative = root2_imp
	end
	if class == '12' or class == '21' then
		root2, root2_imp = make_root2(root)
		
		present_tense = link(PAGENAME, root .. 'ar') .. '/' .. link(PAGENAME, root .. 'er')
		past_tense = link(PAGENAME, root .. 'a') .. '/' .. link(PAGENAME, root2 .. 'te')
		past_participle = link(PAGENAME, root .. 'a') .. '/' .. link(PAGENAME, root2 .. 't')
		passive_infinitive = link(PAGENAME, root .. 'ast') 
		present_participle = link(PAGENAME, root .. 'ande') 
		imperative = link(PAGENAME, PAGENAME) .. '/' .. link(PAGENAME, root) 
	end
	if class == '3' then
		root2, root2_imp = make_root2(root)
		length2 = root2:len()
		if root2:sub(length2, length2) == root2:sub(length2-1, length2-1) then
			root3 = root2:sub(1, length2-1)
		else
			root3 = root2
		end
		if PAGENAME:find('$') then
			present_tense = PAGENAME .. 'r'
		else
			present_tense = root .. 'er'
		end
		if not root3:find('ng$') and not root3:find('r$') and not root:find('øym') then
			if root3:find('$') then
				past_tense = root3 .. 'dde'
				past_participle = link(PAGENAME, root3 .. 'dd') .. '/' .. link(PAGENAME, root3 .. 'tt')
			else
				past_tense = root3 .. 'de'
				past_participle = link(PAGENAME, root3 .. 'd') .. '/' .. link(PAGENAME, root3 .. 't')
			end
		else
			past_tense = root3 .. 'de'
			past_participle = root3 .. 't'
		end
		
		passive_infinitive = root .. 'ast'
		present_participle = root .. 'ande'
		imperative = root2_imp
	end
	
	if class == '4' then
		if root:sub(length-1, length-1) == root:sub(length-2, length-2) then
			root2 = root:sub(1, length-2)
			if root:sub(length-1, length-1) == 'n' then -- døm!, but kjenn!
				imperative = link(PAGENAME, root) 
			else
				imperative = link(PAGENAME, root2)
			end
		else
			root2 = root
			imperative = link(PAGENAME, root) 
		end
		present_tense = root .. 'er'
		past_tense = link(PAGENAME, root2 .. 'de') .. '/' .. link(PAGENAME, root2 .. 'te')
		past_participle = root2 .. 't'
		passive_infinitive = root .. 'ast'
		present_participle = root .. 'ande'
	end
	
	table.insert(inflections, {label = 'present tense', present_tense})
	table.insert(inflections, {label = 'past tense', past_tense})
	table.insert(inflections, {label = 'past participle', past_participle})
	if not args then
		table.insert(inflections, {label = 'passive infinitive', passive_infinitive})
	end
	if not args then
		table.insert(inflections, {label = 'present participle', present_participle})
	end
	if not args then
		table.insert(inflections, {label = 'imperative', imperative})
	end
	
	return require("Module:headword").full_headword(lang, nil, nil, nil, nil, inflections, {lang:getCanonicalName() .. " verbs"}, nil)
end
 
return export