Giter VIP home page Giter VIP logo

gpoat / address-smart-parse Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pupuk/address-smart-parse

0.0 1.0 0.0 216 KB

智能解析收货地址,成功率96%以上,支持(身份证号,电话,座机,区号,省市区街道地址)A smart address parser write by PHP. Get name&receiver phone &post code &address from a complicated string. Get province, city ,area, and street address.

PHP 99.99% HTML 0.01%

address-smart-parse's Introduction

收货地址智能解析

此项目已经停止维护,欢迎使用纯PHP版本

https://github.com/pupuk/address

------------------------------old------------------------------

本项目包含2个功能(可以单独使用)
1. 把字符串解析成姓名、收货电话、邮编、收货地址
2. 把收货地址解析成省、市、区县、街道小区地址

在代购业务中,会经常遇到,客户把收货信息(包含姓名,电话,收货地址的字符串,往往还不会分开,会连在一起)发给代购,代购再到采购平台下单,但是代购会把姓名,收货地址这些信息分开复制,工作量会比较大。本项目正是可以实现收货地址信息的智能解析,让代理解双手,让代理爱上采购平台。

该项目采用的是,统计特征分析,然后以最大的概率来匹配,得出大概率的解。因此只能解析中文的收货信息,而且不能保证100%解析成功,但是从生产环境的使用情况来看,解析成功率保持在96%以上。

如果有什么问题或建议,可以 提交Github Issue

关于如何加入

如果有更好的思路,或者优化建议,可以:

  1. fork该项目
  2. 提交Pull Requests
  3. 如果积极贡献,可以放开权限
  4. 欢迎改写成其它语言版本,只需注明参考链接即可。

其它贡献者的改写版本

1. 把字符串解析成姓名、收货电话、邮编、收货地址

使用parse_prepare.php文件中的Address::smart_parse方法,该静态方法接受字符串,返回数组。如:

Address::smart_parse('身份证号:51250119910927226x 收货地址张三收货地址:成都市武侯区美领馆路11号附2号 617000  136-3333-6666 ');

返回:

array(5) {
  ["name"]=>
  string(6) "张三"
  ["mobile"]=>
  string(11) "13633336666"
  ["postcode"]=>
  string(6) "617000"
  ["idno"]=>
  string(18) "51250119910927226X"
  ["detail"]=>
  string(42) "成都市武侯区美领馆路11号附2号"
}

2. 把收货地址解析成省、市、区县、街道小区地址

使用parse_detail.php文件中的$obj = AddressDetail::detail_parse($str)方法,该静态方法接受字符串,同样返回数组。但该文件要配合项目的的地址库 area.sql 才能使用,如:

AddressDetail::detail_parse('成都市高新区天府软件园B区科技大楼');

返回数组

array(3) {
  [1]=>
  array(2) {
    ["area_id"]=>
    23
    ["area_name"]=>
    "四川省"
  }
  [2]=>
  array(2) {
    ["area_id"]=>
    385
    ["area_name"]=>
    "成都市"
  }
  [3]=>
  array(2) {
    ["area_id"]=>
    5100
    ["area_name"]=>
    "高新区"
  }
}

3. 联系作者

address-smart-parse's People

Contributors

pupuk avatar liuxc2016 avatar outoffl avatar

Watchers

James Cloos 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.