# 抽換詞類

### 說明

在 YOCTOL.AI 左邊功能欄 **`機器人編輯`** 中的 **`抽換詞類`**（entity）是指使用者的輸入語句中，有明確指涉對象的詞彙。常見的抽換詞類包含：物品、人名、時間、地點、金額等。

抽換詞類依附在 [意圖](https://docs.yoctol.ai/term/intent) 之下。當使用者輸入語句時，模型會先判斷語句的意圖，再比對抽換詞類。同一個抽換詞類可用於多個意圖，幫助擴展機器人 [訓練句](https://docs.yoctol.ai/term/utterance) 的廣度。

一個抽換詞類之下可能包含多個抽換詞；一個抽換詞可能會有多個同義詞。

訓練句中包含 [抽換詞類](https://docs.yoctol.ai/term/entity) ，可使用半型的 **{{}}** 標注。

{% hint style="danger" %}
抽換詞類的命名不能以數字作為開頭
{% endhint %}

### 範例

以飲料店機器人為例，搭配「商品介紹」意圖的抽換詞類可能為「商品」：

* 抽換詞類：商品
* 抽換詞：珍珠奶茶、珍珠綠茶
* 同義詞：珍珠奶茶 = 珍奶、珍珠綠茶 = 珍綠

![](/files/-LcFY11fPMn62v2O5EjE)

而「商品」抽換詞類在「商品介紹」意圖中的應用如下：

1. **擴展訓練句**：「商品介紹」意圖的訓練句可能有：我想詢&#x554F;**{{商品}}**？
   * 代表這句話在自然語意模型中或擴展成：
     * 我想詢問**珍珠奶茶**
     * 我想詢問**珍珠綠茶**
     * 我想詢問**珍奶**
     * 我想詢問**珍綠**
   * 試想您有百餘種商品，在訓練機器人的時候就不用撰寫百餘句訓練句把商品帶入，可以直接用抽換詞類幫助訓練。
2. **腳本設計**：針對「商品介紹」意圖對應的腳本，可以安排一次提供菜單或各種商品的介紹
   * 基礎的答案：「商品介紹」節點用菜單總覽所有商品
   * 您可依照抽換詞類拆分更細緻的答案：
     * 「商品介紹\_珍珠奶茶」節點呈現單一商品介紹
     * 「商品介紹\_珍珠綠茶」節點呈現單一商品介紹

### 影片

{% embed url="<https://youtu.be/iTNJr73s42M>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-tw.yoctol.ai/term/entity.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
