Modul:grc-decl/decl/staticdata
Penampilan
< Modul:grc-decl | decl
- Modul ini kekurangan sublaman pendokumenan. Sila mencipta laman pendokumenan berkaitan.
- Pautan berguna: laman akar • sublaman • pautan • transklusi • kes ujian • kotak pasir
--[[
Abbreviations and codes used in declension names:
- accent
- nothing: oxytone
- pax: paroxytone
- prx: proparoxytone
- con: perispomenon
- contraction
- con: contracted (perispomenon)
- open: uncontracted
- the characteristics of the ending (historically the stem)
- 1st declension
- alp: long alpha
- eta: eta
- als: long alpha, but short alpha in nominative and accusative singular
- als: eta, but short alpha in nominative and accusative singular
- 3rd declension
- pure: begins with ι or υ throughout
- weak: begins with ι or υ alternating with ε or η
]]
local export = {
adjinflections = {},
adjinflections_con = {},
}
local module_path = 'Module:grc-decl/decl/staticdata'
local m_paradigms = mw.loadData(module_path .. "/paradigms")
--[[
Creates a version of an ending with macrons removed, and with macrons or breves switched.
The switching is pointless for endings containing more than one macron or breve:
for instance, ᾱσᾰ becomes ᾰσᾱ.
]]
local function mess_with_length(text)
-- local text = mw.ustring.toNFD(text)
local macron = mw.ustring.char(0x304)
local breve = mw.ustring.char(0x306)
local unmarked_length = mw.ustring.gsub(text, "[" .. macron .. breve .. "]", "")
local opposite_length = mw.ustring.gsub(
text,
"[" .. macron .. breve .. "]",
{ [macron] = breve, [breve] = macron }
)
return unmarked_length, opposite_length
end
-- Adds a key with macrons or breves removed to the table.
local function add_unmarked_form(list, key, value)
if type(list) ~= "table" then
return list
end
-- key = mw.ustring.toNFD(key)
local unmarked_length, opposite_length = mess_with_length(key)
if unmarked_length ~= key and not list[opposite_length] then
list[unmarked_length] = list[unmarked_length] or value
end
list[key] = list[key] or value
return list
end
--[=[
Noun declension categories that [[Module:grc-decl/decl]]
uses to determine the declension category of the nominative and genitive forms
that are supplied to the template.
]=]
local infl_categories = {
['1st-alp'] = m_paradigms.alp_pax,
['1st-eta'] = m_paradigms.eta_pax,
['1st-als'] = m_paradigms.als_prx,
['1st-ets'] = m_paradigms.ets_prx,
['1st-M-alp'] = m_paradigms.M_alp_pax,
['1st-M-alp2'] = m_paradigms.M_alp_con, -- add 2 for unique key
['1st-M-eta'] = m_paradigms.M_eta_pax,
['2nd'] = m_paradigms.second,
['2nd-con'] = m_paradigms.second_con,
['2nd-N'] = m_paradigms.second_N,
['2nd-N-con'] = m_paradigms.second_N_con,
['2nd-att'] = m_paradigms.second_att,
['2nd-N-att'] = m_paradigms.second_N_att_prx,
['3rd-εσ-adj'] = m_paradigms.es_adj,
['3rd-N-εσ-adj'] = m_paradigms.N_es_adj,
['3rd-N-εσ'] = m_paradigms.N_es_prx,
['3rd-N-ᾰσ'] = m_paradigms.N_as_prx,
['3rd-κλῆς'] = m_paradigms.kles,
['3rd-κλῆς2'] = m_paradigms.kles_open, -- add 2 for unique key
['3rd-weak-ι'] = m_paradigms.weak_i_prx,
['3rd-weak-υ'] = m_paradigms.weak_u,
['3rd-N-weak-ι'] = m_paradigms.N_weak_i_prx,
['3rd-N-weak-υ'] = m_paradigms.N_weak_u,
['3rd-pure-ι'] = m_paradigms.pure_i_prx,
['3rd-N-pure-ι'] = m_paradigms.N_pure_i_prx,
['3rd-pure-υ-long'] = m_paradigms.pure_u_long_prx,
['3rd-pure-υ'] = m_paradigms.pure_u,
['3rd-N-pure-υ'] = m_paradigms.N_pure_u_prx,
['3rd-ευς'] = m_paradigms.eus,
['3rd-ευς-con'] = m_paradigms.eus_con,
['3rd-οι'] = m_paradigms.oi,
}
-- Used by the function that generates the list of declension categories on the documentation page.
export.conversion = {
['1st-alp'] = 'alp_pax',
['1st-eta'] = 'eta_pax',
['1st-als'] = 'als_prx',
['1st-ets'] = 'ets_prx',
['1st-M-alp'] = 'M_alp_pax',
['1st-M-alp2'] = 'M_alp_con',
['1st-M-eta'] = 'M_eta_pax',
['2nd'] = 'second',
['2nd-con'] = 'second_con',
['2nd-N'] = 'second_N',
['2nd-N-con'] = 'second_N_con',
['2nd-att'] = 'second_att',
['2nd-N-att'] = 'second_N_att_prx',
['3rd-εσ-adj'] = 'es_adj',
['3rd-N-εσ-adj'] = 'N_es_adj',
['3rd-N-εσ'] = 'N_es_prx',
['3rd-N-ᾰσ'] = 'N_as_prx',
['3rd-κλῆς'] = 'kles',
['3rd-κλῆς2'] = 'kles_open',
['3rd-weak-ι'] = 'weak_i_prx',
['3rd-weak-υ'] = 'weak_u',
['3rd-N-weak-ι'] = 'N_weak_i_prx',
['3rd-N-weak-υ'] = 'N_weak_u',
['3rd-pure-ι'] = 'pure_i_prx',
['3rd-N-pure-ι'] = 'N_pure_i_prx',
['3rd-pure-υ-long'] = 'pure_u_long_prx',
['3rd-pure-υ'] = 'pure_u',
['3rd-N-pure-υ'] = 'N_pure_u_prx',
['3rd-ευς'] = 'eus',
['3rd-ευς-con'] = 'eus_con',
['3rd-οι'] = 'oi',
}
infl_info = {}
export.ambig_forms = {}
-- Constructs a table for nouns with the same structure as the one for adjectives.
for name, decl in pairs(infl_categories) do
local strip_tone = require("Module:grc-accent").strip_tone
local nom = strip_tone(mw.ustring.sub(decl.NS, 2))
local gen = strip_tone(mw.ustring.sub(strip_tone(decl.GS), 2))
if not infl_info[nom] then
infl_info[nom] = {}
end
if type(infl_info[nom]) == "table" then
if infl_info[nom][gen] then
error('Conflict in noun declensions; two declensions with nominative ' .. nom ..
' and genitive ' .. gen .. '.')
end
name = mw.ustring.gsub(name, "%d$", "")
infl_info[nom][gen] = name
end
end
for nominative, list in pairs(infl_info) do
local unmarked_length, opposite_length = mess_with_length(nominative)
local data_for_opposite
if unmarked_length ~= opposite_length then
data_for_opposite = infl_info[opposite_length] or infl_info[mw.ustring.toNFC(opposite_length)]
if not data_for_opposite then
infl_info[unmarked_length] = nominative
end
end
if type(list) == "table" then
local new_list = {}
for gen, name in pairs(list) do
local unmarked_length, opposite_length = mess_with_length(gen)
if unmarked_length ~= gen and not list[opposite_length] then
new_list[unmarked_length] = name
end
new_list[gen] = name
end
list = new_list
local combined_gens = {}
if data_for_opposite and not infl_info[unmarked_length] then
local is_ambig = false
for gen, name in pairs(list) do
combined_gens[gen] = name
end
for gen, name in pairs(data_for_opposite or {}) do
local gen_unmarked_length, gen_opposite_length = mess_with_length(gen)
if list[gen] or list[gen_opposite_length] then
--[[
If there are two declension types with the same nominative
and genitive endings aside from the length of the nominative,
then strip the macron or breve from both forms and record them.
]]
is_ambig = true
end
combined_gens = add_unmarked_form(combined_gens, gen, name)
end
if is_ambig then
--[[
Remove length marks and record all the nominative–genitive pairs
that were found.
]]
local nom = mess_with_length(nominative)
for gen, name in pairs(combined_gens) do
gen = mess_with_length(gen)
export.ambig_forms[nom] = export.ambig_forms[nom] or {}
export.ambig_forms[nom][gen] = true
end
else
infl_info[unmarked_length] = combined_gens
end
end
infl_info[nominative] = list
end
end
export.infl_info = infl_info
export.infl_info_adj = {
['ος'] = {
['ᾱ'] = '1&2-alp',
['η'] = '1&2-eta',
['ον'] = '2nd',
},
['ους'] = {
['ᾱ'] = '1&2-alp-con',
['η'] = '1&2-eta-con',
['ουσᾰ'] = '1&3-ουντ',
},
['ῠς'] = { ['ειᾰ'] = '1&3-ups' },
-- ['υς'] = 'ῠς',
['ως'] = {
['υιᾰ'] = '1&3-οτ',
['ων'] = '2nd-att',
},
['ᾱς'] = {
['αινᾰ'] = '1&3-ᾰν',
['ᾱσᾰ'] = '1&3-ᾰντ',
},
['ην'] = { ['εινᾰ'] = '1&3-εν' },
['εις'] = {
['εισᾰ'] = '1&3-εντ',
['εσσᾰ'] = '1&3-εντ',
},
['ων'] = {
['ουσᾰ'] = '1&3-οντ',
['ωσᾰ'] = '1&3-ωντ',
},
['ῡς'] = { ['ῡσᾰ'] = '1&3-ῠντ' },
['ης'] = { ['ες'] = '3rd-εσ-adj' },
}
export.ambig_forms_adj = {}
--[[
[''] = '',
]]
for masculine, list in pairs(export.infl_info_adj) do
if type(list) == "table" then
-- Decompose masculine and feminine (or neuter) endings.
local new_fems = {}
local fems_changed = false
for feminine, name in pairs(list) do
new_feminine = mw.ustring.toNFD(feminine)
if new_feminine ~= feminine then
fems_changed = true
end
new_fems[new_feminine] = name
end
list = new_fems
new_masculine = mw.ustring.toNFD(masculine)
if fems_changed or new_masculine ~= masculine then
-- Delete existing entry
export.infl_info_adj[masculine] = nil
-- Create decomposed one.
export.infl_info_adj[new_masculine] = list
end
elseif type(list) == "string" then
if not export.infl_info_adj[list] then
error(masculine .. ' has been redirected to the form ' .. list .. ', which does not exist.')
end
end
end
for masculine, list in pairs(export.infl_info_adj) do
local unmarked_length, opposite_length = mess_with_length(masculine)
local data_for_opposite
if unmarked_length ~= opposite_length then
data_for_opposite = export.infl_info_adj[opposite_length] or export.infl_info_adj[mw.ustring.toNFC(opposite_length)]
if not data_for_opposite then
export.infl_info_adj[unmarked_length] = masculine
end
end
local new_list = {}
for fem, name in pairs(list) do
local unmarked_length, opposite_length = mess_with_length(fem)
if unmarked_length ~= fem and not list[opposite_length] then
new_list[unmarked_length] = name
end
new_list[fem] = name
end
list = new_list
local combined_fems = {}
if data_for_opposite and not export.infl_info_adj[unmarked_length] then
for fem, name in pairs(list) do
combined_fems[fem] = name
end
for fem, name in pairs(data_for_opposite or {}) do
if list[fem] then
--[[
If there are declension types with the same masculine and
feminine endings, aside from the length (not currently true),
then strip the macron or breve and log them.
]]
local key = mess_with_length(masculine)
local value = mess_with_length(fem)
export.ambig_forms_adj[key] = value
combined_fems = nil
break
end
combined_fems = add_unmarked_form(combined_fems, fem, name)
end
if combined_fems then
export.infl_info_adj[unmarked_length] = combined_fems
end
end
export.infl_info_adj[masculine] = list
end
--[[
Mapping from adjectival declension codes to the declension type used for the masculine (1),
feminine (2), and neuter (3), along with any suffixes added to the stem in the masculine
and neuter (a1) or feminine (a2).
]]
local adeclfirst_and_second = 'Tasrifan [[Lampiran:Tasrifan pertama bahasa Yunani|pertama]] dan [[Lampiran:Tasrifan kedua bahasa Yunani|kedua]]'
local adeclfirst_and_third = 'Tasrifan [[Lampiran:Tasrifan pertama bahasa Yunani|pertama]] dan [[Lampiran:Tasrifan kedua bahasa Yunani|kedua]]'
local adeclsecond = '[[Lampiran:Tasrifan kedua bahasa Yunani|Tasrifan kedua]]'
local adeclthird = '[[Lampiran:Tasrifan ketiga bahasa Yunani|Tasrifan ketiga]]'
local adeclatt = '[[Lampiran:Tasrifan Atika bahasa Yunani|Tasrifan kedua Atika]]'
local adeclirreg = 'Tasrifan tak tentu'
--First-and-second-declension adjectives
export.adjinflections['1&2-alp'] = { '2nd', '1st-alp', '2nd-N', adeclheader = adeclfirst_and_second }
export.adjinflections['1&2-alp-pax'] = { '2nd-pax', '1st-alp-pax', '2nd-N-pax', adeclheader = adeclfirst_and_second }
export.adjinflections['1&2-alp-prx'] = { '2nd-prx', '1st-alp-prx', '2nd-N-prx', adeclheader = adeclfirst_and_second }
export.adjinflections['1&2-alp-con-con'] = { '2nd-prx', '1st-alp-pax', '2nd-N-prx', a1 = 'ε', a2 = 'ε', adeclheader = adeclfirst_and_second } -- avoid collisions
export.adjinflections['1&2-eta'] = { '2nd', '1st-eta', '2nd-N', adeclheader = adeclfirst_and_second }
export.adjinflections['1&2-eta-pax'] = { '2nd-pax', '1st-eta-pax', '2nd-N-pax', adeclheader = adeclfirst_and_second }
export.adjinflections['1&2-eta-prx'] = { '2nd-prx', '1st-eta-prx', '2nd-N-prx', adeclheader = adeclfirst_and_second }
export.adjinflections['1&2-eta-con-con'] = {
'2nd-prx', '1st-alp-pax', '2nd-N-prx', a1 = 'ε', a2 = 'ε', adeclheader = adeclfirst_and_second }
-- First-and-third-declension adjectives
export.adjinflections['1&3-ups'] = { '3rd-weak-υ', '1st-als-pax', '3rd-N-weak-υ', a2 = 'ει', adeclheader = adeclfirst_and_third }
export.adjinflections['1&3-ups-prx'] = { '3rd-weak-υ-prx', '1st-als-prx', '3rd-N-weak-υ-prx', a2 = 'ει', adeclheader = adeclfirst_and_third }
export.adjinflections['1&3-ups-pax'] = { '3rd-weak-υ-prx', '1st-als-prx', '3rd-N-weak-υ-prx', a2 = 'ει', adeclheader = adeclfirst_and_third } -- exact copy of above
export.adjinflections['1&3-ᾰν-pax'] = { '3rd-cons-prx', '1st-ets-prx', '3rd-N-cons-prx', a1 = 'ᾰν', a2 = 'αιν', adeclheader = adeclfirst_and_third }
export.adjinflections['1&3-εν-pax'] = { '3rd-cons-prx', '1st-ets-prx', '3rd-N-cons-prx', a1 = 'εν', a2 = 'ειν', adeclheader = adeclfirst_and_third }
export.adjinflections['1&3-εντ-pax'] = { '3rd-cons-pax', '1st-ets-prx', '3rd-N-cons-pax', a1 = 'εντ', a2 = 'εσσ', adeclheader = adeclfirst_and_third }
--[[ Participles (subtype of first-and-third) ]]
export.adjinflections['1&3-ουντ'] = { '3rd-cons', '1st-ets-pax', '3rd-N-cons', a1 = 'οντ', a2 = 'ουσ', adeclheader = adeclfirst_and_third }
-- perfect active:
export.adjinflections['1&3-οτ'] = { '3rd-cons', '1st-als-pax', '3rd-N-cons', a1 = 'οτ', a2 = 'υι', adeclheader = adeclfirst_and_third }
-- From roots with reflex of *h₁, and in the aorist passive:
export.adjinflections['1&3-εντ'] = { '3rd-cons', '1st-ets-pax', '3rd-N-cons', a1 = 'εντ', a2 = 'εισ', adeclheader = adeclfirst_and_third }
-- From roots with reflex of *h₂:
export.adjinflections['1&3-ᾰντ'] = { '3rd-cons', '1st-ets-pax', '3rd-N-cons', a1 = 'ᾰντ', a2 = 'ᾱσ', adeclheader = adeclfirst_and_third }
-- 1st aorist active:
export.adjinflections['1&3-ᾰντ-pax'] = { '3rd-cons-pax', '1st-ets-prx', '3rd-N-cons-pax', a1 = 'ᾰντ', a2 = 'ᾱσ', adeclheader = adeclfirst_and_third }
-- From roots with reflex of *h₃:
export.adjinflections['1&3-οντ'] = { '3rd-cons', '1st-ets-pax', '3rd-N-cons', a1 = 'οντ', a2 = 'ουσ', adeclheader = adeclfirst_and_third }
-- έω/όω contract:
export.adjinflections['1&3-οντ-con'] = { '3rd-cons', '1st-ets-pax', '3rd-N-cons', a1 = 'ουντ', a2 = 'ουσ', adeclheader = adeclfirst_and_third }
-- thematic active:
export.adjinflections['1&3-οντ-pax'] = { '3rd-cons-pax', '1st-ets-prx', '3rd-N-cons-pax', a1 = 'οντ', a2 = 'ουσ', adeclheader = adeclfirst_and_third }
-- νῡμι active:
export.adjinflections['1&3-ῠντ'] = { '3rd-cons', '1st-ets-pax', '3rd-N-cons', a1 = 'ῠντ', a2 = 'ῡσ', adeclheader = adeclfirst_and_third }
-- άω contract:
export.adjinflections['1&3-ωντ-con'] = { '3rd-cons', '1st-ets-pax', '3rd-N-cons', a1 = 'ωντ', a2 = 'ωσ', adeclheader = adeclfirst_and_third }
-- Masculine and feminine identical
export.adjinflections['2nd'] = { '2nd', nil, '2nd-N', adeclheader = adeclsecond }
export.adjinflections['2nd-pax'] = { '2nd-pax', nil, '2nd-N-pax', adeclheader = adeclsecond }
export.adjinflections['2nd-prx'] = { '2nd-prx', nil, '2nd-N-prx', adeclheader = adeclsecond }
export.adjinflections['2nd-att-prx'] = { '2nd-att-prx', nil, '2nd-N-att-prx', adeclheader = adeclatt }
export.adjinflections['3rd-cons'] = { '3rd-cons', nil, '3rd-N-cons', adeclheader = adeclthird }
export.adjinflections['3rd-cons-pax'] = { '3rd-cons-pax', nil, '3rd-N-cons-pax', adeclheader = adeclthird }
export.adjinflections['3rd-cons-prx'] = { '3rd-cons-prx', nil, '3rd-N-cons-prx', adeclheader = adeclthird }
export.adjinflections['3rd-εσ-adj'] = { '3rd-εσ-adj-open', nil, '3rd-N-εσ-adj-open', adeclheader = adeclthird }
export.adjinflections['3rd-εσ-adj-prx'] = { '3rd-εσ-adj-prx-open', nil, '3rd-N-εσ-adj-prx-open', adeclheader = adeclthird }
export.adjinflections['3rd-εσ-adj-prp'] = { '3rd-εσ-adj-prx-open', nil, '3rd-N-εσ-adj-prp-open', adeclheader = adeclthird }
-- Irregular
export.adjinflections['irreg'] = { 'irreg', 'irreg2', 'irreg3', adeclheader = adeclirreg }
export.adjinflections['irreg-2pt'] = { 'irreg', nil, 'irreg3', adeclheader = adeclirreg }
export.adjinflections_con['1&2-alp-con-con'] = { '2nd-con-con', '1st-alp-con', '2nd-N-con-con', adeclheader = adeclfirst_and_second }
export.adjinflections_con['1&2-eta-con-con'] = { '2nd-con-con', '1st-eta-con', '2nd-N-con-con', adeclheader = adeclfirst_and_second }
export.adjinflections_con['3rd-εσ-adj'] = { '3rd-εσ-adj', nil, '3rd-N-εσ-adj', adeclheader = adeclthird }
export.adjinflections_con['3rd-εσ-adj-prx'] = { '3rd-εσ-adj-prx', nil, '3rd-N-εσ-adj-prx', adeclheader = adeclthird }
export.adjinflections_con['3rd-εσ-adj-prp'] = { '3rd-εσ-adj-prx', nil, '3rd-N-εσ-adj-prp', adeclheader = adeclthird }
return export