User:Sarri.greek (CAT) » Module tin (την) doc » Template:User:Sarri.greek/el-tin
Choose the correct Modern Greek feminine accusative singular article την OR τη
depending on the sound that follows.
Call it at templates with: {{#invoke:el-tin|tin|term=<word>}}
-- at el.wikationary 2019.05.16. Sarri.greek
-- 2024.03.06. ]
-- 2019.07.24. Thanks to Erutuon
-- Recognizes the first letter of a Modern Greek noun (feminine, accusative, singular)
-- and produces the correct article την (tin) or τη (ti)
-- Called by ].
local p = {}
-- by Erutuon: remove error "attempt to call method 'getParent' (a nil value)" by accepting string as argument
function p.tin(arg)
local term
if type(arg) == 'table' and type(arg.getParent) == 'function' then
local frame = arg
local args = frame:getParent().args
term = args or '' -- ] {{#invoke:el-tin|tin|term=<word>}}
else
term = arg
end
PAGENAME = mw.title.getCurrentTitle().text
PAGENAME = PAGENAME:match( "^%s*(.-)%s*$" ) -- Do i need this always? It is about trimming empty beginning and end
-- when the lemma is a feminine suffix with -xxx
-- (1, 1) start at 1st character, stop at 1st character
-- when param 1 is empty, see PAGENAME
if term:sub(1, 1) == '-' or PAGENAME:sub(1, 1) == "-" then
return 'τη(ν)'
end
-- when the lemma is a feminine word
-- begninning with βδθφχλρσζΒΔΘΦΧΛΡΣΖ return 'τη'
if mw.ustring.find(term, '^')
or mw.ustring.find(PAGENAME, '^')
then
return 'τη'
else
-- μ - μπ
if mw.ustring.find(term, '^')
or mw.ustring.find(PAGENAME, '^')
then
return 'την'
else if mw.ustring.find(term, '^') then return 'τη' end
end
-- ν - ντ
if mw.ustring.find(term, '^')
or mw.ustring.find(PAGENAME, '^')
then
return 'την'
else if mw.ustring.find(term, '^') then return 'τη' end
end
-- γ - γκ
if mw.ustring.find(term, '^')
then
return 'την'
else if mw.ustring.find(term, '^')
or mw.ustring.find(PAGENAME, '^')
then
return 'τη' end
end
-- else, if NOT begninning with βδθφχλρσζΒΓΔΘΦΧΛΡΣΖ return 'τηv'
return 'την'
end --close beginning with...
end --close function
-- the same function for transliteration
function p.tin_translit(arg)
--p = function(arg)
local term
if type(arg) == 'table' and type(arg.getParent) == 'function' then
local frame = arg
local args = frame:getParent().args
term = args or '' -- ] {{#invoke:el-tin|tin|term=<word>}}
else
term = arg
end
PAGENAME = mw.title.getCurrentTitle().text
PAGENAME:match( "^%s*(.-)%s*$" ) -- Do i need this always? It is about trimming empty beginning and end
-- when the lemma is a feminine suffix with -xxx
-- (1, 1) start at 1st character, stop at 1st character
-- when param 1 is empty, see PAGENAME
if term:sub(1, 1) == '-' or PAGENAME:sub(1, 1) == "-" then
return 'tī(n)'
end
-- when the lemma is a feminine word
-- begninning with βδθφχλρσζΒΔΘΦΧΛΡΣΖ return 'τη'
if mw.ustring.find(term, '^')
or mw.ustring.find(PAGENAME, '^')
then
return 'tī'
else
-- μ - μπ
if mw.ustring.find(term, '^')
or mw.ustring.find(PAGENAME, '^')
then
return 'tīn'
else if mw.ustring.find(term, '^') then return 'tī' end
end
-- ν - ντ
if mw.ustring.find(term, '^')
or mw.ustring.find(PAGENAME, '^')
then
return 'tīn'
else if mw.ustring.find(term, '^') then return 'tī' end
end
-- γ - γκ
if mw.ustring.find(term, '^')
then
return 'tīn'
else if mw.ustring.find(term, '^')
or mw.ustring.find(PAGENAME, '^')
then
return 'tī' end
end
-- else, if NOT begninning with βδθφχλρσζΒΓΔΘΦΧΛΡΣΖ return 'τηv'
return 'tīn'
end --close beginning with...
end --close function
return p