Jump to content

မေႃႇၵျူး:nb-verb-reg

လုၵ်ႉတီႈ ဝိၵ်ႇသျိၼ်ႇၼရီႇ မႃး

Documentation for this module may be created at မေႃႇၵျူး:nb-verb-reg/doc

local lang = require('Module:languages').getByCode('nb')

local export = {}

function export.main(frame)
	local PAGENAME = mw.title.getCurrentTitle().text
	local args = frame:getParent().args
	local class = tonumber(frame.args[1])

	local root = PAGENAME:gsub('e$', '')
	arg1 = nil
	if args[1] ~= root then
		arg1 = args[1]
	end
	
	local data = {lang = lang, pos_category = 'သၢင်ႈ', categories = {}, inflections = {}}

	-- Generate inflected forms
	local presentTense = {label = 'present tense'}
	local pastTense = {label = 'past tense'}
	local pastParticiple = {label = 'past participle'}

	if class == 1 then
		table.insert(presentTense, root .. 'er')
		table.insert(pastTense, root .. 'a')
		table.insert(pastTense, root .. 'et')
		table.insert(pastParticiple, root .. 'a')
		table.insert(pastParticiple, root .. 'et')
	end
	if class == 2 then
		table.insert(presentTense, root .. 'er')
		table.insert(pastTense, (arg1 or root) .. 'te')
		table.insert(pastParticiple, (arg1 or root) .. 't')
	end
	if class == 3 then
		table.insert(presentTense, root .. 'er')
		table.insert(pastTense, (arg1 or root) .. 'de')
		table.insert(pastParticiple, (arg1 or root) .. 'd')
	end
	
	-- Add inflections
	table.insert(data.inflections, presentTense)
	table.insert(data.inflections, pastTense)
	table.insert(data.inflections, pastParticiple)
	
	return require('Module:headword').full_headword(data)
end

return export