

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

# 產生替代轉錄
<a name="alternative-med-transcriptions"></a>

當您使用 Amazon Transcribe Medical 時，您會取得可信度最高的轉錄。不過，您可以設定 Amazon Transcribe Medical 以傳回其他可信度較低的轉錄。

使用替代轉錄以查看所轉錄音訊的不同解釋。例如，在使用人員能夠審核轉錄的應用程式中，您可以提供可供人員選擇的替代轉錄。

您可以使用 AWS 管理主控台 或 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartMedicalTranscriptionJob.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartMedicalTranscriptionJob.html) API 產生替代轉錄。

## AWS 管理主控台
<a name="alternative-med-transcriptions-console"></a>

若要使用 AWS 管理主控台 產生替代轉錄，請在設定任務時啟用替代結果。

1. 登入 [AWS 管理主控台](https://console.aws.amazon.com/transcribe/)。

1. 在導覽窗格的 Amazon Transcribe Medical 下，選擇**轉錄任務**。

1. 選擇**建立作業**。

1. 在**指定作業詳細資訊**頁面上，提供轉錄作業的相關資訊。

1. 選擇**下一步**。

1. 啟用**替代結果**。

1. 對於**最大替代**，輸入介於 2 到 10 之間的整數值，以取得您要在輸出中顯示的替代轉錄數量上限。

1. 選擇**建立**。

## API
<a name="alternative-med-transcriptions-api"></a>

**使用批次轉錄作業，分隔音訊檔案中每位發言者的文字 (API)**
+ 對於 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartMedicalTranscriptionJob.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartMedicalTranscriptionJob.html) API，請指定以下項目。

  1. 對於 `MedicalTranscriptionJobName`，請指定在 AWS 帳戶中唯一的名稱。

  1. 對於 `LanguageCode`，請指定與音訊檔案中所說的語言對應的語言代碼，以及詞彙篩選語言對應的語言。

  1. 在 `Media` 物件的 `MediaFileUri` 參數中，指定您要轉錄的音訊檔案位置。

  1. 對於 `Specialty`，請指定在音訊檔案中說話的臨床醫生的醫療專科。

  1. 對於 `Type`，指定要轉錄醫學對話或聽寫。

  1. 對於 `OutputBucketName`，指定 Amazon S3 儲存貯體以存放轉錄結果。

  1. 對於 `Settings` 物件，請指定下列項目：

     1. `ShowAlternatives` – `true`.

     1. `MaxAlternatives` - 介於 2 到 10 之間的整數，指示轉錄輸出中所需的替代轉錄數量。

下列請求使用 適用於 Python (Boto3) 的 AWS SDK 啟動轉錄任務，該任務最多產生兩個替代轉錄。

```
from __future__ import print_function
import time
import boto3
transcribe = boto3.client('transcribe', '{{us-west-2}}')
job_name = "{{my-first-transcription-job}}"
job_uri = s3://{{amzn-s3-demo-bucket}}/{{my-input-files}}/{{my-audio-file}}.{{flac}}
transcribe.start_medical_transcription_job(
    MedicalTranscriptionJobName = job_name,
    Media = {
        'MediaFileUri': job_uri
    },
    OutputBucketName = '{{amzn-s3-demo-bucket}}',
    OutputKey = '{{my-output-files}}/', 
    LanguageCode = 'en-US',
    Specialty = 'PRIMARYCARE',
    Type = '{{CONVERSATION}}', 
    Settings = {
        'ShowAlternatives': True,
        'MaxAlternatives': 2
    }
)

while True:
   status = transcribe.get_medical_transcription_job(MedicalTranscriptionJobName = job_name)
   if status['MedicalTranscriptionJob']['TranscriptionJobStatus'] in ['COMPLETED', 'FAILED']:
       break
   print("Not ready yet...")
   time.sleep(5)
print(status)
```

## AWS CLI
<a name="alternative-med-transcriptions-cli"></a>

**在音訊檔案中轉錄初級護理臨床醫生和患者間對話的音訊檔案 (AWS CLI)**
+ 執行下列程式碼。

  ```
                      
  aws transcribe start-transcription-job \
  --cli-input-json file://{{filepath}}/{{example-start-command}}.json
  ```

  下列程式碼顯示 `example-start-command.json` 的內容。

  ```
  {
        "MedicalTranscriptionJobName": "{{my-first-transcription-job}}",
        "LanguageCode": "en-US",
        "Specialty": "PRIMARYCARE",
        "Type": "CONVERSATION",
        "OutputBucketName":"{{amzn-s3-demo-bucket}}",
        "Media": {
            "MediaFileUri": "s3://{{amzn-s3-demo-bucket}}/{{my-input-files}}/{{my-audio-file}}.{{flac}}"
          },
        "Settings":{
            "ShowAlternatives": true,
            "MaxAlternatives": 2
          }
  }
  ```