Take the 2-minute tour ×
English Language & Usage Stack Exchange is a question and answer site for linguists, etymologists, and serious English language enthusiasts. It's 100% free, no registration required.

My current task is to create a (programming) algorithm which reverts a name's order. This since my country's formal name-listing order is different from international ones. The standard is often:

John Doe

However, the standard I must comply to has the following priority:

Doe, John

Our businesses often receives names in the international style, which needs to be converted to our national style.

However, I've yet to come up with a way to deal with double names and similar cases. As an example, how to convert the following name?

John Foo Doe => Doe, John Foo / Doe, Foo John

I'm appreciating all input on this broad question. Please list possible problems (and preferably its solution), or perhaps a project which has faced this problem before.

share|improve this question

closed as off topic by Lynn, aedia λ, MετάEd, choster, J.R. Feb 8 '13 at 20:05

Questions on English Language & Usage Stack Exchange are expected to relate to English language and usage within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Feel free to edit the question to improve it or its language. My native language obviously isn't English ;-). –  Zar Feb 8 '13 at 17:59
7  
I think this is a bit outside the scope of this site, as naming practices are more a feature of culture than language. But I would also caution that there are in fact many more scenarios to consider: people with multiple middle names or multiple surnames, generational modifiers, countries where family names are given before given names, and so on. The King of Spain, commonly Juan Carlos, is fully Juan Carlos Alfonso Víctor María de Borbón y Borbón-Dos Sicilias; try parsing that :). –  choster Feb 8 '13 at 18:04
add comment

2 Answers 2

This is actually a really really hard (not in the NP-hard sense) problem to solve. Consider the following examples:

All of the above are real people from the English speaking world. As you can see, it is almost impossible to find any kind of pattern in their names.

It gets worse. What if you consider titles?

Granted, for some of those, the title is easily separated from the name. I'd like to see you deal with that last one though. It gets even worse if you consider names coming from other languages. A Portuguese friend of mine is called Ana Maria Morais Sarmento de Campos. Honestly. Ana and Maria are her first names and everything else is divided into various classes of surnames.

Finally, some people have their own opinions on how their names should be written. For example, a member of this forum, Mr brian d foy, explains his own preferences very clearly here.

So, if there is any way to avoid it don't parse human names, not in English nor in any other language. It is almost impossible to formalize them. There are some workarounds and parsers available but none of them will work perfectly and their discussion is way out of scope on this site. Have a look at this post on StackOverflow for some examples.

share|improve this answer
add comment

Doe, John Foo would be correct and is used often. I have never seen "complete" reverse-name sorting where the name is listed as <last name>, <middle name> <first name>, it is always <last name>, <first name> <middle name>.

share|improve this answer
3  
But "Neumann, John von" and "Márquez, Gabriel García" would be wrong (showing the perils of automating this process). –  Peter Shor Feb 8 '13 at 19:11
3  
Also, certain asian cultures (and maybe others) place the family name (or surname) first and the given name second. To further complicate it, they may use different orders depending on the group with which they are dealing or where they are visiting. It would be critical to find out which name is the surname, and that may not be obvious except by asking. –  bib Feb 8 '13 at 19:22
    
@bib: certain European cultures (namely Hungarian) do, as well. –  Peter Shor Feb 8 '13 at 20:19
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.