python构建知识库_快速入门:创建知识库 - REST、Python - QnA Maker - Azure Cognitive Services | Microsoft Docs...

您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.快速入门:通过 Python 在 QnA Maker 中创建知识库Quickstart: Create a knowledge base in QnA Maker using Python12/16/2019本文内容本快速入...
摘要由CSDN通过智能技术生成

您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

快速入门:通过 Python 在 QnA Maker 中创建知识库Quickstart: Create a knowledge base in QnA Maker using Python

12/16/2019

本文内容

本快速入门将指导你完成以编程方式创建和发布示例 QnA Maker 知识库的过程。This quickstart walks you through programmatically creating and publishing a sample QnA Maker knowledge base. QnA Maker 自动从数据源中从半结构化内容(例如常见问题解答)中自动提取问题和解答。QnA Maker automatically extracts questions and answers from semi-structured content, like FAQs, from data sources. 用于知识库的模型是在 API 请求的正文中发送的 JSON 中定义的。The model for the knowledge base is defined in the JSON sent in the body of the API request.

本快速入门调用了 QnA Maker API:This quickstart calls QnA Maker APIs:

备注

2019 年 7 月 1 日之后创建的新资源将使用自定义子域名。New resources created after July 1, 2019, will use custom subdomain names. 有关详细信息和区域终结点的完整列表,请参阅认知服务的自定义子域名。For more information and a complete list of regional endpoints, see Custom subdomain names for Cognitive Services.

先决条件Prerequisites

若要检索密钥和终结点(包括资源名称),请在 Azure 门户中为资源选择“快速入门”。To retrieve your key and endpoint (which includes the resource name), select Quickstart for your resource in the Azure portal.

创建知识库 Python 文件Create a knowledge base Python file

创建名为 create-new-knowledge-base-3x.py 的文件。Create a file named create-new-knowledge-base-3x.py.

添加必需的依赖项Add the required dependencies

在 create-new-knowledge-base-3x.py 的顶部,添加以下行来向项目添加必需的依赖项:At the top of create-new-knowledge-base-3x.py, add the following lines to add necessary dependencies to the project:

import http.client, json, os, time

from urllib.parse import urlparse

添加必需的常量Add the required constants

在上述必需的依赖项后,添加访问 QnA Maker 所必需的常量。After the preceding required dependencies, add the required constants to access QnA Maker. 将 和 的值替换为你自己的 QnA Maker 密钥和资源名称。Replace the value of the and with your own QnA Maker key and resource name.

在 Program 类的顶部,

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值