什么是语言理解 (LUIS)?What is Language Understanding (LUIS)?

重要

现在,将对此服务的所有 HTTP 请求强制执行 TLS 1.2。TLS 1.2 is now enforced for all HTTP requests to this service.

语言理解 (LUIS) 是一种基于云的对话式 AI 服务,可在用户对话的自然语言文本中应用自定义机器学习智能,以便预测整体含义并提炼出相关的详细信息。Language Understanding (LUIS) is a cloud-based conversational AI service that applies custom machine-learning intelligence to a user's conversational, natural language text to predict overall meaning, and pull out relevant, detailed information.

LUIS 的客户端应用程序可以是任何传统的应用程序,只要其能够以自然语言与用户通信并完成任务即可。A client application for LUIS is any conversational application that communicates with a user in natural language to complete a task. 这些客户端应用程序包括社交媒体应用、AI 聊天机器人以及支持语音的桌面应用程序。Examples of client applications include social media apps, AI chatbots, and speech-enabled desktop applications.

3 个客户端应用程序使用认知服务语言理解 (LUIS) 的概念图Conceptual image of 3 client applications working with Cognitive Services Language Understanding (LUIS)

在聊天机器人中使用 LUISUse LUIS in a chat bot

Azure LUIS 应用一旦发布,客户端应用程序即可向 LUIS 自然语言处理终结点 API 发送言语(文本)并将结果作为 JSON 响应接收。Once the Azure LUIS app is published, a client application sends utterances (text) to the LUIS natural language processing endpoint API and receives the results as JSON responses. LUIS 的常用客户端应用程序是聊天机器人。A common client application for LUIS is a chat bot.

LUIS 使用聊天机器人以通过自然语言理解 (NLP) 预测用户文本的概念图Conceptual imagery of LUIS working with Chat bot to predict user text with natural language understanding (NLP)

步骤Step 操作Action
11 客户端应用程序将用户 话语(采用自己的词汇的文本)“我想要呼叫 HR 代表”作为 HTTP 请求发送The client application sends the user utterance (text in their own words), "I want to call my HR rep." 给 LUIS 终结点。to the LUIS endpoint as an HTTP request.
22 LUIS 使你能够创建自定义语言模型,以便将智能添加到你的应用程序。LUIS enables you to craft your custom language models to add intelligence to your application. 计算机学习的语言模型采用用户的非结构化输入文本,并以最相关意向 HRContact 返回 JSON 格式的响应。Machine learned language models take the user's unstructured input text and returns a JSON-formatted response, with a top intent, HRContact. JSON 终结点响应至少包含查询话语和得分最高的意向。The minimum JSON endpoint response contains the query utterance, and the top scoring intent. 它还可以提取数据,例如“联系人类型”实体。It can also extract data such as the Contact Type entity.
33 客户端应用程序根据 JSON 响应来决定如何处理用户的请求。The client application uses the JSON response to make decisions about how to fulfill the user's requests. 这些决策可能包括机器人框架代码中的决策树,以及对其他服务的调用。These decisions can include decision tree in the bot framework code and calls to other services.

LUIS 应用提供的智能有助于客户端应用程序进行智能选择。The LUIS app provides intelligence so the client application can make smart choices. LUIS 不提供这些选择。LUIS doesn't provide those choices.

自然语言理解 (NLU)Natural language understanding (NLU)

LUIS 以 NLU 的形式提供人工智能 (AI),NLU 是自然语言处理 AI 的一个分支。LUIS provides artificial intelligence (AI) in the form of NLU, a subset of natural language processing AI.

LUIS 应用包含一个特定于域的自然语言模型。Your LUIS app contains a domain-specific natural language model. 可通过预构建的域模型启动 LUIS 应用、构建你自己的模型,还可将预构建的域的各个部分与自己的自定义信息进行混合。You can start the LUIS app with a prebuilt domain model, build your own model, or blend pieces of a prebuilt domain with your own custom information.

  • 预构建的模型 LUIS 具有多个预构建的域模型,它们自带意向、话语和预构建的实体。Prebuilt model LUIS has many prebuilt domain models including intents, utterances, and prebuilt entities. 即使不使用预构建的模型中的意向和话语,也能使用预构建的实体。You can use the prebuilt entities without having to use the intents and utterances of the prebuilt model. 预构建的域模型包含适合你的整个设计,是实现 LUIS 快速入门的绝佳方式。Prebuilt domain models include the entire design for you and are a great way to start using LUIS quickly.

  • “自定义模型”LUIS 提供多种方法来识别自己的自定义模型,包括意向和实体。Custom model LUIS gives you several ways to identify your own custom models including intents, and entities. 实体包括机器学习的实体、特定实体或文本实体,以及机器学习的实体和文本实体的组合。Entities include machine-learning entities, specific or literal entities, and a combination of machine-learning and literal.

详细了解 NLP AI,以及 NLU 中特定于 LUIS 的领域。Learn more about NLP AI, and the LUIS-specific area of NLU.

步骤 1:设计和生成模型Step 1: Design and build your model

用名为意图的用户意图类别设计模型。Design your model with categories of user intentions called intents. 每个意向都需要用户 话语 的示例。Each intent needs examples of user utterances. 每段言语都可以提供数据,需要通过机器学习实体来提取这些数据。Each utterance can provide data that needs to be extracted with machine-learning entities.

示例用户话语Example user utterance IntentIntent 提取的数据Extracted data
Book a flight to Seattle? BookFlightBookFlight 西雅图Seattle
When does your store open? 店铺营业时间和位置StoreHoursAndLocation 开门open
Schedule a meeting at 1pm with Bob in Distribution 安排谈话ScheduleMeeting 下午 1 点,何石1pm, Bob

使用 创作 API 和/或 LUIS 门户 生成模型。Build the model with the authoring APIs, or with the LUIS portal, or both. 了解如何使用门户SDK 客户端库生成内容。Learn more how to build with the portal and the SDK client libraries.

步骤 2:获取查询预测Step 2: Get the query prediction

在训练应用模型并将其发布到终结点以后,客户端应用程序(如聊天机器人)会将言语发送到预测终结点 API。After your app's model is trained and published to the endpoint, a client application (such as a chat bot) sends utterances to the prediction endpoint API. API 将模型应用到言语进行分析,并使用 JSON 格式的预测结果进行响应。The API applies the model to the utterance for analysis and responds with the prediction results in a JSON format.

JSON 终结点响应至少包含查询话语和得分最高的意向。The minimum JSON endpoint response contains the query utterance, and the top scoring intent. 它还可以提取数据,例如下面的“联系人类型”实体和整体情绪。It can also extract data such as the following Contact Type entity and overall sentiment.

{
    "query": "I want to call my HR rep",
    "prediction": {
        "topIntent": "HRContact",
        "intents": {
            "HRContact": {
                "score": 0.8582669
            }
        },
        "entities": {
            "Contact Type": [
                "call"
            ]
        },
        "sentiment": {
            "label": "neutral",
            "score": 0.5
        }
    }
}

步骤 3:改进模型预测Step 3: Improve model prediction

发布 LUIS 应用并收到真实用户言语后,LUIS 提供终结点言语的主动学习以提高预测准确性。After your LUIS app is published and receives real user utterances, LUIS provides active learning of endpoint utterances to improve prediction accuracy. 作为开发生命周期中定期维护工作的一部分,请查看这些建议。Review these suggestions as part of your regular maintenance work in your development lifecycle.

开发生命周期和工具Development lifecycle and tools

LUIS 提供工具、版本控制以及与其他 LUIS 创建者的协作,以便集成到完整的开发生命周期LUIS provides tools, versioning, and collaboration with other LUIS authors to integrate into the full development life cycle.

作为 REST API,语言理解 (LUIS) 可以与任何发送 HTTP 请求的产品、服务或框架配合使用。Language Understanding (LUIS), as a REST API, can be used with any product, service, or framework with an HTTP request. LUIS 还为多种顶级编程语言提供客户端库 (SDK)。LUIS also provides client libraries (SDKs) for several top programming languages. 详细了解提供的开发人员资源Learn more about the developer resources provided.

通过机器人快速轻松地使用 LUIS 的工具:Tools to quickly and easily use LUIS with a bot:

  • LUIS CLI NPM 包以独立命令行工具或导入的形式提供创作和预测。LUIS CLI The NPM package provides authoring and prediction with as either a stand-alone command-line tool or as import.
  • LUISGen:LUISGen 是一个用于从导出的 LUIS 模型生成强类型 C# 和 typescript 源代码的工具。LUISGen LUISGen is a tool for generating strongly typed C# and typescript source code from an exported LUIS model.
  • 启用调度时,可以使用调度程序模型通过父应用使用多个 LUIS 和 QnA Maker 应用。Dispatch allows several LUIS and QnA Maker apps to be used from a parent app using dispatcher model.
  • LUDown LUDown 是一个命令行工具,可帮助你管理机器人的语言模型。LUDown LUDown is a command-line tool that helps manage language models for your bot.

与其他认知服务集成Integrate with other Cognitive Services

与 LUIS 配合使用的其他认知服务:Other Cognitive Services used with LUIS:

LUIS 提供文本分析的功能,作为现有 LUIS 资源的一部分。LUIS provides functionality from Text Analytics as part of your existing LUIS resources. 此功能包括情绪分析和使用预生成 keyPhrase 实体的关键短语提取This functionality includes sentiment analysis and key phrase extraction with the prebuilt keyPhrase entity.

通过快速入门学习Learn with the Quickstarts

使用门户SDK 客户端库的实际操作快速入门来了解 LUIS。Learn about LUIS with hands-on quickstarts using the portal and the SDK client libraries.

使用 Docker 容器进行本地部署Deploy on premises using Docker containers

使用 LUIS 容器在本地部署 API 功能。Use LUIS containers to deploy API features on-premises. 借助这些 Docker 容器,你能够将服务进一步引入数据,以满足合规性、安全性或其他操作目的。These Docker containers enable you to bring the service closer to your data for compliance, security or other operational reasons.

后续步骤Next steps