You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
# 导入aip模块, 这是一个来自百度AI平台的Python SDK, 可以用来调用百度NLP( 自然语言处理) 服务
from aip import AipNlp
# 定义一个名为address的函数, 它接受一个字符串参数addr, 默认为空字符串
def address ( addr = ' ' ) :
# 在这个函数中定义了APP_ID、API_KEY和SECRET_KEY三个变量, 这些变量是你在百度AI平台上申请的凭证
APP_ID = ' 41768293 '
API_KEY = ' CAnsdV8e40GQtjhK4qHkucUO '
SECRET_KEY = ' jU1NbbnwrhTahngr2p3cz8p2EIAa8zWj '
# 使用凭证创建一个AipNlp的客户端对象, 这个对象会用来发送请求到百度AI平台
client = AipNlp ( APP_ID , API_KEY , SECRET_KEY )
""" 调用词法分析 """
# 调用客户端对象的address方法, 将参数addr发送到百度AI平台进行地址识别, 返回的结果保存在变量re中
re = client . address ( addr )
# 返回识别的结果
return re
# 调用address函数, 参数为你要识别的具体地址, 并将返回的结果打印出来
print ( address ( ' 海南省三亚市吉阳区迎宾大道学院路三亚学院 ' ) )