https://github.com/wingkwong/hk-address-parser
The universal python library for Hong Kong Address Parser
https://github.com/wingkwong/hk-address-parser
hk-address-parser hkaddressparser hkap hong-kong-address-parser
Last synced: 6 months ago
JSON representation
The universal python library for Hong Kong Address Parser
- Host: GitHub
- URL: https://github.com/wingkwong/hk-address-parser
- Owner: wingkwong
- License: mit
- Created: 2019-09-25T16:01:01.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-10-16T04:28:55.000Z (12 months ago)
- Last Synced: 2025-03-22T14:34:51.438Z (7 months ago)
- Topics: hk-address-parser, hkaddressparser, hkap, hong-kong-address-parser
- Language: Python
- Homepage:
- Size: 34.2 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
===============================
hk-address-parser - The Universal Python Library for HKAddressParser
===============================hk-address-parser is a Python library for `Hong Kong Address Parser`_
.. _`Hong Kong Address Parser`: https://g0vhk-io.github.io/HKAddressParser
Getting Started
~~~~~~~~~~~~~~~
Assuming that you have Python and ``virtualenv`` installed:.. code-block:: sh
$ git clone https://github.com/wingkwong/hk-address-parser.git
$ cd hk-address-parser
$ virtualenv venv
...
$ . venv/bin/activate
$ pip install -r requirements.txt
$ pip install -e .Format the code before committing it using ``black``
.. code-block:: sh
$ make black
Usage
~~~~~~~~~~~~~~~
Import the library.. code-block:: python
from hk_address_parser import AddressParser
Single Query
.. code-block:: python
address = AddressParser.parse( "Eaton Hotel, 380 Nathan Road, Jordan")
Batch Query
.. code-block:: python
addresses = AddressParser.parse(
[
"九龍觀塘海濱道 181號 9樓",
"九龍長沙灣道 303號長沙灣政府合署 12樓",
"九龍啟德協調道 3號工業貿易大樓 5樓",
"香港中環統一碼頭道 38號海港政府大樓 7樓",
"香港北角渣華道 333號北角政府合署 12樓1210-11室",
"九龍旺角聯運街 30號旺角政府合署 5樓 503室",
"九龍觀塘鯉魚門道 12號東九龍政府合署 7樓",
"九龍深水埗南昌邨南昌社區中心高座 3樓",
"九龍黃大仙龍翔道 138號龍翔辦公大樓 8樓 801室",
"新界沙田上禾輋路 1號沙田政府合署 7樓 708-714室",
"新界大埔墟鄉事會街 8號大埔綜合大樓 4樓",
"新界荃灣大河道 60號雅麗珊社區中心 3樓",
"新界屯門震寰路 16號大興政府合署 2樓 201室",
"新界元朗橋樂坊 2號元朗政府合署暨大橋街市 12樓"
]Methods
~~~~~~~~~~~~~~~
Return a flatten component of a given address... code-block:: python
address.components(lang)
Return a full address in a given language.
.. code-block:: python
address.full_address(lang)
Return a coordinate of a given address. Used for single query.
.. code-block:: python
address.coordinate()
Return a list of coordinates of given addresses. Used for batch query.
.. code-block:: python
address.coordinates()
Return the data source, either OCGIO or Land Department.
.. code-block:: python
address.data_source(lang)
Return a confidence value of a given address.
.. code-block:: python
address.confidence()