Module:lumb-conj: Difference between revisions
Jump to navigation
Jump to search
Created page with "-- Gollic verb module local p = {} ---------------------------------------------------------------- -- ENDINGS ---------------------------------------------------------------- local endings = { pres_part = "ne", past_part = "re", pres_1s = "é", pres_2s = "ét", pres_3s = "uis", pres_1p = "ié", pres_2p = "ée", pres_3p = "uise", imperf_1s = "ois", imperf_2s = "is", imperf_3s = "ent", imperf_1p = "oise", imperf_2p =..." |
No edit summary |
||
| (15 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
-- | -- Lumbaieric verb module | ||
local p = {} | local p = {} | ||
| Line 7: | Line 7: | ||
local endings = { | local endings = { | ||
pres_part = " | pres_part = "nō", | ||
past_part = " | past_part = "ar", | ||
pres_1s = " | pres_1s = "a", | ||
pres_2s = " | pres_2s = "at", | ||
pres_3s = " | pres_3s = "ahþ", | ||
pres_1p = " | pres_1p = "a", | ||
pres_2p = " | pres_2p = "ata", | ||
pres_3p = " | pres_3p = "ahþa", | ||
imperf_1s = " | imperf_1s = "īz", | ||
imperf_2s = " | imperf_2s = "iz", | ||
imperf_3s = " | imperf_3s = "enþ", | ||
imperf_1p = " | imperf_1p = "īza", | ||
imperf_2p = " | imperf_2p = "iza", | ||
imperf_3p = " | imperf_3p = "enþa", | ||
past_1s = "ir", | past_1s = "ir", | ||
past_2s = " | past_2s = "int", | ||
past_3s = " | past_3s = "iþ", | ||
past_1p = " | past_1p = "ira", | ||
past_2p = " | past_2p = "inta", | ||
past_3p = " | past_3p = "iþa", | ||
fut_1s = " | fut_1s = "ōna", | ||
fut_2s = " | fut_2s = "ōnt", | ||
fut_3s = " | fut_3s = "ōnahþ", | ||
fut_1p = " | fut_1p = "ōnha", | ||
fut_2p = " | fut_2p = "ōnta", | ||
fut_3p = " | fut_3p = "ōnahþa", | ||
Spres_1s = " | Spres_1s = "er", | ||
Spres_2s = " | Spres_2s = "īt", | ||
Spres_3s = " | Spres_3s = "jōt", | ||
Spres_1p = " | Spres_1p = "era", | ||
Spres_2p = " | Spres_2p = "īta", | ||
Spres_3p = " | Spres_3p = "jōta", | ||
Simperf_1s = " | Simperf_1s = "au", | ||
Simperf_2s = " | Simperf_2s = "ōfla", | ||
Simperf_3s = " | Simperf_3s = "in", | ||
Simperf_1p = " | Simperf_1p = "awa", | ||
Simperf_2p = " | Simperf_2p = "ōfla", | ||
Simperf_3p = " | Simperf_3p = "ina", | ||
IMP_2s = "s", | IMP_2s = "s", | ||
IMP_3s = "erþ", | |||
IMP_2p = " | IMP_2p = "sa", | ||
IMP_3p = "erþa", | |||
} | } | ||
| Line 62: | Line 63: | ||
local irregulars = { | local irregulars = { | ||
[" | ["berijana"] = { | ||
fut_1s = "skrōgijōna", | |||
fut_2s = "skrōgijōnt", | |||
fut_3s = "skrōgijōnahþ", | |||
fut_1p = "skrōgijōnha", | |||
fut_2p = "skrōgijōnta", | |||
fut_3p = "skrōgijōnahþa", | |||
past_1s = "pākīr", | |||
past_2s = "pākīnt", | |||
past_3s = "pākīþ", | |||
past_1p = "pākīra", | |||
past_2p = "pākīnta", | |||
past_3p = "pākīþa", | |||
past_part = "pākijar", | |||
} | } | ||
} | } | ||
| Line 133: | Line 124: | ||
-- double h is simplified to single h | -- double h is simplified to single h | ||
form = mw.ustring.gsub(form, "hh", "h") | form = mw.ustring.gsub(form, "hh", "h") | ||
-- double j is simplified to single j | |||
form = mw.ustring.gsub(form, "jj", "j") | |||
-- <iji> is simplified to <ī> | |||
form = mw.ustring.gsub(form, "ij[iī]", "ī") | |||
return form | return form | ||
| Line 147: | Line 144: | ||
local stem = get_stem(title) | local stem = get_stem(title) | ||
local root = args.root | |||
local | local strong = args.strong | ||
local strong_classes = { | |||
a = { | |||
past = "ū", | |||
future = "ō", | |||
}, | |||
e = { | |||
past = "ā", | |||
future = "i", | |||
}, | |||
} | |||
local strong_categories = { | |||
a = "Lumbaieric class 1 strong verbs", | |||
e = "Lumbaieric class 2 strong verbs", | |||
} | |||
local forms = {} | local forms = {} | ||
local used_irregular = false | |||
for slot, ending in pairs(endings) do | for slot, ending in pairs(endings) do | ||
| Line 159: | Line 175: | ||
elseif irregulars[title] and irregulars[title][slot] then | elseif irregulars[title] and irregulars[title][slot] then | ||
forms[slot] = irregulars[title][slot] | forms[slot] = irregulars[title][slot] | ||
used_irregular = true | |||
else | else | ||
local currentStem = stem | local currentStem = stem | ||
local rootPart = root | |||
if | local suffixPart = "" | ||
if rootPart then | |||
suffixPart = mw.ustring.sub(stem, mw.ustring.len(rootPart) + 1) | |||
end | |||
-- STRONG VERBS | |||
if strong and strong_classes[strong] then | |||
local grade | |||
if mw.ustring.match(slot, "^past_") then | |||
grade = strong_classes[strong].past | |||
elseif mw.ustring.match(slot, "^fut_") then | |||
currentStem = mw.ustring.gsub(currentStem, " | grade = strong_classes[strong].future | ||
end | |||
if grade then | |||
if rootPart then | |||
rootPart = mw.ustring.gsub(rootPart, "a", grade) | |||
currentStem = rootPart .. suffixPart | |||
else | |||
currentStem = mw.ustring.gsub(currentStem, "a", grade) | |||
end | |||
end | end | ||
end | end | ||
| Line 185: | Line 212: | ||
end | end | ||
end | end | ||
local conjugation_type | |||
if strong_categories[strong] then | |||
conjugation_type = " (strong class " .. strong_categories[strong]:match("class (%d+)") .. ")" | |||
else | |||
conjugation_type = " (weak)" | |||
end | |||
---------------------------------------------------------------- | ---------------------------------------------------------------- | ||
| Line 193: | Line 228: | ||
table.insert(t, | table.insert(t, | ||
'{| class="wikitable mw-collapsible mw-collapsed"\n' | |||
.. '|+ Conjugation of [[Contionary:' .. title .. '|' .. title .. ']]' | |||
.. conjugation_type .. '\n' | |||
) | |||
table.insert(t, | table.insert(t, | ||
| Line 229: | Line 265: | ||
.. '! rowspan="5" style="background:#bbd0fa;" | Indicative\n' | .. '! rowspan="5" style="background:#bbd0fa;" | Indicative\n' | ||
.. '! \n' | .. '! \n' | ||
.. '! ' .. make_pronoun(" | .. '! ' .. make_pronoun("wī") | ||
.. ' !! ' .. make_pronoun(" | .. ' !! ' .. make_pronoun("þifuz") | ||
.. ' !! ' .. make_pronoun(" | .. ' !! ' .. make_pronoun("wēs/liu/heu") | ||
.. ' !! ' .. make_pronoun(" | .. ' !! ' .. make_pronoun("wīa") | ||
.. ' !! ' .. make_pronoun(" | .. ' !! ' .. make_pronoun("þifuza") | ||
.. ' !! ' .. make_pronoun(" | .. ' !! ' .. make_pronoun("wēza") | ||
.. '\n' | .. '\n' | ||
) | ) | ||
| Line 292: | Line 328: | ||
.. '! rowspan="3" style="background:#b3da9d;" | Subjunctive\n' | .. '! rowspan="3" style="background:#b3da9d;" | Subjunctive\n' | ||
.. '! \n' | .. '! \n' | ||
.. '! ' .. make_pronoun(" | .. '! ' .. make_pronoun("wī") | ||
.. ' !! ' .. make_pronoun(" | .. ' !! ' .. make_pronoun("þifuz") | ||
.. ' !! ' .. make_pronoun(" | .. ' !! ' .. make_pronoun("wēs/liu/heu") | ||
.. ' !! ' .. make_pronoun(" | .. ' !! ' .. make_pronoun("wīa") | ||
.. ' !! ' .. make_pronoun(" | .. ' !! ' .. make_pronoun("þifuza") | ||
.. ' !! ' .. make_pronoun(" | .. ' !! ' .. make_pronoun("wēza") | ||
.. '\n' | .. '\n' | ||
) | ) | ||
| Line 332: | Line 368: | ||
.. '! \n' | .. '! \n' | ||
.. '! —' | .. '! —' | ||
.. ' !! ' .. make_pronoun(" | .. ' !! ' .. make_pronoun("þifuz") | ||
.. ' !! ' .. make_pronoun("wēs/liu/heu") | |||
.. ' !! ' .. make_pronoun(" | |||
.. ' !! —' | .. ' !! —' | ||
.. ' !! ' .. make_pronoun("þifuza") | |||
.. ' !! ' .. make_pronoun("wēza") | |||
.. '\n' | .. '\n' | ||
) | ) | ||
| Line 345: | Line 381: | ||
.. '| ' .. empty_cell() | .. '| ' .. empty_cell() | ||
.. ' || ' .. make_cell(forms.IMP_2s) | .. ' || ' .. make_cell(forms.IMP_2s) | ||
.. ' || ' .. make_cell(forms.IMP_3s) | |||
.. ' || ' .. empty_cell() | .. ' || ' .. empty_cell() | ||
.. ' || ' .. make_cell(forms.IMP_2p) | .. ' || ' .. make_cell(forms.IMP_2p) | ||
.. ' || ' .. | .. ' || ' .. make_cell(forms.IMP_3p) | ||
.. '\n' | .. '\n' | ||
) | ) | ||
| Line 357: | Line 393: | ||
.. '| ' .. empty_cell() | .. '| ' .. empty_cell() | ||
.. ' || ' .. make_cell(forms.IMP_2s, "ne") | .. ' || ' .. make_cell(forms.IMP_2s, "ne") | ||
.. ' || ' .. make_cell(forms.IMP_3s, "ne") | |||
.. ' || ' .. empty_cell() | .. ' || ' .. empty_cell() | ||
.. ' || ' .. make_cell(forms.IMP_2p, "ne") | .. ' || ' .. make_cell(forms.IMP_2p, "ne") | ||
.. ' || ' .. | .. ' || ' .. make_cell(forms.IMP_3p, "ne") | ||
.. '\n' | .. '\n' | ||
) | ) | ||
| Line 366: | Line 402: | ||
table.insert(t, '|}') | table.insert(t, '|}') | ||
return table.concat(t) | if strong_categories[strong] then | ||
table.insert(t, | |||
"\n[[Category:" .. strong_categories[strong] .. "]]") | |||
else | |||
table.insert(t, | |||
"\n[[Category:Lumbaieric weak verbs]]") | |||
end | |||
if used_irregular then | |||
table.insert(t, | |||
"\n[[Category:Lumbaieric irregular verbs]]") | |||
end | |||
return table.concat(t) | |||
end | end | ||
return p | return p | ||
Latest revision as of 17:57, 5 July 2026
- This module lacks a documentation subpage. Please create it.
- Useful links: subpage list • links • transclusions • testcases • sandbox
-- Lumbaieric verb module
local p = {}
----------------------------------------------------------------
-- ENDINGS
----------------------------------------------------------------
local endings = {
pres_part = "nō",
past_part = "ar",
pres_1s = "a",
pres_2s = "at",
pres_3s = "ahþ",
pres_1p = "a",
pres_2p = "ata",
pres_3p = "ahþa",
imperf_1s = "īz",
imperf_2s = "iz",
imperf_3s = "enþ",
imperf_1p = "īza",
imperf_2p = "iza",
imperf_3p = "enþa",
past_1s = "ir",
past_2s = "int",
past_3s = "iþ",
past_1p = "ira",
past_2p = "inta",
past_3p = "iþa",
fut_1s = "ōna",
fut_2s = "ōnt",
fut_3s = "ōnahþ",
fut_1p = "ōnha",
fut_2p = "ōnta",
fut_3p = "ōnahþa",
Spres_1s = "er",
Spres_2s = "īt",
Spres_3s = "jōt",
Spres_1p = "era",
Spres_2p = "īta",
Spres_3p = "jōta",
Simperf_1s = "au",
Simperf_2s = "ōfla",
Simperf_3s = "in",
Simperf_1p = "awa",
Simperf_2p = "ōfla",
Simperf_3p = "ina",
IMP_2s = "s",
IMP_3s = "erþ",
IMP_2p = "sa",
IMP_3p = "erþa",
}
----------------------------------------------------------------
-- IRREGULAR VERBS
----------------------------------------------------------------
local irregulars = {
["berijana"] = {
fut_1s = "skrōgijōna",
fut_2s = "skrōgijōnt",
fut_3s = "skrōgijōnahþ",
fut_1p = "skrōgijōnha",
fut_2p = "skrōgijōnta",
fut_3p = "skrōgijōnahþa",
past_1s = "pākīr",
past_2s = "pākīnt",
past_3s = "pākīþ",
past_1p = "pākīra",
past_2p = "pākīnta",
past_3p = "pākīþa",
past_part = "pākijar",
}
}
----------------------------------------------------------------
-- STEM
----------------------------------------------------------------
local function get_stem(title)
return mw.ustring.gsub(title, "ana$", "")
end
----------------------------------------------------------------
-- DISPLAY HELPERS
----------------------------------------------------------------
local function make_cell(form, prefix)
if not form then return "—" end
if prefix then form = prefix .. " " .. form end
return "<div style='text-align:center;'>"
.. "[[Contionary:" .. form .. "|" .. form .. "]]"
.. "</div>"
end
local function make_pronoun(text)
return text
end
local function empty_cell()
return "<div style='text-align:center;'>—</div>"
end
----------------------------------------------------------------
-- COMBINE
----------------------------------------------------------------
local function combine(stem, ending)
local form = stem .. ending
----------------------------------------------------------------
-- PHONOLOGICAL RULES
----------------------------------------------------------------
-- double h is simplified to single h
form = mw.ustring.gsub(form, "hh", "h")
-- double j is simplified to single j
form = mw.ustring.gsub(form, "jj", "j")
-- <iji> is simplified to <ī>
form = mw.ustring.gsub(form, "ij[iī]", "ī")
return form
end
----------------------------------------------------------------
-- MAIN FUNCTION
----------------------------------------------------------------
function p.show(frame)
local args = frame:getParent().args
local title = mw.title.getCurrentTitle().text
local stem = get_stem(title)
local root = args.root
local strong = args.strong
local strong_classes = {
a = {
past = "ū",
future = "ō",
},
e = {
past = "ā",
future = "i",
},
}
local strong_categories = {
a = "Lumbaieric class 1 strong verbs",
e = "Lumbaieric class 2 strong verbs",
}
local forms = {}
local used_irregular = false
for slot, ending in pairs(endings) do
if args[slot] and args[slot] ~= "" then
forms[slot] = args[slot]
elseif irregulars[title] and irregulars[title][slot] then
forms[slot] = irregulars[title][slot]
used_irregular = true
else
local currentStem = stem
local rootPart = root
local suffixPart = ""
if rootPart then
suffixPart = mw.ustring.sub(stem, mw.ustring.len(rootPart) + 1)
end
-- STRONG VERBS
if strong and strong_classes[strong] then
local grade
if mw.ustring.match(slot, "^past_") then
grade = strong_classes[strong].past
elseif mw.ustring.match(slot, "^fut_") then
grade = strong_classes[strong].future
end
if grade then
if rootPart then
rootPart = mw.ustring.gsub(rootPart, "a", grade)
currentStem = rootPart .. suffixPart
else
currentStem = mw.ustring.gsub(currentStem, "a", grade)
end
end
end
forms[slot] = combine(currentStem, ending)
end
end
local conjugation_type
if strong_categories[strong] then
conjugation_type = " (strong class " .. strong_categories[strong]:match("class (%d+)") .. ")"
else
conjugation_type = " (weak)"
end
----------------------------------------------------------------
-- TABLE OUTPUT
----------------------------------------------------------------
local t = {}
table.insert(t,
'{| class="wikitable mw-collapsible mw-collapsed"\n'
.. '|+ Conjugation of [[Contionary:' .. title .. '|' .. title .. ']]'
.. conjugation_type .. '\n'
)
table.insert(t,
'|-\n'
.. '! colspan="5" style="background:#ebe8b9;" | Infinitive\n'
.. '| colspan="3" | ' .. make_cell(title) .. '\n'
)
table.insert(t,
'|-\n'
.. '! colspan="5" style="background:#ebe8b9;" | Present Participle\n'
.. '| colspan="3" | ' .. make_cell(forms.pres_part or "—") .. '\n'
)
table.insert(t,
'|-\n'
.. '! colspan="5" style="background:#ebe8b9;" | Past Participle\n'
.. '| colspan="3" | ' .. make_cell(forms.past_part or "—") .. '\n'
)
table.insert(t,
'|-\n'
.. '! colspan="2" rowspan="2" style="background:#cfcfcf;" | !! colspan="3" style="background:#cfcfcf;" | Singular !! colspan="3" style="background:#cfcfcf;" | Plural\n'
)
table.insert(t,
'|-\n'
.. '! style="background:#cfcfcf;" | 1st !! style="background:#cfcfcf;" | 2nd !! style="background:#cfcfcf;" | 3rd !! style="background:#cfcfcf;" | 1st !! style="background:#cfcfcf;" | 2nd !! style="background:#cfcfcf;" | 3rd\n'
)
table.insert(t,
'|-\n'
.. '! rowspan="5" style="background:#bbd0fa;" | Indicative\n'
.. '! \n'
.. '! ' .. make_pronoun("wī")
.. ' !! ' .. make_pronoun("þifuz")
.. ' !! ' .. make_pronoun("wēs/liu/heu")
.. ' !! ' .. make_pronoun("wīa")
.. ' !! ' .. make_pronoun("þifuza")
.. ' !! ' .. make_pronoun("wēza")
.. '\n'
)
table.insert(t,
'|-\n'
.. '! Present\n'
.. '| ' .. make_cell(forms.pres_1s)
.. ' || ' .. make_cell(forms.pres_2s)
.. ' || ' .. make_cell(forms.pres_3s)
.. ' || ' .. make_cell(forms.pres_1p)
.. ' || ' .. make_cell(forms.pres_2p)
.. ' || ' .. make_cell(forms.pres_3p)
.. '\n'
)
table.insert(t,
'|-\n'
.. '! Imperfect\n'
.. '| ' .. make_cell(forms.imperf_1s)
.. ' || ' .. make_cell(forms.imperf_2s)
.. ' || ' .. make_cell(forms.imperf_3s)
.. ' || ' .. make_cell(forms.imperf_1p)
.. ' || ' .. make_cell(forms.imperf_2p)
.. ' || ' .. make_cell(forms.imperf_3p)
.. '\n'
)
table.insert(t,
'|-\n'
.. '! Past\n'
.. '| ' .. make_cell(forms.past_1s)
.. ' || ' .. make_cell(forms.past_2s)
.. ' || ' .. make_cell(forms.past_3s)
.. ' || ' .. make_cell(forms.past_1p)
.. ' || ' .. make_cell(forms.past_2p)
.. ' || ' .. make_cell(forms.past_3p)
.. '\n'
)
table.insert(t,
'|-\n'
.. '! Future\n'
.. '| ' .. make_cell(forms.fut_1s)
.. ' || ' .. make_cell(forms.fut_2s)
.. ' || ' .. make_cell(forms.fut_3s)
.. ' || ' .. make_cell(forms.fut_1p)
.. ' || ' .. make_cell(forms.fut_2p)
.. ' || ' .. make_cell(forms.fut_3p)
.. '\n'
.. '|-\n'
.. '| colspan="8" style="background:#cfcfcf; height:6px; padding:0;" | \n'
)
table.insert(t,
'|-\n'
.. '! rowspan="3" style="background:#b3da9d;" | Subjunctive\n'
.. '! \n'
.. '! ' .. make_pronoun("wī")
.. ' !! ' .. make_pronoun("þifuz")
.. ' !! ' .. make_pronoun("wēs/liu/heu")
.. ' !! ' .. make_pronoun("wīa")
.. ' !! ' .. make_pronoun("þifuza")
.. ' !! ' .. make_pronoun("wēza")
.. '\n'
)
table.insert(t,
'|-\n'
.. '! Present\n'
.. '| ' .. make_cell(forms.Spres_1s)
.. ' || ' .. make_cell(forms.Spres_2s)
.. ' || ' .. make_cell(forms.Spres_3s)
.. ' || ' .. make_cell(forms.Spres_1p)
.. ' || ' .. make_cell(forms.Spres_2p)
.. ' || ' .. make_cell(forms.Spres_3p)
.. '\n'
)
table.insert(t,
'|-\n'
.. '! Imperfect\n'
.. '| ' .. make_cell(forms.Simperf_1s)
.. ' || ' .. make_cell(forms.Simperf_2s)
.. ' || ' .. make_cell(forms.Simperf_3s)
.. ' || ' .. make_cell(forms.Simperf_1p)
.. ' || ' .. make_cell(forms.Simperf_2p)
.. ' || ' .. make_cell(forms.Simperf_3p)
.. '\n'
.. '|-\n'
.. '| colspan="8" style="background:#cfcfcf; height:6px; padding:0;" | \n'
)
table.insert(t,
'|-\n'
.. '! rowspan="3" style="background:#e8cc8f;" | Imperative\n'
.. '! \n'
.. '! —'
.. ' !! ' .. make_pronoun("þifuz")
.. ' !! ' .. make_pronoun("wēs/liu/heu")
.. ' !! —'
.. ' !! ' .. make_pronoun("þifuza")
.. ' !! ' .. make_pronoun("wēza")
.. '\n'
)
table.insert(t,
'|-\n'
.. '! Affirmative\n'
.. '| ' .. empty_cell()
.. ' || ' .. make_cell(forms.IMP_2s)
.. ' || ' .. make_cell(forms.IMP_3s)
.. ' || ' .. empty_cell()
.. ' || ' .. make_cell(forms.IMP_2p)
.. ' || ' .. make_cell(forms.IMP_3p)
.. '\n'
)
table.insert(t,
'|-\n'
.. '! Negative\n'
.. '| ' .. empty_cell()
.. ' || ' .. make_cell(forms.IMP_2s, "ne")
.. ' || ' .. make_cell(forms.IMP_3s, "ne")
.. ' || ' .. empty_cell()
.. ' || ' .. make_cell(forms.IMP_2p, "ne")
.. ' || ' .. make_cell(forms.IMP_3p, "ne")
.. '\n'
)
table.insert(t, '|}')
if strong_categories[strong] then
table.insert(t,
"\n[[Category:" .. strong_categories[strong] .. "]]")
else
table.insert(t,
"\n[[Category:Lumbaieric weak verbs]]")
end
if used_irregular then
table.insert(t,
"\n[[Category:Lumbaieric irregular verbs]]")
end
return table.concat(t)
end
return p