当前位置:网站首页>一行代码实现地址信息解析
一行代码实现地址信息解析
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-说明文档#地址解析
中了解更多。
本期分享结束,咱们下回见~
边栏推荐
- Advanced learning of MySQL -- basics -- multi table query -- subquery
- Matlab learning notes
- 深度学习之线性代数
- Command line kills window process
- . Bytecode structure of class file
- Mujoco Jacobi - inverse motion - sensor
- 学习光线跟踪一样的自3D表征Ego3RT
- 2022/2/12 summary
- Rails 4 asset pipeline vendor asset images are not precompiled
- Win10 startup error, press F9 to enter how to repair?
猜你喜欢
Threejs image deformation enlarge full screen animation JS special effect
Learn to use code to generate beautiful interface documents!!!
2022/2/12 summary
用tkinter做一个简单图形界面
. Bytecode structure of class file
Attention slam: a visual monocular slam that learns from human attention
Stm32f407 ------- DAC digital to analog conversion
AI超清修复出黄家驹眼里的光、LeCun大佬《深度学习》课程生还报告、绝美画作只需一行代码、AI最新论文 | ShowMeAI资讯日报 #07.06
三维扫描体数据的VTK体绘制程序设计
深度学习之数据处理
随机推荐
三维扫描体数据的VTK体绘制程序设计
stm32F407-------SPI通信
Advanced learning of MySQL -- basics -- multi table query -- subquery
Advanced learning of MySQL -- basics -- multi table query -- joint query
Leecode brush questions record interview questions 32 - I. print binary tree from top to bottom
JS+SVG爱心扩散动画js特效
Advantages and disadvantages of code cloning
Configuring the stub area of OSPF for Huawei devices
If the college entrance examination goes well, I'm already graying out at the construction site at the moment
[software reverse automation] complete collection of reverse tools
Threejs image deformation enlarge full screen animation JS special effect
Equals() and hashcode()
Hero League | King | cross the line of fire BGM AI score competition sharing
[yolov5 6.0 | 6.1 deploy tensorrt to torch serve] environment construction | model transformation | engine model deployment (detailed packet file writing method)
【批处理DOS-CMD命令-汇总和小结】-字符串搜索、查找、筛选命令(find、findstr),Find和findstr的区别和辨析
以机房B级建设标准满足等保2.0三级要求 | 混合云基础设施
The difference between redirectto and navigateto in uniapp
File and image comparison tool kaleidoscope latest download
Configuring OSPF basic functions for Huawei devices
【批处理DOS-CMD命令-汇总和小结】-查看或修改文件属性(ATTRIB),查看、修改文件关联类型(assoc、ftype)