Coder Social home page Coder Social logo

jcpca's Introduction

jcpca

java版本用于从**地址提取省、市、区(县)
实现和使用主要参考:https://github.com/DQinYuan/chinese_province_city_area_mapper
分词器工具:https://github.com/hankcs/AhoCorasickDoubleArrayTrie
省市区数据来自数据来自国家统计局网站公开数据

Get Started

CpcaExtractor cpcaExtractor = CpcaExtractors.builder().withCpcaCvsFile("adcodes.csv").build();
CpcaSeg cpcaSeg = cpcaExtractor.transform("浙江省杭州市拱墅区祥园路300号");
System.out.println(cpcaExtractor.encodeJson(cpcaSeg));

结果显示:

{"provinceName":"浙江省","cityName":"杭州市","areaName":"拱墅区","cpcaCode":"330105","address":"祥园路300号","provinceNameIndex":{"beginIndex":0,"endIndex":3},"cityNameIndex":{"beginIndex":3,"endIndex":6},"areaNameIndex":{"beginIndex":6,"endIndex":9}}

**行政区(县)这一级别有重名,只有区县时没法确定是哪个区(县),这个时候需要通过umap参数来指定用哪个区(县),比如解析朝阳区的地址:

Map<String, String> umap = new HashMap<>();
umap.put("朝阳区", "110105");
CpcaSeg cpcaSeg = cpcaExtractor.transform("朝阳区汉庭酒店大山子店", umap);
System.out.println(cpcaExtractor.encodeJson(cpcaSeg));

结果显示:

{"provinceName":"吉林省","cityName":"长春市","areaName":"朝阳区","cpcaCode":"220104","address":"汉庭酒店大山子店","areaNameIndex":{"beginIndex":0,"endIndex":3}}

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.