SOUNDEX shmockdex

Back in 1918, in the US, a patent was given to whatever passed as nerds back then, who invented an algorithm for finding similar sounding names and words, such as John and  Jon or Schmitt and Schmidt.
Back in the days and only working with the names common in the US at the time (thing was made for the census) the SOUNDEX algorithm has aged a bit and certainly not transported well to foreign languages.
In some countries, other nerds found new ways of doing it (Kölner Phonetic in Germany for example) but many of those were geared towards the specific target market.

Nowadays, with the percentage of people with migratory background rising everywhere, it has become more difficult to perform this task.
To the rescue : Phonet and it’s posh sibling Phonet2.

As a quick look into the 4D documentation will tell you, there is no such thing in 4D, so we need to roll our own.

Another quick google further and we find the algorithm definition and pseudo code for it…
Nah…
Too complicated!
Well, challenge accepted!

I hereby offer the brotherhood of 4D developers my absolutely genius Phonet component:

AC_PhoneticTools

Just drop it into your components folder, there is just one command you shall call:

PhonetString:=APHON_Get(SourceString;UsePhonet2)

It requires 2 parameters :

  1. the text to be phonetted or phonet2etted (is that a verb? now it is!)
  2. true to use phonet2false to use plain phonet

and it returns the phonetted (new adjective!) string.

some quick and lazy examples:

The wordPhonetPhonet2
SchmidtSHMITZNIT
ShmittSHMITZNIT
SchmiedSHMITZNIT
MeierMEIANEIA
MaierMEIANEIA
MayerMEIANEIA
ChristianKRISTIANKRISTIAN
KristianKRISTIANKRISTIAN
AnnaANAANA
HannaHANAANA

As for testing: just launch the component by itself and it will display this stunningly complex but intricately designed dialog:enter the strings to compare in the top fields and see the magic happen…

Hope you enjoy this, and always grateful for donations towards my Aston Martin fund…

Well, i’m done here, so here you go:

PS: The source is in the component package should you be interested in the innards of this thing…

2 thoughts on “SOUNDEX shmockdex

  1. TALK COSMOS

    Alex, is the AC_PhoneticTool v16 component available? I’d like to get and convert to 4D v17 and see how it handles names with diacriticals. I seem to be having some issues with city spellings and maybe this could help. John F. (find my email contact at 4D Nug under truegold@…)

    Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.