

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 生成备选转录
<a name="alternative-med-transcriptions"></a>

当你使用 M Amazon Transcribe edical 时，你会得到可信度最高的转录。但是，您可以将 M Amazon Transcribe edical 配置为返回置信度较低的其他转录。

使用备选转录可查看对所转录音频的不同解释。例如，在允许用户查看转录的应用程序中，您可以提供备选转录供用户选择。

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

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

要使用生成替代转录，请在配置作业时启用替代结果。 AWS 管理控制台 

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

1. 在导航窗格的 “ Amazon Transcribe 医疗” 下，选择 “**转录作业**”。

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
          }
  }
  ```