Module:nb-adj-reg
Appearance
- The following documentation is located at Module:nb-adj-reg/documentation. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
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 = "adjectives", 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 = 'masculine and feminine', root})
table.insert(data.inflections, { label = 'neuter', root_n .. 't'})
table.insert(data.inflections, { label = 'definite singular and plural', root .. 'e'})
elseif class == '2' then
table.insert(data.inflections, { label = 'indefinite singular', word})
table.insert(data.inflections, { label = 'definite singular and plural', root .. 'e'})
elseif class == '3' then
table.insert(data.inflections, { label = 'singular and plural', word})
elseif class == '4' then
mer = true
root2 = word:sub(1, length-2)
table.insert(data.inflections, { label = 'indefinite singular', word})
table.insert(data.inflections, { label = 'definite singular and plural', root .. 'e', root2 .. 'ede'})
elseif class == '5' then
root2 = word:sub(1, length-2) .. word:sub(-1)
table.insert(data.inflections, {label = 'masculine and feminine', word})
table.insert(data.inflections, {label = 'neuter', word .. 't'})
root2 = mw.ustring.gsub(word:sub(1, length-2), "(.)%1$", "%1") .. word:sub(-1) -- rettkoMNe of [[rettkommen]]
table.insert(data.inflections, {label = 'definite singular and plural', 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 = 'indefinite singular', word})
elseif word:sub(-2) == 'en' then
table.insert(data.inflections, {label = 'masculine and feminine', word})
table.insert(data.inflections, {label = 'neuter', root2 .. 'et'})
end
table.insert(data.inflections, {label = 'definite singular and plural', root2 .. 'ne'})
end
if args[1] == 'mer' or args[1] == 'more' or class == '3' then
mer = true
end
if args[1] == 'non-comparable' or args[1] == 'non-comp' then
mer = false
non_comp = true
end
if mer then
table.insert(data.inflections, { label = 'comparative', '[[mer]] ' .. word})
table.insert(data.inflections, { label = 'superlative', '[[mest]] ' .. word})
elseif not non_comp then
table.insert(data.inflections, { label = 'comparative', root2 .. 'ere'})
if class == '2' and word:sub(-2) == 'ig' then
table.insert(data.inflections, { label = 'indefinite superlative', root2 .. 'st'})
table.insert(data.inflections, { label = 'definite superlative', root2 .. 'ste'})
else
table.insert(data.inflections, { label = 'indefinite superlative', root2 .. 'est'})
table.insert(data.inflections, { label = 'definite superlative', root2 .. 'este'})
end
end
return require('Module:headword').full_headword(data)
end
return export