

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

# 使用醫學自訂詞彙轉錄即時串流
<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 Medical 下，選擇**即時轉錄**。

1. 對於**醫療專科**，請選擇在串流說話的臨床醫生的醫學專科。

1. 對於**音訊輸入類型**，選擇**對話**或**聽寫**。

1. 對於**其他設定**，請選擇**自訂詞彙**。

   1. 對於**詞彙選擇**，請選擇自訂詞彙。

1. 選擇**開始串流**。

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 區域 您正在呼叫的 更新 AWS 區域 （上述範例中的「us-west-2」)。如需有效清單 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 = 年，MM = 月，DD = 日，HH = 小時，MM = 分鐘，SS = 秒，而「T」和「Z」為固定字元。如需詳細資訊，請參閱 [Signature 第 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-encoding**：用於輸入音訊的編碼 有效值為 `pcm`、`ogg-opus` 和 `flac`。
+ **x-amzn-transcribe-sample-rate**：輸入音訊的範例速率 （以 Hertz 為單位）。 Amazon Transcribe 支援從 8，000 Hz 到 48，000 Hz 的範圍。劣質的音訊，例如電話音訊，通常約為 8,000 Hz。優質的音訊，通常介於 16,000 Hz 至 48,000 Hz 間。請注意，您指定的取樣率**必須**與音訊的取樣率相符。
+ **x-amzn-transcribe-vocabulary-name**：您要與轉錄搭配使用的詞彙名稱。
+ **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 串流中的發言者，請使用下列格式以建立預先簽署的 URI，開始 WebSocket請要求並設定 `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
```