# How to find hard to misspell given names?

Here is a question that I believe could be solved with some data mining and a sophisticated algorithm, but I don't quite know how. Any pointers as to what data sources to use and what algorithm to apply are welcome.

Background: I'm a Romanian-Hungarian who is expecting a baby with a Polish-Ukrainian and haven't quite set up our mind in what country we want to settle down. As you may expect, choosing a given name is of uttermost importance and a hot debate. From my side, I am still traumatised by all the hassle I had to go through when somebody would misspell my name as I moved from one country to another. For example, if you were called "Adrian" you would be blessed in Romania, only to find that you ended up being "Adrien" is some official French document. So my only requirement is to make it extremely unlikely for the baby's name to be misspelled in some European countries.

Problem Statement: Given a set of countries, e.g., France, Germany, Sweden, Poland and Romania, find the list of given names that, when pronounced properly, are unlikely to be misspelled by the locals.

More formally: Let p(c, n) be a function that returns the probability of name n being misspelled in country c. Given C a set of countries and p₀ a probability, find N a set of given names, such that

for all nN and cC, p(c, n) < p₀

Initial thoughts: The core problem is how to implement p(c,n). One could try to approximate it with a heuristic. Clearly a name is likely to be misspelled in two cases:

1. It is little used in that country.
2. It is similar to a different name, that is not little used in that country.

I'm not sure how I could use the Internet, e.g., Wikipedia, to efficiently answer these two questions. How would one list only fairly frequently used names in a country? How would one look for similarly spelled ones?

• I'm not sure popularity would greatly affect the probability of misspelling, when compared with low edit distance to other names. E.g. Hanna sounds similar/identical to Hannah and Anna, and Lucas is similar to Luca and Lukas. Once you can get your hands on a list of names for each country, you could start by clustering by low edit distances.
– amon
Dec 8, 2015 at 22:45
• I think it has to do with popularity too. Nobody would spell Anna in Romanian, as double n is just weird in that language. Similarly, a French person would likely write Christian even if you pronounce it without h. (Pun intended. :D) Dec 8, 2015 at 22:53
• The pragmatic approach would be to use a GUID. Dec 9, 2015 at 11:54
• Great XKCD reference. But don't forget Little Bobby tables ;-) xkcd.com/327
– Mawg
Dec 9, 2015 at 15:14
• I would consider comparing vowel sounds in those languages. My German is fluent, but I still make a mess of Ö
– Mawg
Dec 9, 2015 at 15:17

There are some approaches that would work better for some languages than others. For example, soundex (and another description I like) was designed for English pronunciations of names. With soundex, `Michael` becomes M240. This has several steps:

1. First letter is isolated. (`M` and `ichael`)
2. All vowels are removed from remainder (`M` and `chl`)
3. Consonants are replaced
• `c` -> 2
• `l` -> 4

The grouping of the consonant conversions are based on their phonetic similarity - `B`, `F`, `P` and `V` all map to `1`.

And there are variations on this over time. It is particularly useful in genealogy where the spelling of a name may change over time, but the pronunciation remains similar.

There is also approaches such as match rating which was developed by the airlines for names (rather than American genealogy).

The encoding of match rating approach (MRA) is:

1. Delete all non-leading vowels (`Michael` becomes `Mchl` and `Anthony` becomes `Anthny`)
2. Remove the second constant of any doubles
3. If the string is longer than 6 characters, reduce the remaining string to 6 characters by taking the first three and last three.

The full specification for this can be found on archive.org - note that it is "not small" (the printed form is 214 pages).

The comparisons have a matching threshold based on how long the text is.

There are other phonetic algorithms too.

So, what I would encourage you to do is either take the soundex as is, take the match rating approach as is, or modify the soundex based on the Romanian consonants and Polish consonants.

Remember that with soundex, the consonants are grouped (In Polish, `m`, `n`, `ɲ` are all nasal consonants to be grouped, and you would likely group the labial, dental, and alveolar plosives - be they voiceless or voiced together - granted, I don't know Polish so don't know if I'm just saying things that aren't true there).

Then just covert all the names in the database to the two different soundex systems and find out what names have the lowest set of collisions in the different languages. This gives you distinct names. So that `Smith` doesn't show up as `Smyth`.

This, however, only solves the "name likely to collide with other names and be misheard." It doesn't address the other way of the "name heard correctly, written down incorrectly" and for that, one should focus their attention on common names.

For example, `Michael` was a very common name in the US from early 1950 to late 1970. It was really popular. However, for some reason, the name `Micheal` was kind of popular in the 1950s (got up to the 83rd most common name at its peak). And I am certain that people named `Micheal` constantly got their name misspelled.

Thus, you should focus on names where there is one name that dominates the popularity of the name for a given pronunciation. Glancing at another data consumer for the names by year, you can see that names beginning with Jam... for a boy are a mess with `Jamaal`, `Jamal`, `Jamar` and others. Incidentally, these names have slightly different soundexes for American (`J540`, `J540` and `J560` - the `l` and `r` are in different groups even though they are closely related in phonetics). However, for someone from, say Japan, the there is only one sound in the phonetic region where `l` and `r` are pronounced in American English. This may also pose a challenge with the leading consonants using soundex that one should be aware of (I once worked with a Japanese woman who called herself Risa (with an 'R') rather than Lisa as a Romanization of her Japanese name).

You will note that my examples are for the United States. That data is easily accessible. Apparently there are some things for Poland and Hungarian, and only hints at Hungarian name commonality... I suspect that searching in a language other than English might be helpful there.

So, given the soundex for a name, few collisions and the actual spelling is in the set of collisions. Preferably, this is a common name. Looking at that hungarian list, going with `Krisztián` would likely get misspellings while, `Zoltán` less likely so (#22 most common baby name in 2011 in Hungary!). That said, you can't go wrong with `Michael`.

• Awesome answer! I will try to implement it and once I am done I share the code and accept your answer. Dec 9, 2015 at 8:21
• An attempt to implement this idea. Not quite passing "user testing". :) github.com/cristiklein/idemscriptent-given-names Dec 9, 2015 at 23:21
• Excellent answer Michael! @user1202136 great work on the script! I am interested to see the results :) Dec 10, 2015 at 15:41
• @ChrisCirefice: While Michael's answer is simply awesome, I found it did not produce names that would pass the "user test". I went for a far simpler algorithm, that tries to find identically spelled names in top 100 name lists. Please find the results here: github.com/cristiklein/idemscriptent-given-names Dec 13, 2015 at 23:22

You probably want to look into the Double Metaphone phonetic algorithm, which is designed to handle how words are pronounced in different languages. There is also a Metaphone 3, but that costs money to use.