Is there a library for parsing US addresses?

后端 未结 7 566
伪装坚强ぢ
伪装坚强ぢ 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:32

    Quite a few of these answers are a few years old now.

    The most bulletproof library I've seen recently is usaddress: https://github.com/datamade/usaddress:

    • Far more accurate than address which we'd been using for a year now https://pypi.python.org/pypi/address/0.1.1.
    • Yet to see it fail on an address
    • Still being committed to as of this writing

    Pro tip: when testing addresses in all these libraries, use 1) no commas in your address, 2) multi-word city names preferably with "St." in the name to see if the library can differentiate between "street" and "Saint" (e.g., St. Louis), and 3) improper casing. This combo will typically make even the better parsers fall down.

    0 讨论(0)
提交回复
热议问题