Giter Club home page Giter Club logo

address's Introduction

收货地址智能解析(纯PHP版)

Golang版本

Go语言地址智能解析

本项目包含2个功能

  • 把字符串解析成姓名、收货电话、邮编、身份证号、收货地址
  • 把收货地址解析成省、市、区县、街道地址

特色是:简单易用

该项目依然采用的是,统计特征分析,然后以最大的概率来匹配,得出大概率的解。因此只能解析中文的收货信息,不能保证100%解析成功,但是从生产环境的使用情况来看,解析成功率保持在96%以上,就算是百度基于人工智能的地址识别,经我实测,也是有一定的不能识别的情况。

由于上个项目address-smart-parse,地址解析的过程,是对照的数据库里面的地址库,有很多朋友看到相关代码的时候,不知如何改写,为了方便大家,写了一个纯PHP的,开箱即用。纯PHP版本采用遍历搜索,相对于DB的查询,有略微的性能损失,但解析一个地址仍然不到10ms,PHP开启Opcache更是解析1个地址不到5ms。

使用

so easy;

require 'address.php';
$string = '深圳市龙华区龙华街道1980科技文化产业园3栋317    张三    13800138000 518000 120113196808214821';
$r = Address::smart($string);
print_r($r);

结果为: image

demo.php里面有使用示例,如果字符串里面不包含电话,姓名,身份证等,只需要解析地址,可以用:

 Address::smart($string, $user = false);

反馈 &改进

Issue

如果有什么问题或建议,或者发现有不能识别,或者识别错误的地址, 提交到Github Issue 我会继续改进维护代码

协作

  1. fork,优化,PR
  2. 欢迎改写成其它语言版本,只需注明参考链接即可。

联系我

致谢

后来在网上我发现一些作者基于我的识别逻辑,写了js等版本,方便了大家,但是很少注明参考链接。 小小项目,开源不易,谢谢你能给一个star,另外我还在此项目上,写了一个addrss_pro版,解析更准确(准确率在98%左右)。如果此项目的star数目超过500,我也会开源分享出来,里面还会有一些注释,能体现解析的核心逻辑,到时,我也会分享golang的版本,谢谢

address's People

Contributors

pupuk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.