Module:Sandbox/Ajuanca/Names: Difference between revisions

Content deleted Content added
Testing
Testing
 
(11 intermediate revisions by the same user not shown)
Line 239:
function getPositionOfConecctors(fullNameTable)
local connectors = {"de", "del", "y"}
local firstSurname = 0
local lastSurname = 0
for d, actualName in ipairs(fullNameTable)do
local firstSurname = 0
local lastSurname = 0
for x, connector in ipairs(connectors) do
if(connector == actualName) then
Line 255:
end
end
return { firstSurname, lastSurname }
end
end
Line 262 ⟶ 261:
end
local positions = getPositionOfConecctors(fullNameTable)
if(positions[1]~==0) then
if(positions[1] ~#fullNameTable== 1) then
table.insert(name.familyNames, fullNameTable[21])
elseif(#fullNameTable==32)then
-- 1st maybe is a given name
local isGiven = true
local terminations = {"ez", "es", "is", "iz"}
for c, termination in ipairs(terminations) do
local finalLetters = string.sub(fullNameTable[1], -2, -1)
if (finalLetters == termination) then
isGiven = false
end
end
if(isGiven)then
table.insert(name.familyNamesgivenNames, fullNameTable[21])
else
table.insert(name.familyNames, fullNameTable[31])
end
table.insert(name.familyNames, fullNameTable[#fullNameTable2])
else
table.insert(name.givenNames, fullNameTable[1])
table.insert(name.familyNames, table.concat(fullNameTable, " ", positions[2]))
table.insert(name.familyNames, table.concat(fullNameTable, " ", positions[13]))
end
else
if(positions[2]~==0)then
--table.insert(name.familyNames, table.concat(fullNameTable, " ", (positions[1]), positions[2]-1 ))
if(positions[1]==1) then
table.insert(name.familyNames, table.concat(fullNameTable, " "..positions[2], (positions[1]), positions[2]))
-- Maybe a second surname is behind
table.insert(name.familyNames, table.concat(fullNameTable, " ", positions[2]))
table.insert(name.familyNames, table.concat(fullNameTable, " "..positions[2], (positions[1]), positions[2]))
else
ifelseif(positions[1] ~= =2) then
-- 1st maybe is a given name
table.insert(name.familyNames, fullNameTable[2])
local isGiven = true
end
local articlesterminations = {"elez", "laes", "losis", "lasiz"}
for xc, articletermination in ipairs(articlesterminations) do
if(article local finalLetters == string.sub(fullNameTable[#fullNameTable-1]), then-2, -1)
if (finalLetters == termination) then
table.insert(name.familyNames, table.concat(fullNameTable, " ", positions[1]))
isGiven = false
end
end
if(isGiven)then
table.insert(name.givenNames, fullNameTable[1])
else
table.insert(name.familyNames, table.concat(fullNameTable, " ", positions[1], #fullNameTable-1))
table.insert(name.familyNames, fullNameTable[#fullNameTable])
end
table.insert(name.familyNames, table.concat(fullNameTable, " ", positions[1]))
end
endelse
if(positions[1]==2)then
else
if table.insert(#name.givenNames, fullNameTable==2[1]) then
end
table.insert(name.familyNames, fullNameTable[2])
--table.insert(name.familyNames, table.concat(fullNameTable, " ", (positions[1]), positions[2]-1 ))
elseif(#fullNameTable==3)then
table.insert(name.givenNamesfamilyNames, table.concat(fullNameTable, " ", positions[2]))
table.insert(name.familyNames, fullNameTable[3])
end
end