コンテンツにスキップ

モジュール:nn-adj-reg

出典: フリー多機能辞典『ウィクショナリー日本語版(Wiktionary)』

このモジュールについての説明文ページを モジュール:nn-adj-reg/doc に作成できます

local export = {}

local lang = require("モジュール: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 infls = {}
	
	local root = word
	local root2 = word
	
	if class == '1' then
		local root_n = mw.ustring.gsub(word, "kk$", "k")
		table.insert(infls, { label = '男性及び女性', root })
		table.insert(infls, { label = '中性', root_n .. 't' })
		table.insert(infls, { label = '限定単数及び複数', root .. 'e' })
	elseif class == '2' then
		table.insert(infls, { label = '非限定単数', word })
		table.insert(infls, { label = '限定単数及び複数', root .. 'e' })
	elseif class == '3' then
		table.insert(infls, { label = '単数及び複数', word })
	elseif class == '4' then
		root = word:sub(1, length-2)
		root2 = root .. 'n'

		table.insert(infls, { label = '男性及び女性', word })
		table.insert(infls, { label = '中性', '[[' .. root .. 'e]]/[[' .. root .. 'ent]]' })
		table.insert(infls, { label = '限定単数及び複数', 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(infls, { label = '男性及び女性', word })
		table.insert(infls, { label = '中性', root .. 'e' })
		table.insert(infls, { label = '限定単数及び複数', 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(infls, { label = '比較級', '[[meir]] ' .. word })
		table.insert(infls, { label = '最上級', '[[mest]] ' .. word })
	elseif not non_comp then
		table.insert(infls, { label = '比較級', root2 .. 'are' })
		table.insert(infls, { label = '非限定最上級', root2 .. 'ast' })
		table.insert(infls, { label = '限定最上級', root2 .. 'aste' })
	end

	return require('モジュール:headword').full_headword{
		lang = lang,
		inflections = infls,
		categories = {lang:getCanonicalName() .. " 形容詞"},
	}
end
 
return export