-- voir Module:el-conjugaison
--
local p = {}
local acc = require("Module:el-accentuation")
local personnes = {"1re sing.", "2e sing.", "3e sing.", "1re pl.", "2e pl.", "3e pl."}
local desinences = {
present = {
s1 = {2, 'ω'}, s2 = {2, 'εις'}, s3 = {2, 'ει'},
p1 = {2, 'ουμε'}, p2 = {2, 'ετε'}, p3 = {2, 'ουν'},
},
presentA = {
s1 = {3, 'ώ'}, s2 = {3, 'άς'}, s3 = {3, 'ά'},
p1 = {3, 'άμε'}, p2 = {3, 'άτε'}, p3 = {3, 'άν'},
},
presentE = {
s1 = {3, 'ώ'}, s2 = {3, 'είς'}, s3 = {3, 'εί'},
p1 = {3, 'ούμε'}, p2 = {3, 'είτε'}, p3 = {3, 'ούν'},
},
presentM = {
s1 = {2, 'ομαι'}, s2 = {2, 'εσαι'}, s3 = {2, 'εται'},
p1 = {3, 'όμαστε'}, p2 = {2, 'εστε'}, p3 = {2, 'ονται'},
},
presentMA = {
s1 = {3, 'ιέμαι'}, s2 = {3, 'ιέσαι'}, s3 = {3, 'ιέται'},
p1 = {3, 'ιόμαστε'}, p2 = {3, 'ιέστε'}, p3 = {3, 'ιούνται'},
},
presentME = {
s1 = {3, 'ούμαι'}, s2 = {3, 'είσαι'}, s3 = {3, 'είται'},
p1 = {3, 'ούμαστε'}, p2 = {3, 'είστε'}, p3 = {3, 'ούνται'},
},
impfM = {
s1 = {3, 'όμουν'}, s2 = {3, 'όσουν'}, s3 = {3, 'όταν'},
p1 = {3, 'όμασταν'}, p2 = {3, 'όσασταν'}, p3 = {2, 'ονταν'},
},
passe = {
s1 = {1, 'α'}, s2 = {1, 'ας'}, s3 = {1, 'ε'},
p1 = {2, 'αμε'}, p2 = {2, 'ατε'}, p3 = {1, 'αν'},
},
}
-- tronque retourne le mot sans sa desinence. En cas d'argument
-- invalide (si le mot ne termine pas par desinence), renvoie "ERREUR"
function tronque(mot, desinence)
local l = mw.ustring.len(desinence)
if l == 0 then
return mot
end
if mw.ustring.len(mot) < l then
return "ERREUR"
end
if mw.ustring.sub(mot, -l, -1) ~= desinence then
return "ERREUR"
end
return mw.ustring.sub(mot, 1, -l-1)
end
function lang_el(mot)
return '<span lang="el" class="lang-el">' .. mot .. '</span>'
end
function lien_el(mot)
if mot == mw.title.getCurrentTitle().prefixedText then
return ']'
else
return ']'
end
end
function tableau(entetes, colonnes)
lignes = {'{| class="flextable"'}
table.insert(lignes, "! ")
for _, entete in ipairs(entetes) do
table.insert(lignes, "! " .. entete)
end
for p = 1, 6 do
-- une ligne par personne
table.insert(lignes, "|-")
table.insert(lignes, "| " .. personnes)
for i = 1, #entetes do
local mot = colonnes
if mot == "" then
table.insert(lignes, '| |')
else
table.insert(lignes, '| class="colle-gauche" | ' .. lien_el(mot))
end
end
end
table.insert(lignes, "|}")
return table.concat(lignes, "\n")
end
function petit_tableau(entetes, contenu)
lignes = {'{| class="flextable"'}
for i = 1, #entetes do
if i > 1 then table.insert(lignes, "|-") end
if contenu ~= nil and contenu ~= "" then
table.insert(lignes, "! " .. entetes)
table.insert(lignes, "| " .. contenu)
end
end
table.insert(lignes, "|}")
return table.concat(lignes, "\n")
end
function conjugue(radPres, radImp, radAor, radFut, desPres, desImp, desAor, desFut)
entetes = {"Présent", "Imparfait", "Subjonctif", "Aoriste"}
present = combine(radPres, desPres)
imparfait = combine(radImp, desImp)
aoriste = combine(radAor, desAor)
subj = combine(radFut, desFut)
colonnes = {present, imparfait, subj, aoriste}
tab1 = tableau(entetes, colonnes) .. "\n"
tempsExtra = {"Futur", "Parfait", "Impératif continu", "Impératif momentané", "Participe présent", "Participe passif", "Voix passive"}
formesExtra = {
"θα " .. lien_el(subj),
"έχω " .. subj,
"",
"",
"",
"",
"",
}
tab2 = petit_tableau(tempsExtra, formesExtra) .. "\n"
return tab1 .. tab2
end
function combine(radical, des)
if radical == nil then
return {"", "", "", "", "", ""}
end
local rad = acc.radicaux(radical)
function f(des)
local i, d = des, des
return acc.normalise(rad .. d)
end
s1 = f(des.s1)
s2 = f(des.s2)
s3 = f(des.s3)
p1 = f(des.p1)
p2 = f(des.p2)
p3 = f(des.p3)
return {s1, s2, s3, p1, p2, p3}
end
function suffixe(mot, s)
local l = mw.ustring.len(s)
if mw.ustring.len(mot) < l then
return false
end
return mw.ustring.sub(mot, -l, -1) == s
end
function p.conj_auto(pres, imp, aor, fut)
if suffixe(pres, "άω") then
radPres = tronque(pres, "άω")
desPres = desinences.presentA
elseif suffixe(pres, "ω") then
radPres = tronque(pres, "ω")
desPres = desinences.present
elseif suffixe(pres, "ώ") then
radPres = tronque(pres, "ώ")
desPres = desinences.presentE
elseif suffixe(pres, "ομαι") then
radPres = tronque(pres, "ομαι")
desPres = desinences.presentM
elseif suffixe(pres, "ιέμαι") then
radPres = tronque(pres, "ιέμαι")
desPres = desinences.presentMA
elseif suffixe(pres, "ούμαι") then
radPres = tronque(pres, "ούμαι")
desPres = desinences.presentME
else
radPres = "INCORRECT"
desPres = desinences.present
end
if suffixe(imp, "α") then
radImp = tronque(imp, "α")
desImp = desinences.passe
elseif imp == "" then
radImp = nil
desImp = desinences.passe
else
radImp = tronque(imp, "όμουν")
desImp = desinences.impfM
end
radAor = tronque(aor, "α")
desAor = desinences.passe
if suffixe(fut, "ω") then
radFut = tronque(fut, "ω")
desFut = desinences.present
else
radFut = tronque(fut, "ώ")
desFut = desinences.presentE
end
return conjugue(radPres, radImp, radAor, radFut, desPres, desImp, desAor, desFut)
end
function p.conj(frame)
return p.conj_auto(frame.args.pres, frame.args.imp, frame.args.aor, frame.args.fut)
end
function p.test(frame)
return p.conj_auto("αφήνω", "άφηνα", "άφησα", "αφήσω") ..
p.conj_auto("αγαπάω", "αγαπούσα", "αγάπησα", "αγαπήσω") ..
p.conj_auto("οδηγώ", "οδηγούσα", "οδήγησα", "οδηγήσω") ..
p.conj_auto("δέχομαι", "δεχόμουν", "δέχτηκα", "δεχτώ") ..
p.conj_auto("αγαπιέμαι", "αγαπιόμουν", "αγαπήθηκα", "αγαπηθώ") ..
p.conj_auto("θεωρούμαι", "", "θεωρήθηκα", "θεωρηθώ") ..
p.conj_auto("παίρνω", "έ-παιρνα", "πήρα", "πάρω") ..
p.conj_auto("στέλνω", "έ-στελνα", "έ-στειλα", "στείλω") ..
p.conj_auto("μπαίνω", "έ-μπαινα", "μπήκα", "μπώ") ..
p.conj_auto("βγάζω", "έ-βγαζα", "έ-βγαλα", "βγάλω") ..
p.conj_auto("βρίσκω", "έ-βρισκα", "βρήκα", "βρώ") ..
p.conj_auto("βρίσκομαι", "βρισκόμουν", "βρέθηκα", "βρεθώ")
end
return p
--