全部产品
云市场
云游戏

Python SDK

更新时间:2020-08-27 11:38:33

Python SDK

Python 安装方式

pip install aliyun-python-sdk-alinlp==1.0.15

Python SDK 简介

  1. import json
  2. # 这里以分词为例,其它算法的API名称和参数请参考文档
  3. from aliyunsdkalinlp.request.v20200629 import GetWsCustomizedChGeneralRequest
  4. from aliyunsdkcore.client import AcsClient
  5. from aliyunsdkcore.acs_exception.exceptions import ClientException
  6. from aliyunsdkcore.acs_exception.exceptions import ServerException
  7. # 创建AcsClient实例
  8. client = AcsClient(
  9. "XXXX",
  10. "XXXX",
  11. "cn-hangzhou"
  12. )
  13. request = GetWsCustomizedChGeneralRequest.GetWsCustomizedChGeneralRequest()
  14. request.set_Text("云麦好轻智能体脂秤精准蓝牙秤体重测人体脂肪秤家用称健康电子秤")
  15. request.set_OutType("1")
  16. request.set_ServiceCode("alinlp")
  17. request.set_TokenizerId("GENERAL_CHN")
  18. response = client.do_action_with_exception(request)
  19. resp_obj = json.loads(response)
  20. print(resp_obj)