

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

# Amazon Transcribe Medical
<a name="transcribe-medical"></a>

Amazon Transcribe Medical 是一项自动语音识别 (ASR) 服务，专为想要转录医疗相关语音（例如医生口述的笔记、药物安全监测、远程医疗预约或医患对话）的医疗专业人员而设计。Amazon Transcribe可以通过实时音频流（通过麦克风）或转录上传的文件（批量转录）两种形式来使用 Medical。

**重要**  
Amazon Transcribe Medical 并不代替专业的医学意见、诊断或治疗。为您的使用案例确定正确的置信度阈值，并在需要高准确度的情况下使用高置信度阈值。对于某些使用案例，结果应由经过适当培训的人力审核人员进行审核和验证。Amazon TranscribeMedical 转录只能在经过训练有素的医学专家审查准确性和进行合理的医学判断后，在患者护理场景中使用。

Amazon Transcribe Medical 在责任共担模式下运营，AWS 负责保护运行 Amazon Transcribe Medical 的基础设施，而您则负责管理您的数据。有关更多信息，请参阅[责任共担模式](https://aws.amazon.com/compliance/shared-responsibility-model/)。

Amazon Transcribe Medical 提供美国英语 (en-US) 版本。

为获得最佳效果，请使用采用 PCM 16 位编码的无损音频格式，例如 FLAC 或 WAV。Amazon Transcribe Medical 支持 16000Hz 或更高的采样率。

如需分析您的转录，您可以使用其它 AWS 服务，例如 [Amazon Comprehend Medical](https://docs.aws.amazon.com/comprehend/latest/dg/comprehend-medical.html)。


**支持的专科**  

| 专科 | 亚专科 | 音频输入 | 
| --- | --- | --- | 
| 心脏科 | none | 仅限流式转录 | 
| 神经科 | none | 仅限流式转录 | 
| 肿瘤科 | none | 仅限流式转录 | 
| 全科 | 家庭医疗 | 批量转录，流式转录 | 
| 全科 | 内科 | 批量转录，流式转录 | 
| 全科 | 妇产科 (OB-GYN) | 批量转录，流式转录 | 
| 全科 | 儿科 | 批量转录，流式转录 | 
| 放射科 | none | 仅限流式转录 | 
| 泌尿外科 | none | 仅限流式转录 | 

## 区域可用性和配额
<a name="med-regions"></a>

以下 AWS 区域支持呼叫分析：


| **区域** | **转录类型** | 
| --- | --- | 
| af-south-1（开普敦） | 批处理 | 
| ap-east-1（香港） | 批处理 | 
| ap-northeast-1 (东京) | 批处理、流式 | 
| ap-northeast-2 (首尔) | 批处理、流式 | 
| ap-south-1（孟买） | 批处理 | 
| ap-southeast-1 (新加坡) | 批处理 | 
| ap-southeast-2 (悉尼) | 批处理、流式 | 
| ca-central-1（加拿大中部） | 批处理、流式 | 
| eu-central-1 (法兰克福) | 批量转录，流式转录 | 
| eu-north-1（斯德哥尔摩） | 批处理 | 
| eu-west-1 (爱尔兰) | 批处理、流式 | 
| eu-west-2 (伦敦) | 批处理、流式 | 
| eu-west-3（巴黎） | 批处理 | 
| me-south-1（巴林） | 批处理 | 
| sa-east-1（圣保罗） | 批处理、流式 | 
| us-east-1（弗吉尼亚州北部） | 批处理、流式 | 
| us-east-2（俄亥俄州） | 批处理、流式 | 
| us-gov-east-1（GovCloud，美国东部） | 批量转录，流式转录 | 
| us-gov-west-1（GovCloud，美国西部） | 批量转录，流式转录 | 
| us-west-1（旧金山） | 批处理 | 
| us-west-2 (俄勒冈) | 批量转录，流式转录 | 

请注意，[Amazon Transcribe](what-is.md#tsc-regions)、Amazon Transcribe Medical 和 [呼叫分析](call-analytics.md#tca-regions)的区域支持有所不同。

如遇获取每个支持的区域的端点，请参阅**《AWS 一般参考》中的[服务端点](https://docs.aws.amazon.com/general/latest/gr/transcribe.html#transcribe_region)。

有关与您的转录相关的配额列表，请参阅《AWS 一般参考》中的[服务配额](https://docs.aws.amazon.com/general/latest/gr/transcribe.html#limits-amazon-transcribe)。**有些配额可以根据要求进行更改。如果**可调整**列包含“**是**”，则可以请求增加。为此，请选择提供的链接。

# 医学专业和术语
<a name="how-it-works-med"></a>

创建医疗转录作业时，您需要指定源文件的语言、医学专业和音频类型。您输入美国英语作为语言，并输入 `PRIMARYCARE` 作为医学专业。输入初级保健作为值使可让您从以下医学专业的源音频生成转录：
+ 家庭医疗
+ 内科
+ 妇产科 (OB-GYN)
+ 儿科

您可以选择口述和对话作为您的音频类型。对于医生在其中报告有关患者就诊或手术的音频文件选择口述。对于涉及医生与患者之间对话或医生之间对话的音频文件选择对话。

要存储转录作业的输出，请选择您已经创建的 Amazon S3 存储桶。有关 Amazon S3 存储桶的更多信息，请参阅[入门。 Amazon Simple Storage Service](https://docs.aws.amazon.com/AmazonS3/latest/gsg/GetStartedWithS3.html)

以下是示例 JSON 中要输入的最小请求参数的数量：

```
{
   "MedicalTranscriptionJobName": "my-first-transcription-job",
   "LanguageCode": "en-US",
   "Media": {
       "MediaFileUri": "s3://path to your audio file"
   },
   "OutputBucketName": “your output bucket name",
   "Specialty": "PRIMARYCARE",
   "Type": "CONVERSATION"
}
```

Amazon Transcribe Medical 使您能够生成替代转录本。有关更多信息，请参阅 [生成备选转录](alternative-med-transcriptions.md)。

您还可以启用发言者划分或识别音频中的声道。有关更多信息，请参阅[启用发言者划分](conversation-diarization-med.md)和[转录多声道音频](conversation-channel-id-med.md)。

# 转录医学术语和测量结果
<a name="how-measurements-med"></a>

Amazon Transcribe 医疗可以转录医学术语和测量结果。 Amazon Transcribe 医疗输出口语的缩写。例如，“血压”被转录为 BP。您可以在本页的表格中找到 Medical 用于 Amazon Transcribe 医学术语和测量的惯例列表。*说出的术语* 列是指源音频中说出的术语。*输出* 列指您在转录结果中看到的缩写。

您可以在此处查看源音频中所说的术语如何与转录输出对应。


| 源音频中说出的术语 | 输出中使用的缩写 |  输出示例 | 
| --- | --- | --- | 
| 摄氏度 | C | 患者的体温为 37.4 摄氏度。 | 
| 摄氏度 | C | 患者的体温为 37.4 摄氏度。 | 
| 华氏度 | F | 患者的体温是 101 华氏度。 | 
| 克 | 网 | 从患者提取了 100 克的质量。 | 
| 米 | m | 患者身高 1.8 米。 | 
| 英尺 | ft | 患者身高 6 英尺。 | 
| 千克 | kg | 患者体重 80 千克。 | 
| 千克 | kg | 患者体重 80 千克。 | 
| c c | cc | 给患者注射 100 毫升的盐水溶液。 | 
| 立方厘米 | cc | 给患者注射 100 毫升的盐水溶液。 | 
| 毫升 | mL | 患者排出 100 毫升尿液。 | 
| 血压 | BP | 患者血压升高。 | 
| b p | BP | 患者血压升高。 | 
| X / Y | X/Y | 患者血压为 120/80。 | 
| 每分钟心跳数 | BPM | 患者患有心房颤动，心率为 160 BPM。 | 
| 每分钟心跳数 | BPM | 患者患有心房颤动，心率为 160 BPM。 | 
| O 2 | O2 | 患者血氧饱和度为 98%。 | 
| CO2 | CO2 | 患者需要呼吸支持才能升高 CO2。 | 
| 术后 | POSTOP | 患者来接受 POSTOP 评估。 | 
| 术后 | POSTOP | 患者来接受 POSTOP 评估。 | 
| CAT 扫描 | CT 扫描 | 脑出血的患者指示需要使用 CT 扫描。 | 
| 脉搏 80 | P 80 | 患者生命体征为 P 80、R 17、... | 
| 呼吸 17 | R 17 | 患者生命体征为 P 80、R 17、... | 
| 输入和输出 | I/O | 病人是 I/O 窦性心律 | 
| L5 | L5 | 在 L4 和 L5 之间进行腰椎穿刺 | 

# 转录数值
<a name="how-numbers-med"></a>

Amazon Transcribe Medical 将数字转录为数字而不是单词。例如，语音读出来的数字“one thousand two hundred forty-two”会转录成 `1242`。

数值的转录遵循以下规则。


| 规则 | 说明 | 
| --- | --- | 
| 将大于 10 的基数词转换成数字。 |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/transcribe/latest/dg/how-numbers-med.html)  | 
| 当“million”或“billion”后面没有数字时，将后跟“million”或“billion”的基数词转换为数字后跟一个单词。 |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/transcribe/latest/dg/how-numbers-med.html)  | 
|  将大于 10 的序数词转换成数字。  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/transcribe/latest/dg/how-numbers-med.html)  | 
|  将小数转换成数字格式。  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/transcribe/latest/dg/how-numbers-med.html)  | 
| 将小于 10 的数字转换成阿拉伯数字（如果一行中有多个数字的话）。 |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/transcribe/latest/dg/how-numbers-med.html)  | 
| 小数点由“dot”或“point”表示。 |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/transcribe/latest/dg/how-numbers-med.html)  | 
|  将数字后的单词“percent”转换成百分号。  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/transcribe/latest/dg/how-numbers-med.html)  | 
|  将数字后面的单词“dollar”、“Australian dollar”、“AUD”、“US dollar”或“USD”转换成美元符号加在数字之前。  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/transcribe/latest/dg/how-numbers-med.html)  | 
|  将单词“pounds”或“milligrams”转换为“lbs”或“mg”。  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/transcribe/latest/dg/how-numbers-med.html)  | 
|  将数字后面的单词“rupees”、“Indian rupees”或“INR”转换卢比符号 (₹) 加在数字之前。  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/transcribe/latest/dg/how-numbers-med.html)  | 
|  将时间转换成数字。  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/transcribe/latest/dg/how-numbers-med.html)  | 
|  将以两位数表示的年份组合成四位数的年份。 仅适用于 20、21 和 22 世纪的年份。  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/transcribe/latest/dg/how-numbers-med.html)  | 
| 将日期转换成数字。 |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/transcribe/latest/dg/how-numbers-med.html)  | 
|  数字范围用单词“to”来分隔。  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/transcribe/latest/dg/how-numbers-med.html)  | 

# 转录医疗谈话
<a name="transcribe-medical-conversation"></a>

您可以使用 Medic Amazon Transcribe al 通过批量转录作业或实时直播来转录临床医生与患者之间的医疗对话。批量转录作业让您能够转录音频文件。为确保 Medic Amazon Transcribe al 以尽可能高的准确度生成转录结果，您必须在转录工作或直播中指定临床医生的医学专业。

您可以转录以下医学专业的临床医生与患者的就诊情况：
+ 心脏科 – 仅在流式转录中可用
+ 神经科 – 仅在流式转录中可用
+ 肿瘤科 – 仅在流式转录中可用
+ 全科 – 包括以下类型的医疗机构：
  + 家庭医疗
  + 内科
  + 妇产科 (OB-GYN)
  + 儿科
+ 泌尿外科 – 仅在流式转录中可用

您可以使用医学自定义词汇表来提高转录的准确性。有关医学自定义词汇表的信息，请参阅[使用医学自定义词汇表提高转录准确性](vocabulary-med.md)。

默认情况下，M Amazon Transcribe edical 会返回置信度最高的转录。如果您想将其配置为返回备选转录，请参阅[生成备选转录](alternative-med-transcriptions.md)。

有关数字和医学测量结果在转录输出中的显示方式的信息，请参阅[转录数值](how-numbers-med.md)和[转录医学术语和测量结果](how-measurements-med.md)。

**Topics**
+ [转录医疗对话的音频文件](batch-medical-conversation.md)
+ [在实时音频流中转录医疗谈话](streaming-medical-conversation.md)
+ [启用发言者划分](conversation-diarization-med.md)
+ [转录多声道音频](conversation-channel-id-med.md)

# 转录医疗对话的音频文件
<a name="batch-medical-conversation"></a>

使用批量转录作业转录医疗对话的音频文件。您可以用它来转录临床医生与患者的对话。您可以通过 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartMedicalTranscriptionJob.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartMedicalTranscriptionJob.html) API 或 AWS 管理控制台来启动批量转录作业。

使用 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartMedicalTranscriptionJob.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartMedicalTranscriptionJob.html) API 启动医疗转录作业时，您可以将 `PRIMARYCARE` 指定为 `Specialty` 参数的值。

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

**转录临床医生与患者的对话（AWS 管理控制台）**

**要使用转录临床医生与患者的对话，请创建转录作业，然后选择**对话**作为音频输入类型。 AWS 管理控制台 **

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

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

1. 请选择**创建任务**。

1. 在**指定作业详细信息**页面上的**作业设置**下，指定以下设置。

   1. **名称** – 转录作业的名称。

   1. **音频输入类型** - **对话**

1. 对于其余字段，请指定音频文件的 Amazon S3 位置以及要存储转录作业输出的位置。

1. 选择**下一步**。

1. 选择**创建**。

## API
<a name="batch-med-conversation-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`，请将音频文件中说话的临床医生的医学专科指定为 `PRIMARYCARE`。

  1. 对于 `Type`，请指定 `CONVERSATION`。

  1. 对于 `OutputBucketName`，请指定要将转录结果存储到的 Amazon S3 存储桶。

  以下是一个请求示例，该请求使用 适用于 Python (Boto3) 的 AWS SDK 转录该`PRIMARYCARE`专业的临床医生和患者的医疗谈话。

  ```
  from __future__ import print_function
  import time
  import boto3
  transcribe = boto3.client('transcribe', 'us-west-2')
  job_name = "my-first-med-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 = 'output-files/',
        LanguageCode = 'en-US',
        Specialty = 'PRIMARYCARE',
        Type = 'CONVERSATION'
    )
  
  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)
  ```

以下示例代码显示了临床医生与患者对话的转录结果。

```
{
    "jobName": "conversation-medical-transcription-job",
    "accountId": "111122223333",
    "results": {
        "transcripts": [
            {
                "transcript": "... come for a follow up visit today..."
            }
        ],
        "items": [
            {
            ...
                "start_time": "4.85",
                "end_time": "5.12",
                "alternatives": [
                    {
                        "confidence": "1.0",
                        "content": "come"
                    }
                ],
                "type": "pronunciation"
            },
            {
                "start_time": "5.12",
                "end_time": "5.29",
                "alternatives": [
                    {
                        "confidence": "1.0",
                        "content": "for"
                    }
                ],
                "type": "pronunciation"
            },
            {
                "start_time": "5.29",
                "end_time": "5.33",
                "alternatives": [
                    {
                        "confidence": "0.9955",
                        "content": "a"
                    }
                ],
                "type": "pronunciation"
            },
            {
                "start_time": "5.33",
                "end_time": "5.66",
                "alternatives": [
                    {
                        "confidence": "0.9754",
                        "content": "follow"
                    }
                ],
                "type": "pronunciation"
            },
            {
                "start_time": "5.66",
                "end_time": "5.75",
                "alternatives": [
                    {
                        "confidence": "0.9754",
                        "content": "up"
                    }
                ],
                "type": "pronunciation"
            },
            {
                "start_time": "5.75",
                "end_time": "6.02",
                "alternatives": [
                    {
                        "confidence": "1.0",
                        "content": "visit"
                    }
                ]
                ...
    },
    "status": "COMPLETED"
}
```

## AWS CLI
<a name="batch-med-conversation-cli"></a>

**使用批量转录作业转录医疗谈话 (AWS CLI)**
+ 运行以下代码。

  ```
                      
  aws transcribe start-medical-transcription-job \
  --region us-west-2 \
  --cli-input-json file://example-start-command.json
  ```

  以下代码显示了 `example-start-command.json` 的内容。

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

# 在实时音频流中转录医疗谈话
<a name="streaming-medical-conversation"></a>

您可以使用 HTTP/2 或协议转录医疗对话的音频流。[WebSocket ](https://tools.ietf.org/html/rfc6455)有关如何使用 WebSocket 协议启动直播的信息，请参阅[设置直 WebSocket 播](streaming-setting-up.md#streaming-websocket)。要启动 HTTP/2 音频流，请使用 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartMedicalStreamTranscription.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartMedicalStreamTranscription.html) API。

您可以用下列医学专业来转录流音频：
+ 心脏科
+ 神经科
+ 肿瘤科
+ 全科
+ 泌尿外科

每个医学专科都包括许多类型的程序和预约。因此，临床医生会口述多种不同类型的笔记。使用以下示例作为指导，帮助您指定 WebSocket 请求的 `specialty` URI 参数的值或 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartMedicalStreamTranscription.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartMedicalStreamTranscription.html)API 的`Specialty`参数：
+ 对于电生理学或超声心动图咨询，请选择 `CARDIOLOGY`。
+ 对于肿瘤内科、肿瘤外科或放射肿瘤科咨询，请选择 `ONCOLOGY`。
+ 对于为中风（短暂性脑缺血发作或脑血管发作）的患者提供咨询的医生，请选择 `NEUROLOGY`。
+ 有关尿失禁的咨询，请选择 `UROLOGY`。
+ 对于年度体检或急诊，请选择 `PRIMARYCARE`。
+ 对于住院患者住院医生就诊，请选择 `PRIMARYCARE`。
+ 对于生育、输卵管结扎、宫内节育器插入或流产的咨询，请选择 `PRIMARYCARE`。

## AWS 管理控制台
<a name="streaming-medical-conversation-console"></a>

**转录流式转录医疗谈话（AWS 管理控制台）**

要使用在 AWS 管理控制台 实时直播中转录临床医生与患者的对话，请选择转录医疗对话的选项，开始直播，然后开始对着麦克风说话。

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

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

1. 选择**对话**。

1. 对于**医学专科**，请选择临床医生的专科。

1. 选择 **Start streaming（开始流式传输）**。

1. 对着麦克风说话。

## 在 HTTP/2 音频流中转录医疗谈话
<a name="http2-med-conversation-streaming"></a>

以下是 HTTP/2 请求的参数的语法。

要转录医疗对话的 HTTP/2 音频流，请使用 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartMedicalStreamTranscription.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartMedicalStreamTranscription.html)API 并指定以下内容：
+ `LanguageCode` – 语言代码。有效值为 `en-US`
+ `MediaEncoding` – 用于输入音频的编码。有效值包括 `pcm`、`ogg-opus` 和 `flac`。
+ `Specialty` – 医疗专业人员的专科。
+ `Type` – `CONVERSATION`

要提高实时音频流中特定术语的转录准确性，请使用自定义词汇表。要启用自定义词汇表，请将 `VocabularyName` 参数的值设置为要使用的自定义词汇表的名称。有关更多信息，请参阅 [使用医学自定义词汇表提高转录准确性](vocabulary-med.md)。

要标记来自不同发言者的语音，请将 `ShowSpeakerLabel` 参数设置为 `true`。有关更多信息，请参阅 [启用发言者划分](conversation-diarization-med.md)。

有关设置 HTTP/2 音频流以转录医疗对话的更多信息，请参阅[设置 HTTP/2 音频流](streaming-setting-up.md#streaming-http2)。

## 在直播中转录医疗谈话 WebSocket
<a name="transcribe-medical-conversation-websocket"></a>

您可以使用 WebSocket 请求来转录医疗谈话。当你发出 WebSocket 请求时，你会创建一个预签名 URI。此 URI 包含在应用程序和 Amazon Transcribe Medical 之间建立音频流所需的信息。有关创建 WebSocket 请求的更多信息，请参阅[设置直 WebSocket 播](streaming-setting-up.md#streaming-websocket)。

使用以下模板来创建您的预签名 URI。

```
GET wss://transcribestreaming.us-west-2.amazonaws.com:8443/medical-stream-transcription-websocket
?language-code=languageCode
&X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIAIOSFODNN7EXAMPLE%2F20220208%2Fus-west-2%2Ftranscribe%2Faws4_request
&X-Amz-Date=20220208T235959Z
&X-Amz-Expires=300
&X-Amz-Security-Token=security-token
&X-Amz-Signature=Signature Version 4 signature 
&X-Amz-SignedHeaders=host
&media-encoding=flac
&sample-rate=16000
&session-id=sessionId
&specialty=medicalSpecialty
&type=CONVERSATION
&vocabulary-name=vocabularyName
&show-speaker-label=boolean
```

要提高实时音频流中特定术语的转录准确性，请使用自定义词汇表。要启用自定义词汇表，请将 `vocabulary-name` 的值设置为要使用的自定义词汇表的名称。有关更多信息，请参阅 [使用医学自定义词汇表提高转录准确性](vocabulary-med.md)。

要标记来自不同发言者的语音，请将 `show-speaker-label` 参数设置为 `true`。有关更多信息，请参阅 [启用发言者划分](conversation-diarization-med.md)。

有关创建预签名的更多信息 URIs，请参阅[设置直 WebSocket 播](streaming-setting-up.md#streaming-websocket)。

# 启用发言者划分
<a name="conversation-diarization-med"></a>

要在 “ Amazon Transcribe 医疗” 中启用扬声器分区，请使用*扬声器日记法*。该功能使您能够在转录输出中看到患者所说的话和临床医生所说的话。

当你启用说话者日记功能时，M Amazon Transcribe edical 会用每个*说*话者的唯一标识符来标记每个说话者的话。*言语*是一种语音单位，通常用静默与其它言语隔开。在批量转录中，临床医生的言语可能会收到一个 `spk_0` 标签，而患者可能会收到一个 `spk_1` 标签。

如果一位发言者的言语与另一位发言者的言语重叠， Amazon Transcribe Medical 会按具体的开始时间在转录中对其进行排序。在输入音频中重叠的表达不会在转录输出中重叠。

当您使用批量转录作业或在实时音频流转录音频文件时，您可以启用发言者分类功能。

**Topics**
+ [在批量转录中启用发言者划分](conversation-diarization-batch-med.md)
+ [在实时音频流中启用发言者划分](conversation-diarization-streaming-med.md)

# 在批量转录中启用发言者划分
<a name="conversation-diarization-batch-med"></a>

您可以使用 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartMedicalTranscriptionJob.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartMedicalTranscriptionJob.html) API 或 AWS 管理控制台，在批量转录作业中启用发言者划分。该功能使您能够在临床医生与患者对话中对每位说话者的文本进行划分，并确定谁在转录输出中说了什么。

## AWS 管理控制台
<a name="conversation-diarization-batch-med-console"></a>

要在转录作业中 AWS 管理控制台 使用启用说话者日记功能，请先启用音频识别，然后启用说话者分区。

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

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

1. 请选择**创建任务**。

1. 在**指定作业详细信息**页面上，提供有关您的转录作业的信息。

1. 选择**下一步**。

1. 启用**音频识别**。

1. 对于**音频识别类型**，请选择**发言者划分**。

1. 在**发言者人数上限**中，输入您认为将在音频文件中发言的最大发言者数量。

1. 选择**创建**。

## API
<a name="conversation-diarization-batch-med-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`，请指定 `CONVERSATION`。

  1. 对于`OutputBucketName`，请指定用于 Amazon S3 存储转录结果的存储桶。

  1. 对于 `Settings` 对象，指定以下内容。

     1. `ShowSpeakerLabels` – `true`.

     1. `MaxSpeakerLabels` – 介于 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-media-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',
    OutputBucketName = 'amzn-s3-demo-bucket',
Settings = {'ShowSpeakerLabels': True,
         'MaxSpeakerLabels': 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)
```

以下示例代码显示了启用发言者划分情况下的转录作业的转录结果。

```
{
    "jobName": "job ID",
    "accountId": "111122223333",
    "results": {
        "transcripts": [
            {
                "transcript": "Professional answer."
            }
        ],
        "speaker_labels": {
            "speakers": 1,
            "segments": [
                {
                    "start_time": "0.000000",
                    "speaker_label": "spk_0",
                    "end_time": "1.430",
                    "items": [
                        {
                            "start_time": "0.100",
                            "speaker_label": "spk_0",
                            "end_time": "0.690"
                        },
                        {
                            "start_time": "0.690",
                            "speaker_label": "spk_0",
                            "end_time": "1.210"
                        }
                    ]
                }
            ]
        },
        "items": [
            {
                "start_time": "0.100",
                "end_time": "0.690",
                "alternatives": [
                    {
                        "confidence": "0.8162",
                        "content": "Professional"
                    }
                ],
                "type": "pronunciation"
            },
            {
                "start_time": "0.690",
                "end_time": "1.210",
                "alternatives": [
                    {
                        "confidence": "0.9939",
                        "content": "answer"
                    }
                ],
                "type": "pronunciation"
            },
            {
                "alternatives": [
                    {
                        "content": "."
                    }
                ],
                "type": "punctuation"
            }
        ]
    },
    "status": "COMPLETED"
}
```

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

**转录全科临床医生与患者之间对话的音频文件 (AWS CLI)**
+ 运行以下代码。

  ```
                      
  aws transcribe start-transcription-job \
  --region us-west-2 \
  --cli-input-json file://example-start-command.json
  ```

  以下代码显示了 `example-start-command.json` 的内容。

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

# 在实时音频流中启用发言者划分
<a name="conversation-diarization-streaming-med"></a>

要对发言者进行分区并在实时流中标记他们的语音，请使用 AWS 管理控制台 或直播请求。发言者划分最适合流式转录中有两到五个发言者。尽管 M Amazon Transcribe edical 可以在一个直播中对五个以上的扬声器进行分区，但如果超过该数字，分区的准确性就会降低。

要启动 HTTP/2 请求，请使用 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartMedicalStreamTranscription.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartMedicalStreamTranscription.html) API。要启动 WebSocket 请求，请使用预签名 URI。URI 包含在应用程序和 Amazon Transcribe Medical 之间建立双向通信所需的信息。

## 在对着麦克风说话的音频中启用发言者划分（AWS 管理控制台）
<a name="conversation-diarization-console"></a>

您可以使用开始实时直播临床医生与患者的对话，或者开始对着麦克风实时说出的听写。 AWS 管理控制台 

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

1. 在导航窗格中，为 “ Amazon Transcribe 医疗” 选择 “**实时转录**”。

1. 对于**音频输入类型**，选择要转录的医疗语音类型。

1. 对于**其它设置**，请选择**发言者划分**。

1. 选择**开始流式转录**以开始转录您的实时音频。

1. 对着麦克风说话。

## 在 HTTP/2 音频流中启用发言者划分
<a name="conversation-diarization-med-http2"></a>

要在医疗对话的 HTTP/2 音频流中启用发言者划分，请使用 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartMedicalStreamTranscription.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartMedicalStreamTranscription.html) API 并指定以下内容：
+ 对于 `LanguageCode`，指定与流式转录中所用语言对应的语言代码。有效值为 `en-US`。
+ 对于 `MediaSampleHertz`，请指定音频的采样率。
+ 对于 `Specialty`，指定提供者的医学专科。
+ `ShowSpeakerLabel` – `true`

有关设置 HTTP/2 音频流以转录医疗对话的更多信息，请参阅[设置 HTTP/2 音频流](streaming-setting-up.md#streaming-http2)。

## 在请求中启用扬声器分区 WebSocket
<a name="conversation-diarization-med-websocket"></a>

要使用 API 对 WebSocket 直播中的演讲者进行分区，请使用以下格式创建用于启动 WebSocket 请求的预签名 URI 并将其设置`show-speaker-label`为`true`。

```
GET wss://transcribestreaming.us-west-2.amazonaws.com:8443/medical-stream-transcription-websocket
?language-code=languageCode
&X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIAIOSFODNN7EXAMPLE%2F20220208%2Fus-west-2%2Ftranscribe%2Faws4_request
&X-Amz-Date=20220208T235959Z
&X-Amz-Expires=300
&X-Amz-Security-Token=security-token
&X-Amz-Signature=Signature Version 4 signature 
&X-Amz-SignedHeaders=host
&media-encoding=flac
&sample-rate=16000
&session-id=sessionId
&specialty=medicalSpecialty
&type=CONVERSATION
&vocabulary-name=vocabularyName
&show-speaker-label=boolean
```

以下代码显示了流式转录请求的截断示例响应。

```
{
  "Transcript": {
    "Results": [
      {
        "Alternatives": [
          {
            "Items": [
              {
                "Confidence": 0.97,
                "Content": "From",
                "EndTime": 18.98,
                "Speaker": "0",
                "StartTime": 18.74,
                "Type": "pronunciation",
                "VocabularyFilterMatch": false
              },
              {
                "Confidence": 1,
                "Content": "the",
                "EndTime": 19.31,
                "Speaker": "0",
                "StartTime": 19,
                "Type": "pronunciation",
                "VocabularyFilterMatch": false
              },
              {
                "Confidence": 1,
                "Content": "last",
                "EndTime": 19.86,
                "Speaker": "0",
                "StartTime": 19.32,
                "Type": "pronunciation",
                "VocabularyFilterMatch": false
              },
             ...
              {
                "Confidence": 1,
                "Content": "chronic",
                "EndTime": 22.55,
                "Speaker": "0",
                "StartTime": 21.97,
                "Type": "pronunciation",
                "VocabularyFilterMatch": false
              },
              ...
                "Confidence": 1,
                "Content": "fatigue",
                "EndTime": 24.42,
                "Speaker": "0",
                "StartTime": 23.95,
                "Type": "pronunciation",
                "VocabularyFilterMatch": false
              },
              {
                "EndTime": 25.22,
                "StartTime": 25.22,
                "Type": "speaker-change",
                "VocabularyFilterMatch": false
              },
              {
                "Confidence": 0.99,
                "Content": "True",
                "EndTime": 25.63,
                "Speaker": "1",
                "StartTime": 25.22,
                "Type": "pronunciation",
                "VocabularyFilterMatch": false
              },
              {
                "Content": ".",
                "EndTime": 25.63,
                "StartTime": 25.63,
                "Type": "punctuation",
                "VocabularyFilterMatch": false
              }
            ],
            "Transcript": "From the last note she still has mild sleep deprivation and chronic fatigue True."
          }
        ],
        "EndTime": 25.63,
        "IsPartial": false,
        "ResultId": "XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXX",
        "StartTime": 18.74
      }
    ]
  }
}
```

Amazon Transcribe Medical 会根据自然的语音片段（例如说话者的变化或音频的暂停）来中断传入的音频流。转录将逐步返回到您的应用程序，每个响应包含更多转录的语音，直到整个片段被转录。前面的代码是完全转录的语音片段的截断示例。只有完全转录的语音片段才会显示发言者标签。

以下列表显示了流式转录输出中对象和参数的组织结构。

**`Transcript`**  
每个语音段都有自己的 `Transcript` 对象。

**`Results`**  
每个 `Transcript` 对象都有自己的 `Results` 对象。此对象包含 `isPartial` 字段。当其值为 `false` 时，返回的结果就是针对整个语音片段的。

**`Alternatives`**  
每个 `Results` 对象都有一个 `Alternatives` 对象。

**`Items`**  
每个 `Alternatives` 对象都有自己的 `Items` 对象，其中包含有关转录输出中每个单词和标点符号的信息。启用扬声器分区后，每个单词都有一个用于`Speaker`标注完全转录的语音片段的标签。 Amazon Transcribe Medical 使用此标签为直播中的每个发言者分配一个唯一的整数。值为 `speaker-change` 的 `Type` 参数表示一个人已停止说话，另一个人即将开始说话。

**`Transcript`**  
每个 Items 对象都包含一个转录的语音片段作为 `Transcript` 字段的值。

有关 WebSocket 请求的更多信息，请参阅[设置直 WebSocket 播](streaming-setting-up.md#streaming-websocket)。

# 转录多声道音频
<a name="conversation-channel-id-med"></a>

如果您的音频文件或视频流具有多个频道，则可以使用*频道识别*来转录每个频道的语音。 Amazon Transcribe Medical 分别转录每个频道的演讲。它将每个声道的单独转录合并为一个转录输出。

使用声道识别来识别音频中的不同声道，并转录每个声道的语音。在来电者和座席场景等场景中启用此功能。使用它来区分执行药物安全监控的联络中心的录音或音频流中的来电者和座席。

您可以为批量转录和实时流式转录启用声道识别。以下列表描述了如何为每种方法启用该功能。
+ Batch 转录 — AWS 管理控制台 和 API [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartMedicalTranscriptionJob.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartMedicalTranscriptionJob.html)
+ 直播转录 — WebSocket 直播和 API [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartMedicalStreamTranscription.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartMedicalStreamTranscription.html)

## 转录多声道音频文件
<a name="conversation-channel-id-med-batch"></a>

当您转录音频文件时，M Amazon Transcribe edical 会返回每个频道的*项目*列表。项目是转录的单词或标点符号。每个单词都有开始时间和结束时间。如果一个声道上的某个人与另一个声道上的一个人交谈，则当这些人互相交谈时，每个声道的项目的开始时间和结束时间会重叠。

默认情况下，您可以转录包含两个声道的音频文件。如果您需要转录的文件具有超过两个声道，则可以申请增加配额。有关请求增加配额的更多信息，请参阅 [AWS 服务 配额](https://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html)。

要在批量转录作业中转录多声道音频，请使用 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="channel-id-batch-med-console"></a>

要在 AWS 管理控制台 批量转录作业中使用启用频道识别，请先启用音频识别，然后启用频道识别。频道识别是中音频识别的一个子集 AWS 管理控制台。

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

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

1. 请选择**创建任务**。

1. 在**指定作业详细信息**页面上，提供有关您的转录作业的信息。

1. 选择**下一步**。

1. 启用**音频识别**。

1. 对于**音频识别类型**，请选择**声道识别**。

1. 选择**创建**。

### API
<a name="channel-id-batch-med-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. 对于 `TranscriptionJobName`，请指定对于您 AWS 账户而言唯一的名称。

  1. 对于 `LanguageCode`，指定与音频文件中所用语言对应的语言代码。有效值为 `en-US`。

  1. 对于 `Media` 对象的 `MediaFileUri` 参数，指定要转录的媒体文件的名称。

  1. 对于`Settings` 对象，将 `ChannelIdentification` 设置为 `true`。

以下是一个使用 适用于 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_name = "my-first-med-transcription-job"
job_uri = "s3://amzn-s3-demo-bucket/my-input-files/my-media-file.flac"
transcribe.start_medical_transcription_job(
      MedicalTranscriptionJobName = job_name,
      Media = {
        'MediaFileUri': job_uri
      },
      OutputBucketName = 'amzn-s3-demo-bucket',
      OutputKey = 'output-files/',
      LanguageCode = 'en-US',
      Specialty = 'PRIMARYCARE',
      Type = 'CONVERSATION',
      Settings = {
        'ChannelIdentification': True
      }
)
while True:
    status = transcribe.get_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="channel-id-med-cli"></a>

**使用批量转录作业转录多声道音频文件（AWS CLI）**
+ 运行以下代码。

  ```
                      
  aws transcribe start-medical-transcription-job \
  --region us-west-2 \
  --cli-input-json file://example-start-command.json
  ```

  以下是 `example-start-command.json` 的代码。

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

以下代码显示了在两个声道上进行对话的音频文件的转录输出。

```
{
  "jobName": "job id",
  "accountId": "111122223333",
  "results": {
    "transcripts": [
      {
        "transcript": "When you try ... It seems to ..."
      }
    ],
    "channel_labels": {
      "channels": [
        {
          "channel_label": "ch_0",
          "items": [
            {
              "start_time": "12.282",
              "end_time": "12.592",
              "alternatives": [
                {
                  "confidence": "1.0000",
                  "content": "When"
                }
              ],
              "type": "pronunciation"
            },
            {
              "start_time": "12.592",
              "end_time": "12.692",
              "alternatives": [
                {
                  "confidence": "0.8787",
                  "content": "you"
                }
              ],
              "type": "pronunciation"
            },
            {
              "start_time": "12.702",
              "end_time": "13.252",
              "alternatives": [
                {
                  "confidence": "0.8318",
                  "content": "try"
                }
              ],
              "type": "pronunciation"
            },
            ...
         ]
      },
      {
          "channel_label": "ch_1",
          "items": [
            {
              "start_time": "12.379",
              "end_time": "12.589",
              "alternatives": [
                {
                  "confidence": "0.5645",
                  "content": "It"
                }
              ],
              "type": "pronunciation"
            },
            {
              "start_time": "12.599",
              "end_time": "12.659",
              "alternatives": [
                {
                  "confidence": "0.2907",
                  "content": "seems"
                }
              ],
              "type": "pronunciation"
            },
            {
              "start_time": "12.669",
              "end_time": "13.029",
              "alternatives": [
                {
                  "confidence": "0.2497",
                  "content": "to"
                }
              ],
              "type": "pronunciation"
            },
            ...
        ]
    }
}
```

## 转录多声道音频流
<a name="conversation-channel-id-med-stream"></a>

您可以使用 API 在 HTTP/2 或 WebSocket直播中转录来自不同频道的音频。[https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartMedicalStreamTranscription.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartMedicalStreamTranscription.html)

默认情况下，您可以转录包含两个声道的音频流。如果您需要转录的音频流具有超过两个声道，则可以申请增加配额。有关请求增加配额的信息，请参阅 [AWS 服务配额](https://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html)。

### 在 HTTP/2 音频流中转录多声道音频
<a name="conversation-channel-id-http2"></a>

要转录 HTTP/2 流中的多声道音频，请使用 [StartMedicalStreamTranscription](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartMedicalStreamTranscription.html)API 并指定以下内容：
+ `LanguageCode` – 音频的语言代码。有效值为 `en-US`。
+ `MediaEncoding` – 音频的编码。有效值包括 `ogg-opus`、`flac` 和 `pcm`。
+ `EnableChannelIdentification` – `true`
+ `NumberOfChannels` – 流式音频中的声道数量。

有关设置 HTTP/2 音频流以转录医疗对话的更多信息，请参阅[设置 HTTP/2 音频流](streaming-setting-up.md#streaming-http2)。

### 在直播中转录多声道音频 WebSocket
<a name="channel-id-med-websocket"></a>

要对 WebSocket 直播中的演讲者进行分区，请使用以下格式创建预签名 URI 并启动 WebSocket 请求。将 `enable-channel-identification` 指定为 `true`，并在 `number-of-channels` 中指定您音频流中的声道数量。预签名 URI 包含在您的应用程序和 Amazon Transcribe Medical 之间建立双向通信所需的信息。

```
GET wss://transcribestreaming.us-west-2.amazonaws.com:8443/medical-stream-transcription-websocket
?language-code=languageCode
&X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIAIOSFODNN7EXAMPLE%2F20220208%2Fus-west-2%2Ftranscribe%2Faws4_request
&X-Amz-Date=20220208T235959Z
&X-Amz-Expires=300
&X-Amz-Security-Token=security-token
&X-Amz-Signature=Signature Version 4 signature
&X-Amz-SignedHeaders=host
&media-encoding=flac
&sample-rate=16000
&session-id=sessionId
&enable-channel-identification=true
&number-of-channels=2
```

参数定义可在 [API 参考](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_Reference.html)中找到；所有 AWS API 操作的通用参数列在[常用参数](https://docs.aws.amazon.com/transcribe/latest/APIReference/CommonParameters.html)部分中。

有关 WebSocket 请求的更多信息，请参阅[设置直 WebSocket 播](streaming-setting-up.md#streaming-websocket)。

### 多声道流式输出
<a name="streaming-med-output"></a>

HTTP/2 和请求的流式转录输出相同。 WebSocket下面是一个示例输出。

```
{
    "resultId": "XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX",
    "startTime": 0.11,
    "endTime": 0.66,
    "isPartial": false,
    "alternatives": [
        {
            "transcript": "Left.",
            "items": [
                {
                    "startTime": 0.11,
                    "endTime": 0.45,
                    "type": "pronunciation",
                    "content": "Left",
                    "vocabularyFilterMatch": false
                },
                {
                    "startTime": 0.45,
                    "endTime": 0.45,
                    "type": "punctuation",
                    "content": ".",
                    "vocabularyFilterMatch": false
                }
            ]
        }
    ],
    "channelId": "ch_0"
}
```

对于每个语音片段，都有一个 `channelId` 标志，用于指示语音属于哪个声道。

# 转录医学口述
<a name="transcribe-medical-dictation"></a>

您可以使用 Medic Amazon Transcribe al 通过批量转录作业或实时流来转录临床医生口述的医疗记录。批量转录作业让您能够转录音频文件。您可以在转录工作或直播中指定临床医生的医学专业，以确保 Medic Amazon Transcribe al 以尽可能高的准确度生成转录结果。

您可以转录以下专业的医学口述：
+ 心脏科 – 仅在流式转录中可用
+ 神经科 – 仅在流式转录中可用
+ 肿瘤科 – 仅在流式转录中可用
+ 全科 – 包括以下类型的医疗机构：
  + 家庭医疗
  + 内科
  + 妇产科 (OB-GYN)
  + 儿科
+ 放射科 – 仅在流式转录中可用
+ 泌尿外科 – 仅在流式转录中可用

您可以使用自定义词汇表来提高转录的准确性。有关医学自定义词汇表的信息，请参阅[使用医学自定义词汇表提高转录准确性](vocabulary-med.md)。

默认情况下，M Amazon Transcribe edical 会返回置信度最高的转录。如果您想将其配置为返回备选转录，请参阅[生成备选转录](alternative-med-transcriptions.md)。

有关数字和医学测量结果在转录输出中的显示方式的信息，请参阅[转录数值](how-numbers-med.md)和[转录医学术语和测量结果](how-measurements-med.md)。

**Topics**
+ [转录医学口述的音频文件](batch-medical-dictation.md)
+ [在实时音频流中转录医学口述](streaming-medical-dictation.md)

# 转录医学口述的音频文件
<a name="batch-medical-dictation"></a>

使用批量转录作业转录医疗对话的音频文件。您可以用它来转录临床医生与患者的对话。您可以通过 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartMedicalTranscriptionJob.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartMedicalTranscriptionJob.html) API 或 AWS 管理控制台来启动批量转录作业。

使用 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartMedicalTranscriptionJob.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartMedicalTranscriptionJob.html) API 启动医疗转录作业时，您可以将 `PRIMARYCARE` 指定为 `Specialty` 参数的值。

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

**转录临床医生与患者的对话（AWS 管理控制台）**

**要使用转录临床医生与患者的对话，请创建转录作业，然后选择**对话**作为音频输入类型。 AWS 管理控制台 **

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

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

1. 请选择**创建任务**。

1. 在**指定作业详细信息**页面上的**作业设置**下，指定以下设置。

   1. **名称** – 转录作业的名称。

   1. **音频输入类型** – **口述**

1. 对于其余字段，请指定音频文件的 Amazon S3 位置以及要存储转录作业输出的位置。

1. 选择**下一步**。

1. 选择**创建**。

## API
<a name="batch-med-dictation-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`，请指定 `DICTATION`。

  1. 对于 `OutputBucketName`，请指定要将转录结果存储到的 Amazon S3 存储桶。

  以下是一个请求示例，该请求使用 适用于 Python (Boto3) 的 AWS SDK 转录该专业临床医生的医疗听写。`PRIMARYCARE`

  ```
   from __future__ import print_function
   import time
   import boto3
   transcribe = boto3.client('transcribe')
   job_name = "my-first-med-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 = 'DICTATION'
   )
  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)
  ```

以下示例代码显示了医学口述的转录结果。

```
{
    "jobName": "dictation-medical-transcription-job",
    "accountId": "111122223333",
    "results": {
        "transcripts": [
            {
                "transcript": "... came for a follow up visit today..."
            }
        ],
        "items": [
            {
            ...
                "start_time": "4.85",
                "end_time": "5.12",
                "alternatives": [
                    {
                        "confidence": "1.0",
                        "content": "came"
                    }
                ],
                "type": "pronunciation"
            },
            {
                "start_time": "5.12",
                "end_time": "5.29",
                "alternatives": [
                    {
                        "confidence": "1.0",
                        "content": "for"
                    }
                ],
                "type": "pronunciation"
            },
            {
                "start_time": "5.29",
                "end_time": "5.33",
                "alternatives": [
                    {
                        "confidence": "0.9955",
                        "content": "a"
                    }
                ],
                "type": "pronunciation"
            },
            {
                "start_time": "5.33",
                "end_time": "5.66",
                "alternatives": [
                    {
                        "confidence": "0.9754",
                        "content": "follow"
                    }
                ],
                "type": "pronunciation"
            },
            {
                "start_time": "5.66",
                "end_time": "5.75",
                "alternatives": [
                    {
                        "confidence": "0.9754",
                        "content": "up"
                    }
                ],
                "type": "pronunciation"
            },
            {
                "start_time": "5.75",
                "end_time": "6.02",
                "alternatives": [
                    {
                        "confidence": "1.0",
                        "content": "visit"
                    }
                ]
                ...
    },
    "status": "COMPLETED"
}
```

## AWS CLI
<a name="batch-med-dictation-cli"></a>

**在批量转录作业中启用发言者划分 (AWS CLI)**
+ 运行以下代码。

  ```
                      
  aws transcribe start-medical-transcription-job \
  --region us-west-2 \
  --cli-input-json file://example-start-command.json
  ```

  以下代码显示了 `example-start-command.json` 的内容。

  ```
  {
        "MedicalTranscriptionJobName": "my-first-med-transcription-job",        
        "Media": {
        "MediaFileUri": "s3://amzn-s3-demo-bucket/my-input-files/my-audio-file.flac"
        },
        "OutputBucketName": "amzn-s3-demo-bucket",
        "OutputKey": "my-output-files/", 
        "LanguageCode": "en-US",  
        "Specialty": "PRIMARYCARE",
        "Type": "DICTATION"
  }
  ```

# 在实时音频流中转录医学口述
<a name="streaming-medical-dictation"></a>

使用 WebSocket 直播将医疗听写转录为音频流。您也可以使用将您或其他人直接说话的语音转录到麦克风中。 AWS 管理控制台 

 对于 HTTP/2 或 WebSocket 直播，您可以转录以下医学专业的音频：
+ 心脏科
+ 肿瘤科
+ 神经科
+ 全科
+ 放射科
+ 泌尿外科

每个医学专科都包括许多类型的程序和预约。因此，临床医生会口述多种不同类型的笔记。使用以下示例作为指导，帮助您指定 WebSocket 请求的 `specialty` URI 参数的值或 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartMedicalStreamTranscription.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartMedicalStreamTranscription.html)API 的`Specialty`参数：
+ 如需电生理学或超声心动图检查后的口述，请选择 `CARDIOLOGY`。
+ 如需肿瘤外科或放射肿瘤科检查后的口述，请选择 `ONCOLOGY`。
+ 如需讲解脑炎诊断情况的医生口述笔记，请选择 `NEUROLOGY`。
+ 如需切开膀胱结石的手术注意事项的口述，请选择 `UROLOGY`。
+ 如需内科咨询后的临床医生笔记口述，请选择 `PRIMARYCARE`。
+ 如需传达 CT 扫描、PET 扫描、MRI 或 X 光片检查结果的医生口述，请选择 `RADIOLOGY`。
+ 如需妇科咨询后的医生笔记口述，请选择 `PRIMARYCARE`。

要提高实时音频流中特定术语的转录准确性，请使用自定义词汇表。要启用自定义词汇表，请将 `vocabulary-name` 的值设置为要使用的自定义词汇表的名称。

## 使用麦克风将听写内容转录到麦克风中 AWS 管理控制台
<a name="streaming-medical-dictation-console"></a>

要使用转录医疗听写的流式音频，请选择转录医疗听写的选项，开始直播，然后开始对着麦克风说话。 AWS 管理控制台 

**转录医学口述的流式音频（AWS 管理控制台）**

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

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

1. 选择**口述**。

1. 对于**医学专科**，请选择在音频流中发言的临床医生的医学专科。

1. 选择 **Start streaming（开始流式传输）**。

1. 对着麦克风说话。

## 在 HTTP/2 音频流中转录口述
<a name="http2-med-dictation-streaming"></a>

要转录医学口述的 HTTP/2 音频流，请使用 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartMedicalStreamTranscription.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartMedicalStreamTranscription.html)API 并指定以下内容：
+ `LanguageCode` – 语言代码。有效值为 `en-US`
+ `MediaEncoding` – 用于输入音频的编码。有效值包括 `pcm`、`ogg-opus` 和 `flac`。
+ `Specialty` – 医疗专业人员的专科。
+ `Type` – `DICTATION`

有关设置 HTTP/2 音频流以转录医学口述的更多信息，请参阅[设置 HTTP/2 音频流](streaming-setting-up.md#streaming-http2)。

## 使用 WebSocket 直播请求转录医疗听写
<a name="transcribe-medical-dictation-websocket"></a>

要使用 WebSocket请求在实时流中转录医疗听写，请创建预签名 URI。此 URI 包含在您的应用程序和 Medic Amazon Transcribe al 之间设置音频流所需的信息。有关创建 WebSocket 请求的更多信息，请参阅[设置直 WebSocket 播](streaming-setting-up.md#streaming-websocket)。

使用以下模板来创建您的预签名 URI。

```
GET wss://transcribestreaming.us-west-2.amazonaws.com:8443/medical-stream-transcription-websocket
?language-code=languageCode
&X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIAIOSFODNN7EXAMPLE%2F20220208%2Fus-west-2%2Ftranscribe%2Faws4_request
&X-Amz-Date=20220208T235959Z
&X-Amz-Expires=300
&X-Amz-Security-Token=security-token
&X-Amz-Signature=Signature Version 4 signature 
&X-Amz-SignedHeaders=host
&media-encoding=flac
&sample-rate=16000
&session-id=sessionId
&specialty=medicalSpecialty
&type=DICTATION
&vocabulary-name=vocabularyName
&show-speaker-label=boolean
```

有关创建预签名的更多信息 URIs，请参阅[设置直 WebSocket 播](streaming-setting-up.md#streaming-websocket)。

# 使用医学自定义词汇表提高转录准确性
<a name="vocabulary-med"></a>

要提高 Medic Amazon Transcribe al 中的转录准确性，请创建并使用一个或多个医学自定义词汇表。*自定义词汇表*是特定领域的单词或短语的集合。该集合有助于提高 Medic Amazon Transcribe al 在转录这些单词或短语方面的表现。

在使用 Medic Amazon Transcribe al 时，您应对自己数据的完整性负责。请勿在自定义词汇表中输入机密信息、个人信息 (PII) 或受保护的健康信息 (PHI)。

为了获得最佳效果，请创建单独的小型自定义词汇表，每个词汇表都有助于转录特定的录音。与创建用于所有录音的大型自定义词汇表相比，在转录准确性方面可以获得更大的改进。

默认情况下，您最多可以有 100 个自定义词汇表。 AWS 账户自定义词汇的大小不能超过 50 KB。有关申请增加可包含的自定义词汇量的信息 AWS 账户，请参阅[AWS 服务配额](https://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html)。

自定义词汇表是美国英语 (en-US) 版本。

**Topics**
+ [为您的医学自定义词汇表创建文本文件](create-med-vocab-text.md)
+ [使用文本文件创建医学自定义词汇表](create-med-custom-vocabulary.md)
+ [使用医学自定义词汇表转录音频文件](start-med-custom-vocab-job.md)
+ [使用医学自定义词汇表转录实时音频流](start-med-vocab-stream.md)
+ [Amazon Transcribe 医疗字符集](charsets-med.md)

# 为您的医学自定义词汇表创建文本文件
<a name="create-med-vocab-text"></a>

要创建自定义词汇表，请创建 UTF-8 格式的文本文件。在此文件中，您将创建一个包含四列的表，每列指定一个字段。每个字段都告诉 M Amazon Transcribe edical 要么是特定领域的术语是如何发音的，要么是如何在转录中显示这些术语。您将包含这些字段的文本文件存储在 Amazon S3 存储桶中。

## 了解如何格式化文本文件
<a name="understand-vocab-formatting"></a>

要创建医学自定义词汇表，请将列名作为标头行输入。您可以为标头行下方的每列输入值。

以下是该表中四个列的名称：
+  `Phrase` – 列为必填项，值为必填项 
+  `IPA` – 列为必填项，值为可选项 
+  `SoundsLike` – 列为必填项，值为可选项 
+  `DisplayAs` – 列为必填项，值为可选项 

在创建自定义词汇表时，请务必：
+ 使用单个 Tab 字符分隔每列。 Amazon Transcribe 如果您尝试用空格或多个 Tab 字符分隔列，则会抛出错误消息。
+ 确保列中的每个值后面没有尾随空格或空格。

确保您为每列输入的值符合以下条件：
+ 包括连字符在内不超过 256 个字符
+ 仅使用允许的字符集中的字符，请参阅[Amazon Transcribe 医疗字符集](charsets-med.md)。

## 为表的列输入值
<a name="entering-vocabulary-values-med"></a>

以下信息向您展示了如何为表的四个列指定值：
+ `Phrase` – 应识别的单词或短语。您必须在该列中输入值。

  如果条目为短语，请用连字符 (-) 隔开各个单词。例如，以 **cerebral-autosomal-dominant-arteriopathy-with-subcortical-infarcts-and-leukoencephalopathy** 形式输入 **cerebral autosomal dominant arteriopathy with subcortical infarcts and leukoencephalopathy**。

  以单个字母后跟圆点的形式（例如 **D.N.A.** 或 **S.T.E.M.I.**），输入字母应单独发音的首字母缩写词或其他单词。要输入首字母缩略词的复数形式，例如 “”STEMIs，请使用连字符将 “s” 与首字母缩略词分开：“**S.T.E.M.I-s**” 您可以使用大写或小写字母作为首字母缩略词。

  `Phrase` 列是必填的。您可以使用输入语言允许的任何字符。有关允许的字符，请参阅[Amazon Transcribe 医疗字符集](charsets-med.md)。如果您未指定该`DisplayAs`列，M Amazon Transcribe edical 将在输出文件中使用该`Phrase`列的内容。
+ `IPA`（列为必填项，值为可选项）– 要指定单词或短语的发音，您可以在该列中包含[国际音标字母 (IPA)](https://en.wikipedia.org/wiki/International_Phonetic_Alphabet) 中的字符。`IPA` 列不能包含前导空格或尾随空格，并且您必须使用单个空格以隔开输入中的每个音素。例如，在英语中，您以 **ə k j u t ɹ ɛ s p ɪ ɹ ə t ɔ ɹ i d ɪ s t ɹ ɛ s s ɪ n d ɹ oʊ m** 形式输入短语 **acute-respiratory-distress-syndrome**。您以 **eɪ ɛ l ɛ l** 形式输入短语 **A.L.L.**。

  即使未指定 `IPA` 列的内容，您也必须包含空白的 `IPA` 列。如果在 `IPA` 列中包含值，则不能为 `SoundsLike` 列提供值。

  有关特定语言允许的 IPA 字符列表，请参阅[Amazon Transcribe 医疗字符集](charsets-med.md)。美国英语是 Amazon Transcribe 医疗领域唯一可用的语言。
+ `SoundsLike`（列为必填项，值为可选项）– 您可以将单词或短语拆分为更小的部分，并使用语言的标准拼写法为每个部分提供发音以模仿单词的发音方式。例如，您可以按以下方式为短语 **cerebral-autosomal-dominant-arteriopathy-with-subcortical-infarcts-and-leukoencephalopathy** 提供发音提示：**sir-e-brul-aut-o-som-ul-dah-mi-nant-ar-ter-ri-o-pa-thy-with-sub-cor-ti-cul-in-farcts-and-lewk-o-en-ce-phul-ah-pu-thy**。短语 **atrioventricular-nodal-reentrant-tachycardia** 的提示如下所示：**ay-tree-o-ven-trick-u-lar-node-al-re-entr-ant-tack-ih-card-ia**。您使用连字符 (-) 分隔提示的每个部分。

  即使没有为 `SoundsLike` 列提供值，您也必须包含空白的 `SoundsLike` 列。如果在 `SoundsLike` 列中包含值，则不能为 `IPA` 列提供值。

  您可以使用输入语言允许的任何字符。有关允许的字符列表，请参阅[Amazon Transcribe 医疗字符集](charsets-med.md)。
+ （列为必填项，值为可选项）– 定义单词或短语在输出时的显示效果。例如，如果单词或短语为 **cerebral-autosomal-dominant-arteriopathy-with-subcortical-infarcts-and-leukoencephalopathy**，您可以将显示形式指定为 `cerebral autosomal dominant arteriopathy with subcortical infarcts and leukoencephalopathy`，以便不会显示连字符。如果要在输出中显示首字母缩写词而不是完整术语，您也可以使用 `CADASIL` 形式指定 `DisplayAs`。

  如果您未指定该`DisplayAs`列，M Amazon Transcribe edical `Phrase` 将在输出中使用输入文件中的列。

  您可以在 `DisplayAs` 列中使用任何 UTF-8 字符。

可以在 `IPA` 和 `DisplayAs` 列中包含空格值。

要创建自定义词汇表的文本文件，请将文本文件中的每个单词或短语放在单独的行中。使用制表符分隔列。仅在 `IPA` 和 `DisplayAs` 列中包含空格值。将带有扩展名的`.txt`文件保存在 Amazon S3 存储桶中，与使用 M Amazon Transcribe edical 创建自定义词汇表相同 AWS 区域 。

如果您在 Windows 中编辑文本文件，请确保文件采用 `LF` 格式，而不是 `CRLF` 格式。否则，您无法创建自定义词汇表。通过使用某些文本编辑器，您可以使用查找和替换命令更改格式。

以下示例显示可用于创建自定义词汇表的文本。要从这些示例中创建自定义词汇表，请将一个示例复制到文本编辑器中，将 `[TAB]` 替换为制表符，然后将保存的文本文件上传到 Amazon S3。

```
Phrase[TAB]IPA[TAB]SoundsLike[TAB]DisplayAs
acute-respiratory-distress-syndrome[TAB][TAB][TAB]acute respiratory distress syndrome
A.L.L.[TAB]eɪ ɛ l ɛ l[TAB][TAB]ALL
atrioventricular-nodal-reentrant-tachycardia[TAB][TAB]ay-tree-o-ven-trick-u-lar-node-al-re-entr-ant-tack-ih-card-ia[TAB]
```

您可以按任意顺序输入列。以下示例显示了自定义词汇表输入文件的其他有效结构。

```
Phrase[TAB]SoundsLike[TAB]IPA[TAB]DisplayAs
acute-respiratory-distress-syndrome[TAB][TAB][TAB]acute respiratory distress syndrome
A.L.L.[TAB][TAB]eɪ ɛ l ɛ l[TAB]ALL
atrioventricular-nodal-reentrant-tachycardia[TAB]ay-tree-o-ven-trick-u-lar-node-al-re-entr-ant-tack-ih-card-ia[TAB][TAB]
```

```
DisplayAs[TAB]SoundsLike[TAB]IPA[TAB]Phrase
acute respiratory distress syndrome[TAB][TAB][TAB]acute-respiratory-distress-syndrome
ALL[TAB][TAB]eɪ ɛ l ɛ l[TAB]A.L.L.
[TAB]ay-tree-o-ven-trick-u-lar-node-al-re-entr-ant-tack-ih-card-ia[TAB][TAB]atrioventricular-nodal-reentrant-tachycardia
```

为了便于阅读，下表以 html 格式更清楚地显示上述示例。它们仅用于说明示例。


| Phrase | IPA | SoundsLike | DisplayAs | 
| --- | --- | --- | --- | 
| acute-respiratory-distress-syndrome |  |  | acute respiratory distress syndrome | 
| A.L.L。 | eɪ ɛ l ɛ l |  | ALL | 
| atrioventricular-nodal-reentrant-tachycardia |  | ay-tree-o-ven-trick-u-lar-node-al-re-entr-ant-tack-ih-card-ia |  | 


| Phrase | SoundsLike | IPA | DisplayAs | 
| --- | --- | --- | --- | 
| acute-respiratory-distress-syndrome |  |  | acute respiratory distress syndrome | 
| atrioventricular-nodal-reentrant-tachycardia | ay-tree-o-ven-trick-u-lar-node-al-re-entr-ant-tack-ih-card-ia |  |  | 
| A.L.L。 |  | eɪ ɛ l ɛ l | ALL | 


| DisplayAs | SoundsLike | IPA | Phrase | 
| --- | --- | --- | --- | 
| acute respiratory distress syndrome |  |  | acute-respiratory-distress-syndrome | 
| ALL |  | eɪ ɛ l ɛ l | A.L.L。 | 
|  | ay-tree-o-ven-trick-u-lar-node-al-re-entr-ant-tack-ih-card-ia |  | atrioventricular-nodal-reentrant-tachycardia | 

# 使用文本文件创建医学自定义词汇表
<a name="create-med-custom-vocabulary"></a>

要创建自定义词汇表，必须准备好包含单词或短语集合的文本文件。 Amazon Transcribe Medical 使用此文本文件创建自定义词汇表，您可以使用该词汇来提高这些单词或短语的转录准确性。您可以使用 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_CreateMedicalVocabulary.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_CreateMedicalVocabulary.html)API 或 Amazon Transcribe 医疗控制台创建自定义词汇表。

## AWS 管理控制台
<a name="create-med-custom-vocab-console"></a>

要使用创建自定义词汇，您需要提供包含您的单词或短语的文本文件的 Amazon S3 URI。 AWS 管理控制台 

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

1. 在导航窗格的 “ Amazon Transcribe 医疗” 下，选择 “**自定义词汇**”。

1. 在**名称**中的**词汇表设置** 下，为您的自定义词汇表选择一个名称。

1. 指定音频文件或视频文件在 Amazon S3中的位置：
   + 在**词汇表设置**下的 **S3 中的词汇表输入文件位置**中，指定用来标识将用于创建自定义词汇表的文本文件的 Amazon S3 URI。
   + 对于 **S3 中的词汇表输入文件位置**，请选择**浏览 S3**，浏览文本文件并将其选中。

1. 选择**创建词汇表**。

您可以在 AWS 管理控制台中查看自定义词汇表的处理状态。

## API
<a name="create-med-custom-vocab-api"></a>

**创建医学自定义词汇表 (API)**
+ 对于 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartTranscriptionJob.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartTranscriptionJob.html) API，请指定以下内容。

  1. 对于 `LanguageCode`，请指定 `en-US`。

  1. 对于`VocabularyFileUri`，请指定用于定义自定义词汇表的文本文件 Amazon S3 的位置。

  1. 对于 `VocabularyName`，为您的自定义词汇表指定一个名称。您指定的名称在您的名称中必须是唯一的 AWS 账户。

要查看自定义词汇表的处理状态，请使用 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_GetMedicalVocabulary.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_GetMedicalVocabulary.html) API。

以下是使用创建自定义词汇表 适用于 Python (Boto3) 的 AWS SDK 的请求示例。

```
from __future__ import print_function
import time
import boto3  
transcribe = boto3.client('transcribe', 'us-west-2')
vocab_name = "my-first-vocabulary"
response = transcribe.create_medical_vocabulary(
    VocabularyName = job_name,
    VocabularyFileUri = 's3://amzn-s3-demo-bucket/my-vocabularies/my-vocabulary-table.txt'
    LanguageCode = 'en-US',
  )
  
while True:
    status = transcribe.get_medical_vocabulary(VocabularyName = vocab_name)
    if status['VocabularyState'] in ['READY', 'FAILED']:
        break
    print("Not ready yet...")
    time.sleep(5)
print(status)
```

## AWS CLI
<a name="create-med-custom-vocab-cli"></a>

**在批量转录作业中启用发言者划分 (AWS CLI)**
+ 运行以下代码。

  ```
  aws transcribe create-medical-vocabulary \
  --vocabulary-name my-first-vocabulary \ 
  --vocabulary-file-uri s3://amzn-s3-demo-bucket/my-vocabularies/my-vocabulary-file.txt \
  --language-code en-US
  ```

# 使用医学自定义词汇表转录音频文件
<a name="start-med-custom-vocab-job"></a>

使用[https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartMedicalTranscriptionJob.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartMedicalTranscriptionJob.html)或开始使用自定义词汇 AWS 管理控制台 来提高转录准确性的转录作业。

## AWS 管理控制台
<a name="start-med-custom-vocab-job-console"></a>

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

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

1. 请选择**创建任务**。

1. 在**指定作业详细信息**页面上，提供有关您的转录作业的信息。

1. 选择**下一步**。

1. 在**自定义**下，启用**自定义词汇表**。

1. 在**词汇表选择**下，选择一个自定义词汇表。

1. 选择**创建**。

## API
<a name="start-med-custom-vocab-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. `VocabularyName` – 您的自定义词汇表的名称。

以下请求使用使用自定义词汇启动批量转录作业。 适用于 Python (Boto3) 的 AWS SDK 

```
from __future__ import print_function
import time
import boto3
transcribe = boto3.client('transcribe', 'us-west-2')
job_name = "my-first-med-transcription-job"
job_uri = "s3://amzn-s3-demo-bucket/my-input-files/my-media-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 = {
       'VocabularyName': 'example-med-custom-vocab'
       }
 )

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

# 使用医学自定义词汇表转录实时音频流
<a name="start-med-vocab-stream"></a>

要提高实时流中的转录准确性，您可以使用 HTTP/2 或直播来使用自定义词汇。 WebSocket 要启动 HTTP/2 请求，请使用 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartMedicalStreamTranscription.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartMedicalStreamTranscription.html) API。您可以使用 AWS 管理控制台、[https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartMedicalStreamTranscription.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartMedicalStreamTranscription.html)API 或使用 WebSocket 协议实时使用自定义词汇表。

## 转录对着麦克风说出的口述 (AWS 管理控制台)
<a name="streaming-medical-vocabulary-console"></a>

要使用转录医疗听写的流式音频，请选择转录医疗听写的选项，开始直播，然后开始对着麦克风说话。 AWS 管理控制台 

**转录医学口述的流式音频（AWS 管理控制台）**

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

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

1. 对于**医学专科**，请选择在音频流中发言的临床医生的医学专科。

1. 对于**音频输入类型**，选择**对话**或**口述**。

1. 对于**其它设置**，请选择**自定义词汇表**。

   1. 对于**词汇表选择**，请选择自定义词汇表。

1. 选择 **Start streaming（开始流式传输）**。

1. 对着麦克风说话。

## 在 HTTP/2 音频流中启用发言者划分
<a name="vocabulary-med-http2"></a>

以下是 HTTP/2 请求的参数的语法。

```
POST /medical-stream-transcription HTTP/2
host: transcribestreaming.us-west-2.amazonaws.com
authorization: Generated value
x-amz-target: com.amazonaws.transcribe.Transcribe.StartMedicalStreamTranscription
x-amz-content-sha256: STREAMING-MED-AWS4-HMAC-SHA256-EVENTS
x-amz-date: 20220208T235959Z
x-amzn-transcribe-session-id: my-first-http2-med-stream
x-amzn-transcribe-language-code: en-US
x-amzn-transcribe-media-encoding: flac
x-amzn-transcribe-sample-rate: 16000
x-amzn-transcribe-vocabulary-name: my-first-med-vocab
x-amzn-transcribe-specialty: PRIMARYCARE
x-amzn-transcribe-type: CONVERSATION
x-amzn-transcribe-show-speaker-label: true
Content-type: application/vnd.amazon.eventstream
transfer-encoding: chunked
```

参数描述：
+ **主机**：用你正在调用的更新 AWS 区域 （在前面的示例中为'us-west-2'）。 AWS 区域 有关有效内容的列表 AWS 区域，请参阅[AWS 区域 和终端节点](https://docs.aws.amazon.com/general/latest/gr/rande.html#transcribe_region)。
+ **授权**：这是一个生成的字段。要了解有关创建签名的更多信息，请参阅使用[签名版本 4 对 AWS 请求进行签名](https://docs.aws.amazon.com/general/latest/gr/sigv4_signing.html)。
+ **x-amz-target**: 请勿更改此字段；请使用前面示例中显示的内容。
+ **x-amz-content-sha256**：这是一个生成的字段。要了解有关计算签名的更多信息，请参阅使用[签名版本 4 对 AWS 请求进行签名](https://docs.aws.amazon.com/general/latest/gr/sigv4_signing.html)。
+ **x-amz-date**：签名的创建日期和时间。格式为 YYYYMMDDTHHMMSSZ，其中 YYYY=year、MM=month、DD=day、HH=hour、MM=minute、SS=seconds，T 和 Z 是固定字符。有关更多信息，请参阅[处理签名版本 4 中的日期](https://docs.aws.amazon.com/general/latest/gr/sigv4-date-handling.html)。
+ **x-amzn-transcribe-session-id**：您的直播会话的名称。
+ **x-amzn-transcribe-language-code**：用于输入音频的编码。有关有效值的列表，请参阅 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartMedicalStreamTranscription.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartMedicalStreamTranscription.html) 或[支持的语言和特定语言的特征](supported-languages.md)。
+ **x-amzn-transcribe-media-encod** ing：用于输入音频的编码。有效值包括 `pcm`、`ogg-opus` 和 `flac`。
+ **x-amzn-transcribe-sample-rat** e：输入音频的采样率（以赫兹为单位）。 Amazon Transcribe 支持 8,000 Hz 到 48,000 Hz 的范围。低质量音频（例如电话音频）通常在 8000 Hz 左右。高质量音频的范围通常在 16000 Hz 到 48000 Hz 之间。请注意，您指定的采样率**必须**与音频的采样率相匹配。
+ **x-amzn-transcribe-vocabulary-nam** e：要用于转录的词汇的名称。
+ **x-amzn-transcribe-specialty**: 正在转录的医学专业。
+ **x-amzn-transcribe-type**: 选择这是听写还是对话。
+ **x-amzn-transcribe-show-speaker-label**：要启用二进制，此值必须为。`true`
+ **content-type**：不要更改此字段；请使用前面示例中显示的内容。

## 在请求中启用扬声器分区 WebSocket
<a name="vocabulary-websocket"></a>

要使用 API 对 WebSocket 直播中的演讲者进行分区，请使用以下格式创建用于启动 WebSocket 请求的预签名 URI，并将其设置`vocabulary-name`为自定义词汇表的名称。

```
GET wss://transcribestreaming.us-west-2.amazonaws.com:8443/medical-stream-transcription-websocket
?language-code=en-US
&X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIAIOSFODNN7EXAMPLE%2F20220208%2Fus-west-2%2Ftranscribe%2Faws4_request
&X-Amz-Date=20220208T235959Z
&X-Amz-Expires=300
&X-Amz-Security-Token=security-token
&X-Amz-Signature=Signature Version 4 signature 
&X-Amz-SignedHeaders=host
&media-encoding=flac
&sample-rate=16000
&session-id=sessionId
&specialty=medicalSpecialty
&type=CONVERSATION
&vocabulary-name=vocabularyName
&show-speaker-label=boolean
```

# Amazon Transcribe 医疗字符集
<a name="charsets-med"></a>

要在 Medic Amazon Transcribe al 中使用自定义词汇表，请使用以下字符集。

## 英语字符集
<a name="char-english-med"></a>

对于英语自定义词汇表，您可以在 `Phrase` 和 `SoundsLike` 列中使用以下字符：
+ a - z
+ A - Z
+ '（撇号）
+ - (连字符)
+ .（句点）

您可以在词汇表输入文件的 `IPA` 列中使用以下国际音标字母 (IPA) 字符。


| Character | 代码 | Character | 代码 | 
| --- | --- | --- | --- | 
| aʊ | 0061 028A | w | 0077 | 
| aɪ | 0061 026A | z | 007A | 
| b | 0062 | æ | 00E6 | 
| d | 0064 | ð | 00F0 | 
| eɪ | 0065 026A | ŋ | 014B | 
| f | 0066 | ɑ | 0251 | 
| g | 0067 | ɔ | 0254 | 
| h | 0068 | ɔɪ | 0254 026A | 
| i | 0069 | ə | 0259 | 
| j | 006A | ɛ | 025B | 
| k | 006B | ɝ | 025D | 
| l | 006C | ɡ | 0261 | 
| l̩ | 006C 0329 | ɪ | 026A | 
| m | 006D | ɹ | 0279 | 
| n | 006E | ʃ | 0283 | 
| n̩ | 006E 0329 | ʊ | 028A | 
| oʊ | 006F 028A | ʌ | 028C | 
| p | 0070 | ʍ | 028D | 
| s | 0073 | ʒ | 0292 | 
| t | 0074 | ʤ | 02A4 | 
| u | 0075 | ʧ | 02A7 | 
| v | 0076 | θ | 03B8 | 

# 识别转录中的个人健康信息（PHI）
<a name="phi-id"></a>

使用*个人健康信息识别*标记转录结果中的个人健康信息 (PHI)。通过查看标签，您可以找到可用于识别患者的 PHI。

您可以使用实时音频流或批量转录作业识别 PHI。

您可以使用自己的后处理来编辑在转录输出中识别的 PHI。

使用个人健康信息识别来识别以下类型的 PHI：
+ 个人 PHI：
  + 姓名 – 全名或姓氏和首字母
  + 性别
  + 天数
  + 电话号码
  + 与患者直接相关的日期（不包括年份）
  + 电子邮件地址
+ 地理 PHI：
  + 实际地址
  + 邮政编码
  + 医疗中心或诊所的名称
+ 账户 PHI：
  + 传真号码
  + 社会安全号码 (SSNs)
  + 健康保险受益人号码
  + 账户号码
  + 证书或许可证号
+ 车辆 PHI：
  + 车辆识别号码 (VIN)
  + 车牌号
+ 其它 PHI：
  + Web 统一资源位置 (URL)
  + IP 地址号

Amazon Transcribe Medical是符合1996年健康保险便携性和责任法案（HIPAA）资格的服务。有关更多信息，请参阅 [Amazon Transcribe Medical](transcribe-medical.md)。有关在音频文件中识别 PHI 的信息，请参阅[在音频文件中识别 PHI](phi-id-batch.md)。有关在流式转录中识别 PHI 的信息，请参阅[在实时音频流中识别 PHI](phi-id-stream.md)。

**Topics**
+ [在音频文件中识别 PHI](phi-id-batch.md)
+ [在实时音频流中识别 PHI](phi-id-stream.md)

# 在音频文件中识别 PHI
<a name="phi-id-batch"></a>

使用批量转录作业来转录音频文件并识别其中的个人健康信息 (PHI)。当您激活个人健康信息 (PHI) 识别时，M Amazon Transcribe edical 会对其在转录结果中识别的 PHI 进行标记。有关 Medic Amazon Transcribe al 可以识别的 PHI 的信息，请参阅[识别转录中的个人健康信息（PHI）](phi-id.md)。

您可以使用 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartMedicalTranscriptionJob.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartMedicalTranscriptionJob.html) API 或 AWS 管理控制台来启动批量转录作业。

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

**要使用转录临床医生与患者的对话，请创建转录作业，然后选择**对话**作为音频输入类型。 AWS 管理控制台 **

**转录音频文件并识别其 PHI (AWS 管理控制台)**

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

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

1. 请选择**创建任务**。

1. 在**指定作业详细信息**页面上的**作业设置**下，指定以下设置。

   1. **名称**-您的 AWS 账户专属转录作业的名称。

   1. **音频输入类型** - **对话**或**口述**。

1. 对于其余字段，请指定音频文件的 Amazon S3 位置以及要存储转录作业输出的位置。

1. 选择**下一步**。

1. 在**音频设置** 下，选择 **PHI 识别**。

1. 选择**创建**。

## API
<a name="batch-med-phi-api"></a>

**使用批量转录作业转录音频文件并识别其 PHI (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`，请将音频文件中说话的临床医生的医学专科指定为 `PRIMARYCARE`。

  1. 对于 `Type`，请指定 `CONVERSATION` 或 `DICTATION`。

  1. 对于 `OutputBucketName`，请指定要将转录结果存储到的 Amazon S3 存储桶。

  以下是使用转录音频文件并识别患者的 PHI 的请求示例。 适用于 Python (Boto3) 的 AWS SDK 

  ```
  from __future__ import print_function
  import time
  import boto3
  transcribe = boto3.client('transcribe')
  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},
        LanguageCode = 'en-US',
        ContentIdentificationType = 'PHI',
        Specialty = 'PRIMARYCARE',
        Type = 'type', # Specify 'CONVERSATION' for a medical conversation. Specify 'DICTATION' for a medical dictation.
        OutputBucketName = 'amzn-s3-demo-bucket'
    )
  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)
  ```

以下示例代码演示了识别患者 PHI 的转录结果。

```
{
    "jobName": "my-medical-transcription-job-name",
    "accountId": "111122223333",
    "results": {
        "transcripts": [{
            "transcript": "The patient's name is Bertrand."
        }],
        "items": [{
                "id": 0,
            "start_time": "0.0",
            "end_time": "0.37",
            "alternatives": [{
                "confidence": "0.9993",
                "content": "The"
            }],
            "type": "pronunciation"
        }, {
                "id": 1,
            "start_time": "0.37",
            "end_time": "0.44",
            "alternatives": [{
                "confidence": "0.9981",
                "content": "patient's"
            }],
            "type": "pronunciation"
        }, {
                "id": 2,
            "start_time": "0.44",
            "end_time": "0.52",
            "alternatives": [{
                "confidence": "1.0",
                "content": "name"
            }],
            "type": "pronunciation"
        }, {
                "id": 3,
            "start_time": "0.52",
            "end_time": "0.92",
            "alternatives": [{
                "confidence": "1.0",
                "content": "is"
            }],
            "type": "pronunciation"
        }, {
                "id": 4,
            "start_time": "0.92",
            "end_time": "0.9989",
            "alternatives": [{
                "confidence": "1.0",
                "content": "Bertrand"
            }],
            "type": "pronunciation"
        }, {
                "id": 5,
            "alternatives": [{
                "confidence": "0.0",
                "content": "."
            }],
            "type": "punctuation"
        }],
        "entities": [{
            "content": "Bertrand",
            "category": "PHI*-Personal*",
            "startTime": 0.92,
            "endTime": 1.2,
            "confidence": 0.9989
        }],
        "audio_segments": [
            {
                "id": 0,
                "transcript": "The patient's name is Bertrand.",
                "start_time": "0.0",
                "end_time": "0.9989",
                "items": [
                    0,
                    1,
                    2,
                    3,
                    4,
                    5
                ]
            }
        ]
    },
    "status": "COMPLETED"
}
```

## AWS CLI
<a name="batch-med-conversation-cli"></a>

**使用批量转录作业转录音频文件并识别 PHI (AWS CLI)**
+ 运行以下代码。

  ```
  aws transcribe start-medical-transcription-job \
  --medical-transcription-job-name my-medical-transcription-job-name\
  --language-code en-US \
  --media MediaFileUri="s3://amzn-s3-demo-bucket/my-input-files/my-audio-file.flac" \
  --output-bucket-name amzn-s3-demo-bucket \
  --specialty PRIMARYCARE \
  --type type \ # Choose CONVERSATION to transcribe a medical conversation. Choose DICTATION to transcribe a medical dictation.
  --content-identification-type PHI
  ```

# 在实时音频流中识别 PHI
<a name="phi-id-stream"></a>

您可以在 HTTP/2 或 WebSocket 直播中识别个人健康信息 (PHI)。激活 PHI 识别后，M Amazon Transcribe edical 会在转录结果中对其识别的 PHI 进行标记。有关 Medic Amazon Transcribe al 可以识别的 PHI 的信息，请参阅[识别转录中的个人健康信息（PHI）](phi-id.md)。



## 在对着麦克风讲出的口述中识别 PHI
<a name="console-stream-phi"></a>

要使用转录麦克风拾取的语音并识别任何 PHI，请选择 “**听写**” 作为音频输入类型，开始直播，然后开始对着计算机上的麦克风说话。 AWS 管理控制台 

**要在听写中识别 PHI，请使用 AWS 管理控制台**

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

1. 在导航窗格中，选择 **Real-time transcription (实时转录)**。

1. 对于**音频输入类型**，选择**口述**。

1. 对于**其它设置**，请选择 **PHI 识别**。

1. 选择**开始流式转录**并对着麦克风说话。

1. 选择**停止流式转录**可结束口述。

## 在 HTTP/2 音频流中识别 PHI
<a name="http2-stream-phi"></a>

要在激活 PHI 识别的情况下启动 HTTP/2 音频流，请使用 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartMedicalStreamTranscription.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartMedicalStreamTranscription.html) API 并指定以下内容：
+ 对于 `LanguageCode`，请指定流式转录中使用的语言所对应的语言代码。对于美国英语，请指定 `en-US`。
+ 对于 `MediaSampleHertz`，请指定音频的采样率。
+ 对于 `content-identification-type`，请指定 `PHI`。

## 在 WebSocket 直播中识别 PHI
<a name="websocket-phi-id"></a>

 要在激活 PHI 识别的情况下开始 WebSocket 直播，请使用以下格式创建预签名 URL。

```
GET wss://transcribestreaming.us-west-2.amazonaws.com:8443/medical-stream-transcription-websocket?
&X-Amz-Algorithm=AWS4-HMAC-SHA256 
&X-Amz-Credential=AKIAIOSFODNN7EXAMPLE%2F20220208%2Fus-west-2%2Ftranscribe%2Faws4_request 
&X-Amz-Date=20220208T235959Z 
&X-Amz-Expires=300 
&X-Amz-Security-Token=security-token 
&X-Amz-Signature=Signature Version 4 signature 
&X-Amz-SignedHeaders=host 
&language-code=en-US
&media-encoding=flac 
&sample-rate=16000 
&specialty=medical-specialty
&content-identification-type=PHI
```

参数定义可在 [API 参考](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_Reference.html)中找到；所有 AWS API 操作的通用参数列在[常用参数](https://docs.aws.amazon.com/transcribe/latest/APIReference/CommonParameters.html)部分中。

# 生成备选转录
<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
          }
  }
  ```

# Amazon Transcribe 医疗和接口 VPC 终端节点 (AWS PrivateLink)
<a name="med-vpc-interface-endpoints"></a>

您可以通过创建接*口 VPC 终端节点在您的 VPC 和 Amazon Transcribe 医疗之间建立私有*连接。接口端点由一项技术提供支持 [AWS PrivateLink](https://aws.amazon.com/privatelink)，该技术使您 APIs 无需互联网网关、NAT 设备、VPN 连接或 Direct Connect 连接即可私密访问 Amazon Transcribe 医疗服务。您的 VPC 中的实例不需要公有 IP 地址即可与 Amazon Transcribe 医疗机构通信 APIs。您的 VPC 和 Amazon Transcribe 医疗之间的流量不会离开亚马逊网络。

每个接口端点均由子网中的一个或多个[弹性网络接口](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html)表示。

有关更多信息，请参阅《Amazon VPC 用户指南》**中的[接口 VPC 端点 (AWS PrivateLink)](https://docs.aws.amazon.com/vpc/latest/userguide/vpce-interface.html)。

## Amazon Transcribe 医疗 VPC 终端节点的注意事项
<a name="med-vpc-endpoint-considerations"></a>

在为 Amazon Transcribe 医疗设置接口 VPC 终端节点之前，请务必查看*Amazon VPC 用户指南*中的[接口终端节点属性和限制](https://docs.aws.amazon.com/vpc/latest/userguide/vpce-interface.html#vpce-interface-limitations)。

Amazon Transcribe 医疗支持从您的 VPC 调用其所有 API 操作。

## 为 Amazon Transcribe 医疗行业创建接口 VPC 终端节点
<a name="med-vpc-endpoint-create"></a>

您可以使用 AWS 管理控制台 或为 Amazon Transcribe 医疗服务创建 VPC 终端节点 AWS CLI。有关更多信息，请参阅**《Amazon VPC 用户指南》中的[创建接口端点](https://docs.aws.amazon.com/vpc/latest/userguide/vpce-interface.html#create-interface-endpoint)。

要在 Medic Amazon Transcribe al 中进行批量转录，请使用以下服务名称创建 VPC 端点：
+ com.amazonaws。 *us-west-2*. 转录 

要在 Medic Amazon Transcribe al 中进行流式转录，请使用以下服务名称创建 VPC 端点：
+ com.amazonaws。 *us-west-2*.transcribe 

如果您为终端节点启用私有 DNS，则可以使用其默认 DNS 名称向 M Amazon Transcribe edical 发出 API 请求 AWS 区域，例如`transcribestreaming.us-east-2.amazonaws.com`。

有关更多信息，请参阅《Amazon VPC 用户指南》**中的[通过接口端点访问服务](https://docs.aws.amazon.com/vpc/latest/userguide/vpce-interface.html#access-service-though-endpoint)。

## 为 Amazon Transcribe 医疗直播创建 VPC 终端节点策略
<a name="med-vpc-endpoint-policy"></a>

您可以将终端节点策略附加到控制 Amazon Transcribe 医疗访问权限的 VPC 终端节点。该策略指定以下信息：
+ 可执行操作的主体。
+ 可执行的操作。
+ 可对其执行操作的资源。

有关更多信息，请参阅《Amazon VPC 用户指南》**中的[使用 VPC 端点控制对服务的访问](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-endpoints-access.html)。

**示例： Amazon Transcribe 医疗流转录操作的 VPC 端点策略**  
以下是 Medic Amazon Transcribe al 中流媒体转录的端点策略示例。当连接到终端节点时，此策略将授予所有资源的所有委托人访问列出的 Amazon Transcribe 医疗操作的权限。

```
{
   "Statement":[
      {
         "Principal":"*",
         "Effect":"Allow",
         "Action":[
            "transcribe:StartMedicalStreamTranscription",
         ],
         "Resource":"*"
      }
   ]
}
```

**示例： Amazon Transcribe 医疗批量转录操作的 VPC 端点策略**  
以下是 Medic Amazon Transcribe al 中批量转录的端点策略示例。当连接到终端节点时，此策略将授予所有资源的所有委托人访问列出的 Amazon Transcribe 医疗操作的权限。

```
{
   "Statement":[
      {
         "Principal":"*",
         "Effect":"Allow",
         "Action":[
            "transcribe:StartMedicalTranscriptionJob"
         ],
         "Resource":"*"
      }
   ]
}
```

## 共享子网
<a name="med-vpc-shared-subnets"></a>

您无法在与您共享的子网中创建、描述、修改或删除 VPC 端点。但是，您可以在与您共享的子网中使用 VPC 端点。有关 VPC 共享的信息，请参阅 Amazon Virtual Private Cloud 指南中的[与其他账户共享您的 VPC](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-sharing.html#vpc-sharing-service-behavior)。