Module:Tl-headword

local export = {} local pos_functions = {}

local lang = require("Module:languages").getByCode("tl") local PAGENAME = mw.title.getCurrentTitle.text local script = require("Module:scripts").findBestScript(PAGENAME, lang) -- Latn or Tglg

function export.show(frame)

local tracking_categories = {}

local args = frame:getParent.args local poscat = frame.args[1] or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")

local head = {} -- supports multiple headword if args["head"] or args[1] then table.insert(head, args["head"] or args[1]) end if args["head2"] or args[2] then table.insert(head, args["head2"] or args[2]) end if args["head3"] or args[3] then table.insert(head, args["head3"] or args[3]) end

local data = {lang = lang, sc = script, pos_category = poscat, categories = {}, heads = head, translits = {"-"}, inflections = {}} local baybayin = {label = "Baybayin spelling"} local sc_Tglg = require("Module:scripts").getByCode("Tglg") if args["b"] then table.insert(baybayin, { term = args["b"], sc = sc_Tglg }) end if args["b2"] then table.insert(baybayin, { term = args["b2"], sc = sc_Tglg }) end if args["b3"] then table.insert(baybayin, { term = args["b3"], sc = sc_Tglg }) end if #baybayin > 0 then table.insert(data.inflections, baybayin) end

if pos_functions[poscat] then pos_functions[poscat](args, data) end

local content = mw.title.new(PAGENAME):getContent local code = content and mw.ustring.match(content, "{{tl%-IPA[^}]*}}")

if script:getCode == "Latn" and not code then table.insert(tracking_categories, "Tagalog terms without tl-IPA template") end

return require("Module:headword").full_headword(data) .. require("Module:utilities").format_categories(tracking_categories, lang)

end

local conjugation_types = { ["actor I"] = {"1st actor trigger", "Tagalog 1st actor focus verbs"}, ["actor II"] = { "2nd actor trigger", "Tagalog 2nd actor trigger verbs" }, ["actor III"] = { "3rd actor trigger", "Tagalog 3rd actor trigger verbs" }, ["actor IV"] = { "4th actor trigger", "Tagalog 4th actor trigger verbs" }, ["actor V"] = { "5th actor trigger", "Tagalog 5th actor trigger verbs" }, ["actor indirect"] = { "indirect actor trigger", "Tagalog indirect actor trigger verbs" }, ["actor 2nd indirect I"] = { "1st indirect actor trigger", "Tagalog 1st secondary indirect actor trigger verbs" }, ["actor 2nd indirect II"] = { "2nd indirect actor trigger", "Tagalog 2nd secondary indirect actor trigger verbs" }, ["actor 2nd indirect III"] = { "3rd indirect actor trigger", "Tagalog 3rd secondary indirect actor trigger verbs" }, ["actor 2nd indirect IV"] = { "4th indirect actor trigger", "Tagalog 4th second indirect actor trigger verbs" }, ["object I"] = { "1st object trigger", "Tagalog 1st object trigger verbs" }, ["object II"] = { "2nd object trigger", "Tagalog 2nd object trigger verbs" }, ["object III"] = { "3rd object trigger", "Tagalog 3rd object trigger verbs" }, ["object IV"] = { "4th object trigger", "Tagalog 4th object trigger verbs" }, ["object V"] = { "5th object trigger", "Tagalog 5th object trigger verbs" }, ["object VI"] = { "6th object trigger", "Tagalog 6th object trigger verbs" }, ["object VII"] = { "7th object trigger", "Tagalog 7th object trigger verbs" }, ["object VIII"] = { "8th object trigger", "Tagalog 8th object trigger verbs" }, ["object IX"] = { "9th object trigger", "Tagalog 9th object trigger verbs" }, ["object X"] = { "10th object trigger", "Tagalog 10th object trigger verbs" }, ["object XI"] = { "11th object trigger", "Tagalog 11th object trigger verbs" }, ["locative I"] = { "1st locative trigger", "Tagalog 1st locative trigger verbs" }, ["locative II"] = { "2nd locative trigger", "Tagalog 2nd locative trigger verbs" }, ["benefactive I"] = { "1st benefactive trigger", "Tagalog 1st benefactive trigger verbs" }, ["benefactive II"] = { "2nd benefactive trigger", "Tagalog 2nd benefactive trigger verbs" }, ["benefactive III"] = { "3rd benefactive trigger", "Tagalog 3rd benefactive trigger verbs" }, ["instrument I"] = { "1st instrument trigger", "Tagalog 1st instrument trigger verbs" }, ["instrument II"] = { "2nd instrument trigger", "Tagalog 2nd instrument trigger verbs" }, ["reason I"] = { "1st reason trigger", "Tagalog 1st reason trigger verbs" }, ["reason IA"] = { "alternate 1st reason trigger", "Tagalog alternate 1st reason trigger verbs" }, ["reason II"] = { "2nd reason trigger", "Tagalog 2nd reason trigger verbs" }, ["reason IIA"] = { "alternate 2nd reason trigger", "Tagalog alternate 2nd reason trigger verbs" }, ["reason III"] = { "3rd reason trigger", "Tagalog alternate 3rd reason trigger verbs" }, ["reason IIIA"] = { "alternate 3rd reason trigger", "Tagalog alternate 3rd reason trigger verbs" }, ["reason IV"] = { "4th reason trigger", "Tagalog 4th reason trigger verbs" }, ["directional I"] = { "1st directional trigger", "Tagalog 1st directional trigger verbs" }, ["directional II"] = { "2nd directional trigger", "Tagalog 2nd directional trigger verbs" }, ["directional III"] = { "3rd directional trigger", "Tagalog 3rd directional trigger verbs" }, ["directional IV"] = { "4th directional trigger", "Tagalog 4th directional trigger verbs" }, ["directional V"] = { "5th directional trigger", "Tagalog 5th directional trigger verbs" }, ["directional VI"] = { "6th directional trigger", "Tagalog 6th directional trigger verbs" }, ["reference"] = { "reference trigger", "Tagalog reference trigger verbs" }, ["reciprocal I"] = { "1st reciprocal trigger", "Tagalog 1st reciprocal trigger verbs" }, ["reciprocal II"] = { "2nd reciprocal trigger", "Tagalog 2nd reciprocal trigger verbs" }, }

pos_functions["verbs"] = function(args, data)

params = { [1] = {alias_of = 'head'}, [2] = {alias_of = 'comp'}, [3] = {alias_of = 'prog'}, [4] = {alias_of = 'cont'}, head = {list = true}, head2= {}, head3= {}, comp = {list = true}, prog = {list = true}, cont = {list = true}, rootword = {}, type = {}, type2 = {}, type3 = {}, b= {}, b2= {}, b3= {} }

local args = require("Module:parameters").process(args,params) data.heads = args.head data.id = args.id	local pattern = args.pattern args.comp.label = "complete" args.prog.label = "progressive" args.cont.label = "contemplative"

args.comp.accel = {form = "comp"} args.prog.accel = {form = "prog"} args.cont.accel = {form = "cont"}

if #args.comp > 0 then table.insert(data.inflections, args.comp) end if #args.prog > 0 then table.insert(data.inflections, args.prog) end if #args.cont > 0 then table.insert(data.inflections, args.cont) end

--Tagging root forms of verbs local rootword = args["rootword"] or nil if require("Module:yesno")(rootword) then table.insert(data.inflections, {label = "root word"}) table.insert(data.categories, "Tagalog roots") end

--Tagging verb trigger local conjtype = args["type"] or nil if conjtype and conjugation_types[conjtype] then table.insert(data.inflections, {label = conjugation_types[conjtype][1]}) table.insert(data.categories, conjugation_types[conjtype][2]) end local conjtype = args["type2"] or nil if conjtype and conjugation_types[conjtype] then table.insert(data.inflections, {label = conjugation_types[conjtype][1]}) table.insert(data.categories, conjugation_types[conjtype][2]) end local conjtype = args["type3"] or nil if conjtype and conjugation_types[conjtype] then table.insert(data.inflections, {label = conjugation_types[conjtype][1]}) table.insert(data.categories, conjugation_types[conjtype][2]) end

end

pos_functions["adjectives"] = function(args, data)

--Tagging plurals of "ma-" type adjectives params = { [1] = {alias_of = 'head'}, head = {list = true}, head2= {}, head3= {}, plural = {list = true}, b= {}, b2= {}, b3= {} }	local args = require("Module:parameters").process(args,params) data.heads = args.head data.id = args.id	local pattern = args.pattern args.plural.label = "plural"

args.plural.accel = {form = "plural"}

if #args.plural > 0 then table.insert(data.inflections, args.plural) end

end

pos_functions["nouns"] = function(args, data)

--Tagging root forms of nouns local rootword = args["rootword"] or nil if require("Module:yesno")(rootword) then table.insert(data.inflections, {label = "root word"}) table.insert(data.categories, "Tagalog roots") end

end

return export