Mòdul:El-trans
Aparença
Documentació del mòdul [ mostra ] [ modifica el codi ] [ mostra l'historial ] [ refresca ]
A continuació es mostra la documentació transclosa de la subpàgina /ús. [salta a la caixa de codi]
Mòdul per a la transcripció automàtica del grec modern al català. Segueix els criteris indicats a Transliteració i transcripció de l'alfabet grec segons la proposta feta per l’Associació Catalana de Neohel·lenistes a l’Institut d’Estudis Catalans. L’IEC ha aprovat, el 14 de febrer del 2020, una recomanació de transcripció però no està encara publicada.
Els personatges del món clàssic solen tenir una forma adaptada al català, sigui per via patrimonial en català antic o bé com a cultisme tradicional.
Eina de consulta:
local p = {}
local tt = {
["α"] = "a", ["β"] = "v", ["γ"] = "g", ["δ"] = "d",
["ε"] = "e", ["ζ"] = "z", ["η"] = "i", ["θ"] = "th",
["ι"] = "i", ["κ"] = "k", ["λ"] = "l", ["μ"] = "m",
["ν"] = "n", ["ξ"] = "x", ["ο"] = "o", ["π"] = "p",
["ρ"] = "r", ["σ"] = "s", ["ς"] = "s",
["τ"] = "t", ["υ"] = "i", ["φ"] = "f",
["χ"] = "kh", ["ψ"] = "ps", ["ω"] = "o",
["Α"] = "A", ["Β"] = "V", ["Γ"] = "G", ["Δ"] = "D",
["Ε"] = "E", ["Ζ"] = "Z", ["Η"] = "I", ["Θ"] = "Th",
["Ι"] = "I", ["Κ"] = "K", ["Λ"] = "L", ["Μ"] = "M",
["Ν"] = "N", ["Ξ"] = "X", ["Ο"] = "O", ["Π"] = "P",
["Ρ"] = "R", ["Σ"] = "S",
["Τ"] = "T", ["Υ"] = "I", ["Φ"] = "F",
["Χ"] = "Kh", ["Ψ"] = "Ps", ["Ω"] = "O",
[";"] = "?", ["·"] = ";"
}
-- transliterates any words or phrases
function p.tr(text)
if type(text) == "table" then text = text.args[1] end
local gsub = mw.ustring.gsub
local find = mw.ustring.find
local acute = mw.ustring.char(0x301)
local diaeresis = mw.ustring.char(0x308)
local vowels = "[αΑεΕηΗιΙυΥοΟωΩ" .. acute .. diaeresis .. "]"
text = mw.text.trim(text)
text = mw.ustring.toNFD(text)
text = mw.ustring.gsub(text, acute .. diaeresis, diaeresis .. acute)
text = gsub(text, "([βκπτ])([βκπτ])", -- no dobles ββ, κκ, ππ, ττ
function (cons, doble)
if cons == doble then
return cons
end
end)
text = gsub(text, "(.?)([γΓ]ι)", -- γι (inicial) > i
function(before, current)
if before == "" or before == " " or before == "-" then
return current == "Γι" and "I" or "i"
end
end)
text = gsub(text, "γγ(.)", -- γγ > ng(u)
function(following)
if find(following, "[ει]") then
return "ngu" .. following
end
return "ng" .. following
end)
text = gsub(text, "(.?)([γΓ])κ(.)", -- γκ (inicial, medial) > (n)g(u)
function(before, gamma, following)
local ucase = gamma == "Γ"
local cons = ucase and "G" or "g"
if before ~= "" and before ~= " " and before ~= "-" then
cons = ucase and "Ng" or "ng"
end
if find(following, "[ει]") then
return before .. cons .. "u" .. following
end
return before .. cons .. following
end)
text = gsub(text, "γ([ξχ])", "n%1")
text = gsub(text, "μβ", "mb")
text = gsub(text, "(.?)([μΜ])π", -- μπ (inicial o rere consonant, medial) > (m)b
function(before, mi)
local ucase = mi == "Μ"
if before == "" or before == " " or before == "-" or not find(before, vowels) then
return before .. (ucase and "B" or "b")
end
return before .. "mb"
end)
text = gsub(text, "(.?)([νΝ])τ(.?)", -- ντ (inicial o rere consonant, medial) > (n)d, excepte τζ > tz
function(before, ni, following)
local ucase = ni == "Ν"
if before == "" or before == " " or before == "-" or not find(before, vowels) then
return before .. (ucase and "D" or "d") .. following
elseif following ~= "ζ" then
return before .. "nd" .. following
end
end)
text = gsub(text, "(.?)σ(.?)", -- ss entre vocals
function (before, following)
if find(before, vowels) and find(following, vowels) then
return before .. "ss" .. following
end
end)
-- vowels
text = gsub(text, "([αεοΑΕΟ])ι(.?)", -- αι > e, ει > i, οι > i, excepte ϊ
function (vowel, following)
if following ~= diaeresis then
return gsub(vowel, "[αεοΑΕΟ]", {["α"] = "e", ["Α"] = "E", ["ε"] = "i", ["Ε"] = "I", ["ο"] = "i", ["Ο"] = "I"})
.. following
end
end)
text = gsub(text, "([αεΑΕ])υ(.?)", -- αυ > av, ευ > ev, excepte ϋ
function (vowel, following)
if following ~= diaeresis then
return tt[vowel] .. "v" .. following
end
end)
text = gsub(text, "([αεοωΑΕΟΩ])η",
function (vowel)
return tt[vowel] .. "i" .. diaeresis
end)
text = gsub(text, "([οΟ])υ", {["ο"] = "u", ["Ο"] = "U"})
text = gsub(text, ".", tt)
text = gsub(text, "ll", "l·l")
-- regles d'accentuació en català
text = gsub(text, diaeresis, "")
local latin = require("Mòdul:ca-trans").accents(text)
latin = gsub(latin, "([áÁ])", {["á"]="à", ["Á"]="À"})
return latin
end
return p