The ZIP Code Finder for Taiwan
This package lets you find ZIP code by address in Taiwan.
The main features:
Fast. It builds ZIP code index by tokenization.
Gradual. It returns partial ZIP code rather than noting when address is not detailed enoguh.
Stand-alone. It depends on nothing.
Usage
Find ZIP code gradually:
>>> import zipcodetw
>>> zipcodetw.find('臺北市')
u'1'
>>> zipcodetw.find('臺北市信義區')
u'110'
>>> zipcodetw.find('臺北市信義區市府路')
u'110'
>>> zipcodetw.find('臺北市信義區市府路1號')
u'11008'
After v0.3, you even can find ZIP code like:
>>> zipcodetw.find('松山區')
u'105'
>>> zipcodetw.find('秀山街')
u''
>>> zipcodetw.find('台北市秀山街')
u'10042'
Installation
It is available on PyPI:
$ sudo pip install zipcodetw
Just install it and have fun. :)
Build Index Manually
If you install it by pip or python setup.py install, a ZIP code index will be built automatically. But if you want to use it from source code, you have to build an index manually:
$ python -m zipcodetw.builder
Data
The ZIP code directory is provided by Chunghwa Post, and is available from: http://www.post.gov.tw/post/internet/Download/all_list.jsp?ID=2201#dl_txt_s_A0206
Changelog
v0.6.5
Updated to the 3+3 v2102.01 data.
Fixed a Python 3 bug, maybe.
v0.6.2–0.6.4
A black hole ate the logs.
v0.6.1
Fixed the py2 py3 compatibility. Thanks the contribution from Poren Chiang and Ryan.
v0.6
Updated the data to 2014/12.
v0.5.7
Fixed a rarely issue that causes IndexError.
v0.5.6
Reverted removing insignificant tokens introduced in v0.5.4.
It now handles insignificant tokens; and
redundant units in the finding logic (directory.find).
Allowed number token ends without unit.
Now address.tokens is a list.
v0.5.5
Fixed a gradual matching issue causing some wrong results.
v0.5.4
Removed the token whose unit is insignificant automatically.
v0.5.3
Fixed and simplified the matching logic for address tail.
Refined the index building logic.
v0.5.2
Fixed the issue while it was running in multi-threaded environment.
Added a new argument, keep_alive, for the Directory class.
v0.5.1
Refined the code slightly.
v0.5
It now builds a ZIP code index when you install it; so
the package size is 12.5x smaller.
The internal API is better now.
v0.4
It now shipped with an index compiled in SQLite; so
initiation time is ~680x faster, i.e. ~30ms each import; and
zipcodetw.find is ~1.9x slower, i.e. ~2ms each call; and
has bigger package size.
All code was moved into zipcodetw package.
zipcodetw.find now returns unicode instead of string.
v0.3
It builds full index for middle tokens; and
also normalizes Chinese numerals now!
zipcodetw.find is ~1.06x faster.
But initiation time increases to ~1.7x.
v0.2
zipcodetw.find is 8x faster now!
It has a better tokenizing logic; and
a better matching logic for sub-number now.
zipcodetw.find_zipcodes was removed.
Internal API was changed a lot.
The tests are better now.
Metadata
Release files for zipcodetw 0.6.8
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 | Actions |
|---|---|---|---|---|
| zipcodetw-0.6.8.tar.gz | 592.4 kB | Without provenance | Details for zipcodetw-0.6.8.tar.gz |
Release files / zipcodetw-0.6.8.tar.gz
| Download URL | zipcodetw-0.6.8.tar.gz |
|---|---|
| Size | 592.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b6d9e7816d76da58d313da3d789f439c5f841effe39d4c552a9b4d6504dbd120
|
|
BLAKE2b-256 checksum How to use checksums |
e5b27a8df28853a6ae4baafb9dde6758326f403c163fc155a67695c002a76f77
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/3.7
|
Security for zipcodetw 0.6.8
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.