Hopp til innhald

Modul:regulært nynorsk eigenskapsord

Frå Wiktionary - den frie ordboka

Dokumentasjon for modulen kan opprettast på Modul:regulært nynorsk eigenskapsord/dok

local export = {}

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

function export.main(frame)
	local word = mw.title.getCurrentTitle().text
	local args = frame:getParent().args
	local class = frame.args[1]  
	local length = word:len()
	
	local data = {lang = lang, pos_category = "eigenskapsord", categories = {}, inflections = {}}
	
	local root = word
	local root2 = word
	
	if class == '1' then
		local root_n = mw.ustring.gsub(word, "kk$", "k")
		table.insert(data.inflections, { label = 'hankjønn og hokjønn', root })
		table.insert(data.inflections, { label = 'inkjekjønn', root_n .. 't' })
		table.insert(data.inflections, { label = 'bunde eintal og fleirtal', root .. 'e' })
	elseif class == '2' then
		table.insert(data.inflections, { label = 'ubunde eintal', word })
		table.insert(data.inflections, { label = 'bunde eintal og fleirtal', root .. 'e' })
	elseif class == '3' then
		table.insert(data.inflections, { label = 'eintal og fleirtal', word })
	elseif class == '4' then
		root = word:sub(1, length-2)
		root2 = root .. 'n'

		table.insert(data.inflections, { label = 'hankjønn og hokjønn', word })
		table.insert(data.inflections, { label = 'inkjekjønn', root .. 'e', root .. 'ent'})
		table.insert(data.inflections, { label = 'bunde eintal og fleirtal', root .. 'ne'})
	elseif class == '5' then
		root  = word:sub(1, length-2)
		root2 = root .. 'n'
		local root_dsg_pl = mw.ustring.gsub(root, "(.)%1$", "%1") -- rettkoMne (of [[rettkommen]])

		table.insert(data.inflections, { label = 'hankjønn og hokjønn', word })
		table.insert(data.inflections, { label = 'inkjekjønn', root .. 'e' })
		table.insert(data.inflections, { label = 'bunde eintal og fleirtal', root_dsg_pl .. 'ne' })
	end
	
	if args[1] == 'meir' or args[1] == 'more' or class == '3' then
		meir = true
	end
	
	if args[1] == 'non-comparable' or args[1] == 'non-comp' then
		meir = false
		non_comp = true
	end
	
	if meir then
		table.insert(data.inflections, { label = 'komparativ', '[[meir]] ' .. word })
		table.insert(data.inflections, { label = 'superlativ', '[[mest]] ' .. word })
	elseif not non_comp then
		table.insert(data.inflections, { label = 'komparativ', root2 .. 'are' })
		table.insert(data.inflections, { label = 'ubunden superlativ', root2 .. 'ast' })
		table.insert(data.inflections, { label = 'bunden superlativ', root2 .. 'aste' })
	end

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