Jump to content

Name Matching, with inaccuracy

Recommended Posts

I have a feeling that something like this has already been asked, and I'm just not finding the correct keywords to search. Regular Expression and Character Matching are too verbose and not yielding results. :-/


I have a giant file with thousands of people's names and email addresses. I have to compare that to a similar list from last years results. The big problem is that we allow people to dupe Email addresses (Ex: ParisiFamily@hotmail.com might be used for five different people), thus email address matching is not 100% accurate. So I thought up Email Address, coupled with name matching.

Basically I'll compare the email address to an array with other emails, if the match is go, then it will start to compare the full name of the individual. If that matches, it is considered to be a successful match.

The problem:

Names change too. Not by much, but consider Robert Smith may now go by Bob Smith. Or Elizabeth is now Beth. So now my real question comes into play:

Is there a way I can use built in inaccurace when comparing the strings? I figure if I compare the new string

Liz Johnson

with the old String

Elizabeth Johnson

and I get XX% (thinking 50-75, open for input) of the characters matching, I'll consider that enough to call it a successful hit.

Does that sound do-able? Is there an easy function to work with this, or am I basically looping regular expressions?

Thanks for any help!

Link to post
Share on other sites

Here is a link you may find interesting.

Apparently it is not easy.

Anyway, here's a little script I made for fun to get the ball rolling for you.

$longname = StringLower(InputBox("full name","Enter long name"))

$shortname = StringLower(InputBox("short name","Enter short name"))

MsgBox(0,"Result",_IsShortFor($longname,$shortname) & " %")

Func _IsShortFor($L , $S)
    If StringInStr($L,$S) Then
        Return 99
    If StringLen($S) >= 3 And StringInStr($L,StringLeft($S,3)) Then
        Return 99

    Local $result
    $iCount = 0
    $Slen = StringLen($S)
    $aS = StringSplit($S,"",3)
    For $i = 0 To UBound($aS) -1
        $ipos = StringInStr($L,$aS[$i])
        If $ipos Then
            $L = StringReplace($L,$aS[$i],"")
            $iCount +=1
    $result =  Ceiling(($iCount/$Slen) * 100) -1
    Return $result



Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to post
Share on other sites

You should try material in those posts:

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...