Module:Chak-verbs: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 4: | Line 4: | ||
p = {} | p = {} | ||
require("Module:Chak-verbs/data") | |||
function p.getBaseStems (root1, root2) | function p.getBaseStems (root1, root2) | ||
Line 161: | Line 30: | ||
function p.getForms(root1,root2,manual_stems) | function p.getForms(root1,root2,manual_stems) | ||
local | local forms = {} | ||
baseStems = p.getBaseStems(root1,root2) | local baseStems = p.getBaseStems(root1,root2) | ||
local full_form = '' | |||
if root2 == nil then | if root2 == nil then | ||
for _,conj in ipairs(CONJUGATIONS) do | |||
for _,form in ipairs(FORMS) do | |||
full_form = conj[1]..'.ipfv.'..form[1] | |||
forms[full_form] = baseStems[1]..UNMOD_SUFFIXES[full_form] | |||
full_form = conj[1]..'.pfv.'..form[1] | |||
forms[full_form] = baseStems[2]..UNMOD_SUFFIXES[full_form] | |||
end | |||
full_form = conj[1]..".imp" | |||
forms[full_form] = baseStems[1]..UNMOD_SUFFIXES[full_form] | |||
end | |||
else | else | ||
-- Standard stems | -- Standard stems | ||
Line 280: | Line 104: | ||
end | end | ||
return | return forms | ||
end | end | ||
function p.showConjugations(root1,root2) | function p.showConjugations(root1,root2) | ||
local forms = {} | |||
local std_forms = {} | local std_forms = {} | ||
local caus_forms = {} | local caus_forms = {} | ||
local pass_forms = {} | local pass_forms = {} | ||
forms = p.getForms(root1,root2) | |||
local output = {} | local output = {} | ||
Line 297: | Line 122: | ||
for _,v in ipairs(FORMS) do | for _,v in ipairs(FORMS) do | ||
table.insert(output,"|-\n") | table.insert(output,"|-\n") | ||
table.insert(output,"| "..v[2].." || ".. | table.insert(output,"| "..v[2].." || ".. forms["std.ipfv."..v[1]] .. " || " .. forms["std.pfv."..v[1]].." ") | ||
table.insert(output,"|| ".. | table.insert(output,"|| ".. forms["caus.ipfv."..v[1]] .. " || " .. forms["caus.pfv."..v[1]].." ") | ||
table.insert(output,"|| ".. | table.insert(output,"|| ".. forms["pass.ipfv."..v[1]] .. " || " .. forms["pass.pfv."..v[1]].."\n") | ||
end | end | ||
table.insert(output,"|-\n") | table.insert(output,"|-\n") | ||
table.insert(output,"| Imperative || ".. | table.insert(output,"| Imperative || ".. forms["std.imp"] .. " || ") | ||
table.insert(output,"|| ".. | table.insert(output,"|| ".. forms["caus.imp"] .. " || " ) | ||
table.insert(output,"|| ".. | table.insert(output,"|| ".. forms["pass.imp"] .. " || \n") | ||
table.insert(output,"|}") | table.insert(output,"|}") | ||
Revision as of 09:55, 16 October 2023
- The following documentation is located at Module:Chak-verbs/documentation. [edit]
- Useful links: subpage list • transclusions • testcases • sandbox
Implements {{chak-verb}}
and {{chak-conj}}
Note: Formatting for tables is defined in Module:Chak-verbs/format.
-- WORK-IN-PROGRESS
--
p = {}
require("Module:Chak-verbs/data")
function p.getBaseStems (root1, root2)
local stems = {}
if root1 == nil then
error("First root is required")
end
if root2 == nil then
stems[1] = root1
stems[2] = root1..string.sub(root1,-1)
else
stems[1] = root1..'aa'..root2
stems[2] = root1..root2
stems[3] = root1..string.sub(root1,-1).."uu"..root2
stems[4] = root1..string.sub(root1,-1).."u"..root2
stems[5] = root1..'a'..root2
end
return stems
end
function p.getForms(root1,root2,manual_stems)
local forms = {}
local baseStems = p.getBaseStems(root1,root2)
local full_form = ''
if root2 == nil then
for _,conj in ipairs(CONJUGATIONS) do
for _,form in ipairs(FORMS) do
full_form = conj[1]..'.ipfv.'..form[1]
forms[full_form] = baseStems[1]..UNMOD_SUFFIXES[full_form]
full_form = conj[1]..'.pfv.'..form[1]
forms[full_form] = baseStems[2]..UNMOD_SUFFIXES[full_form]
end
full_form = conj[1]..".imp"
forms[full_form] = baseStems[1]..UNMOD_SUFFIXES[full_form]
end
else
-- Standard stems
std_stems["imp.1s"] = baseStems[1]..STD_DERIVED_SUF["imp.1s"]
std_stems["perf.1s"] = baseStems[2]..STD_DERIVED_SUF["perf.1s"]
std_stems["imp.2s"] = baseStems[1]..STD_DERIVED_SUF["imp.2s"]
std_stems["perf.2s"] = baseStems[2]..STD_DERIVED_SUF["perf.2s"]
std_stems["imp.3s"] = baseStems[1]..STD_DERIVED_SUF["imp.3s"]
std_stems["perf.3s"] = baseStems[2]..STD_DERIVED_SUF["perf.3s"]
std_stems["imp.1p"] = baseStems[1]..STD_DERIVED_SUF["imp.1p"]
std_stems["perf.1p"] = baseStems[2]..STD_DERIVED_SUF["perf.1p"]
std_stems["imp.2/3p"] = baseStems[1]..STD_DERIVED_SUF["imp.2/3p"]
std_stems["perf.2/3p"] = baseStems[2]..STD_DERIVED_SUF["perf.2/3p"]
std_stems["imp.rels"] = baseStems[1]..STD_DERIVED_SUF["imp.rels"]
std_stems["perf.rels"] = baseStems[2]..STD_DERIVED_SUF["perf.rels"]
std_stems["imp.relp"] = baseStems[1]..STD_DERIVED_SUF["imp.relp"]
std_stems["perf.relp"] = baseStems[2]..STD_DERIVED_SUF["perf.relp"]
std_stems["imp.inf"] = baseStems[5]..STD_DERIVED_SUF["imp.inf"]
std_stems["perf.inf"] = baseStems[2]..STD_DERIVED_SUF["perf.inf"]
std_stems["imp"] = baseStems[2]..STD_DERIVED_SUF["imp"]
-- Causative Stems
caus_stems["imp.1s"] = baseStems[3]..CAUS_DERIVED_SUF["imp.1s"]
caus_stems["perf.1s"] = baseStems[4]..CAUS_DERIVED_SUF["perf.1s"]
caus_stems["imp.2s"] = baseStems[3]..CAUS_DERIVED_SUF["imp.2s"]
caus_stems["perf.2s"] = baseStems[4]..CAUS_DERIVED_SUF["perf.2s"]
caus_stems["imp.3s"] = baseStems[3]..CAUS_DERIVED_SUF["imp.3s"]
caus_stems["perf.3s"] = baseStems[4]..CAUS_DERIVED_SUF["perf.3s"]
caus_stems["imp.1p"] = baseStems[3]..CAUS_DERIVED_SUF["imp.1p"]
caus_stems["perf.1p"] = baseStems[4]..CAUS_DERIVED_SUF["perf.1p"]
caus_stems["imp.2/3p"] = baseStems[3]..CAUS_DERIVED_SUF["imp.2/3p"]
caus_stems["perf.2/3p"] = baseStems[4]..CAUS_DERIVED_SUF["perf.2/3p"]
caus_stems["imp.rels"] = baseStems[3]..CAUS_DERIVED_SUF["imp.rels"]
caus_stems["perf.rels"] = baseStems[4]..CAUS_DERIVED_SUF["perf.rels"]
caus_stems["imp.relp"] = baseStems[3]..CAUS_DERIVED_SUF["imp.relp"]
caus_stems["perf.relp"] = baseStems[4]..CAUS_DERIVED_SUF["perf.relp"]
caus_stems["imp.inf"] = baseStems[3]..CAUS_DERIVED_SUF["imp.inf"]
caus_stems["perf.inf"] = baseStems[4]..CAUS_DERIVED_SUF["perf.inf"]
caus_stems["imp"] = baseStems[4]..CAUS_DERIVED_SUF["imp"]
-- Passive Stems
pass_stems["imp.1s"] = baseStems[1]..PASS_DERIVED_SUF["imp.1s"]
pass_stems["perf.1s"] = baseStems[2]..PASS_DERIVED_SUF["perf.1s"]
pass_stems["imp.2s"] = baseStems[1]..PASS_DERIVED_SUF["imp.2s"]
pass_stems["perf.2s"] = baseStems[2]..PASS_DERIVED_SUF["perf.2s"]
pass_stems["imp.3s"] = baseStems[1]..PASS_DERIVED_SUF["imp.3s"]
pass_stems["perf.3s"] = baseStems[2]..PASS_DERIVED_SUF["perf.3s"]
pass_stems["imp.1p"] = baseStems[1]..PASS_DERIVED_SUF["imp.1p"]
pass_stems["perf.1p"] = baseStems[2]..PASS_DERIVED_SUF["perf.1p"]
pass_stems["imp.2/3p"] = baseStems[1]..PASS_DERIVED_SUF["imp.2/3p"]
pass_stems["perf.2/3p"] = baseStems[2]..PASS_DERIVED_SUF["perf.2/3p"]
pass_stems["imp.rels"] = baseStems[1]..PASS_DERIVED_SUF["imp.rels"]
pass_stems["perf.rels"] = baseStems[2]..PASS_DERIVED_SUF["perf.rels"]
pass_stems["imp.relp"] = baseStems[1]..PASS_DERIVED_SUF["imp.relp"]
pass_stems["perf.relp"] = baseStems[2]..PASS_DERIVED_SUF["perf.relp"]
pass_stems["imp.inf"] = baseStems[5]..PASS_DERIVED_SUF["imp.inf"]
pass_stems["perf.inf"] = baseStems[2]..PASS_DERIVED_SUF["perf.inf"]
pass_stems["imp"] = baseStems[2]..PASS_DERIVED_SUF["imp"]
end
return forms
end
function p.showConjugations(root1,root2)
local forms = {}
local std_forms = {}
local caus_forms = {}
local pass_forms = {}
forms = p.getForms(root1,root2)
local output = {}
table.insert(output,'{| class="wikitable\n ! !! colspan=2 | Standard !! colspan=2 | Causative !! colspan=2 | Passive\n')
table.insert(output,"|-\n! Form !! Imperfect !! Perfect !! Imperfect !! Perfect !! Imperfect !! Perfect\n")
for _,v in ipairs(FORMS) do
table.insert(output,"|-\n")
table.insert(output,"| "..v[2].." || ".. forms["std.ipfv."..v[1]] .. " || " .. forms["std.pfv."..v[1]].." ")
table.insert(output,"|| ".. forms["caus.ipfv."..v[1]] .. " || " .. forms["caus.pfv."..v[1]].." ")
table.insert(output,"|| ".. forms["pass.ipfv."..v[1]] .. " || " .. forms["pass.pfv."..v[1]].."\n")
end
table.insert(output,"|-\n")
table.insert(output,"| Imperative || ".. forms["std.imp"] .. " || ")
table.insert(output,"|| ".. forms["caus.imp"] .. " || " )
table.insert(output,"|| ".. forms["pass.imp"] .. " || \n")
table.insert(output,"|}")
return table.concat(output)
end
function p.test1()
return p.showConjugations("shun",nil)
end
function p.test2()
return p.showConjugations("nak","l")
end
return p