Modul:regulært bokmålseigenskapsord
Dokumentasjon for modulen kan opprettast på Modul:regulært bokmålseigenskapsord/dok
local export = {}
local lang = require('Module:languages').getByCode('nb')
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
mer = true
root2 = word:sub(1, length-2)
table.insert(data.inflections, { label = 'ubunde eintal', word})
table.insert(data.inflections, { label = 'bunde eintal og fleirtal', root .. 'e', root2 .. 'ede'})
elseif class == '5' then
root2 = word:sub(1, length-2) .. word:sub(-1)
table.insert(data.inflections, {label = 'hankjønn og hokjønn', word})
table.insert(data.inflections, {label = 'inkjekjønn', word .. 't'})
root2 = mw.ustring.gsub(word:sub(1, length-2), "(.)%1$", "%1") .. word:sub(-1) -- rettkoMNe of [[rettkommen]]
table.insert(data.inflections, {label = 'bunde eintal og fleirtal', root2 .. 'e'})
elseif class == '6' then
mer = true
root2 = word:sub(1, length-2)
if word:sub(-2) == 'et' then
table.insert(data.inflections, {label = 'ubunde eintal', word})
elseif word:sub(-2) == 'en' then
table.insert(data.inflections, {label = 'hankjønn og hokjønn', word})
table.insert(data.inflections, {label = 'inkjekjønn', root2 .. 'et'})
end
table.insert(data.inflections, {label = 'bunde eintal og fleirtal', root2 .. 'ne'})
end
if args[1] == 'mer' or args[1] == 'meir' or class == '3' then
mer = true
end
if args[1] == 'usaman' then
mer = false
non_comp = true
end
if mer then
table.insert(data.inflections, { label = 'komparativ', '[[mer]] ' .. word})
table.insert(data.inflections, { label = 'superlativ', '[[mest]] ' .. word})
elseif not non_comp then
table.insert(data.inflections, { label = 'komparativ', root2 .. 'ere'})
if class == '2' and word:sub(-2) == 'ig' then
table.insert(data.inflections, { label = 'ubunden superlativ', root2 .. 'st'})
table.insert(data.inflections, { label = 'bunden superlativ', root2 .. 'ste'})
else
table.insert(data.inflections, { label = 'ubunden superlativ', root2 .. 'est'})
table.insert(data.inflections, { label = 'bunden superlativ', root2 .. 'este'})
end
end
return require('Module:headword').full_headword(data)
end
return export