Pergi ke kandungan

Modul:grc-decl/decl/data

Daripada Wikikamus
local module_path = 'Module:grc-decl/decl'

local m_decl_static_data = mw.loadData(module_path .. '/staticdata')
local m_paradigms = mw.loadData(module_path .. '/staticdata/paradigms')
local m_dialect_groups = mw.loadData(module_path .. '/staticdata/dialects')
local m_table = require("Module:table")
local m_accent = require('Module:grc-accent')
local m_links = require('Module:links')
local grc = require('Module:languages').getByCode('grc')
local grk_pro = require('Module:languages').getByCode('grk-pro')

local export = {
	inflections = {},
	adjinflections = m_decl_static_data.adjinflections,
	adjinflections_con = m_decl_static_data.adjinflections_con,
}

local function quote(text)
	return "“" .. text .. "”"
end

local function mention(alt)
	return m_links.full_link({ alt = alt, lang = grc }, "term")
end

local function proto_mention(alt)
	return m_links.full_link({ alt = alt, lang = grk_pro }, "term")
end

local dental_lookup = {
	["τ"] = "*-ts",
	["δ"] = "*-ds",
	["θ"] = "*-tʰs",
}

local function deepcopy(orig)
	local orig_type = type(orig)
	local copy
	if orig_type == 'table' then
		copy = {}
		for orig_key, orig_value in pairs(orig) do
			copy[deepcopy(orig_key)] = deepcopy(orig_value)
		end
	else -- number, string, boolean, etc
		copy = orig
	end
	return copy
end

local function dial_form(args, f, suffix, dialect, dialect2)
	if args.dial and (args.dial == dialect or args.dial == dialect2 or
			(m_dialect_groups[dialect] and m_dialect_groups[dialect][args.dial])) then
		args.ctable[f] = suffix
	end
end

local function dial_forms_first(args)
	dial_form(args, 'GD', '1αι(ῐ)ν/1ῃῐν', 'epi')
	dial_form(args, 'GP', '3ᾱ́ων/3έων/3ῶν', 'epi')
	dial_form(args, 'DP', '1ῃσῐ(ν)/1ῃς/1αις', 'epi')
	
	dial_form(args, 'DS', '1η', 'boi') -- 104.3
	dial_form(args, 'DS', '1αι', 'ara', 'ele')
	dial_form(args, 'DS', '1ᾱ', 'the', 'les')
	
	dial_form(args, 'GP', '3έων/3ῶν', 'ion') -- 104.6
	dial_form(args, 'GP', '3ᾶν', 'nonIA')
	dial_form(args, 'GP', '3ᾱ́ων', 'boi')
	
	dial_form(args, 'DP', '1ῃσῐ(ν)', 'ion') -- 104.7, ato must be dealt with separately
	dial_form(args, 'DP', '1αισῐ(ν)', 'les')
	
	dial_form(args, 'AP', '1ᾰς', 'buck78') -- 104.8
	dial_form(args, 'AP', '1ᾰνς', 'kre', 'arg')
	dial_form(args, 'AP', '1αις', 'les')
	dial_form(args, 'AP', '1αιρ', 'ele')
	
	dial_form(args, 'GD', '3αίαιρ', 'ele')
end

local function dial_forms_first_oxy(args)
	dial_form(args, 'GD', '3αῖ(ῐ)ν/3ῇῐν', 'epi')
	dial_form(args, 'GP', '3ᾱ́ων/3έων/3ῶν', 'epi')
	dial_form(args, 'DP', '3ῇσῐ(ν)/1ῇς/1αῖς', 'epi')
	
	dial_form(args, 'DS', '3ῆ', 'boi') -- 104.3
	dial_form(args, 'DS', '3αῖ', 'ara', 'ele')
	dial_form(args, 'DS', '3ᾶ', 'the', 'les')
	
	dial_form(args, 'GP', '3έων/3ῶν', 'ion') -- 104.6
	dial_form(args, 'GP', '3ᾶν', 'nonIA')
	dial_form(args, 'GP', '3ᾱ́ων', 'boi')
	
	dial_form(args, 'DP', '3ῇσῐ(ν)', 'ion') -- 104.7, ato must be dealt with separately
	dial_form(args, 'DP', '1αισῐ(ν)', 'les')
	
	dial_form(args, 'AP', '3ᾰ́ς', 'buck78') -- 104.8
	dial_form(args, 'AP', '3ᾰ́νς', 'kre', 'arg')
	dial_form(args, 'AP', '1αις', 'les')
	dial_form(args, 'AP', '3αίρ', 'ele')
	
	dial_form(args, 'GD', '3αίαιρ', 'ele')
end

export.inflections['1st-alp-pax'] = function(args)
	args.ctable = deepcopy(m_paradigms.alp_pax)
	dial_forms_first(args)
	dial_form(args, 'DP', '1ᾱσῐ(ν)', 'ato')
	if args.adjective then
		args.ctable['GP'] = '1ων'
	end
end

export.inflections['1st-eta-pax'] = function(args)
	args.ctable = deepcopy(m_paradigms.eta_pax)
	dial_forms_first(args)
	dial_form(args, 'DP', '1ησῐ(ν)', 'ato')
	if args.adjective then
		args.ctable['GP'] = '1ων'
	end
end

--[=[
	Only difference from "1st-alp-pax" and "1st-eta-pax" is that because of the "-prx",
	[[Module:grc-decl/decl]] doesn't shift the accent to the end of the stem
	in all forms. Used only in 1st-and-2nd-declension adjectives.
]=]
export.inflections['1st-alp-prx'] = export.inflections['1st-alp-pax']

export.inflections['1st-eta-prx'] = export.inflections['1st-eta-pax']

export.inflections['1st-alp'] = function(args)
	args.ctable = deepcopy(m_paradigms.alp)
	dial_forms_first_oxy(args)
	dial_form(args, 'DP', '3ᾶσῐ(ν)', 'ato')
end

export.inflections['1st-eta'] = function(args)
	args.ctable = deepcopy(m_paradigms.eta)
	dial_forms_first_oxy(args)
	dial_form(args, 'DP', '3ῆσῐ(ν)', 'ato')
end

export.inflections['1st-als-pax'] = function(args)
	args.ctable = deepcopy(m_paradigms.als_prx)
	dial_forms_first(args)
	dial_form(args, 'DP', '1ᾱσῐ(ν)', 'ato')
end

export.inflections['1st-als-prx'] = function(args)
	args.ctable = deepcopy(m_paradigms.als_prx)
	dial_forms_first(args)
	dial_form(args, 'DP', '1ᾱσῐ(ν)', 'ato')
end

export.inflections['1st-ets-pax'] = function(args)
	args.ctable = deepcopy(m_paradigms.ets_prx)
	dial_forms_first(args)
	dial_form(args, 'DP', '1ησῐ(ν)', 'ato')
end

export.inflections['1st-ets-prx'] = function(args)
	args.ctable = deepcopy(m_paradigms.ets_prx)
	dial_forms_first(args)
	dial_form(args, 'DP', '1ησῐ(ν)', 'ato')
end

export.inflections['1st-alp-con'] = function(args)
	args.ctable = deepcopy(m_paradigms.alp_con)
end

export.inflections['1st-eta-con'] = function(args)
	args.ctable = deepcopy(m_paradigms.eta_con)
end

export.inflections['1st-M-alp-pax'] = function(args)
	args.ctable = deepcopy(m_paradigms.M_alp_pax)
	dial_forms_first(args)
	dial_form(args, 'GS', '1ᾱο/1ε͜ω/1ω', 'epi')
	
	dial_form(args, 'GS', '1εω/1ω', 'ion')
	dial_form(args, 'GS', '1ᾱ', 'nonIA')
	dial_form(args, 'GS', '1ᾱο', 'boi')
	dial_form(args, 'GS', '1ᾱυ', 'ark')
end

export.inflections['1st-M-eta-pax'] = function(args)
	args.ctable = deepcopy(m_paradigms.M_eta_pax)
	dial_forms_first(args)
	dial_form(args, 'GS', '1ᾱο/1ε͜ω/1ω', 'epi')
	
	if args['voc'] == 'α' or mw.ustring.sub(args.stem[3], -1) == 'τ' then
		args.ctable['VS'] = '2ᾰ'
	end
	
	dial_form(args, 'GS', '1εω/1ω', 'ion')
	dial_form(args, 'GS', '1ᾱ', 'nonIA')
	dial_form(args, 'GS', '1ᾱο', 'boi')
	dial_form(args, 'GS', '1ᾱυ', 'ark')
end

export.inflections['1st-M-eta'] = function(args)
	args.ctable = deepcopy(m_paradigms.M_eta)
	dial_forms_first_oxy(args)
	dial_form(args, 'GS', '3ᾶο/3έ͜ω/3ῶ', 'epi')
	
	if args['voc'] == 'α' then
		args.ctable['VS'] = '3ᾰ́'
	end
	
	dial_form(args, 'GS', '3έω/3ῶ', 'ion')
	dial_form(args, 'GS', '3ᾶ', 'nonIA')
	dial_form(args, 'GS', '3ᾶο', 'boi')
	dial_form(args, 'GS', '3ᾶυ', 'ark')
end

export.inflections['1st-M-alp-con'] = function(args)
	args.ctable = deepcopy(m_paradigms.M_alp_con)
end

export.inflections['1st-M-eta-con'] = function(args)
	args.ctable = deepcopy(m_paradigms.M_eta_con)
end

local function dial_forms_second(args)
	dial_form(args, 'GS', '1ου/3οῖο/1οιο/3όο/1οο', 'epi')
	dial_form(args, 'GD', '1οιῐν', 'epi')
	dial_form(args, 'DP', '1οισῐ(ν)/1οις', 'epi')
	
	dial_form(args, 'GS', '1οιο', 'dor')
	
	dial_form(args, 'GS', '1οι', 'the') -- 106.1
	dial_form(args, 'GS', '1ω', 'severe', 'boi')
	dial_form(args, 'GS', '1ων', 'kyp')
	
	dial_form(args, 'DS', '1ω', 'les') -- 106.2
	dial_form(args, 'DS', '1ου', 'the')
	dial_form(args, 'DS', '1οι', 'ele', 'boi')
	dial_form(args, 'DS', '1οι', 'ara', 'eub')
	
	dial_form(args, 'DP', '1οισῐ(ν)', 'ato', 'ion') -- 106.4
	dial_form(args, 'DP', '1οισῐ(ν)', 'les')
	
	dial_form(args, 'AP', '1ως', 'severe') -- 106.5
	dial_form(args, 'AP', '1ος', 'buck78')
	dial_form(args, 'AP', '1ονς', 'kre', 'arg')
	dial_form(args, 'AP', '1οις', 'les')
	dial_form(args, 'AP', '1οιρ', 'ele')
	
	dial_form(args, 'GD', '3οίοιρ', 'ele') -- 106.6
	
	dial_form(args, 'ND', '1ου', 'the') -- 23
	dial_form(args, 'GP', '1ουν', 'the')
end

local function dial_forms_second_oxy(args)
	dial_form(args, 'GS', '3οῦ/3οῖο/3όο', 'epi')
	dial_form(args, 'GD', '3οῖῐν', 'epi')
	dial_form(args, 'DP', '3οῖσῐ(ν)/3οῖς', 'epi')
	
	dial_form(args, 'GS', '3οῖο', 'dor')
	
	dial_form(args, 'GS', '3οῖ', 'the') -- 106.1
	dial_form(args, 'GS', '3ῶ', 'severe', 'boi')
	dial_form(args, 'GS', '3ῶν', 'kyp')
	
	dial_form(args, 'DS', '1ω', 'les') -- 106.2
	dial_form(args, 'DS', '3οῦ', 'the')
	dial_form(args, 'DS', '3οῖ', 'ele', 'boi')
	dial_form(args, 'DS', '3οῖ', 'ara', 'eub')
	
	dial_form(args, 'DP', '3οῖσῐ(ν)', 'ato', 'ion') -- 106.4
	dial_form(args, 'DP', '1οισῐ(ν)', 'les')
	
	dial_form(args, 'AP', '3ώς', 'severe') -- 106.5
	dial_form(args, 'AP', '3ός', 'buck78')
	dial_form(args, 'AP', '3όνς', 'kre', 'arg')
	dial_form(args, 'AP', '3οίς', 'les')
	dial_form(args, 'AP', '3οίρ', 'ele')
	
	dial_form(args, 'GD', '3οίοιρ', 'ele') -- 106.6
	
	dial_form(args, 'ND', '3ού', 'the') -- 23
	dial_form(args, 'GP', '3οῦν', 'the')
end

export.inflections['2nd-prx'] = function(args)
	args.ctable = deepcopy(m_paradigms.second_prx)
	dial_forms_second(args)
end

export.inflections['2nd-pax'] = function(args)
	args.ctable = deepcopy(m_paradigms.second_prx)
	dial_forms_second(args)
end

export.inflections['2nd'] = function(args)
	args.ctable = deepcopy(m_paradigms.second)
	dial_forms_second_oxy(args)
end

export.inflections['2nd-N-prx'] = function(args)
	args.ctable = deepcopy(m_paradigms.second_N_prx)
	dial_forms_second(args)
end

export.inflections['2nd-N-pax'] = function(args)
	args.ctable = deepcopy(m_paradigms.second_N_prx)
	dial_forms_second(args)
end

export.inflections['2nd-N'] = function(args)
	args.ctable = deepcopy(m_paradigms.second_N)
	dial_forms_second_oxy(args)
end

export.inflections['2nd-con-con'] = function(args)
	args.ctable = deepcopy(m_paradigms.second_con)
end

export.inflections['2nd-con-pax'] = function(args)
	args.ctable = deepcopy(m_paradigms.second_con_pax)
end

export.inflections['2nd-N-con-con'] = function(args)
	args.ctable = deepcopy(m_paradigms.second_N_con)
end

export.inflections['2nd-att-prx'] = function(args)
	args.ctable = deepcopy(m_paradigms.second_att_prx)
	args.stem = { args.stem[2] }
end

export.inflections['2nd-att-pax'] = function(args)
	args.ctable = deepcopy(m_paradigms.second_att_prx)
end

export.inflections['2nd-att'] = function(args)
	args.ctable = deepcopy(m_paradigms.second_att)
end

export.inflections['2nd-N-att-prx'] = function(args)
	args.ctable = deepcopy(m_paradigms.second_N_att_prx)
	args.stem = { args.stem[2] }
end

export.inflections['2nd-att-con'] = function(args)
	args.ctable = deepcopy(m_paradigms.second_att_con)
end

--[[
	In order:
		- ending of stem
		- masculine nominative singular ending
		- neuter nominative singular ending
		- segment preceding ῐ in dative plural
]]
local nt = {
	['οντ'] = { 'ων', 'ον', 'ουσ' },
	['1&3-ουντ'] = { 'ους', 'ον', 'ουσ' },
	['ουντ'] = { 'ων', 'ουν', 'ουσ' },
	['εντ'] = { 'εις', 'εν', 'εισ' },
	['ωντ'] = { 'ων', 'ων', 'ωσ' },
}

local function new_gender(gender)
	return { gender, [gender] = true }
end

local function third_nom(args, is_neuter)
	local base = args.stem[3]
	
	-- So that it's easy to grab the last three letters even if one of them has a macron or breve.
	base = mw.ustring.toNFC(base)
	
	local last1, last2 = mw.ustring.sub(base, -1), mw.ustring.sub(base, -2)
	
	local nom = mw.ustring.sub(base, 1, -2)
	local dp
	
	if mw.ustring.match('πφβ', last1) then
		nom = nom .. 'ψ'
		if not args.gender.N then
			table.insert(args.notes,
				"Nominatif mufrad/tunggal " ..
						mention('-ψ') ..
						(mw.ustring.match('φβ', last1) and " akhiran tunggal nominatif " or " adalah ejaan semula bagi ") ..
						mention(last1) ..
						" + akhiran tunggal nominatif " ..
						mention('-ς') .. ".")
		end
	elseif 'κτ' == last2 then
		nom = mw.ustring.sub(base, 1, -3) .. 'ξ'
		if not args.gender.N then
			table.insert(args.notes,
				"Nominatif mufrad/tunggal " ..
						mention('-ξ') ..
						" akhiran tunggal nominatif " ..
						mention(last2) ..
						" + akhiran tunggal nominatif " ..
						mention('-ς') .. ".")
		end
	elseif mw.ustring.match('κχγ', last1) then
		nom = nom .. 'ξ'
		if not args.gender.N then
			table.insert(args.notes,
				"Nominatif mufrad/tunggal " ..
						mention('-ξ') ..
						(mw.ustring.match('χγ', last1) and " adalah peneutralan bagi " or " adalah ejaan semula bagi ") ..
						mention(last1) ..
						" + akhiran tunggal nominatif " ..
						mention('-ς') .. ".")
		end
	elseif 'ντ' == last2 then
		local last3, last4 = mw.ustring.sub(base, -3), mw.ustring.sub(base, -4)
		local nom3, nom4 = mw.ustring.sub(base, 1, -4), mw.ustring.sub(base, 1, -5)
		
		if args.gender[1] ~= 'N' then
			local data = nt[args.decl_type] or nt[last3] or nt[last4]
			
			if data then
				nom = (nt[last4] and nom4 or nom3) .. (is_neuter and data[2] or data[1])
				dp = (nt[last4] and nom4 or nom3) .. data[3]
			else
				last3 = mw.ustring.toNFD(last3)
				
				local macron = mw.ustring.char(0x304)
				local breve = mw.ustring.char(0x306)
				local long_or_short = "[" .. macron .. breve .. "]"
				local vowel = mw.ustring.match(last3, '([αυ])' .. long_or_short .. 'ντ')
				if vowel then
					nom = nom3 .. vowel
					if is_neuter then
						nom = nom .. breve .. "ν"
					else
						nom = nom .. macron .. 'ς'
					end
					dp = nom3 .. vowel .. macron .. 'σ'
				else
					error('Gagal menjana nominal tunggal dan jamak datif untuk ' .. quote(args[1]) .. ", " .. quote(args[2]) .. ".")
				end
			end
		end
		args.gender[1] = args.gender[1] or 'M'
	elseif mw.ustring.match('τδθ', last1) then
		dp = nom .. 'σ'
		if not args.adjective then
			if mw.ustring.sub(base, -3) == 'τητ' then
				if not args.gender[1] then
					args.gender = new_gender('F')
				end
			elseif last2 == 'ητ' or last2 == 'ωτ' then
				if not args.gender[1] then
					args.gender = new_gender('M')
				end
			elseif mw.ustring.match('δθ', last1) then
				if not args.gender[1] then
					args.gender = new_gender('F')
				end
			elseif mw.ustring.match(base, '[ᾰᾱ]τ$') then
				if not args.gender[1] then
					args.gender = new_gender('N')
				end
			end
		end
		if not args.gender.N then
			nom = nom .. 'ς'
			if last2 == 'οτ' then
				nom = mw.ustring.sub(base, 1, -3) .. 'ως'
			end
		elseif last2 == 'οτ' then
				nom = nom .. 'ς'
		end
		if mw.ustring.match(args[1], 'ς$') then
			table.insert(args.notes,
				"Nominatif mufrad/tunggal " ..
						mention('-ς') ..
						" timbul dengan pengurangan kluster asal " ..
						proto_mention(dental_lookup[last1]) .. ".")
		end
	elseif mw.ustring.match('ρν', last1) then
		local vowel = mw.ustring.sub(base, -2, -2)
		if last1 == 'ρ' then
			dp = base .. 'σ'
		else
			dp = nom .. 'σ'
		end
		if args.gender[1] == 'N' or is_neuter then
			nom = base
		elseif vowel == 'ε' then
			nom = mw.ustring.sub(base, 1, -3) .. 'η' .. last1
		elseif vowel == 'ο' then
			nom = mw.ustring.sub(base, 1, -3) .. 'ω' .. last1
		elseif vowel == 'ῑ' then --ῥίς etc.
			nom = nom .. 'ς'
		elseif (vowel == 'ᾰ' and args.gender[1] ~= 'N') then
			nom = mw.ustring.sub(base, 1, -3) .. 'ᾱς'
		else
			nom = base
		end
		if mw.ustring.sub(base, -3) == 'γον' or mw.ustring.sub(base, -3) == 'δον' then
			args.gender[1] = args.gender[1] or 'F'
		elseif mw.ustring.match(last2, '[ᾰᾱα]ρ') then
			args.gender[1] = args.gender[1] or 'N'
		else
			args.gender[1] = args.gender[1] or 'M'
		end
	elseif last1 == 'σ' then
		dp = base
		if args.gender[1] == 'N' then
			nom = nom .. 'ς'
		else
			nom = mw.ustring.sub(base, 1, -3) .. 'ης'
		end
		args.ctable['DS'] = '2ῐ̈'
	elseif last1 == 'ω' then
		if args.ctable.NS == m_paradigms.lp_prx.NS then
			args.ctable['DS'] = m_accent.penult(nom .. 'ῳ') .. '/2ῐ̈'
			args.ctable['AS'] = '2/2ᾰ'
		else
			args.ctable['DS'] = '3ῐ̈́'
			args.ctable['AS'] = '2/3ᾰ́'
		end
		dp = nom .. 'ωσ'
		nom = nom .. 'ως'
		args.gender[1] = args.gender[1] or 'M'
	else
		error('Stem does not end in a consonant: ' .. base)
	end
	dp = dp or nom
	if args.adjective and args.gender[1] ~= 'N' then
	else
		nom = args[1] or nom
	end
	return nom, dp
end

local function dial_forms_third(args)
	args.ctable['DP'] = args.ctable['DP'] .. 'ῐ(ν)'
	
	dial_form(args, 'DP', args.ctable['DP'] .. '/1εσσῐ(ν)/1εσῐ(ν)', 'epi')
	dial_form(args, 'GD', '1οιῐν', 'epi')
	
	dial_form(args, 'DP', '1εσσῐ(ν)', 'dor')
	
	dial_form(args, 'AS', '2ᾰν', 'kyp')
	
	dial_form(args, 'DP', '1εσσῐ(ν)', 'les', 'the')
	dial_form(args, 'DP', '1εσσῐ(ν)', 'boi')
	dial_form(args, 'DP', '1οις', 'lok', 'ele')
	
	dial_form(args, 'AP', '2ες', 'ark', 'ele')
	dial_form(args, 'AP', '2ᾰς/2ᾰνς', 'kre')
end

local function dial_forms_third_oxy(args)
	args.ctable['DP'] = args.ctable['DP'] .. 'ῐ́(ν)'
	dial_form(args, 'GD', '3οῖῐν', 'epi')
	dial_form(args, 'DP', args.ctable['DP'] .. '/1εσσῐ(ν)/1εσῐ(ν)', 'epi')
	
	dial_form(args, 'DP', '1εσσῐ(ν)', 'dor')
	
	dial_form(args, 'AS', '2ᾰν', 'kyp')
	
	dial_form(args, 'DP', '1εσσῐ(ν)', 'les', 'the')
	dial_form(args, 'DP', '1εσσῐ(ν)', 'boi')
	dial_form(args, 'DP', '3οῖς', 'lok', 'ele')
	
	dial_form(args, 'AP', '2ες', 'ark', 'ele')
	dial_form(args, 'AP', '2ᾰς/2ᾰνς', 'kre')
end

export.inflections['3rd-cons-prx'] = function(args)
	args.ctable = deepcopy(m_paradigms.lp_prx)
	args.ctable['NS'], args.ctable['DP'] = third_nom(args)
	args.ctable['NS'] = m_accent.antepenult(args.ctable['NS'])
	args.ctable['DP'] = m_accent.penult(args.ctable['DP'])
	local q = mw.ustring.sub(args.stem[3], -2)
	if q == 'ῐδ' or q == 'ῐτ' or q == 'ῑθ' then
		dial_form(args, 'AS', args.ctable['AS'], 'epi', 'ion') -- i.e. -χάριν; also poetic
		args.ctable['AS'] = m_accent.antepenult(mw.ustring.sub(args.stem[3], 1, -2) .. 'ν')
		args.ctable['VS'] = m_accent.antepenult(mw.ustring.sub(args.stem[3], 1, -2))
	elseif q == 'ντ' and not args.adjective then
		args.ctable['VS'] = m_accent.antepenult(mw.ustring.sub(args.stem[3], 1, -2))
	elseif mw.ustring.match(args.stem[3], '[ρν]$') then
		args.ctable['VS'] = m_accent.antepenult(args.stem[3])
	elseif mw.ustring.sub(args.stem[3], -1) == 'ε' then
		args.ctable['VS'] = m_accent.antepenult(args.stem[3] .. 'ς')
	end
	dial_forms_third(args)
end

export.inflections['3rd-N-cons-prx'] = function(args)
	args.ctable = deepcopy(m_paradigms.N_lp_prx)
	args.ctable['NS'], args.ctable['DP'] = third_nom(args, true)
	args.ctable['NS'] = m_accent.antepenult(args.ctable['NS'])
	args.ctable['DP'] = m_accent.penult(args.ctable['DP'])
	dial_forms_third(args)
end

export.inflections['3rd-cons-pax'] = function(args)
	args.ctable = deepcopy(m_paradigms.lp_prx)
	args.ctable['NS'], args.ctable['DP'] = third_nom(args)
	args.ctable['NS'] = m_accent.pencirc(args.ctable['NS'])
	args.ctable['DP'] = m_accent.penult(args.ctable['DP'])
	local q = mw.ustring.sub(args.stem[3], -2)
	if q == 'ῐδ' or q == 'ῐτ' or q == 'ῑθ' then
		dial_form(args, 'AS', args.ctable['AS'], 'epi', 'ion') -- i.e. -χάριν; also poetic
		args.ctable['AS'] = m_accent.pencirc(mw.ustring.sub(args.stem[3], 1, -2) .. 'ν')
		args.ctable['VS'] = m_accent.pencirc(mw.ustring.sub(args.stem[3], 1, -2))
	elseif q == 'ντ' and (args.decl_type == '1&3-εντ-pax' or not args.adjective) then
		args.ctable['VS'] = m_accent.pencirc(mw.ustring.sub(args.stem[3], 1, -2))
	elseif mw.ustring.match(args.stem[3], '[ρν]$') then
		args.ctable['VS'] = m_accent.pencirc(args.stem[3])
	elseif mw.ustring.sub(args.stem[3], -1) == 'ε' then
		args.ctable['VS'] = m_accent.pencirc(args.stem[3] .. 'ς')
	end
	dial_forms_third(args)
end

export.inflections['3rd-N-cons-pax'] = function(args)
	args.ctable = deepcopy(m_paradigms.N_lp_prx)
	args.ctable['NS'], args.ctable['DP'] = third_nom(args, true)
	args.ctable['NS'] = m_accent.pencirc(args.ctable['NS'])
	args.ctable['DP'] = m_accent.penult(args.ctable['DP'])
	dial_forms_third(args)
end

export.inflections['3rd-cons'] = function(args)
	local mono = (m_accent.penult(args.stem[3]) == m_accent.circ(args.stem[3]))
	args.ctable = mono and deepcopy(m_paradigms.lp) or deepcopy(m_paradigms.lp_prx)
	args.ctable['NS'], args.ctable['DP'] = third_nom(args)
	local q = mw.ustring.sub(args.stem[3], -2)
	if q == 'ῐδ' or q == 'ῐτ' or q == 'ῑθ' then
		args.ctable['VS'] = m_accent.ult(mw.ustring.sub(args.stem[3], 1, -2))
	elseif q == 'ντ' and not args.adjective then
		args.ctable['VS'] = m_accent.circ(mw.ustring.sub(args.stem[3], 1, -2))
	end
	if args.decl_type:match('con') then
		args.ctable['NS'] = m_accent.circ(args.ctable['NS'])
	else
		args.ctable['NS'] = m_accent.ult(args.ctable['NS'])
	end
	if mono and not mw.ustring.match(args.decl_type, 'ντ') then --no participles are oxytone in oblique forms
		dial_forms_third_oxy(args)
	else
		args.ctable['DP'] = m_accent.circ(args.ctable['DP'])
		dial_forms_third(args)
	end
end

export.inflections['3rd-N-cons'] = function(args)
	local mono = (m_accent.penult(args.stem[3]) == m_accent.circ(args.stem[3]))
	args.ctable = mono and deepcopy(m_paradigms.N_lp) or deepcopy(m_paradigms.N_lp_prx)
	args.ctable['NS'], args.ctable['DP'] = third_nom(args, true)
	local q = mw.ustring.sub(args.stem[3], -2)
	if args.decl_type:match('con') then
		args.ctable['NS'] = m_accent.circ(args.ctable['NS'])
	else
		args.ctable['NS'] = m_accent.ult(args.ctable['NS'])
	end
	if mono and not mw.ustring.match(args.decl_type, 'ντ') then
		dial_forms_third_oxy(args)
	else
		dial_forms_third(args)
	end
end

local function dial_forms_es(args)
	dial_form(args, 'GS', '1εος', 'nonIA')
	dial_form(args, 'GS', '1ιος', 'buck9')
	dial_form(args, 'GS', '1εος/1ευς', 'ion')
	dial_form(args, 'AS', '1εᾰ', 'nonIA', 'ion')
	dial_form(args, 'AS', '1ιᾰ', 'buck9')
	dial_form(args, 'GD', '3έοιν', 'nonIA', 'ion')
	dial_form(args, 'GD', '3ίοιν', 'buck9')
	dial_form(args, 'GP', '3έων', 'nonIA', 'ion')
	dial_form(args, 'GP', '3ίων', 'buck9')
	dial_form(args, 'AP', '1εᾰς', 'nonIA', 'ion')
	dial_form(args, 'AP', '1ιᾰς', 'buck9')
end

local function dial_forms_es_oxy(args)
	dial_form(args, 'GS', '3έος', 'nonIA')
	dial_form(args, 'GS', '3ίος', 'buck9')
	dial_form(args, 'GS', '3έος/3εῦς', 'ion')
	dial_form(args, 'AS', '3έᾰ', 'nonIA', 'ion')
	dial_form(args, 'AS', '3ίᾰ', 'buck9')
	dial_form(args, 'GD', '3έοιν', 'nonIA', 'ion')
	dial_form(args, 'GD', '3ίοιν', 'buck9')
	dial_form(args, 'GP', '3έων', 'nonIA', 'ion')
	dial_form(args, 'GP', '3ίων', 'buck9')
	dial_form(args, 'AP', '3έᾰς', 'nonIA', 'ion')
	dial_form(args, 'AP', '3ίᾰς', 'buck9')
end

export.inflections['3rd-N-εσ-adj-prx'] = function(args)
	args.ctable = deepcopy(m_paradigms.N_es_adj_prx)
	
	dial_forms_es(args)
end

export.inflections['3rd-N-εσ-adj-prp'] = function(args)
	args.ctable = deepcopy(m_paradigms.N_es_adj_prx)
	args.stem[2] = m_accent.circ(args.stem[3])
	dial_forms_es(args)
end

export.inflections['3rd-εσ-adj-prx'] = function(args)
	args.ctable = deepcopy(m_paradigms.es_adj_prx)
	
	dial_forms_es(args)
	dial_form(args, 'NS', '1εις', 'boi', 'the')
end

export.inflections['3rd-N-εσ-prx'] = function(args)
	args.ctable = deepcopy(m_paradigms.N_es_prx)
	
	dial_forms_es(args)
end

export.inflections['3rd-εσ-adj'] = function(args)
	args.ctable = deepcopy(m_paradigms.es_adj)
	
	dial_forms_es_oxy(args)
	dial_form(args, 'NS', '3εῖς', 'boi', 'the')
end

export.inflections['3rd-N-εσ-adj'] = function(args)
	args.ctable = deepcopy(m_paradigms.N_es_adj)
	
	dial_forms_es_oxy(args)
end

export.inflections['3rd-N-εσ-adj-prx-open'] = function(args)
	args.ctable = deepcopy(m_paradigms.N_es_adj_prx_open)
end

export.inflections['3rd-N-εσ-adj-prp-open'] = function(args)
	args.ctable = deepcopy(m_paradigms.N_es_adj_prx_open)
	args.stem[2] = m_accent.circ(args.stem[3])
end

export.inflections['3rd-εσ-adj-prx-open'] = function(args)
	args.ctable = deepcopy(m_paradigms.es_adj_prx_open)
end

export.inflections['3rd-N-εσ-prx-open'] = function(args)
	args.ctable = deepcopy(m_paradigms.N_es_prx_open)
end

export.inflections['3rd-εσ-adj-open'] = function(args)
	args.ctable = deepcopy(m_paradigms.es_adj_open)
end

export.inflections['3rd-N-εσ-adj-open'] = function(args)
	args.ctable = deepcopy(m_paradigms.N_es_adj_open)
end

export.inflections['3rd-N-ᾰσ-prx'] = function(args)
	args.ctable = deepcopy(m_paradigms.N_as_prx)
end

export.inflections['3rd-N-ᾰσ-prx-open'] = function(args)
	args.ctable = deepcopy(m_paradigms.N_as_prx_open)
end

export.inflections['3rd-κλῆς-con'] = function(args)
	args.ctable = deepcopy(m_paradigms.kles)
	args.number = { 'S', S = true }
	dial_form(args, 'GS', '3κλέος', 'nonIA')
	dial_form(args, 'GS', '3κλεῖος', 'boi')
end

export.inflections['3rd-κλῆς-con-open'] = function(args)
	args.ctable = deepcopy(m_paradigms.kles_open)
	args.number = { 'S', S = true }
	dial_form(args, 'GS', '3κλῆος/3κλέος', 'epi', 'ion')
	dial_form(args, 'DS', '3κλῆῐ̈/3κλέῐ̈', 'epi', 'ion')
	dial_form(args, 'AS', '3κλῆᾰ/3κλέᾱ', 'epi', 'ion')
end

export.inflections['3rd-weak-ι-prx'] = function(args)
	args.ctable = deepcopy(m_paradigms.weak_i_prx)
end
export.inflections['3rd-weak-ι-pax'] = export.inflections['3rd-weak-ι-prx']

export.inflections['3rd-N-weak-ι-prx'] = function(args)
	args.ctable = deepcopy(m_paradigms.N_weak_i_prx)
end
export.inflections['3rd-N-weak-ι-pax'] = export.inflections['3rd-N-weak-ι-prx']

local function dial_forms_weak_u(args)
	dial_form(args, 'GS', '3έος', 'epi', 'ion')
	dial_form(args, 'GD', '3έοιῐν', 'epi')
	dial_form(args, 'DP', '3έεσσῐ(ν)/3έεσῐ(ν)/1εσῐ(ν)', 'epi')
	
	dial_form(args, 'DP', '3έεσσῐ(ν)', 'dor')
end

local function dial_forms_weak_u_prx(args)
	dial_form(args, 'GS', '1εος', 'epi', 'ion')
	dial_form(args, 'GD', '3έοιῐν', 'epi')
	dial_form(args, 'DP', '3έεσσῐ(ν)/3έεσῐ(ν)/1εσῐ(ν)', 'epi')
	
	dial_form(args, 'DP', '3έεσσῐ(ν)', 'dor')
end

export.inflections['3rd-weak-υ'] = function(args)
	args.ctable = deepcopy(m_paradigms.weak_u)
	dial_forms_weak_u(args)
	if args.adjective then
		args.ctable['ND'] = '3έε'
	end
end

export.inflections['3rd-N-weak-υ'] = function(args)
	args.ctable = deepcopy(m_paradigms.N_weak_u)
	dial_forms_weak_u(args)
	if args.adjective then
		args.ctable['ND'] = '3έε'
	end
end

export.inflections['3rd-weak-υ-prx'] = function(args)
	args.ctable = deepcopy(m_paradigms.weak_u_prx)
	dial_forms_weak_u_prx(args)
	if args.adjective then
		args.ctable['ND'] = '1εε'
	end
end

export.inflections['3rd-N-weak-υ-prx'] = function(args)
	args.ctable = deepcopy(m_paradigms.N_weak_u_prx)
	dial_forms_weak_u_prx(args)
	if args.adjective then
		args.ctable['ND'] = '1εε'
	end
end

export.inflections['3rd-pure-ι-prx'] = function(args)
	args.ctable = deepcopy(m_paradigms.pure_i_prx)
	dial_form(args, 'GS', '1ῐος/1ηος', 'epi')
	dial_form(args, 'DS', '1ῐῐ/1ῑ/1ηῐ̈/2ει', 'epi')
	dial_form(args, 'GD', '3ῐ́οιῐν', 'epi')
	dial_form(args, 'NP', '1ῐες/1ηες', 'epi')
	dial_form(args, 'DP', '3ῐ́εσσῐ(ν)/1εσῐ(ν)/1ῐσῐ(ν)', 'epi')
	dial_form(args, 'AP', '1ῐᾰς/1ηᾰς/1ῑς', 'epi')
	
	dial_form(args, 'DP', '1ῐ́εσσῐ(ν)', 'dor')
end
export.inflections['3rd-pure-ι-pax'] = export.inflections['3rd-pure-ι-prx']

export.inflections['3rd-N-pure-ι-prx'] = function(args)
	args.ctable = deepcopy(m_paradigms.N_pure_i_prx)
end
export.inflections['3rd-N-pure-ι-pax'] = export.inflections['3rd-N-pure-ι-prx']

export.inflections['3rd-pure-υ-prx'] = function(args)
	args.ctable = deepcopy(m_paradigms.pure_u_prx)
	dial_form(args, 'GD', '3ῠ́οιῐν', 'epi')
	dial_form(args, 'DP', '3ῠ́εσσῐ(ν)/1ῠσῐ(ν)/1ῠσσῐ(ν)', 'epi')
	dial_form(args, 'DP', '3ῠ́εσσῐ(ν)', 'dor')
end

export.inflections['3rd-pure-υ-long-prx'] = function(args)
	args.ctable = deepcopy(m_paradigms.pure_u_long_prx)
	dial_form(args, 'GD', '3ῠ́οιῐν', 'epi')
	dial_form(args, 'DP', '3ῠ́εσσῐ(ν)/1ῡσῐ(ν)/1ῡσσῐ(ν)', 'epi')
	dial_form(args, 'DP', '3ῠ́εσσῐ(ν)', 'dor')
end

export.inflections['3rd-pure-υ-long'] = function(args)
	args.ctable = deepcopy(m_paradigms.pure_u_long)
	dial_form(args, 'GD', '3ῠ́οιῐν', 'epi')
	dial_form(args, 'DP', '3ῠ́εσσῐ(ν)/1ῠσῐ(ν)/1ῠσσῐ(ν)', 'epi')
	dial_form(args, 'DP', '3ῠ́εσσῐ(ν)', 'dor')
end

export.inflections['3rd-pure-υ-long-con'] = function(args)
	args.ctable = deepcopy(m_paradigms.pure_u_long_con)
	dial_form(args, 'GD', '3ῠ́οιῐν', 'epi')
	dial_form(args, 'DP', '3ῠ́εσσῐ(ν)', 'epi', 'dor')
end

export.inflections['3rd-pure-υ'] = function(args)
	args.ctable = deepcopy(m_paradigms.pure_u)
	dial_form(args, 'GD', '3ῠ́οιῐν', 'epi')
	dial_form(args, 'DP', '3ῠ́εσσῐ(ν)/1ῠσῐ(ν)/1ῠσσῐ(ν)', 'epi')
	dial_form(args, 'DP', '3ῠ́εσσῐ(ν)', 'dor')
end

export.inflections['3rd-N-pure-υ-prx'] = function(args)
	args.ctable = deepcopy(m_paradigms.pure_u_prx)
	dial_form(args, 'GD', '3ῠ́οιῐν', 'epi')
	dial_form(args, 'DP', '3ῠ́εσσῐ(ν)/1ῠσῐ(ν)/1ῠσσῐ(ν)', 'epi')
	dial_form(args, 'DP', '3ῠ́εσσῐ', 'dor')
end

export.inflections['3rd-ευς'] = function(args)
	if args.dial == 'kyp' or args.dial == 'boi' then
		args.ctable = deepcopy(m_paradigms.eus_hwos)
	elseif args.dial == 'les' or args.dial == 'epi' then
		args.ctable = deepcopy(m_paradigms.eus_hos)
		
		dial_form(args, 'GS', '3ῆος/3έος', 'epi')
		dial_form(args, 'DS', '3ῆῐ̈/3έῐ̈', 'epi')
		dial_form(args, 'AS', '3ῆᾰ/3έᾰ', 'epi')
		dial_form(args, 'GD', '3ήοιῐν', 'epi')
		dial_form(args, 'DP', '3ήεσσῐ(ν)/3εῦσῐ(ν)', 'epi')
	elseif args.dial == 'the' or args.dial == 'ele' then
		args.ctable = deepcopy(m_paradigms.eus_eios)
	else
		args.ctable = deepcopy(m_paradigms.eus)
		
		dial_form(args, 'DP', '3έεσσῐ(ν)', 'dor') -- this is somewhat conjectured
		
		dial_form(args, 'GS', '3έος', 'nonIA', 'ion')
		
		dial_form(args, 'DS', '3εῖ', 'att')
		
		dial_form(args, 'AS', '3έᾰ', 'nonIA', 'ion')
		dial_form(args, 'AS', '3ῆ', 'doric', 'del')
		dial_form(args, 'AS', '3έᾰ', 'lok', 'kre')
		
		dial_form(args, 'NP', '3εῖς', 'nonIA', 'ion')
		dial_form(args, 'NP', '3ῆς', 'koa', 'lak')
		dial_form(args, 'NP', '3ῆς', 'ara')
		dial_form(args, 'NP', '3έες', 'kre')
		dial_form(args, 'NP', '3εῖς', 'late')
		
		dial_form(args, 'AP', '3έᾰς', 'nonIA', 'ion')
		
		dial_form(args, 'NS', '3ής', 'ara')
		dial_form(args, 'AS', '3ήν', 'ara')
		
		--[[
			Contraction only for nouns with vowel before -ευς;
			this will fail if the vowel has a macron or breve.
		]]
		if mw.ustring.match("αιεηοωυ", mw.ustring.sub(args.stem[3], -1)) then
			dial_form(args, 'GS', '3έως/3ῶς', 'att')
			dial_form(args, 'AS', '3έᾱ/3ᾶ', 'att')
			dial_form(args, 'GP', '3έων/3ῶν', 'att')
			dial_form(args, 'AP', '3έᾱς/3ᾶς', 'att')
			table.insert(args.notes, 'Bentuk pertama adalah bukan pemendekan, bentuk kedua adalah [[Lampian:Pemendekan bahasa Yunani Purba|pemendekan]].')
		end
	end
end

export.inflections['3rd-ευς-con'] = function(args)
	args.ctable = deepcopy(m_paradigms.eus_con)
	table.insert(args.titleapp, '[[Lampian:Pemendekan bahasa Yunani Purba|pemendekan]]')
end

export.inflections['3rd-οι'] = function(args)
	args.ctable = deepcopy(m_paradigms.oi)
	args.number = { 'S', S = true }
	dial_form(args, 'GS', '3ῶς', 'sever')
	dial_form(args, 'AS', '3οῦν', 'ion')
end

export.inflections['irreg'] = function(args)
	args.ctable = deepcopy(m_paradigms.irreg)
	args.stem = { args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12] }
end

export.inflections['irreg2'] = function(args) --feminine part of irregular adjectives
	args.ctable = deepcopy(m_paradigms.irreg)
	args.stem = { args[13], args[14], args[15], args[16], args[13], args[17], args[18], args[19], args[20], args[21], args[22] }
end

export.inflections['irreg3'] = function(args) --neuter part of irregular adjectives
	args.ctable = deepcopy(m_paradigms.irreg)
	args.stem = { args[23], args[3], args[4], args[23], args[23], args[7], args[8], args[24], args[10], args[11], args[24] }
end

export.inflections['irregN'] = function(args) --neuter irregular nouns
	args.ctable = deepcopy(m_paradigms.irreg)
	args.stem = { args[2], args[3], args[4], args[2], args[2], args[5], args[6], args[7], args[8], args[9], args[7] }
end

export.inflections['indecl'] = function(args)
	args.ctable = deepcopy(m_paradigms.indecl)
	args.stem = { args[2] }
end

return export