Address parsing algorithm needed please

J

Jon Lewis

Hi, I'm looking for an Address parsing algorithm in VB6/VBA, preferably for
UK addresses. I want to replicate what Microsoft Outlook does if you paste
an complete address in the address field of a Contact record when the Check
Details box pops up with an estimated parsing into Street, City, Region etc.
(Have Googled to no avail.)

TIA
 
M

MikeD

Jon Lewis said:
Hi, I'm looking for an Address parsing algorithm in VB6/VBA, preferably
for UK addresses. I want to replicate what Microsoft Outlook does if you
paste an complete address in the address field of a Contact record when
the Check Details box pops up with an estimated parsing into Street, City,
Region etc. (Have Googled to no avail.)


What have you tried to do so far on your own? What problem(s) are you
encountering?
 
J

Jon Lewis

No problems as such. I'm refering to the logic required to parse a single
address text string into street, city, region, post code etc. Just seeing
if I can find a ready made algorithm before attempting to write my own.

Jon
 
P

Paul Shapiro

There won't be an easy answer. Even if you assume that all entries are
correctly formatted, the allowed variations are too big to make this easy.
There are commercial applications that do this nicely, but they were pricy
the last time I looked. With the advent of web services, maybe some of these
have more reasonably priced subscriptions now. You can search for "address
correction software".
 
J

Jon Lewis

I know it's not easy logic and I'm not bothered with data cleasing - I just
need an algorithm to use for splitting a chunk of Contact data from say a
web page to paste into a database of separate address fields via a check
form (like the Outlook form described in my original post). I thought that
Outlook's method may have been replicated though I'm not too hopeful!
 
A

a a r o n . k e m p f

It's not really practical to code this.

I would call up Experian QAS and buy their address verification
software
 
D

Dirk Goldgar

Jon Lewis said:
I know it's not easy logic and I'm not bothered with data cleasing - I just
need an algorithm to use for splitting a chunk of Contact data from say a
web page to paste into a database of separate address fields via a check
form (like the Outlook form described in my original post). I thought that
Outlook's method may have been replicated though I'm not too hopeful!


Have you checked to see if you can do this by automating Outlook?
 
J

Jon Lewis

I thought about it Dirk but I don't really want Outlook dependency - guess
I'll have to roll my own.
Thanks
 
B

Boris Pauljev

dim sFirstName$
dim sLastName$
dim sTitle$
dim sStreet$
dim sZipCode$
dim sCountry$
(...)

dim sLines() as string
sLines = Split(uText, vbnewline)

dim l&
for l = 0 to ubound(slines)

dim sLine$
sLine = slines(l)

if len(sline)=0 then 'if this line is not empty and not erased by ourselves

'Try to find country first because it's most easy to determine it
if len(sCountry)=0 then
if IsCountry(sLine) then
sCountry = sLine
sLines(l) =""'erase it to clean up what was already processed
end if
elseif len(szipcode)=0 then
if iszipcode(sline) then
sZipCode = sLine
slines(l) = ""'erase it to clean up what was already processed
end if
else
(...)
end if
next l

.... the rest is your work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top