localexports={}localfunctionverbData(ending)localgroupifending=='pôr'orending=='por'thengroup='er'elseifending=='erir-defective'thengroup='ir'elsegroup,_=string.gsub(ending,"%d+$","")group=string.sub(group,#group-1)endifgroup==""thenreturnnilendlocalsuccess,m_verb_data=pcall(require,"Module:pt-conj/data/-"..group)ifsuccessandm_verb_data[ending]thenreturnmw.clone(m_verb_data[ending])elsereturnnilendendlocalfunctionapplyFuncToTableValues(tbl,func)fork,vinpairs(tbl)doiftype(v)=='table'thenapplyFuncToTableValues(v,func)elsetbl[k]=func(v)endendend-- stem (required if applicable): beginning of the verb. All characters of the infinitive form, except those in the template's title.-- ending (required): Ending of the verb. The last characters chosen specifically by the template.-- compound (required if applicable): Compound words. Text to be added after the verb.functionexports.inflect(stem,ending,compound)localdata=verbData(ending)ifdatathenapplyFuncToTableValues(data.forms,function(form)ifform~=""thenreturnstem..form..(compoundand(' '..compound)or'')elsereturn""endend)returndataelsereturnnilendend-- The main entry point.-- This is the only function that can be invoked from a template.functionexports.show(frame)localm_table=require("Module:pt-conj/table")localargs=frame:getParent().argslocalstem,ending,compound=args[1],args[2],args[3]localword=exports.inflect(stem,ending,compound)ifwordthenreturnm_table.create(word)elseerror("No inflection data found")endendreturnexports