当前位置:网站首页>一行代码实现地址信息解析
一行代码实现地址信息解析
2022-07-06 17:04:00 【朱卫军】
*本文完整示例代码及文件已上传至我的Github
仓库https://github.com/CNFeffery/PythonPracticalSkills*
这是我的系列文章「「Python实用秘技」」的第8期,本系列立足于笔者日常工作中使用Python
积累的心得体会,每一期为大家带来一个几分钟内就可学会的简单小技巧。
作为系列第8期,我们即将学习的是:一行代码解析地址信息
。
在日常数据处理的过程中,有时候拿到手的是完整的地址信息,如果需要从地址信息中解析出相应的各级行政单元名称,方式有很多,而今天要介绍的方式只需要一行代码即可快速实现。
首先我们需要安装jionlp
这个非常好用的文本预处理工具包,建议使用国内镜像安装:
pip install jionlp -i https://pypi.douban.com/simple/
安装完成后,只需要使用其parse_location()
接口即可进行地址信息的解析,且具有多种不同的功能:
- 基础的省市区信息提取
- 街镇乡、村或居委会信息提取
通过设置参数town_village=True
,还可以额外尝试提取出街镇乡、村或居委会信息等级别的信息字段:
- 自动补全省市信息
若地址信息中缺失省市信息也无妨,在不存在歧义的情况下,parse_location()
会自动关联并补全相关信息:
除此之外,parse_location()
还具有旧地名修正为新地名、自定义行政区划词典等功能,你可以在其官方文档https://github.com/dongrixinyu/JioNLP/wiki/Gadget-说明文档#地址解析
中了解更多。
本期分享结束,咱们下回见~
边栏推荐
- Notes of training courses selected by Massey school
- Web project com mysql. cj. jdbc. Driver and com mysql. jdbc. Driver differences
- Personal digestion of DDD
- 【软件逆向-自动化】逆向工具大全
- VTK volume rendering program design of 3D scanned volume data
- Model-Free Control
- System activity monitor ISTAT menus 6.61 (1185) Chinese repair
- uniapp实现从本地上传头像并显示,同时将头像转化为base64格式存储在mysql数据库中
- Zynq transplant ucosiii
- Learn self 3D representation like ray tracing ego3rt
猜你喜欢
The way of intelligent operation and maintenance application, bid farewell to the crisis of enterprise digital transformation
Attention SLAM:一种从人类注意中学习的视觉单目SLAM
Testers, how to prepare test data
[software reverse - solve flag] memory acquisition, inverse transformation operation, linear transformation, constraint solving
Distributed cache
The programmer resigned and was sentenced to 10 months for deleting the code. Jingdong came home and said that it took 30000 to restore the database. Netizen: This is really a revenge
Deep learning environment configuration jupyter notebook
一图看懂对程序员的误解:西方程序员眼中的中国程序员
stm32F407-------SPI通信
三维扫描体数据的VTK体绘制程序设计
随机推荐
X.509 certificate based on go language
Configuring the stub area of OSPF for Huawei devices
equals()与hashCode()
2021 SASE integration strategic roadmap (I)
Attention SLAM:一种从人类注意中学习的视觉单目SLAM
build. How to configure the dependent version number in the gradle file
三维扫描体数据的VTK体绘制程序设计
Leecode brush questions record sword finger offer 44 A digit in a sequence of numbers
System activity monitor ISTAT menus 6.61 (1185) Chinese repair
Mujoco finite state machine and trajectory tracking
fastDFS数据迁移操作记录
Mujoco Jacobi - inverse motion - sensor
Leecode brush questions record interview questions 32 - I. print binary tree from top to bottom
Linear algebra of deep learning
Advanced learning of MySQL -- Fundamentals -- four characteristics of transactions
Leecode brush question record sword finger offer 58 - ii Rotate string left
Mujoco produces analog video
Advanced learning of MySQL -- basics -- multi table query -- subquery
Sword finger offer 26 Substructure of tree
英雄联盟|王者|穿越火线 bgm AI配乐大赛分享