pyap2


Namepyap2 JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://github.com/argyle-engineering/pyap
SummaryPyap2 is a maintained fork of pyap, a regex-based library for parsing US, CA, and UK addresses. The fork adds typing support, handles more address formats and edge cases.
upload_time2024-04-29 13:26:34
maintainerNone
docs_urlNone
authorArgyle Developers
requires_python<4.0,>=3.9
licenseMIT
keywords address parser regex
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Pyap2: Python address parser
============================


Pyap2 is a maintained fork of Pyap, a regex-based python library for
detecting and parsing addresses. Currently it supports US πŸ‡ΊπŸ‡Έ, Canadian πŸ‡¨πŸ‡¦ and British πŸ‡¬πŸ‡§ addresses. 


.. code-block:: python

    >>> import pyap
    >>> test_address = """
        Lorem ipsum
        225 E. John Carpenter Freeway, 
        Suite 1500 Irving, Texas 75062
        Dorem sit amet
        """
    >>> addresses = pyap.parse(test_address, country='US')
    >>> for address in addresses:
            # shows found address
            print(address)
            # shows address parts
            print(address.as_dict())
    ...




Installation
------------

To install Pyap2, simply:

.. code-block:: bash

    $ pip install pyap2



About
-----
We started improving the original `pyap` by adopting poetry and adding typing support. 
It was extensively tested in web-scraping operations on thousands of US addresses. 
Gradually, we added support for many rarer address formats and edge cases, as well 
as the ability to parse a partial address where only street info is available. 


Typical workflow
----------------
Pyap should be used as a first thing when you need to detect an address
inside a text when you don't know for sure whether the text contains
addresses or not.


Limitations
-----------
Because Pyap2 (and Pyap) is based on regular expressions it provides fast results.
This is also a limitation because regexps intentionally do not use too
much context to detect an address.

In other words in order to detect US address, the library doesn't
use any list of US cities or a list of typical street names. It
looks for a pattern which is most likely to be an address.

For example the string below would be detected as a valid address: 
"1 SPIRITUAL HEALER DR SHARIF NSAMBU SPECIALISING IN"

It happens because this string has all the components of a valid
address: street number "1", street name "SPIRITUAL HEALER" followed
by a street identifier "DR" (Drive), city "SHARIF NSAMBU SPECIALISING"
and a state name abbreviation "IN" (Indiana).

The good news is that the above mentioned errors are **quite rare**.




            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/argyle-engineering/pyap",
    "name": "pyap2",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "address, parser, regex",
    "author": "Argyle Developers",
    "author_email": "developers@argyle.io",
    "download_url": "https://files.pythonhosted.org/packages/f3/35/5412ef4001de13b6e1f731cf13462859b6432baf3ff68298dbe153d84dbf/pyap2-0.1.1.tar.gz",
    "platform": null,
    "description": "Pyap2: Python address parser\n============================\n\n\nPyap2 is a maintained fork of Pyap, a regex-based python library for\ndetecting and parsing addresses. Currently it supports US \ud83c\uddfa\ud83c\uddf8, Canadian \ud83c\udde8\ud83c\udde6 and British \ud83c\uddec\ud83c\udde7 addresses. \n\n\n.. code-block:: python\n\n    >>> import pyap\n    >>> test_address = \"\"\"\n        Lorem ipsum\n        225 E. John Carpenter Freeway, \n        Suite 1500 Irving, Texas 75062\n        Dorem sit amet\n        \"\"\"\n    >>> addresses = pyap.parse(test_address, country='US')\n    >>> for address in addresses:\n            # shows found address\n            print(address)\n            # shows address parts\n            print(address.as_dict())\n    ...\n\n\n\n\nInstallation\n------------\n\nTo install Pyap2, simply:\n\n.. code-block:: bash\n\n    $ pip install pyap2\n\n\n\nAbout\n-----\nWe started improving the original `pyap` by adopting poetry and adding typing support. \nIt was extensively tested in web-scraping operations on thousands of US addresses. \nGradually, we added support for many rarer address formats and edge cases, as well \nas the ability to parse a partial address where only street info is available. \n\n\nTypical workflow\n----------------\nPyap should be used as a first thing when you need to detect an address\ninside a text when you don't know for sure whether the text contains\naddresses or not.\n\n\nLimitations\n-----------\nBecause Pyap2 (and Pyap) is based on regular expressions it provides fast results.\nThis is also a limitation because regexps intentionally do not use too\nmuch context to detect an address.\n\nIn other words in order to detect US address, the library doesn't\nuse any list of US cities or a list of typical street names. It\nlooks for a pattern which is most likely to be an address.\n\nFor example the string below would be detected as a valid address: \n\"1 SPIRITUAL HEALER DR SHARIF NSAMBU SPECIALISING IN\"\n\nIt happens because this string has all the components of a valid\naddress: street number \"1\", street name \"SPIRITUAL HEALER\" followed\nby a street identifier \"DR\" (Drive), city \"SHARIF NSAMBU SPECIALISING\"\nand a state name abbreviation \"IN\" (Indiana).\n\nThe good news is that the above mentioned errors are **quite rare**.\n\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Pyap2 is a maintained fork of pyap, a regex-based library for parsing US, CA, and UK addresses. The fork adds typing support, handles more address formats and edge cases.",
    "version": "0.1.1",
    "project_urls": {
        "Documentation": "https://github.com/argyle-engineering/pyap",
        "Homepage": "https://github.com/argyle-engineering/pyap",
        "Repository": "https://github.com/argyle-engineering/pyap"
    },
    "split_keywords": [
        "address",
        " parser",
        " regex"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c624fbeb1a38b672190340fc4df75c6255a028b6b1ea1eab2ea0ddd7dc773db4",
                "md5": "d526606eb0b2460d243f773ccfe2aea9",
                "sha256": "d31d45f03c1d48b39b5e96ab483671037854dad04aced6952b8037402bf5bcc7"
            },
            "downloads": -1,
            "filename": "pyap2-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d526606eb0b2460d243f773ccfe2aea9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 22433,
            "upload_time": "2024-04-29T13:26:32",
            "upload_time_iso_8601": "2024-04-29T13:26:32.427776Z",
            "url": "https://files.pythonhosted.org/packages/c6/24/fbeb1a38b672190340fc4df75c6255a028b6b1ea1eab2ea0ddd7dc773db4/pyap2-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f3355412ef4001de13b6e1f731cf13462859b6432baf3ff68298dbe153d84dbf",
                "md5": "6eace96531f1ea54228139ca3b0c5b3e",
                "sha256": "54e81259f0f210d11cd503985e26b4a5fa2a4c9bb1bace1ae8a462364883683b"
            },
            "downloads": -1,
            "filename": "pyap2-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "6eace96531f1ea54228139ca3b0c5b3e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 18812,
            "upload_time": "2024-04-29T13:26:34",
            "upload_time_iso_8601": "2024-04-29T13:26:34.213581Z",
            "url": "https://files.pythonhosted.org/packages/f3/35/5412ef4001de13b6e1f731cf13462859b6432baf3ff68298dbe153d84dbf/pyap2-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-29 13:26:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "argyle-engineering",
    "github_project": "pyap",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "pyap2"
}
        
Elapsed time: 0.26168s