Module:sms-verbs
Jump to navigation
Jump to search
- The following documentation is located at Module:sms-verbs/documentation. [edit] Categories were auto-generated by Module:module categorization. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
local lang = require("Module:languages").getByCode("sms")
local export = {}
-- Inflection functions
function export.even(frame)
local fparams = {
}
local fargs = require("Module:parameters").process(frame.args, fparams)
local params = {
[1] = {required = true, default = "{{{1}}}"},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local stem = require("Module:sms-common").Stem(args[1], not fargs["nograd"])
local data = {
forms = {},
info = "even " .. require("Module:links").full_link({lang = lang, alt = stem.uvowel}, "term") .. "-stem",
categories = {},
}
if stem.gradation then
data.info = data.info .. ", " ..
require("Module:links").full_link({lang = lang, alt = stem.gradation.strong.scons}, "term") .. "-" ..
require("Module:links").full_link({lang = lang, alt = stem.gradation.weak.scons}, "term") .. " gradation"
else
data.info = data.info .. ", no gradation"
end
if not mw.ustring.find(stem.uvowel, "^[aeoå]$") and mw.title.getCurrentTitle().nsText ~= "Template" then
--error("The final vowel(s) of the stem must be one of a, e, o, å.")
end
table.insert(data.categories, lang:getCanonicalName() .. " even verbs")
table.insert(data.categories, lang:getCanonicalName() .. " even " .. (stem.uvowel or "") .. "-stem verbs")
data.forms["inf"] = {stem:make_form{grade = "strong", ending = "d"}}
data.forms["pres|ptcp"] = {stem:make_form{grade = "strong", ending = "i", variant = "j0"}}
data.forms["past|ptcp"] = {stem:make_form{grade = "strong", ending = "m", variant = "past_ptcp"}}
data.forms["1|s|pres|indc"] = {stem:make_form{grade = "weak", ending = "m", variant = "pres_12sg"}}
data.forms["2|s|pres|indc"] = {stem:make_form{grade = "weak", ending = "k", variant = "pres_12sg"}}
data.forms["3|s|pres|indc"] = {stem:make_form{grade = "strong", variant = "pres_3sg_even"}}
data.forms["1|p|pres|indc"] = {stem:make_form{grade = "strong", ending = "p"}}
data.forms["2|p|pres|indc"] = {stem:make_form{grade = "strong", ending = "veʹted", variant = "normal0"}}
data.forms["3|p|pres|indc"] = {stem:make_form{grade = "extra", variant = "pres_3pl"}}
data.forms["4|pres|indc"] = {stem:make_form{grade = "weak", ending = "t"}}
data.forms["pres|indc|conn"] = {stem:make_form{grade = "weak", variant = "normal0"}}
data.forms["1|s|past|indc"] = {stem:make_form{grade = "extra", ending = "m", variant = "j_contr"}}
data.forms["2|s|past|indc"] = {stem:make_form{grade = "extra", ending = stem.uvowel == "a" and "k" or "ǩ", variant = "j_contr2"}}
data.forms["3|s|past|indc"] = {stem:make_form{grade = "weak", ending = "i", variant = "j0"}}
data.forms["1|p|past|indc"] = {stem:make_form{grade = "weak", ending = "im", variant = "j0"}}
data.forms["2|p|past|indc"] = {stem:make_form{grade = "weak", ending = "id", variant = "j0"}}
data.forms["3|p|past|indc"] = {stem:make_form{grade = "extra", variant = "j_contr"}}
data.forms["4|past|indc"] = {stem:make_form{grade = "extra", ending = "š", variant = "j_contr"}}
data.forms["past|indc|conn"] = {stem:make_form{grade = "strong", ending = "m", variant = "past_ptcp"}}
data.forms["2|s|impr"] = {stem:make_form{grade = "weak", variant = "normal0"}}
data.forms["3|s|impr"] = {stem:make_form{grade = "weak", ending = "s", variant = "impr"}}
data.forms["1|p|impr"] = {stem:make_form{grade = "strong", ending = "p"}}
data.forms["2|p|impr"] = {stem:make_form{grade = "strong", ending = "d"}}
data.forms["3|p|impr"] = {stem:make_form{grade = "extra", ending = "z", variant = "impr"}}
data.forms["impr|conn"] = {stem:make_form{grade = "weak", variant = "normal0"}}
data.forms["1|s|cond"] = {stem:make_form{grade = "weak", ending = "čem", variant = "normal0"}}
data.forms["2|s|cond"] = {stem:make_form{grade = "weak", ending = "čiǩ", variant = "normal0"}}
data.forms["3|s|cond"] = {stem:make_form{grade = "weak", ending = "či", variant = "normal0"}}
data.forms["1|p|cond"] = {stem:make_form{grade = "weak", ending = "čim", variant = "normal0"}}
data.forms["2|p|cond"] = {stem:make_form{grade = "weak", ending = "čid", variant = "normal0"}}
data.forms["3|p|cond"] = {stem:make_form{grade = "weak", ending = "če", variant = "normal0"}}
data.forms["4|cond"] = {stem:make_form{grade = "weak", ending = "češ", variant = "normal0"}}
data.forms["cond|conn"] = {stem:make_form{grade = "weak", ending = "če", variant = "normal0"}}
data.forms["1|s|potn"] = {stem:make_form{grade = "weak", ending = "žem", variant = "j0"}}
data.forms["2|s|potn"] = {stem:make_form{grade = "weak", ending = "žiǩ", variant = "j0"}}
data.forms["3|s|potn"] = {stem:make_form{grade = "weak", ending = "ž", variant = "j"}}
data.forms["1|p|potn"] = {stem:make_form{grade = "weak", ending = "žep", variant = "j0"}}
data.forms["2|p|potn"] = {stem:make_form{grade = "weak", ending = "žid", variant = "j0"}}
data.forms["3|p|potn"] = {stem:make_form{grade = "weak", ending = "že", variant = "j0"}}
data.forms["4|potn"] = {stem:make_form{grade = "weak", ending = "žet", variant = "j0"}}
data.forms["potn|conn"] = {stem:make_form{grade = "weak", ending = "že", variant = "j0"}}
postprocess(args, data)
return make_table(data)
end
function export.odd(frame)
local fparams = {
}
local fargs = require("Module:parameters").process(frame.args, fparams)
local params = {
[1] = {required = true, default = "{{{1}}}"},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local stem = require("Module:sms-common").Stem(args[1])
local stem2 = require("Module:sms-common").Stem(args[1])
if stem.ucons == "ǥ" then
stem.ucons = "j"
elseif stem2.ucons == "j" then
stem2.ucons = ""
end
local data = {
forms = {},
info = "odd " .. require("Module:links").full_link({lang = lang, alt = stem.uvowel}, "term") .. "-stem, no gradation",
categories = {},
}
table.insert(data.categories, lang:getCanonicalName() .. " odd verbs")
table.insert(data.categories, lang:getCanonicalName() .. " odd " .. (stem.uvowel or "") .. "-stem verbs")
data.forms["inf"] = {stem:make_form{ending = "ed", variant = "normal0"}}
data.forms["pres|ptcp"] = {stem:make_form{ending = "eei", variant = "normal0"}}
data.forms["past|ptcp"] = {stem:make_form{ending = "am", variant = "normal0"}}
data.forms["1|s|pres|indc"] = {stem:make_form{ending = "am", variant = "normal0"}}
data.forms["2|s|pres|indc"] = {stem:make_form{ending = "ak", variant = "normal0"}}
data.forms["3|s|pres|indc"] = {stem:make_form{variant = "pres_3sg_odd"}}
data.forms["1|p|pres|indc"] = {stem:make_form{ending = "ep", variant = "normal0"}}
data.forms["2|p|pres|indc"] = {stem:make_form{ending = "eʹped", variant = "normal0"}}
data.forms["3|p|pres|indc"] = {stem:make_form{ending = "e", variant = "normal0"}}
data.forms["4|pres|indc"] = {stem:make_form{ending = "et", variant = "normal0"}}
data.forms["pres|indc|conn"] = {stem2:make_form{variant = stem2.ucons == "" and "j_contr" or nil}}
data.forms["1|s|past|indc"] = {stem:make_form{ending = "em", variant = "normal0"}}
data.forms["2|s|past|indc"] = {stem:make_form{ending = "iǩ", variant = "normal0"}}
data.forms["3|s|past|indc"] = {stem:make_form{ending = "i", variant = "normal0"}}
data.forms["1|p|past|indc"] = {stem:make_form{ending = "im", variant = "normal0"}}
data.forms["2|p|past|indc"] = {stem:make_form{ending = "id", variant = "normal0"}}
data.forms["3|p|past|indc"] = {stem:make_form{ending = "e", variant = "normal0"}}
data.forms["4|past|indc"] = {stem:make_form{ending = "eš", variant = "normal0"}}
data.forms["past|indc|conn"] = {stem:make_form{ending = "am", variant = "normal0"}}
data.forms["2|s|impr"] = {stem2:make_form{variant = stem2.ucons == "" and "j_contr" or nil}}
data.forms["3|s|impr"] = {stem:make_form{ending = "ââǥǥas", variant = "normal0"}}
data.forms["1|p|impr"] = {stem:make_form{ending = "âkap", variant = "normal0"}}
data.forms["2|p|impr"] = {stem:make_form{ending = "eʹǩed", variant = "normal0"}}
data.forms["3|p|impr"] = {stem:make_form{ending = "âkaz", variant = "normal0"}}
data.forms["impr|conn"] = {stem2:make_form{variant = stem2.ucons == "" and "j_contr" or nil}}
data.forms["1|s|cond"] = {stem:make_form{ending = "eʹčem", variant = "normal0"}}
data.forms["2|s|cond"] = {stem:make_form{ending = "eʹčiǩ", variant = "normal0"}}
data.forms["3|s|cond"] = {stem:make_form{ending = "eʹči", variant = "normal0"}}
data.forms["1|p|cond"] = {stem:make_form{ending = "eʹčim", variant = "normal0"}}
data.forms["2|p|cond"] = {stem:make_form{ending = "eʹčid", variant = "normal0"}}
data.forms["3|p|cond"] = {stem:make_form{ending = "eʹče", variant = "normal0"}}
data.forms["4|cond"] = {stem:make_form{ending = "eʹčeš", variant = "normal0"}}
data.forms["cond|conn"] = {stem:make_form{ending = "eʹče", variant = "normal0"}}
data.forms["1|s|potn"] = {stem:make_form{ending = "eʹžem", variant = "normal0"}}
data.forms["2|s|potn"] = {stem:make_form{ending = "eʹžiǩ", variant = "normal0"}}
data.forms["3|s|potn"] = {stem:make_form{ending = "ež", variant = "normal0"}}
data.forms["1|p|potn"] = {stem:make_form{ending = "eʹžep", variant = "normal0"}}
data.forms["2|p|potn"] = {stem:make_form{ending = "eʹžid", variant = "normal0"}}
data.forms["3|p|potn"] = {stem:make_form{ending = "eʹže", variant = "normal0"}}
data.forms["4|potn"] = {stem:make_form{ending = "eʹžet", variant = "normal0"}}
data.forms["potn|conn"] = {stem:make_form{ending = "eʹže", variant = "normal0"}}
postprocess(args, data)
return make_table(data)
end
function export.contr(frame)
local fparams = {
}
local fargs = require("Module:parameters").process(frame.args, fparams)
local params = {
[1] = {required = true, default = "{{{1}}}"},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local stem = require("Module:sms-common").Stem(args[1])
local data = {
forms = {},
info = "contracted " .. require("Module:links").full_link({lang = lang, alt = stem.uvowel}, "term") .. "-stem, no gradation",
categories = {},
}
table.insert(data.categories, lang:getCanonicalName() .. " contracted verbs")
table.insert(data.categories, lang:getCanonicalName() .. " contracted " .. (stem.uvowel or "") .. "-stem verbs")
data.forms["inf"] = {stem:make_form{ending = "eed", variant = "normal0"}}
data.forms["pres|ptcp"] = {stem:make_form{ending = "eei", variant = "normal0"}}
data.forms["past|ptcp"] = {stem:make_form{ending = "ääm", variant = "normal0"}}
data.forms["1|s|pres|indc"] = {stem:make_form{ending = "ääm", variant = "normal0"}}
data.forms["2|s|pres|indc"] = {stem:make_form{ending = "ääk", variant = "normal0"}}
data.forms["3|s|pres|indc"] = {stem:make_form{ending = "ad", variant = "normal0"}}
data.forms["1|p|pres|indc"] = {stem:make_form{ending = "eep", variant = "normal0"}}
data.forms["2|p|pres|indc"] = {stem:make_form{ending = "eʹped", variant = "normal0"}}
data.forms["3|p|pres|indc"] = {stem:make_form{ending = "ee", variant = "normal0"}}
data.forms["4|pres|indc"] = {stem:make_form{ending = "eet", variant = "normal0"}}
data.forms["pres|indc|conn"] = {stem:make_form{ending = "d"}}
data.forms["1|s|past|indc"] = {stem:make_form{ending = "eem", variant = "normal0"}}
data.forms["2|s|past|indc"] = {stem:make_form{ending = "iiǩ", variant = "normal0"}}
data.forms["3|s|past|indc"] = {stem:make_form{ending = "ii", variant = "normal0"}}
data.forms["1|p|past|indc"] = {stem:make_form{ending = "iim", variant = "normal0"}}
data.forms["2|p|past|indc"] = {stem:make_form{ending = "iid", variant = "normal0"}}
data.forms["3|p|past|indc"] = {stem:make_form{ending = "ee", variant = "normal0"}}
data.forms["4|past|indc"] = {stem:make_form{ending = "eeš", variant = "normal0"}}
data.forms["past|indc|conn"] = {stem:make_form{ending = "ääm", variant = "normal0"}}
data.forms["2|s|impr"] = {stem:make_form{ending = "d"}}
data.forms["3|s|impr"] = {stem:make_form{ending = "ââǥǥas", variant = "normal0"}}
data.forms["1|p|impr"] = {stem:make_form{ending = "âkap", variant = "normal0"}}
data.forms["2|p|impr"] = {stem:make_form{ending = "eʹǩed", variant = "normal0"}}
data.forms["3|p|impr"] = {stem:make_form{ending = "âkaz", variant = "normal0"}}
data.forms["impr|conn"] = {stem:make_form{ending = "d"}}
data.forms["1|s|cond"] = {stem:make_form{ending = "eʹčem", variant = "normal0"}}
data.forms["2|s|cond"] = {stem:make_form{ending = "eʹčiǩ", variant = "normal0"}}
data.forms["3|s|cond"] = {stem:make_form{ending = "eʹči", variant = "normal0"}}
data.forms["1|p|cond"] = {stem:make_form{ending = "eʹčim", variant = "normal0"}}
data.forms["2|p|cond"] = {stem:make_form{ending = "eʹčid", variant = "normal0"}}
data.forms["3|p|cond"] = {stem:make_form{ending = "eʹče", variant = "normal0"}}
data.forms["4|cond"] = {stem:make_form{ending = "eʹčeš", variant = "normal0"}}
data.forms["cond|conn"] = {stem:make_form{ending = "eʹče", variant = "normal0"}}
data.forms["1|s|potn"] = {stem:make_form{ending = "eʹžem", variant = "normal0"}}
data.forms["2|s|potn"] = {stem:make_form{ending = "eʹžiǩ", variant = "normal0"}}
data.forms["3|s|potn"] = {stem:make_form{ending = "ež", variant = "normal0"}}
data.forms["1|p|potn"] = {stem:make_form{ending = "eʹžep", variant = "normal0"}}
data.forms["2|p|potn"] = {stem:make_form{ending = "eʹžid", variant = "normal0"}}
data.forms["3|p|potn"] = {stem:make_form{ending = "eʹže", variant = "normal0"}}
data.forms["4|potn"] = {stem:make_form{ending = "eʹžet", variant = "normal0"}}
data.forms["potn|conn"] = {stem:make_form{ending = "eʹže", variant = "normal0"}}
postprocess(args, data)
return make_table(data)
end
function postprocess(args, data)
data.lemma = data.forms["inf"][1]
-- Check if the lemma form matches the page name
if (lang:makeEntryName(data.lemma)) ~= mw.title.getCurrentTitle().text then
table.insert(data.categories, lang:getCanonicalName() .. " entries with inflection not matching pagename")
end
end
-- Make the table
function make_table(data)
local function repl(param)
local accel = true
local no_store = false
if param == "info" then
return mw.getContentLanguage():ucfirst(data.info or "")
elseif string.sub(param, 1, 1) == "!" then
no_store = true
param = string.sub(param, 2)
elseif string.sub(param, 1, 1) == "#" then
accel = false
param = string.sub(param, 2)
end
local forms = data.forms[param]
if not forms then
return "—"
end
local ret = {}
for key, subform in ipairs(forms) do
table.insert(ret, require("Module:links").full_link({lang = lang, term = subform, accel = accel and {form = param, lemma = data.lemma, no_store = no_store} or nil}))
end
return table.concat(ret, "<br/>")
end
local wikicode = [=[
{| class="inflection-table vsSwitcher" data-toggle-category="inflection" style="border: solid 1px #CCCCFF;" cellspacing="1" cellpadding="2"
|- style="background: #E2F6E2; text-align: left;"
! class="vsToggleElement" colspan="4" | {{{info}}}
|- class="vsShow" style="background: #F2F2FF;"
! style="width: 11em; background: #E2F6E2;" | infinitive
| style="width: 15em;" colspan="2" | {{{!inf}}}
|- class="vsShow" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 1st sing. present
| colspan="2" | {{{!1|s|pres|indc}}}
|- class="vsShow" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 1st sing. past
| colspan="2" | {{{!1|s|past|indc}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | infinitive
| colspan="3" | {{{inf}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | present participle
| colspan="3" | {{{pres|ptcp}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | past participle
| colspan="3" | {{{past|ptcp}}}
|- class="vsHide"
! style="background: #C0E4C0; width: 11em;" |
! style="background: #C0E4C0; width: 15em;" | present indicative
! style="background: #C0E4C0; width: 15em;" | past indicative
! style="background: #C0E4C0; width: 15em;" | imperative
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 1st singular
| data-accel-col="1" | {{{1|s|pres|indc}}}
| data-accel-col="2" | {{{1|s|past|indc}}}
| data-accel-col="3" | {{{1|s|impr}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 2nd singular
| data-accel-col="1" | {{{2|s|pres|indc}}}
| data-accel-col="2" | {{{2|s|past|indc}}}
| data-accel-col="3" | {{{2|s|impr}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 3rd singular
| data-accel-col="1" | {{{3|s|pres|indc}}}
| data-accel-col="2" | {{{3|s|past|indc}}}
| data-accel-col="3" | {{{3|s|impr}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 1st plural
| data-accel-col="1" | {{{1|p|pres|indc}}}
| data-accel-col="2" | {{{1|p|past|indc}}}
| data-accel-col="3" | {{{1|p|impr}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 2nd plural
| data-accel-col="1" | {{{2|p|pres|indc}}}
| data-accel-col="2" | {{{2|p|past|indc}}}
| data-accel-col="3" | {{{2|p|impr}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 3rd plural
| data-accel-col="1" | {{{3|p|pres|indc}}}
| data-accel-col="2" | {{{3|p|past|indc}}}
| data-accel-col="3" | {{{3|p|impr}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 4th person
| data-accel-col="1" | {{{4|pres|indc}}}
| data-accel-col="2" | {{{4|past|indc}}}
| data-accel-col="3" | {{{4|impr}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | connegative
| data-accel-col="1" | {{{pres|indc|conn}}}
| data-accel-col="2" | {{{past|indc|conn}}}
| data-accel-col="3" | {{{impr|conn}}}
|- class="vsHide"
! style="background: #C0E4C0;" |
! style="background: #C0E4C0;" | conditional
! style="background: #C0E4C0;" | potential
! style="background: #F2F2FF;" rowspan="9" |
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 1st singular
| data-accel-col="4" | {{{1|s|cond}}}
| data-accel-col="5" | {{{1|s|potn}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 2nd singular
| data-accel-col="4" | {{{2|s|cond}}}
| data-accel-col="5" | {{{2|s|potn}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 3rd singular
| data-accel-col="4" | {{{3|s|cond}}}
| data-accel-col="5" | {{{3|s|potn}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 1st plural
| data-accel-col="4" | {{{1|p|cond}}}
| data-accel-col="5" | {{{1|p|potn}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 2nd plural
| data-accel-col="4" | {{{2|p|cond}}}
| data-accel-col="5" | {{{2|p|potn}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 3rd plural
| data-accel-col="4" | {{{3|p|cond}}}
| data-accel-col="5" | {{{3|p|potn}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 4th person
| data-accel-col="4" | {{{4|cond}}}
| data-accel-col="5" | {{{4|potn}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | connegative
| data-accel-col="4" | {{{cond|conn}}}
| data-accel-col="5" | {{{potn|conn}}}
|}]=]
return mw.ustring.gsub(wikicode, "{{{[#!]?([a-z0-9|]+)}}}", repl) .. require("Module:utilities").format_categories(data.categories, lang)
end
return export