Module:Chak-verbs: Difference between revisions

From The Languages of David J. Peterson
Jump to navigation Jump to search
No edit summary
No edit summary
Line 236: Line 236:
std_stems["perf.2/3p"] = baseStems[2]..STD_DERIVED_SUF["perf.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["imp.rels"] = baseStems[1]..STD_DERIVED_SUF["imp.rels"]
std_stems["perf.rels"] = baseStems[2]..STD_UNDERIVED_SUF["perf.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["imp.relp"] = baseStems[1]..STD_DERIVED_SUF["imp.relp"]
std_stems["perf.relp"] = baseStems[2]..STD_DERIVED_SUF["perf.relp"]
std_stems["perf.relp"] = baseStems[2]..STD_DERIVED_SUF["perf.relp"]
Line 257: Line 257:
caus_stems["imp.relp"] = baseStems[3]..CAUS_DERIVED_SUF["imp.relp"]
caus_stems["imp.relp"] = baseStems[3]..CAUS_DERIVED_SUF["imp.relp"]
caus_stems["perf.relp"] = baseStems[4]..CAUS_DERIVED_SUF["perf.relp"]
caus_stems["perf.relp"] = baseStems[4]..CAUS_DERIVED_SUF["perf.relp"]
caus_stems["imp.inf"] = baseStems[5]..CAUS_DERIVED_SUF["imp.inf"]
caus_stems["imp.inf"] = baseStems[3]..CAUS_DERIVED_SUF["imp.inf"]
caus_stems["perf.inf"] = baseStems[4]..CAUS_DERIVED_SUF["perf.inf"]
caus_stems["perf.inf"] = baseStems[4]..CAUS_DERIVED_SUF["perf.inf"]
caus_stems["imp"] = baseStems[4]..CAUS_DERIVED_SUF["imp"]
caus_stems["imp"] = baseStems[4]..CAUS_DERIVED_SUF["imp"]

Revision as of 22:40, 15 October 2023

Implements {{chak-verb}} and {{chak-conj}}

Note: Formatting for tables is defined in Module:Chak-verbs/format.


-- WORK-IN-PROGRESS
--

p = {}

FORMS = {
		{'1s','1st Singular'},	
		{'2s','2nd Singular'},
		{'3s','3rd Singular'},
		{'1p','1st Plural'},
		{'2/3p','2nd/3rd Plural'},
		{'rels','Rel. Singular'},
		{'relp','Rel. Plural'},
		{'inf','Infinitive'},
}

STD_UNDERIVED_SUF = {
		["imp.1s"] = 'ii',	
		["perf.1s"] = 'ii',
		["imp.2s"] = 'aash',
		["perf.2s"] = 'asha',
		["imp.3s"] = 'aaha',
		["perf.3s"] = 'aha',
		["imp.1p"] = 'iim',
		["perf.1p"] = 'imi',
		["imp.2/3p"] = 'aak',
		["perf.2/3p"] = 'aka',
		["imp.rels"] = 'aabit',
		["perf.rels"] = 'abit',
		["imp.relp"] = 'aabet',
		["perf.relp"] = 'abet',
		["imp.inf"] = 'a',
		["perf.inf"] = 'aha',
		["imp"] = 'a',
}

CAUS_UNDERIVED_SUF = {
		["imp.1s"] = 'uuyi',	
		["perf.1s"] = 'uyi',
		["imp.2s"] = 'uush',
		["perf.2s"] = 'ushu',
		["imp.3s"] = 'uuha',
		["perf.3s"] = 'usha',
		["imp.1p"] = 'uum',
		["perf.1p"] = 'umu',
		["imp.2/3p"] = 'uuk',
		["perf.2/3p"] = 'uku',
		["imp.rels"] = 'uubit',
		["perf.rels"] = 'ubit',
		["imp.relp"] = 'uubet',
		["perf.relp"] = 'ubet',
		["imp.inf"] = 'u',
		["perf.inf"] = 'uvu',
		["imp"] = 'u',
}

PASS_UNDERIVED_SUF = {
		["imp.1s"] = 'aasii',	
		["perf.1s"] = 'asii',
		["imp.2s"] = 'aasash',
		["perf.2s"] = 'asash',
		["imp.3s"] = 'aasha',
		["perf.3s"] = 'asha',
		["imp.1p"] = 'aasim',
		["perf.1p"] = 'asim',
		["imp.2/3p"] = 'aasak',
		["perf.2/3p"] = 'asak',
		["imp.rels"] = 'aasbit',
		["perf.rels"] = 'asbit',
		["imp.relp"] = 'aasbet',
		["perf.relp"] = 'asbet',
		["imp.inf"] = 'as',
		["perf.inf"] = 'asa',
		["imp"] = 'as',
}

STD_DERIVED_SUF = {
		["imp.1s"] = 'ii',	
		["perf.1s"] = 'ii',
		["imp.2s"] = 'ash',
		["perf.2s"] = 'asha',
		["imp.3s"] = 'aha',
		["perf.3s"] = 'aha',
		["imp.1p"] = 'im',
		["perf.1p"] = 'imi',
		["imp.2/3p"] = 'ak',
		["perf.2/3p"] = 'aka',
		["imp.rels"] = 'abit',
		["perf.rels"] = 'abit',
		["imp.relp"] = 'abet',
		["perf.relp"] = 'abet',
		["imp.inf"] = 'a',
		["perf.inf"] = 'aha',
		["imp"] = 'a',
}

CAUS_DERIVED_SUF = {
		["imp.1s"] = 'ii',	
		["perf.1s"] = 'ii',
		["imp.2s"] = 'ash',
		["perf.2s"] = 'ash',
		["imp.3s"] = 'aha',
		["perf.3s"] = 'ha',
		["imp.1p"] = 'im',
		["perf.1p"] = 'im',
		["imp.2/3p"] = 'ak',
		["perf.2/3p"] = 'ak',
		["imp.rels"] = 'abit',
		["perf.rels"] = 'bit',
		["imp.relp"] = 'abet',
		["perf.relp"] = 'bet',
		["imp.inf"] = '',
		["perf.inf"] = 'u',
		["imp"] = '',
}

PASS_DERIVED_SUF = {
		["imp.1s"] = 'asii',	
		["perf.1s"] = 'asii',
		["imp.2s"] = 'asash',
		["perf.2s"] = 'asash',
		["imp.3s"] = 'asha',
		["perf.3s"] = 'asha',
		["imp.1p"] = 'asim',
		["perf.1p"] = 'asim',
		["imp.2/3p"] = 'asak',
		["perf.2/3p"] = 'asak',
		["imp.rels"] = 'asbit',
		["perf.rels"] = 'asbit',
		["imp.relp"] = 'asbet',
		["perf.relp"] = 'asbet',
		["imp.inf"] = 'as',
		["perf.inf"] = 'asa',
		["imp"] = 'as',
}



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 std_stems = {}
	local caus_stems = {}
	local pass_stems = {}
	
	baseStems = p.getBaseStems(root1,root2)


	if root2 == nil then
		-- Standard Stems
		std_stems["imp.1s"] = baseStems[1]..STD_UNDERIVED_SUF["imp.1s"]
		std_stems["perf.1s"] = baseStems[2]..STD_UNDERIVED_SUF["perf.1s"]
		std_stems["imp.2s"] = baseStems[1]..STD_UNDERIVED_SUF["imp.2s"]
		std_stems["perf.2s"] = baseStems[2]..STD_UNDERIVED_SUF["perf.2s"]
		std_stems["imp.3s"] = baseStems[1]..STD_UNDERIVED_SUF["imp.3s"]
		std_stems["perf.3s"] = baseStems[2]..STD_UNDERIVED_SUF["perf.3s"]
		std_stems["imp.1p"] = baseStems[1]..STD_UNDERIVED_SUF["imp.1p"]
		std_stems["perf.1p"] = baseStems[2]..STD_UNDERIVED_SUF["perf.1p"]
		std_stems["imp.2/3p"] = baseStems[1]..STD_UNDERIVED_SUF["imp.2/3p"]
		std_stems["perf.2/3p"] = baseStems[2]..STD_UNDERIVED_SUF["perf.2/3p"]
		std_stems["imp.rels"] = baseStems[1]..STD_UNDERIVED_SUF["imp.rels"]
		std_stems["perf.rels"] = baseStems[2]..STD_UNDERIVED_SUF["perf.rels"]
		std_stems["imp.relp"] = baseStems[1]..STD_UNDERIVED_SUF["imp.relp"]
		std_stems["perf.relp"] = baseStems[2]..STD_UNDERIVED_SUF["perf.relp"]
		std_stems["imp.inf"] = baseStems[1]..STD_UNDERIVED_SUF["imp.inf"]
		std_stems["perf.inf"] = baseStems[2]..STD_UNDERIVED_SUF["perf.inf"]
		std_stems["imp"] = baseStems[1]..STD_UNDERIVED_SUF["imp"]
		-- Causative Stems
		caus_stems["imp.1s"] = baseStems[1]..CAUS_UNDERIVED_SUF["imp.1s"]
		caus_stems["perf.1s"] = baseStems[2]..CAUS_UNDERIVED_SUF["perf.1s"]
		caus_stems["imp.2s"] = baseStems[1]..CAUS_UNDERIVED_SUF["imp.2s"]
		caus_stems["perf.2s"] = baseStems[2]..CAUS_UNDERIVED_SUF["perf.2s"]
		caus_stems["imp.3s"] = baseStems[1]..CAUS_UNDERIVED_SUF["imp.3s"]
		caus_stems["perf.3s"] = baseStems[2]..CAUS_UNDERIVED_SUF["perf.3s"]
		caus_stems["imp.1p"] = baseStems[1]..CAUS_UNDERIVED_SUF["imp.1p"]
		caus_stems["perf.1p"] = baseStems[2]..CAUS_UNDERIVED_SUF["perf.1p"]
		caus_stems["imp.2/3p"] = baseStems[1]..CAUS_UNDERIVED_SUF["imp.2/3p"]
		caus_stems["perf.2/3p"] = baseStems[2]..CAUS_UNDERIVED_SUF["perf.2/3p"]
		caus_stems["imp.rels"] = baseStems[1]..CAUS_UNDERIVED_SUF["imp.rels"]
		caus_stems["perf.rels"] = baseStems[2]..CAUS_UNDERIVED_SUF["perf.rels"]
		caus_stems["imp.relp"] = baseStems[1]..CAUS_UNDERIVED_SUF["imp.relp"]
		caus_stems["perf.relp"] = baseStems[2]..CAUS_UNDERIVED_SUF["perf.relp"]
		caus_stems["imp.inf"] = baseStems[1]..CAUS_UNDERIVED_SUF["imp.inf"]
		caus_stems["perf.inf"] = baseStems[2]..CAUS_UNDERIVED_SUF["perf.inf"]
		caus_stems["imp"] = baseStems[1]..CAUS_UNDERIVED_SUF["imp"]
		-- Passive Stems
		pass_stems["imp.1s"] = baseStems[1]..PASS_UNDERIVED_SUF["imp.1s"]
		pass_stems["perf.1s"] = baseStems[2]..PASS_UNDERIVED_SUF["perf.1s"]
		pass_stems["imp.2s"] = baseStems[1]..PASS_UNDERIVED_SUF["imp.2s"]
		pass_stems["perf.2s"] = baseStems[2]..PASS_UNDERIVED_SUF["perf.2s"]
		pass_stems["imp.3s"] = baseStems[1]..PASS_UNDERIVED_SUF["imp.3s"]
		pass_stems["perf.3s"] = baseStems[2]..PASS_UNDERIVED_SUF["perf.3s"]
		pass_stems["imp.1p"] = baseStems[1]..PASS_UNDERIVED_SUF["imp.1p"]
		pass_stems["perf.1p"] = baseStems[2]..PASS_UNDERIVED_SUF["perf.1p"]
		pass_stems["imp.2/3p"] = baseStems[1]..PASS_UNDERIVED_SUF["imp.2/3p"]
		pass_stems["perf.2/3p"] = baseStems[2]..PASS_UNDERIVED_SUF["perf.2/3p"]
		pass_stems["imp.rels"] = baseStems[1]..PASS_UNDERIVED_SUF["imp.rels"]
		pass_stems["perf.rels"] = baseStems[2]..PASS_UNDERIVED_SUF["perf.rels"]
		pass_stems["imp.relp"] = baseStems[1]..PASS_UNDERIVED_SUF["imp.relp"]
		pass_stems["perf.relp"] = baseStems[2]..PASS_UNDERIVED_SUF["perf.relp"]
		pass_stems["imp.inf"] = baseStems[1]..PASS_UNDERIVED_SUF["imp.inf"]
		pass_stems["perf.inf"] = baseStems[2]..PASS_UNDERIVED_SUF["perf.inf"]
		pass_stems["imp"] = baseStems[1]..PASS_UNDERIVED_SUF["imp"]
	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 std_stems, caus_stems, pass_stems
end

function p.showConjugations(root1,root2)

	local std_forms = {}
	local caus_forms = {}
	local pass_forms = {}
	
	std_forms, caus_forms, pass_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].." || ".. std_forms["imp."..v[1]] .. " || " .. std_forms["perf."..v[1]].." ")
		table.insert(output,"|| ".. caus_forms["imp."..v[1]] .. " || " .. caus_forms["perf."..v[1]].." ")
		table.insert(output,"|| ".. pass_forms["imp."..v[1]] .. " || " .. pass_forms["perf."..v[1]].."\n")
	end
		table.insert(output,"|-\n")
		table.insert(output,"| Imperative || ".. std_forms["imp"] .. " || ")
		table.insert(output,"|| ".. caus_forms["imp"] .. " || " )
		table.insert(output,"|| ".. pass_forms["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