Is there a library for parsing US addresses?

后端 未结 7 568
伪装坚强ぢ
伪装坚强ぢ 2021-01-30 11:54

I have a list of US addresses I need to break into city,state, zip code,state etc.

example address : \"16100 Sand Canyon Avenue, Suite 380 Irvine, CA 92618\"

Do

7条回答
  •  礼貌的吻别
    2021-01-30 12:06

    That pyparsing library looks very interesting and seems to do a nice job with a variety of examples. And I think that's a more readable alternative to raw regular expressions (which aren't really a good solution for this problem).

    Be aware that that kind of solution implies that you will, at some point, be standardizing addresses that aren't valid...they'll just appear valid. If knowing whether an address is in fact, real (and perhaps deliverable) is important to your application then you should be using a USPS-Certified service that using Delivery Point Validation (DPV). I am a developer for SmartyStreets, which provides just such a service, along with SDKs that make integration easy (here's a succinct sample).

    The responses come back standardized according to USPS Publication 28. The API is free for low-usage users.

提交回复
热议问题