Java postal address parser [closed]

南楼画角 提交于 2019-12-17 16:29:04

问题


Somewhat related to this question, but in the absence of any answer about QuickBooks specifically, does anyone know of an address parser for Java? Something that can take unstructured address information and parse out the address line 1, 2 and city state postal code and country?


回答1:


I do know that the Google Maps web service is great at doing this. So, if you want to use that, you could save a lot of effort.

The real issue here is that you need a worldwide database of city/country/province names to effectively parse UNSTRUCTURED addresses.

Here is how I build a URL for use by the Google Maps API in C#:

string url = "http://maps.google.com/maps/geo?key=" + HttpUtility.UrlEncode(this.apiKey) + "&sensor=false&output=xml&oe=utf8&q=" + HttpUtility.UrlEncode(location);



回答2:


The SourceForge JGeocoder has an address parser that you may find useful. See http://jgeocoder.sourceforge.net/parser.html.




回答3:


Might want to read this Stack Overflow question: "Parse usable Street Address, City, State, Zip from a string". No actual Java code to do the job (just some VB), but there is some discussion of the problem and more info on the alternative John Gietzen mentions, of using a web service to interpret it for you.




回答4:


The Mural project has an address parser: https://mural.dev.java.net/. I haven't figured out how to exract it from the larger Mural engine, but it does work based on some very limited tests.




回答5:


See www.address-parser.com, they offer a web service for parsing international addresses.



来源:https://stackoverflow.com/questions/877742/java-postal-address-parser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!