Module:qhv-verb/head: Difference between revisions

From Linguifex
Jump to navigation Jump to search
No edit summary
No edit summary
Line 8: Line 8:
local word = term or PAGENAME
local word = term or PAGENAME
local data = {forms = {}, categories = {}}
local data = {forms = {}, categories = {}}
data.thematic_vowel = m_p.tv
local decl, stem = m_p.detect_decl(word)
local decl, stem = m_p.detect_decl(word)

Revision as of 11:32, 26 April 2021



local export = {}

local m_p = require("Module:qhv-verb")
local m_d = require("Module:qhv-verb/data")
local PAGENAME = mw.title.getCurrentTitle().text

function export.fetch(tense, term)
	local word = term or PAGENAME
	local data = {forms = {}, categories = {}}
	data.thematic_vowel = m_p.tv
	local decl, stem = m_p.detect_decl(word)
	
	stem = {table.concat(stem), "a"}
	
	if m_d[word] then m_d[word](stem, data)
	else m_d[decl](stem, data) end
	
	return data.forms[tense]
end

return export