モジュール:nn-noun-uncountable

出典: フリー多機能辞典『ウィクショナリー日本語版(Wiktionary)』
ナビゲーションに移動 検索に移動

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

local export = {}

local lang = require("モジュール:languages").getByCode("nn")

function export.main(frame)
	local word = mw.title.getCurrentTitle().text
	local g1, g2, g3 = frame.args[1], frame.args[2], frame.args[3]
	local args = frame:getParent().args
	local length = word:len()
	
	local root
	if args['root'] and args['root'] ~= '' then
		root = args['root']    
	elseif word:find('e$') then
		root = word:sub(1, length-1)
	else
		root = word
	end
	
	if args['root2'] and args['root2'] ~= '' then
		root2 = args['root2']
	end

	local all_genders	
	if g3 and g3 ~= '' then
		all_genders = {g1, g2, g3}
	elseif g2 and g2 ~= '' then
		all_genders = {g1, g2}
	else
		all_genders = {g1}
	end
	
	suffix = {["m"] = 'en', ["f"] = 'a', ["n"] = 'et', ["?"] = '?'}
	
	local all_forms = { root .. suffix[g1] }
	if g2 and g2 ~= '' then
		table.insert(all_forms, root .. suffix[g2])
	end       
	if g3 and g3 ~= '' then
		table.insert(all_forms, root .. suffix[g3])
	end
	if root2 and root2 ~= '' then
		table.insert(all_forms, root2 .. suffix[g1])
	end	
	
	all_forms.label = '限定単数'

	local infls = {}
	table.insert(infls, all_forms)
	table.insert(infls, { label = '[[不可算名詞|不可算]]' })

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