地址标准化
Project description
Geocoding
-
该模块用于将不规范(或者连续)的文本地址进行尽可能的标准化, 以及对两个地址进行相似度的计算
-
该模块为 IceMimosa/geocoding 项目的Python封装,原项目为Kotlin开发
-
为方便使用Python方法调用,这里使用Python的
jpype
模块将 IceMimosa/geocoding 进行封装,因此该模块需要Java环境的支持(需要添加JAVA_HOME等环境变量) -
安装命令
pip install GeocodingCHN
地址标准化
Geocoding.normalizing(address)
- address: 文本地址
from GeocodingCHN import Geocoding
text = '山东青岛李沧区延川路116号绿城城园东区7号楼2单元802户'
address_nor = Geocoding.normalizing(text)
print(address_nor)
Address(
provinceId=370000000000, province=山东省,
cityId=370200000000, city=青岛市,
districtId=370213000000, district=李沧区,
streetId=0, street=,
townId=0, town=,
villageId=0, village=,
road=延川路,
roadNum=116号,
buildingNum=7号楼2单元802户,
text=绿城城园东区
)
地址相似度计算
Geocoding.similarityWithResult(Address1, Address2)
-
Address1: 地址1, 由 Geocoding.normalizing 方法返回的 Address 类
-
Address2: 地址2, 由 Geocoding.normalizing 方法返回的 Address 类
from GeocodingCHN import Geocoding
text1 = '山东青岛李沧区延川路116号绿城城园东区7号楼2单元802户'
text2 = '山东青岛李沧区延川路绿城城园东区7-2-802'
Address_1 = Geocoding.normalizing(text1)
Address_2 = Geocoding.normalizing(text2)
similar = Geocoding.similarityWithResult(Address_1, Address_2)
print(similar)
0.9473309334313418
添加自定义地址
Geocoding.addRegionEntry(Id, parentId, name, RegionType, alias='')
-
Id: 地址的ID
-
parentId: 地址的父ID, 必须存在
-
name: 地址的名称
-
RegionType: RegionType,地址类型
-
alias: 地址的别名, default=''
-
return: bool
from GeocodingCHN import Geocoding
Geocoding.addRegionEntry(1, 321200000000, "A街道", Geocoding.RegionType.Street)
test_address = Geocoding.normalizing("江苏泰州A街道")
Address(
provinceId=320000000000, province=江苏省,
cityId=321200000000, city=泰州市,
districtId=321200000000, district=泰州市,
streetId=1, street=A街道,
townId=0, town=,
villageId=0, village=,
road=,
roadNum=,
buildingNum=,
text=
)
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
Built Distribution
File details
Details for the file GeocodingCHN-1.4.0.tar.gz
.
File metadata
- Download URL: GeocodingCHN-1.4.0.tar.gz
- Upload date:
- Size: 11.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 212738953ec8db710f511d085784b38aea4c14e4a4f5a7b1c9f66f1de56caf13 |
|
MD5 | d9a06063a76146841df7f249e2bf3704 |
|
BLAKE2b-256 | d97e0191b4d93e7a3d4817dcd71aaaed4cc5fd7bbb8eee13d33010e8d9eaa1c7 |
File details
Details for the file GeocodingCHN-1.4.0-py3-none-any.whl
.
File metadata
- Download URL: GeocodingCHN-1.4.0-py3-none-any.whl
- Upload date:
- Size: 11.1 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab0c82358d807e07fe3089f70234c3dd6c18b3537725516e77ee4284e9b8eb51 |
|
MD5 | 9ddfed58db9225f5644a53c712fbf536 |
|
BLAKE2b-256 | 6b72cf4ce915b6c6153b3c76b6a8ea713f1a71c09124bb38566f7bd56cb45090 |