Skip to main content

Find Taiwan ZIP code by address fuzzily.

Project description

https://pypip.in/v/zipcodetw/badge.png https://pypip.in/d/zipcodetw/badge.png

The ZIP Code Finder for Taiwan

This package lets you find ZIP code by address in Taiwan.

The main features:

  1. Fast. It builds ZIP code index by tokenization.

  2. Gradual. It returns partial ZIP code rather than noting when address is not detailed enoguh.

  3. 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 can find ZIP code fuzzier:

>>> 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. :)

Data

The ZIP code directory we use is provided by Chunghwa Post, and is available from: http://www.post.gov.tw/post/internet/down/index.html#1808

Changelog

v0.4

  1. It now shipped with an index compiled in SQLite; so

  2. initiation time is ~680x faster, i.e. ~30ms each import; and

  3. zipcodetw.find is ~1.9x slower, i.e. ~2ms each call; and

  4. has bigger package size.

  5. All code was moved into zipcodetw package.

  6. zipcodetw.find now returns unicode instead of string.

v0.3

  1. It builds full index for middle tokens; and

  2. also normalizes Chinese numerals now!

  3. zipcodetw.find is ~1.06x faster.

  4. But initiation time increases to ~1.7x.

v0.2

  1. zipcodetw.find is 8x faster now!

  2. It has a better tokenizing logic; and

  3. a better matching logic for sub-number now.

  4. zipcodetw.find_zipcodes was removed.

  5. Internal API was changed a lot.

  6. The tests are better now.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zipcodetw-0.4.tar.gz (5.4 MB view details)

Uploaded Source

File details

Details for the file zipcodetw-0.4.tar.gz.

File metadata

  • Download URL: zipcodetw-0.4.tar.gz
  • Upload date:
  • Size: 5.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for zipcodetw-0.4.tar.gz
Algorithm Hash digest
SHA256 5fa55ac9876d8b5a7bdba578b2b3b8acc7b30d739660f829fff9cae9ba688c21
MD5 2df4c5c52f79368d19e2c540e15a5d02
BLAKE2b-256 5c82c738889c0ea180aed0c949ceb96c6df98dbede0b029b41e7bea4d98c57ac

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page