產生替代轉錄 - Amazon Transcribe

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

產生替代轉錄

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

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

您可以使用 AWS Management Console 或 StartMedicalTranscriptionJob API 產生替代轉錄。

若要使用 AWS Management Console 產生替代轉錄,請在設定任務時啟用替代結果。

  1. 登入 AWS Management Console

  2. 在導覽窗格的 Amazon Transcribe Medical 下,選擇轉錄任務

  3. 選擇建立作業

  4. 指定作業詳細資訊頁面上,提供轉錄作業的相關資訊。

  5. 選擇下一步

  6. 啟用替代結果

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

  8. 選擇建立

使用批次轉錄作業,分隔音訊檔案中每位發言者的文字 (API)
  • 對於 StartMedicalTranscriptionJob API,請指定以下項目。

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

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

    3. Media 物件的 MediaFileUri 參數中,指定您要轉錄的音訊檔案位置。

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

    5. 對於 Type,指定要轉錄醫學對話或聽寫。

    6. 對於 OutputBucketName,指定 Amazon S3 儲存貯體以存放轉錄結果。

    7. 對於 Settings 物件,請指定下列項目:

      1. ShowAlternativestrue.

      2. 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)
  • 執行下列程式碼。

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