This module deploys Ilocano headword-line templates and associated templates
local export = {}
local pos_functions = {}
local lang = require("Module:languages").getByCode("ilo")
local PAGENAME = mw.title.getCurrentTitle().text
local script = lang:findBestScript(PAGENAME) -- Latn or Tglg
local function track(page)
require("Module:debug/track")("ilo-headword/" .. page)
return true
end
function export.show(frame)
local tracking_categories = {}
local args = frame:getParent().args
local poscat = frame.args or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")
local head = {} -- supports multiple headword
local function insert_head(arg)
if arg == "" then
track("blank-head")
arg = PAGENAME
end
if arg then
table.insert(head, arg)
end
end
insert_head(args or args)
insert_head(args or args)
insert_head(args or args)
local data = {lang = lang, sc = script, pos_category = poscat, categories = {}, heads = head, tr = tr, inflections = {}}
local baybayin = {label = "Kur-itan spelling"}
local sc_Tglg = require("Module:scripts").getByCode("Tglg")
if args then table.insert(baybayin, { term = args, sc = sc_Tglg }) end
if args then table.insert(baybayin, { term = args, sc = sc_Tglg }) end
if args then table.insert(baybayin, { term = args, sc = sc_Tglg }) end
if script:getCode() == "Latn" then
if #baybayin > 0 then
table.insert(data.inflections, baybayin)
table.insert(data.categories, "Ilocano terms with Baybayin script")
else
table.insert(data.categories, "Ilocano terms without Baybayin script")
end
elseif script:getCode() == "Tglg" then
--Categorize words with Kur-itan
table.insert(data.categories, "Ilocano terms in Baybayin script")
end
-- Kur-itan to Latin
local tr = args
if not tr then
tr = require("Module:ilo-translit")
end
-- feminines and masculines
local fem = {label = "feminine"}
if args then table.insert(fem, {term = args}) end
if #fem > 0 then table.insert(data.inflections, fem) end
local masc = {label = "masculine"}
if args then table.insert(masc, {term = args}) end
if #masc > 0 then table.insert(data.inflections, masc) end
local collective = {label = "collective" }
if args then table.insert(collective, {term = args}) end
if #collective > 0 then table.insert(data.inflections, collective) end
if pos_functions then
pos_functions(args, data)
end
local content = mw.title.new(PAGENAME):getContent()
local code = content and mw.ustring.match(content, "{{ilo%-IPA*}}")
--Categorize words without ]
if script:getCode() == "Latn" and not code then
table.insert(tracking_categories, "Ilocano terms without ilo-IPA template")
end
return require("Module:headword").full_headword(data) .. require("Module:utilities").format_categories(tracking_categories, lang)
end
local conjugation_types = {
= {"1st actor trigger", "Ilocano 1st actor focus verbs"}, -- um- or -um-
= { "2nd actor trigger", "Ilocano 2nd actor trigger verbs" }, -- ag-
= { "3rd actor trigger", "Ilocano 3rd actor trigger verbs" }, -- mang-
= { "4th actor trigger", "Ilocano 4th actor trigger verbs" }, -- ma-
= { "1st actor trigger potential mood", "Ilocano 1st actor trigger potential mood verbs" }, -- maka-
= { "2nd actor trigger potential mood", "Ilocano 2nd actor trigger potential mood verbs" }, -- makapag-
= { "2nd actor trigger potential mood", "Ilocano 1st actor trigger causative mood verbs" }, -- agpa-
= { "2nd actor trigger potential mood", "Ilocano 2nd actor trigger causative mood verbs" }, -- mangpa-
= { "object trigger", "Ilocano object trigger verbs" }, -- -en
= { "object trigger potential mood", "Ilocano object trigger potential mood verbs" }, -- ma-
= { "2nd actor trigger potential mood", "Ilocano object trigger causative mood verbs" }, -- ipai-
= { "comitative trigger", "Ilocano comitative trigger verbs" }, -- ka-
= { "comitative trigger potential mood", "Ilocano comitative trigger potential mood verbs" }, -- maka-
= { "1st comitative trigger causative mood", "Ilocano 1st comitative trigger causative mood verbs" }, -- makapa-
= { "2nd comitative trigger causative mood", "Ilocano 2nd comitative trigger causative mood verbs" }, -- makipa-
= { "locative trigger", "Ilocano locative trigger verbs" },-- -an
= { "locative trigger potential mood", "Ilocano locative trigger potential mood verbs" }, -- ma- -an
= { "locative trigger causative mood", "Ilocano locative trigger causative mood verbs" }, -- pa- -an
= { "thematic trigger", "Ilocano thematic trigger verbs" }, -- i-
= { "thematic trigger potential mood", "Ilocano thematic trigger potential mood verbs" }, -- mai-
= { "thematic trigger causative mood", "Ilocano thematic trigger causative mood verbs" }, -- ipa-
= { "benefactive trigger", "Ilocano benefactive trigger verbs" }, -- i- -an
= { "benefactive trigger potential mood", "Ilocano thematic trigger potential mood verbs" }, -- mai- -an
= { "benefactive trigger causative mood", "Ilocano thematic trigger causative mood verbs" }, -- ipa- -an
= { "instrument trigger", "Ilocano instrument trigger verbs" }, -- pag-
= { "instrument trigger potential mood", "Ilocano instrument trigger potential mood verbs" }, -- mapag-
= { "1st instrument trigger causative mood", "Ilocano 1st instrument trigger causative mood verbs" }, -- pagpa- -an
= { "2nd instrument trigger causative mood", "Ilocano 2nd instrument trigger causative mood verbs" }, -- panagpa-
}
pos_functions = function(args, data)
params = {
= {alias_of = 'head'},
= {alias_of = 'perf'},
= {alias_of = 'imperf'},
= {alias_of = 'past_imperf'},
= {alias_of = 'fut'},
head = {list = true},
head2= {},
head3= {},
perf = {list = true},
imperf = {list = true},
past_imperf = {list = true},
fut = {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.perf.label = "perfective"
args.imperf.label = "imperfective"
args.past_imperf.label = "past imperfective"
args.fut.label = "future"
args.perf.accel = {form = "perf"}
args.imperf.accel = {form = "imperf"}
args.past_imperf.accel = {form = "past|imperf"}
args.fut.accel = {form = "fut"}
if #args.perf > 0 then table.insert(data.inflections, args.perf) end
if #args.imperf > 0 then table.insert(data.inflections, args.imperf) end
if #args.past_imperf > 0 then table.insert(data.inflections, args.past_imperf) end
if #args.fut > 0 then table.insert(data.inflections, args.fut) end
--Tagging verb trigger
local conjtype = args or nil
if conjtype and conjugation_types then
table.insert(data.inflections, {label = conjugation_types})
table.insert(data.categories, conjugation_types)
end
local conjtype = args or nil
if conjtype and conjugation_types then
table.insert(data.inflections, {label = conjugation_types})
table.insert(data.categories, conjugation_types)
end
local conjtype = args or nil
if conjtype and conjugation_types then
table.insert(data.inflections, {label = conjugation_types})
table.insert(data.categories, conjugation_types)
end
end
pos_functions = function(args, data)
--Mark adjective degrees
params = {
= {alias_of = 'head'},
= {alias_of = 'comp'},
= {alias_of = 'mod'},
= {alias_of = 'comp_sup'},
= {alias_of = 'abs_sup'},
= {alias_of = 'int'},
head = {list = true},
head2= {},
head3= {},
comp = {list = true},
mod = {list = true},
comp_sup = {list = true},
abs_sup = {list = true},
int = {list = true},
b= {},
b2= {},
b3= {},
tr= {}
}
local args = require("Module:parameters").process(args,params)
data.heads = args.head
data.id = args.id
local pattern = args.pattern
args.comp.label = "comparative"
args.mod.label = "moderative"
args.comp_sup.label = "comparative superlative"
args.abs_sup.label = "absolutive superlative"
args.int.label = "intensive"
args.comp.accel = {form = "comparative"}
args.mod.accel = {form = "moderative"}
args.comp_sup.accel = {form = "comparative|superlative"}
args.abs_sup.accel = {form = "absolutive|superlative"}
args.int.accel = {form = "intensive"}
if #args.comp > 0 then table.insert(data.inflections, args.comp) end
if #args.mod > 0 then table.insert(data.inflections, args.mod) end
if #args.comp_sup > 0 then table.insert(data.inflections, args.comp_sup) end
if #args.abs_sup > 0 then table.insert(data.inflections, args.abs_sup) end
if #args.int > 0 then table.insert(data.inflections, args.int) end
end
pos_functions = function(args, data)
--Tagging plurals
params = {
= {alias_of = 'head'},
head = {list = true},
head2= {},
head3= {},
plural = {list = true},
b= {},
b2= {},
b3= {},
tr= {}
}
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
return export