阿里云地址标准化服务使用Java SDK示例

本文涉及的产品
地址标准化addrp,10QPS
简介: 地址标准化(Address Purification)是依托阿里云海量的地址语料库,以及超强的NLP算法实力所沉淀出的高性能及高准确率的标准地址算法服务。该地址算法服务能解决一地多名,地址识别,地址真伪辨别等多种问题,为企业,政府机关以及开发者提供地址数据清洗,地址标准化能力,使地址数据更好的为业务提供支持。 本文分别使用服务SDK及Core SDK演示该服务的Java SDK调用方法。

Step By Step

1、服务开通地址
图片.png

2、创建项目
图片.png

3、控制台快速校验测试
图片.png

4、pom.xml

        <dependency>
            <groupId>com.aliyun</groupId>
            <artifactId>aliyun-java-sdk-address-purification</artifactId>
            <version>1.0.0</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.aliyun/aliyun-java-sdk-core -->
        <dependency>
            <groupId>com.aliyun</groupId>
            <artifactId>aliyun-java-sdk-core</artifactId>
            <version>4.5.6</version>
        </dependency>

5、地址标准化SDK Code Sample


import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.address_purification.model.v20191118.ClassifyPOIRequest;
import com.aliyuncs.address_purification.model.v20191118.ClassifyPOIResponse;
import com.aliyuncs.profile.DefaultProfile;

public class AddressPurificationTestApp {

    public static void main(String[] args) throws ClientException {
        // AccessKey,AccessSecret获取参考链接:https://developer.aliyun.com/article/693979?spm=a2c6h.13262185.0.0.28695eb5HCba5B
        DefaultProfile profile = DefaultProfile.getProfile(
                "cn-hangzhou",
                "******",
                "******");
        IAcsClient client = new DefaultAcsClient(profile);
        ClassifyPOIRequest request = new ClassifyPOIRequest();
        request.setServiceCode("addrp");
        request.setAppKey("d6qs********");
        request.setText("杭州市文一西路969号");
//        request.setDefaultProvince("浙江省");
//        request.setDefaultCity("杭州市");
//        request.setDefaultDistrict("余杭区");
        ClassifyPOIResponse response = client.getAcsResponse(request);
        System.out.println(response.getData());
    }
}

6、Java Core SDK Code Sample

import com.aliyuncs.CommonRequest;
import com.aliyuncs.CommonResponse;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.profile.DefaultProfile;

public class AddressPurificationByCoreSDK {

    public static void main(String[] args) {
        // AccessKey,AccessSecret获取参考链接:https://developer.aliyun.com/article/693979?spm=a2c6h.13262185.0.0.28695eb5HCba5B
        DefaultProfile profile = DefaultProfile.getProfile(
                "cn-hangzhou",
                "******",
                "******");
        IAcsClient client = new DefaultAcsClient(profile);

        CommonRequest commonRequest = new CommonRequest();
        commonRequest.setSysAction("ClassifyPOI");
        commonRequest.setSysMethod(MethodType.POST);
        commonRequest.setSysVersion("2019-11-18");
        commonRequest.setSysDomain("address-purification.cn-hangzhou.aliyuncs.com");
        commonRequest.putBodyParameter("AppKey","d6qs******");
        commonRequest.putBodyParameter("ServiceCode","addrp");
        commonRequest.putBodyParameter("Text","杭州市文一西路969号");

        CommonResponse response = null;
        try {
            response = client.getCommonResponse(commonRequest);
        } catch (ClientException e) {
            e.printStackTrace();
        }
        System.out.println(response.getData());
    }
}

参考链接

JAVA SDK
阿里云人脸识别 1:N 使用简明示例

相关文章
|
1月前
|
Java 开发工具
【Azure Storage Account】Java Code访问Storage Account File Share的上传和下载代码示例
本文介绍如何使用Java通过azure-storage-file-share SDK实现Azure文件共享的上传下载。包含依赖引入、客户端创建及完整示例代码,助你快速集成Azure File Share功能。
334 4
|
1月前
|
JSON Java 数据格式
java调用服务报错400
java调用服务报错400
76 6
java调用服务报错400
|
1月前
|
JSON Java 数据格式
java调用服务报错415 Content type ‘application/octet-stream‘ not supported
java调用服务报错415 Content type ‘application/octet-stream‘ not supported
157 6
|
2月前
|
IDE Java 关系型数据库
Java 初学者学习路线(含代码示例)
本教程为Java初学者设计,涵盖基础语法、面向对象、集合、异常处理、文件操作、多线程、JDBC、Servlet及MyBatis等内容,每阶段配核心代码示例,强调动手实践,助你循序渐进掌握Java编程。
397 3
|
2月前
|
Java
java入门代码示例
本文介绍Java入门基础,包含Hello World、变量类型、条件判断、循环及方法定义等核心语法示例,帮助初学者快速掌握Java编程基本结构与逻辑。
404 0
Java API 开发者
99 0
|
3月前
|
存储 数据采集 搜索推荐
Java 大视界 -- Java 大数据在智慧文旅旅游景区游客情感分析与服务改进中的应用实践(226)
本篇文章探讨了 Java 大数据在智慧文旅景区中的创新应用,重点分析了如何通过数据采集、情感分析与可视化等技术,挖掘游客情感需求,进而优化景区服务。文章结合实际案例,展示了 Java 在数据处理与智能推荐等方面的强大能力,为文旅行业的智慧化升级提供了可行路径。
Java 大视界 -- Java 大数据在智慧文旅旅游景区游客情感分析与服务改进中的应用实践(226)
|
4月前
|
分布式计算 搜索推荐 算法
Java 大视界 -- Java 大数据在智慧养老服务需求分析与个性化服务匹配中的应用(186)
本篇文章探讨了Java大数据技术在智慧养老服务需求分析与个性化服务匹配中的应用。通过整合老年人健康数据与行为数据,结合机器学习与推荐算法,实现对老年人健康风险的预测及个性化服务推荐,提升养老服务的智能化与精准化水平,助力智慧养老高质量发展。
|
4月前
|
安全 Java 网络安全
Java 实现 SMTP 协议调用的详细示例及实战指南 SMTP Java 调用示例
本文介绍了如何使用Java调用SMTP协议发送邮件,涵盖SMTP基本概念、JavaMail API配置、代码实现及注意事项,适合Java开发者快速掌握邮件发送功能集成。
443 0
下一篇
oss云网关配置