We have a program that displays map data (think Google Maps, but with much more interactivity and custom layers for our clients).
We allow navigation via a set of combo
Geocoder.ca cleans up, standardizes and geocodes location address strings. It appends postal code, timezone and area code too.
For eg: https://geocoder.ca/22%20Main%20St,%20Kitchener,%20On?geoit=xml
<geodata>
<latt>43.286272</latt>
<longt>-80.445823</longt>
<postal>N0B1E1</postal>
<Dissemination_Area><dauid>35300802</dauid><adauid>35300042</adauid></Dissemination_Area>
<AreaCode>226,519</AreaCode>
<TimeZone>America/Toronto</TimeZone>
<standard>
<stnumber>22</stnumber><staddress>Main ST</staddress><city>Kitchener</city><prov>ON</prov><confidence>0.7</confidence></standard>
</geodata>
Simson Garfinkel worked one up for his nifty address book for NeXTstep
(which was later compiled and updated for Mac OS X and submitted to an Apple Design contest). Since then, it has been open sourced and is available from his website below:
http://simson.net/ref/sbook5/
Incidentally, have you seen a new API endpoint that SmartyStreets is experimenting with? It extracts addresses from text and validates them and converts them into components.
Refer to this other Stack Overflow post which goes into more detail. I work at SmartyStreets and helped to develop it, so I can tell you that this is a very hard problem, even if from the surface it seems simple.
This is essentially a class of the Named Entity Resolution problem. NER on Wikipedia
The best way to approach this is to parse the address using a language transducer to identify various constructs - an approach is similar to using regular expressions with a finite state machine.
I've had great success with the Java NLP and Machine learning framework called GATE, and their transducer lib is called Jape. Check out their GUI, and use that to write some Java code for it!
Their built in examples should get you started with the basics, and you can then extend it as needed. Essentially, it compartmentalizes text into components using the rules and the rule engine, so something like,
Xyz, Blah St,
Foo City, 11110, CA
would be translated to,
Place: Xyz
Street: Blah St
City: Foo
...
And then you can use your database of locations to do matches.
Jape also supports dictionary lookups, apart from rules - so if you already have "Blah St" in your database, and it has 2 parents - city Foo and Bar - you just disambiguate by parsing the next line.
Edit: GATE includes a tool called ANNIE - an information extraction system, that can be played around with to identify addresses. This uses some built in Jape rules that you can build upon.