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 = "副詞", 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, "巴斯克語無比較級副詞")
data.inflections = {{label = "無比較級"}}
elseif args[1] == "?" then
table.insert(data.categories, "巴斯克語疑問副詞")
table.insert(data.categories, "巴斯克語無比較級副詞")
data.inflections = {{label = "疑問"}}
else
if stem == "ongi" then
data.inflections = {{label = "比較級", "hobeto", "hobeki"}, {label = "最高級", "hobekien", "ongien"}, {label = "excessive", "ongiegi"}}
elseif stem == "ondo" then
data.inflections = {{label = "比較級", "hobeto", "hobeki"}, {label = "最高級", "ondoen"}, {label = "excessive", "ondoegi"}}
elseif stem == "asko" then
data.inflections = {{label = "比較級", "gehiago"}, {label = "最高級", "gehien"}, {label = "excessive", "gehiegi"}}
else
data.inflections = {{label = "比較級", accel = {form = "comparative"}, stem .. "ago"}, {label = "最高級", accel = {form = "superlative"}, stem .. "en"},
{label = "excessive", accel = {form = "excd"}, stem .. "egi"}}
end
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 = "形容詞", categories = {"巴斯克語無屈折形容詞", "巴斯克語無比較級形容詞"}, sort_key = args.sort, heads = {args.head}, genders = {}, inflections = {}}
local tracking_categories = {}
data.inflections = {{label = '無屈折'}}
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 = "形容詞", 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, "巴斯克語無比較級形容詞")
data.inflections = {{label = "無比較級"}}
elseif args[1] == "?" then
table.insert(data.categories, "巴斯克語疑問形容詞")
table.insert(data.categories, "巴斯克語無比較級形容詞")
data.inflections = {{label = "疑問"}}
else
if stem == "asko" then
data.inflections = {{label = "比較級", "gehiago"}, {label = "最高級", "gehien"}, {label = "excessive", "gehiegi"}}
elseif stem == "on" then
data.inflections = {{label = "比較級", "hobe"}, {label = "最高級", "onen", "hoberen"}, {label = "excessive", "onegi"}}
else
data.inflections = {{label = "比較級", accel = {form = "comparative"}, stem .. "ago"}, {label = "最高級", accel = {form = "superlative"}, stem .. "en"},
{label = "excessive", accel = {form = "excd"}, stem .. "egi"}}
end
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 = "限定詞", 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] == "b" then
data.inflections = {{label = "前置"}}
elseif args[1] == "a" then
data.inflections = {{label = "後置"}}
elseif args[1] == "ba" or args[1] == "ab" then
data.inflections = {{label = "前置/後置"}}
end
if args[2] == "?" then
table.insert(data.categories, "巴斯克語疑問限定詞")
if args[1] == "b" then
data.inflections = {{label = "前置、疑問"}}
end
elseif args[2] == "dem" then
table.insert(data.categories, "巴斯克語指示限定詞")
if args[1] == "a" then
data.inflections = {{label = "後置、指示"}}
end
elseif args[2] == "ind" then
table.insert(data.categories, "巴斯克語不定限定詞")
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 "專有名詞" or "名詞", 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
--numerals
function export.show_numeral(frame)
local args = frame:getParent().args
local head_processed = require("Module:headword").add_multiword_links(mw.title.getCurrentTitle().text)
if string.find(head_processed, "geita") then
head_processed = mw.ustring.gsub(head_processed, "geita", "gei]][[eta|ta")
end
local data = {lang = lang, pos_category = "數詞", categories = {}, sort_key = args.sort, heads = {head_processed}}
local tracking_categories = {}
return require("Module:headword").full_headword(data)
end
--verbs
function export.show_verb(frame)
local args = frame:getParent().args
local data = {lang = lang, pos_category = "動詞", 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 = ""
local fut_part_en = ""
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) == "l" then
ending = "l"
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_ko = 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_ko = stem .. "go"
fut_part_en = stem .. "en"
inf = stem
v_noun = stem_s .. "te"
elseif ending == "l" then
fut_part_ko = stem .. "ko"
fut_part_en = stem .. "en"
inf = stem
v_noun = stem_s .. "tze"
elseif ending == "i" then
fut_part_ko = 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_ko = 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) or for verbs ending in -n/-l in which only one ending is used
if args.fi then
fut_part_ko = args.fi
end
-- irregular verbal noun
if args.vn then
v_noun = args.vn
end
--transitivity
if args[1] == "da" then
table.insert(data.categories, "巴斯克語da動詞")
table.insert(data.info_mid, '<abbr title="不及物、無間接受詞">da</abbr>')
elseif args[1] == "du" then
table.insert(data.categories, "巴斯克語du動詞")
table.insert(data.info_mid, '<abbr title="及物、無間接受詞">du</abbr>')
elseif args[1] == "dio" then
table.insert(data.categories, "巴斯克語dio動詞")
table.insert(data.info_mid, '<abbr title="及物、有間接受詞">dio</abbr>')
elseif args[1] == "zaio" then
table.insert(data.categories, "巴斯克語zaio動詞")
table.insert(data.info_mid, '<abbr title="不及物、有間接受詞">zaio</abbr>')
elseif args[1] == "da-du" then
table.insert(data.categories, "巴斯克語da動詞")
table.insert(data.categories, "巴斯克語du動詞")
table.insert(data.info_mid, '<abbr title="intransitive/及物、無間接受詞">da/du</abbr>')
elseif args[1] == "du-dio" then
table.insert(data.categories, "巴斯克語du動詞")
table.insert(data.categories, "巴斯克語dio動詞")
table.insert(data.info_mid, '<abbr title="及物、有或沒有間接受詞">du/dio</abbr>')
elseif args[1] == "du-zaio" then
table.insert(data.categories, "巴斯克語du動詞")
table.insert(data.categories, "巴斯克語zaio動詞")
table.insert(data.info_mid, '<abbr title="及物、有直接受詞/不及物、有間接受詞">du/zaio</abbr>')
elseif args[1] == "da-dio" then
table.insert(data.categories, "巴斯克語da動詞")
table.insert(data.categories, "巴斯克語dio動詞")
table.insert(data.info_mid, '<abbr title="不及物或及物、有直接受詞">da/dio</abbr>')
elseif args[1] == "da-du-zaio" then
table.insert(data.categories, "巴斯克語da動詞")
table.insert(data.categories, "巴斯克語du動詞")
table.insert(data.categories, "巴斯克語zaio動詞")
table.insert(data.info_mid, '<abbr title="intransitive/及物、無間接受詞;不及物、有間接受詞">da/du/zaio</abbr>')
elseif args[1] == "da-zaio" then
table.insert(data.categories, "巴斯克語da動詞")
table.insert(data.categories, "巴斯克語zaio動詞")
table.insert(data.info_mid, '<abbr title="不及物、無間接受詞">da/zaio</abbr>')
elseif args[1] == "da-du-dio-zaio" then
table.insert(data.categories, "巴斯克語da動詞")
table.insert(data.categories, "巴斯克語du動詞")
table.insert(data.categories, "巴斯克語dio動詞")
table.insert(data.categories, "巴斯克語zaio動詞")
table.insert(data.info_mid, '<abbr title="intransitive/及物、有或沒有間接受詞">da/du/dio/zaio</abbr>')
else
table.insert(data.categories, "未指定是否及物的巴斯克語動詞")
table.insert(data.info_mid, '<abbr title="未指定及物性">?</abbr>')
end
if (ending == "l" or ending == "n") and (not args.fi) then
data.inflections = {{label = "未完成時分詞", v_noun .. "n"}, {label = "未來時分詞", fut_part_ko, fut_part_en}, {label = "短形式", inf}, {label = "動詞性名詞", v_noun}}
else
data.inflections = {{label = "未完成時分詞", v_noun .. "n"}, {label = "未來時分詞", fut_part_ko}, {label = "短形式", inf}, {label = "動詞性名詞", v_noun}}
end
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, pos_category = "動詞變位形式", categories = {}, sort_key = args.sort, heads = {args.head}, genders = {}, inflections = {}}
local tracking_categories = {}
if args[1] and args[2] then
data.inflections = {{label = "陽性 allocutive", args[1]}, {label = "陰性 allocutive", args[2]}}
elseif args[1] or args[2] then
error("Please provide both allocutive forms.")
end
return require("Module:headword").full_headword(data) .. require("Module:utilities").format_categories(tracking_categories, lang, args.sort)
end
return export