Content deleted Content added
Testing |
Testing |
||
(88 intermediate revisions by the same user not shown) | |||
Line 18:
elseif (language == "de") then
name = p.deName(fullPersonalName)
elseif (language == "zh") then
name = p.zhName(fullPersonalName)
Line 92 ⟶ 91:
}},
{ "ru",
{ "Poda", "Petrenko", "Roschin", "Uspensky", "Vladímir"
}},
-- No need to include Wang, Zhang or Chang (common termination -ang).
Line 201 ⟶ 200:
-- Now is common to find given names of just one character.
if(string.len(name) <= 3) then
if(string.
return "en"
else
return "zh"
end
end
Line 233 ⟶ 232:
familyNames = {}
}
if(not(p.isOnlyName(fullNameTable))) then
table.remove(fullNameTable)
end
table.insert(name.givenNames, fullNameTable[1])
table.remove(fullNameTable, 1)
function getPositionOfConecctors(fullNameTable)
local connectors = {"de", "del", "y"}
firstSurname = 0
lastSurname = 0
for x, connector in ipairs(connectors) do
if(connector == actualName) then
firstSurname = d
for z, lastConnector in ipairs(connectors) do
if((fullNameTable[
lastSurname = #fullNameTable-1
return {firstSurname, lastSurname }
end
if(fullNameTable[#fullNameTable-2] == lastConnector and (firstSurname ~= #fullNameTable-2)) then
lastSurname = #fullNameTable-2
return {firstSurname, lastSurname}
end
end
Line 258:
end
end
return { firstSurname, lastSurname }
end
local positions = getPositionOfConecctors(fullNameTable)
if
table.insert(name.
-- 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.givenNames, fullNameTable[1])
else
table.insert(name.familyNames, fullNameTable[1])
end
table.insert(name.familyNames, fullNameTable[2])
else
table.insert(name.givenNames, fullNameTable[1])
table.insert(name.familyNames, fullNameTable[2])
table.insert(name.familyNames, fullNameTable[3])
end
else
if(positions[2]==0)then
if(positions[1]==1) then
-- Maybe a second surname is behind
table.insert(name.familyNames, table.concat(fullNameTable, " ", positions[1]))
elseif(positions[1]==2)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.givenNames, fullNameTable[1])
else
table.insert(name.familyNames, fullNameTable[1])
end
table.insert(name.familyNames, table.concat(fullNameTable, " ", positions[1]))
end
else
if(positions[1]==2)then
table.insert(name.givenNames, fullNameTable[1])
end
table.insert(name.familyNames, table.concat(fullNameTable, " ", positions[1], positions[2]-1))
table.insert(name.familyNames, table.concat(fullNameTable, " ", positions[2]))
end
end
return name
Line 298 ⟶ 347:
familyNames = {}
}
local connectors = {"de", "van", "den", "ten", "Van", "der", "Le", "le"}
if(not(p.isOnlyName(fullNameTable))) then
table.remove(fullNameTable)
end
for d, actualName in ipairs(fullNameTable)do
if(d==#fullNameTable) then
table.insert(name.familyNames, actualName)
else
for x, connector in ipairs(connectors) do
if(connector == actualName) then
table.insert(name.familyNames, table.concat(fullNameTable, " ", d))
return name
end
end
table.insert(name.givenNames, actualName)
end
end
return name
end
Line 347 ⟶ 408:
local intEnd = string.find(eachName, ")")-1
table.insert(name.familyNames, string.sub(eachName, intStart, intEnd))
else
table.insert(name.givenNames, " " .. eachName)
end
end
return name
Line 386 ⟶ 447:
end
return isJustName
end
return p
|