

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 建立通話後轉錄的類別
<a name="tca-categories-batch"></a>

通話後分析支援建立自訂類別，讓您量身打造文字記錄分析，以適當滿足您的特定業務需求。

您可以根據需要，建立任意數量的類別，以涵蓋一系列不同的情況。您必須為您建立的每個類別建立 1 到 20 個規則。每個規則都依據四個標準之一：中斷、關鍵字、非通話時間或情緒。如需將這些條件與 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_CreateCallAnalyticsCategory.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_CreateCallAnalyticsCategory.html) 操作搭配使用的詳細資訊，請參閱 [通話後分析類別的規則條件](#tca-rules-batch) 一節。

如果媒體中的內容符合您在指定類別中指定的所有規則， Amazon Transcribe 將標示輸出為該類別。如需 JSON 輸出中類別相符項目的範例，請參閱[通話分類輸出](tca-output-batch.md#tca-output-categorization-batch)。

以下是您可以使用自訂類別執行的幾個範例：
+ 隔離具有特定特徵的通話，例如以負面客戶情緒結束的通話
+ 標記和追蹤特定的關鍵字集以識別客戶問題的趨勢
+ 監控合規性，例如通話的前幾秒鐘內，客服人員說出 (或省略) 特定片語
+ 標記許多客服人員中斷和負面客戶情緒的通話，以取得對客戶體驗的見解
+ 比較多個類別以衡量相關性，例如分析使用歡迎片語的客服人員是否與正面的客戶情緒相關

**通話後與即時類別**

建立新類別時，您可以指定建立為通話後分析類別 (`POST_CALL`) 或建立為即時通話分析類別 (`REAL_TIME`)。如果未指定選項，則預設會將類別建立為通話後類別。完成通話後分析轉錄後，可以在您的輸出中使用通話後分析類別相符的項目。

若要建立通話後分析的新類別，您可以使用 **AWS 管理主控台**、**AWS CLI** 或 **AWS SDK**；請參閱下列範例：

## AWS 管理主控台
<a name="tca-category-console-batch"></a>

1. 在導覽窗格中， Amazon Transcribe選擇**Amazon Transcribe 通話分析**。

1. 選擇**通話分析類別**，將引導您進入**通話分析類別**頁面。選擇**建立類別**。  
![\[Amazon Transcribe 主控台螢幕擷取畫面：呼叫分析「類別」頁面。\]](http://docs.aws.amazon.com/zh_tw/transcribe/latest/dg/images/analytics-categories.png)

1. 您現在已進入**建立類別頁面**。輸入類別的名稱，然後在**類別類型**下拉式功能表中，選擇「批次通話分析」。  
![\[Amazon Transcribe 主控台螢幕擷取畫面：「類別設定」面板。\]](http://docs.aws.amazon.com/zh_tw/transcribe/latest/dg/images/analytics-categories-type.png)

1. 您可以選擇範本，以建立您的類別，也可以從頭開始建立範本。

   如果使用範本：選擇**使用範本 (建議選項)**，選擇您要的範本，然後選擇**建立類別**。  
![\[Amazon Transcribe 主控台螢幕擷取畫面：顯示選用範本的「類別設定」面板。\]](http://docs.aws.amazon.com/zh_tw/transcribe/latest/dg/images/analytics-categories-settings-batch.png)

1. 如果建立自訂類別：選擇**從頭開始建立**。  
![\[Amazon Transcribe 主控台螢幕擷取畫面：顯示「規則」窗格的「建立類別」頁面。\]](http://docs.aws.amazon.com/zh_tw/transcribe/latest/dg/images/analytics-categories-custom.png)

1. 使用下拉式功能表將規則新增至您的類別。每個類別最多可新增 20 個規則。  
![\[Amazon Transcribe 主控台螢幕擷取畫面：具有規則類型清單的「規則」窗格。\]](http://docs.aws.amazon.com/zh_tw/transcribe/latest/dg/images/analytics-categories-custom-rules1.png)

1. 以下是帶兩個規則的類別範例：通話期間中斷客戶超過 15 秒的客服人員，以及在通話的最後兩分鐘內，客戶或客服人員感覺到負面情緒。  
![\[Amazon Transcribe 主控台螢幕擷取畫面：具有兩個範例規則的「規則」窗格。\]](http://docs.aws.amazon.com/zh_tw/transcribe/latest/dg/images/analytics-categories-custom-rules2.png)

1. 將規則新增至類別時，選擇**建立類別**。

## AWS CLI
<a name="tca-category-cli-batch"></a>

此範例使用 [create-call-analytics-category](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/transcribe/create-call-analytics-category.html) 指令。如需詳細資訊，請參閱[https://docs.aws.amazon.com/transcribe/latest/APIReference/API_CreateCallAnalyticsCategory.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_CreateCallAnalyticsCategory.html)、[https://docs.aws.amazon.com/transcribe/latest/APIReference/API_CategoryProperties.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_CategoryProperties.html)及[https://docs.aws.amazon.com/transcribe/latest/APIReference/API_Rule.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_Rule.html)。

下列範例會建立帶規則的類別：
+ 客戶在前 60,000 毫秒內被中斷。這些中斷的持續時間至少持續 10,000 毫秒。
+ 進入通話的 10% 到 80% 間，靜音持續至少 20,000 毫秒。
+ 客服人員在通話中的某個時段有負面情緒。
+ 在通話的前 10,000 毫秒中，未使用「歡迎」或「您好」單詞。

此範例使用 [create-call-analytics-category](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/transcribe/create-call-analytics-category.html) 指令，以及新增多個規則到類別的請求主文。

```
aws transcribe create-call-analytics-category \
--cli-input-json file://filepath/my-first-analytics-category.json
```

檔案 *my-first-analytics-category.json* 包含以下請求主文。

```
{
  "CategoryName": "my-new-category",
  "InputType": "POST_CALL",
  "Rules": [
        {
            "InterruptionFilter": {
                "AbsoluteTimeRange": {
                    "First": 60000
                },
                "Negate": false,
                "ParticipantRole": "CUSTOMER",
                "Threshold": 10000
            }
        },
        {
            "NonTalkTimeFilter": {
                "Negate": false,
                "RelativeTimeRange": {
                    "EndPercentage": 80,
                    "StartPercentage": 10
                },
                "Threshold": 20000
            }
        },
        {
            "SentimentFilter": {
                "ParticipantRole": "AGENT",
                "Sentiments": [
                    "NEGATIVE"                    
                ]
            }
        },
        {
            "TranscriptFilter": {
                "Negate": true,
                "AbsoluteTimeRange": {
                    "First": 10000
                },
                "Targets": [
                    "welcome",
                    "hello"
                ],
                "TranscriptFilterType": "EXACT"
            }
        }
    ]
}
```

## 適用於 Python (Boto3) 的 AWS SDK
<a name="tca-category-python-batch"></a>

此範例會使用 [create\$1call\$1analytics\$1category](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/transcribe.html#TranscribeService.Client.create_call_analytics_category) 方法的 `CategoryName`和 `Rules`引數 適用於 Python (Boto3) 的 AWS SDK 來建立類別。如需詳細資訊，請參閱[https://docs.aws.amazon.com/transcribe/latest/APIReference/API_CreateCallAnalyticsCategory.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_CreateCallAnalyticsCategory.html)、[https://docs.aws.amazon.com/transcribe/latest/APIReference/API_CategoryProperties.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_CategoryProperties.html)及[https://docs.aws.amazon.com/transcribe/latest/APIReference/API_Rule.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_Rule.html)。

如需使用 AWS SDKs 的其他範例，包括功能特定、案例和跨服務範例，請參閱 [Amazon Transcribe AWS SDKs的程式碼範例](service_code_examples.md)章節。

下列範例會建立帶規則的類別：
+ 客戶在前 60,000 毫秒內被中斷。這些中斷的持續時間至少持續 10,000 毫秒。
+ 進入通話的 10% 到 80% 間，靜音持續至少 20,000 毫秒。
+ 客服人員在通話中的某個時段有負面情緒。
+ 在通話的前 10,000 毫秒中，未使用「歡迎」或「您好」單詞。

```
from __future__ import print_function
import time
import boto3
transcribe = boto3.client('transcribe', 'us-west-2')
category_name = "my-new-category"
transcribe.create_call_analytics_category(
    CategoryName = category_name,
    InputType = POST_CALL,
    Rules = [
        {
            'InterruptionFilter': {
                'AbsoluteTimeRange': {
                    'First': 60000
                },
                'Negate': False,
                'ParticipantRole': 'CUSTOMER',
                'Threshold': 10000
            }
        },
        {
            'NonTalkTimeFilter': {
                'Negate': False,
                'RelativeTimeRange': {
                    'EndPercentage': 80,
                    'StartPercentage': 10
                },
                'Threshold': 20000
            }
        },
        {
            'SentimentFilter': {
                'ParticipantRole': 'AGENT',
                'Sentiments': [
                    'NEGATIVE'                    
                ]
            }
        },
        {
            'TranscriptFilter': {
                'Negate': True,
                'AbsoluteTimeRange': {
                    'First': 10000
                },
                'Targets': [
                    'welcome',
                    'hello'
                ],
                'TranscriptFilterType': 'EXACT'
            }
        }
    ]
    
)

result = transcribe.get_call_analytics_category(CategoryName = category_name)    
print(result)
```

## 通話後分析類別的規則條件
<a name="tca-rules-batch"></a>

本節概述您可以使用 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_CreateCallAnalyticsCategory.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_CreateCallAnalyticsCategory.html) API 操作建立的自訂 `POST_CALL` 規則類型。

### 中斷配對
<a name="tca-rules-interruptions-batch"></a>

使用中斷 ([https://docs.aws.amazon.com/transcribe/latest/APIReference/API_InterruptionFilter.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_InterruptionFilter.html)資料類型) 的規則設計為符合下列項目：
+ 客服人員中斷客戶的範例
+ 客戶中斷客服人員的範例
+ 中斷其他參與者的參與者
+ 缺乏中斷

以下是可搭配 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_InterruptionFilter.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_InterruptionFilter.html) 使用的參數範例：

```
"InterruptionFilter": { 
    "AbsoluteTimeRange": { 
       Specify the time frame, in milliseconds, when the match should occur
    },
    "RelativeTimeRange": { 
       Specify the time frame, in percentage, when the match should occur
    },
    "Negate": Specify if you want to match the presence or absence of interruptions,
    "ParticipantRole": Specify if you want to match speech from the agent, the customer, or both,    
    "Threshold": Specify a threshold for the amount of time, in seconds, interruptions occurred during the call
},
```

請參閱 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_CreateCallAnalyticsCategory.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_CreateCallAnalyticsCategory.html) 及 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_InterruptionFilter.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_InterruptionFilter.html)，了解這些參數與這些參數相關的有效值的詳細資訊。

### 關鍵字配對
<a name="tca-rules-keywords-batch"></a>

使用關鍵字 ([https://docs.aws.amazon.com/transcribe/latest/APIReference/API_TranscriptFilter.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_TranscriptFilter.html) 資料類型) 的規則設計為符合下列項目：
+ 客服人員、客戶或兩者說出的自訂單字或片語
+ 客服人員、客戶或兩者都**未**說出的自訂單字或片語
+ 在特定時間範圍內發生的自訂單字或片語

以下是可搭配 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_TranscriptFilter.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_TranscriptFilter.html) 使用的參數範例：

```
"TranscriptFilter": { 
    "AbsoluteTimeRange": { 
       Specify the time frame, in milliseconds, when the match should occur
    },
    "RelativeTimeRange": { 
       Specify the time frame, in percentage, when the match should occur
    },
    "Negate": Specify if you want to match the presence or absence of your custom keywords,
    "ParticipantRole": Specify if you want to match speech from the agent, the customer, or both,
    "Targets": [ The custom words and phrases you want to match ],
    "TranscriptFilterType": Use this parameter to specify an exact match for the specified targets
}
```

請參閱 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_CreateCallAnalyticsCategory.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_CreateCallAnalyticsCategory.html) 及 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_TranscriptFilter.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_TranscriptFilter.html)，了解這些參數與這些參數相關的有效值的詳細資訊。

### 非通話時間配對
<a name="tca-rules-nontalktime-batch"></a>

使用非通話時間 ([https://docs.aws.amazon.com/transcribe/latest/APIReference/API_NonTalkTimeFilter.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_NonTalkTimeFilter.html) 資料類型) 的規則設計為符合下列項目：
+ 在整個通話的指定時間內出現靜音
+ 在整個通話的指定時間內說話

以下是可搭配 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_NonTalkTimeFilter.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_NonTalkTimeFilter.html) 使用的參數範例：

```
"NonTalkTimeFilter": { 
    "AbsoluteTimeRange": { 
 Specify the time frame, in milliseconds, when the match should occur
 },
    "RelativeTimeRange": { 
 Specify the time frame, in percentage, when the match should occur
 },
    "Negate": Specify if you want to match the presence or absence of speech,      
    "Threshold": Specify a threshold for the amount of time, in seconds, silence (or speech) occurred during the call
},
```

請參閱 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_CreateCallAnalyticsCategory.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_CreateCallAnalyticsCategory.html) 及 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_NonTalkTimeFilter.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_NonTalkTimeFilter.html)，了解這些參數與這些參數相關的有效值的詳細資訊。

### 情緒配對
<a name="tca-rules-sentiment-batch"></a>

使用情緒 ([https://docs.aws.amazon.com/transcribe/latest/APIReference/API_SentimentFilter.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_SentimentFilter.html) 資料類型) 的規則設計為符合下列項目：
+ 客戶、客服人員或兩者是否在通話的指定點表達出正面情緒
+ 客戶、客服人員或兩者是否在通話的指定點表達出負面情緒
+ 客戶、客服人員或兩者是否在通話的指定點表達出中性情緒
+ 客戶、客服人員或兩者是否在通話的指定點表達出混合情緒

以下是可搭配 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_SentimentFilter.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_SentimentFilter.html) 使用的參數範例：

```
"SentimentFilter": { 
    "AbsoluteTimeRange": { 
    Specify the time frame, in milliseconds, when the match should occur
    },
    "RelativeTimeRange": { 
    Specify the time frame, in percentage, when the match should occur
    },
    "Negate": Specify if you want to match the presence or absence of your chosen sentiment,
    "ParticipantRole": Specify if you want to match speech from the agent, the customer, or both,    
    "Sentiments": [ The sentiments you want to match ]
},
```

請參閱 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_CreateCallAnalyticsCategory.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_CreateCallAnalyticsCategory.html) 及 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_SentimentFilter.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_SentimentFilter.html)，了解這些參數與這些參數相關的有效值的詳細資訊。