address_extractor
A script to extract US-style street addresses from a text file
$ address_extractor 1600 Pennsylvania Ave NW, Washington, DC 20500 ^D 1 lines in input ,1600 Pennsylvania Ave NW,Washington DC 20500 $ address_extractor -o output.csv input.csv 4361 lines in input *snip* 11 lines unable to be parsed $ ls output.csv
address_extractor takes text or a text file containing address-like data, one address per line, and parses it into a uniform format with the usaddress package.
Installation
This package is available from PyPi via pip:
pip install address_extractor
This will install the module as well as the command-line script as address_extractor.
Command-line Usage
address_extractor [-h] [-o OUTPUT] [--remove-post-zip] [input]
positional arguments:
input the input file. Defaults to stdin.
optional arguments:
-h, --help show this help message and exit
-o OUTPUT, --output OUTPUT
the output file. Defaults to stdout.
--remove-post-zip, -r
when scanning the input lines, remove everything after
a sequence of 5 digits followed by a comma. The
parsing library used by this script chokes on
addresses containing this kind of information, often a
county name.
Lines that could not be parsed will be printed to STDERR. They can be saved to a file with standard bash redirection techniques:
$ address_extractor -o good_addresses.csv has_some_bad_addresses.txt 2> bad_addresses.txt
Usage as a Module
address_extractor can be used as a Python module:
>>> import address_extractor >>> address_extractor.main(input=input_file_object, output=output_file_object, remove_post_zip=a_bool)
There are some small issues with this implementation:
If using
sys.stdinorsys.stdoutfor input or output, respectively, the file objects will still be closed. This presents issues trying to use these in the future.Errored lines are still printed to
sys.stderrwhich may not be expected.
Versions and Stability
This package is uploaded as a 0.1.0 release. There are no tests and little error checking–it originated as a quick-‘n-dirty script and I decided to release it as a package to gain familiarity with that process.
Issues, comments, and pull requests are welcome at the GitHub page!
Metadata
Release files for address_extractor 0.1.0.post1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| address_extractor-0.1.0.post1.tar.gz | 4.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| address_extractor-0.1.0.post1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.6 kB
Release files / address_extractor-0.1.0.post1.tar.gz
| Download URL | address_extractor-0.1.0.post1.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fd62961905c9bae63223b4624116571953a4a83b7c2b473ef3d4a51eccd40a9d
|
|
BLAKE2b-256 checksum How to use checksums |
198aa0b8e6676e7fe5a7d553a44d90608236236aeac7d72505b717b2049179b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / address_extractor-0.1.0.post1-py3-none-any.whl
| Download URL | address_extractor-0.1.0.post1-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b5983231c123a92d0b6fb8c45ffb763d102b6692fc007fe34e2ac486902afe6b
|
|
BLAKE2b-256 checksum How to use checksums |
40a96e20672d4bbaa5e7c3871ca29429d1703acea6312159225f564657da23ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for address_extractor 0.1.0.post1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.