local export = {}
local lang = require("Module:languages").getByCode("eu")
--adverbs
function export.show_adv(frame)
local args = frame:getParent().args
local data = {lang = lang, pos_category = "adverbs", categories = {}, sort_key = args.sort, heads = {args.head}, genders = {}, inflections = {}}
local tracking_categories = {}
local stem = mw.title.getCurrentTitle().text
local comparative, superlative, excessive = {}, {}, {}
if stem:sub(-1) == "r" then
stem = stem .. 'r' --add an r if the adjective ends in r
elseif stem:sub(-1) == "a" then
stem = stem:sub(1, -2)
end
if args[1] == "-" then
table.insert(data.categories, "Basque uncomparable adverbs")
data.inflections = {{label = "not comparable"}}
elseif args[1] == "?" then
table.insert(data.categories, "Basque interrogative adverbs")
table.insert(data.categories, "Basque uncomparable adverbs")
data.inflections = {{label = "interrogative"}}
else
data.inflections = {{label = "comparative", accel = {form = "comparative"}, stem .. "ago"}, {label = "superlative", accel = {form = "superlative"}, stem .. "en"},
{label = "excessive", accel = {form = "excd"}, stem .. "egi"}}
end
return require("Module:headword").full_headword(data) ..
require("Module:utilities").format_categories(tracking_categories, lang, args.sort)
end
--adnominals aka indeclinable adjectives
function export.show_adn(frame)
local args = frame:getParent().args
local data = {lang = lang, pos_category = "adjectives", categories = {"Basque indeclinable adjectives", "Basque uncomparable adjectives"}, sort_key = args.sort, heads = {args.head}, genders = {}, inflections = {}}
local tracking_categories = {}
data.inflections = {{label = 'indeclinable'}}
return require("Module:headword").full_headword(data) ..
require("Module:utilities").format_categories(tracking_categories, lang, args.sort)
end
--adjectives
function export.show_adj(frame)
local args = frame:getParent().args
local data = {lang = lang, pos_category = "adjectives", categories = {}, sort_key = args.sort, heads = {args.head}, genders = {}, inflections = {}}
local tracking_categories = {}
local stem = mw.title.getCurrentTitle().text
local comparative, superlative, excessive = {}, {}, {}
if stem:sub(-1) == "r" then
stem = stem .. 'r' --add an r if the adjective ends in r
elseif stem:sub(-1) == "a" then
stem = stem:sub(1, -2)
end
if args[1] == "-" then
table.insert(data.categories, "Basque uncomparable adjectives")
data.inflections = {{label = "not comparable"}}
elseif args[1] == "?" then
table.insert(data.categories, "Basque interrogative adjectives")
table.insert(data.categories, "Basque uncomparable adjectives")
data.inflections = {{label = "interrogative"}}
else
data.inflections = {{label = "comparative", accel = {form = "comparative"}, stem .. "ago"}, {label = "superlative", accel = {form = "superlative"}, stem .. "en"},
{label = "excessive", accel = {form = "excd"}, stem .. "egi"}}
end
return require("Module:headword").full_headword(data) ..
require("Module:utilities").format_categories(tracking_categories, lang, args.sort)
end
--determiners
function export.show_det(frame)
local args = frame:getParent().args
local data = {lang = lang, pos_category = "determiners", categories = {}, sort_key = args.sort, heads = {args.head}, genders = {}, inflections = {}}
local tracking_categories = {}
local stem = mw.title.getCurrentTitle().text
local comparative, superlative, excessive = {}, {}, {}
if args[1] == "ind-l" or args[1] == "b-ind" then
data.inflections = {{label = "indefinite numeral, before the noun"}}
elseif args[1] == "ind-r" or args[1] == "a-ind" then
data.inflections = {{label = "indefinite numeral, after the noun"}}
elseif args[1] == "ind-b" or args[1] == "ba-ind" then
data.inflections = {{label = "indefinite numeral, before/after the noun"}}
elseif args[1] == "gen" then
data.inflections = {{label = "general numeral"}}
end
return require("Module:headword").full_headword(data) ..
require("Module:utilities").format_categories(tracking_categories, lang, args.sort)
end
--nouns
function export.show_noun(frame)
local args = frame:getParent().args
local g, genders = args.g or args[1]
local data = {lang = lang, pos_category = frame.args.proper and "Danh từ riêng" or "Danh từ", categories = {}, sort_key = args.sort, heads = {args.head}, genders, inflections = {}}
local tracking_categories = {}
if g == "an" then
data.genders = { "an" }
elseif g == "in" then
data.genders = { "in" }
elseif g == "both" then
data.genders = { "in","an" }
else
data.genders = { "?" }
end
return require("Module:headword").full_headword(data) ..
require("Module:utilities").format_categories(tracking_categories, lang, args.sort)
end
--verbs
function export.show_verb(frame)
local args = frame:getParent().args
local data = {lang = lang, pos_category = "verbs", categories = {}, sort_key = args.sort, heads = {args.head}, genders = {"m"}, inflections = {}, info_mid={}, nogendercat=1} --the gender parameter is a placeholder
local tracking_categories = {}
local stem = mw.title.getCurrentTitle().text
local stem_s = stem
local ending = ""
if stem:sub(-2,-1) == "tu" then
stem_s = stem:sub(1, -3)
ending = "tu"
elseif stem:sub(-2,-1) == "du" then
stem_s = stem:sub(1, -3)
ending = "du"
elseif stem:sub(-1) == "n" then
stem_s = stem:sub(1,-2)
ending = "n"
elseif stem:sub(-1) == "i" then
stem_s = stem:sub(1,-2)
ending = "i"
end
--some verbs ending in -i can have "irregular" short forms (they are predictable, but as there aren't many of them it's easier to enter them manually)
if args.inf or args.short then
stem_s = args.inf or args.short
end
--for verbs ending in -rri
if stem_s:sub(-2,-1) == "rr" then
stem_s = stem_s:sub(1,-2)
end
--generate the non-finite forms
if ending == "du" or ending == "tu" then
fut_part = stem .. "ko"
inf = stem_s
if ('szx'):match(stem_s:sub(-1)) then
v_noun = stem_s .. "te"
else
v_noun = stem_s .. "tze"
end
elseif ending == "n" then
fut_part = stem .. "go"
inf = stem
v_noun = stem_s .. "te"
elseif ending == "i" then
fut_part = stem .. "ko"
inf = stem_s
if stem_s:sub(-2,-1) == "tz" then
v_noun = stem_s:sub(1,-3) .. "zte"
elseif stem_s:sub(-2,-1) == "ts" then
v_noun = stem_s:sub(1,-3) .. "ste"
elseif stem_s:sub(-2,-1) == "tx" then
v_noun = stem_s:sub(1,-3) .. "xte"
elseif ('szx'):match(stem_s:sub(-1)) then
v_noun = stem_s .. "te"
else
v_noun = stem_s .. "tze"
end
else
fut_part = stem .. "ko"
inf = stem
v_noun = stem_s .. "tze"
end
--for verbs like "ezagutu", where the short form isn't "ezagu", but "ezagut"
if args.si then
inf = args.si
end
--irregular future participle (for noun+izan verbs where the future participle is noun-ko, not noun+izango)
if args.fi then
fut_part = args.fi
end
--transitivity
if args[1] == "da" then
table.insert(data.categories, "Basque da verbs")
table.insert(data.info_mid, '<abbr title="intransitive without indirect object">da</abbr>')
elseif args[1] == "du" then
table.insert(data.categories, "Basque du verbs")
table.insert(data.info_mid, '<abbr title="transitive without indirect object">du</abbr>')
elseif args[1] == "dio" then
table.insert(data.categories, "Basque dio verbs")
table.insert(data.info_mid, '<abbr title="transitive with indirect object">dio</abbr>')
elseif args[1] == "zaio" then
table.insert(data.categories, "Basque zaio verbs")
table.insert(data.info_mid, '<abbr title="intransitive with indirect object">zaio</abbr>')
elseif args[1] == "da-du" then
table.insert(data.categories, "Basque da verbs")
table.insert(data.categories, "Basque du verbs")
table.insert(data.info_mid, '<abbr title="intransitive/transitive without indirect object">da/du</abbr>')
elseif args[1] == "du-dio" then
table.insert(data.categories, "Basque du verbs")
table.insert(data.categories, "Basque dio verbs")
table.insert(data.info_mid, '<abbr title="transitive with or without indirect object">du/dio</abbr>')
elseif args[1] == "du-zaio" then
table.insert(data.categories, "Basque du verbs")
table.insert(data.categories, "Basque zaio verbs")
table.insert(data.info_mid, '<abbr title="transitive with direct object/intransitive with indirect object">du/zaio</abbr>')
elseif args[1] == "da-dio" then
table.insert(data.categories, "Basque da verbs")
table.insert(data.categories, "Basque dio verbs")
table.insert(data.info_mid, '<abbr title="intransitive or transitive with direct object">da/dio</abbr>')
elseif args[1] == "da-du-zaio" then
table.insert(data.categories, "Basque da verbs")
table.insert(data.categories, "Basque du verbs")
table.insert(data.categories, "Basque zaio verbs")
table.insert(data.info_mid, '<abbr title="intransitive/transitive without indirect object, intransitive with indirect object">da/du/zaio</abbr>')
elseif args[1] == "da-zaio" then
table.insert(data.categories, "Basque da verbs")
table.insert(data.categories, "Basque zaio verbs")
table.insert(data.info_mid, '<abbr title="intransitive with or without indirect object">da/zaio</abbr>')
elseif args[1] == "da-du-dio-zaio" then
table.insert(data.categories, "Basque da verbs")
table.insert(data.categories, "Basque du verbs")
table.insert(data.categories, "Basque dio verbs")
table.insert(data.categories, "Basque zaio verbs")
table.insert(data.info_mid, '<abbr title="intransitive/transitive without or with indirect object">da/du/dio/zaio</abbr>')
else
table.insert(data.categories, "Basque verbs without transitivity")
table.insert(data.info_mid, '<abbr title="transitivity incomplete">?</abbr>')
end
data.inflections = {{label = "present participle", v_noun .. "n"}, {label = "future participle", fut_part}, {label = "short form", inf}, {label = "verbal noun", v_noun}}
return
require("Module:headword").full_headword(data)
:gsub('<span class="gender">.-</span>', '<i>'..table.concat(data.info_mid, ' ')..'</i>') ..
require("Module:utilities").format_categories(tracking_categories, lang, args.sort)
end
--verb forms
function export.show_verb_form(frame)
local args = frame:getParent().args
local data = {lang = lang, categories = {}, sort_key = args.sort, heads = {args.head}, genders = {}, inflections = {}}
local tracking_categories = {}
local stem = mw.title.getCurrentTitle().text
local stem_s = stem
local ending = ""
if args[1] == "-" then
data.inflections = {{label = "indeclinable"}}
data.pos_category = {"verb forms"}
elseif args["g"] == "m" then
data.pos_category = {"masculine allocutive verb forms"}
elseif args["g"] == "f" then
data.pos_category = {"feminine allocutive verb forms"}
elseif args[1] and args[2] then
data.inflections = {{label = "masculine allocutive", args[1]}, {label = "feminine allocutive", args[2]}}
else
error("Wrong parameter usage.")
end
return require("Module:headword").full_headword(data) ..
require("Module:utilities").format_categories(tracking_categories, lang, args.sort)
end
return export