搭GetTranscriptionJob配使用 AWS SDK或 CLI - Amazon Transcribe

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

GetTranscriptionJob配使用 AWS SDK或 CLI

下列程式碼範例會示範如何使用GetTranscriptionJob

動作範例是大型程式的程式碼摘錄,必須在內容中執行。您可以在下列程式碼範例的內容中看到此動作:

.NET
AWS SDK for .NET
注意

還有更多關於 GitHub。尋找完整的範例,並瞭解如何設定和執行 AWS 代碼示例存儲庫

/// <summary> /// Get details about a transcription job. /// </summary> /// <param name="jobName">A unique name for the transcription job.</param> /// <returns>A TranscriptionJob instance with information on the requested job.</returns> public async Task<TranscriptionJob> GetTranscriptionJob(string jobName) { var response = await _amazonTranscribeService.GetTranscriptionJobAsync( new GetTranscriptionJobRequest() { TranscriptionJobName = jobName }); return response.TranscriptionJob; }
CLI
AWS CLI

取得特定轉錄作業的相關資訊

以下 get-transcription-job 範例會取得特定轉錄作業的相關資訊。若要存取轉錄結果,請使用 TranscriptFileUri 參數。使用 MediaFileUri 參數可查看您在此工作中轉錄的音訊檔案。您可以使用 Settings 物件來查看您在轉錄作業中已啟用的選用功能。

aws transcribe get-transcription-job \ --transcription-job-name your-transcription-job

輸出:

{ "TranscriptionJob": { "TranscriptionJobName": "your-transcription-job", "TranscriptionJobStatus": "COMPLETED", "LanguageCode": "language-code", "MediaSampleRateHertz": 48000, "MediaFormat": "mp4", "Media": { "MediaFileUri": "s3://DOC-EXAMPLE-BUCKET/your-audio-file.file-extension" }, "Transcript": { "TranscriptFileUri": "https://Amazon-S3-file-location-of-transcription-output" }, "StartTime": "2020-09-18T22:27:23.970000+00:00", "CreationTime": "2020-09-18T22:27:23.948000+00:00", "CompletionTime": "2020-09-18T22:28:21.197000+00:00", "Settings": { "ChannelIdentification": false, "ShowAlternatives": false }, "IdentifyLanguage": true, "IdentifiedLanguageScore": 0.8672199249267578 } }

如需詳細資訊,請參閱入門 (AWS 命令列界面) Amazon Transcribe 開發人員指南中。

Python
SDK對於 Python(肉毒桿菌 3)
注意

還有更多關於 GitHub。尋找完整的範例,並瞭解如何設定和執行 AWS 代碼示例存儲庫

def get_job(job_name, transcribe_client): """ Gets details about a transcription job. :param job_name: The name of the job to retrieve. :param transcribe_client: The Boto3 Transcribe client. :return: The retrieved transcription job. """ try: response = transcribe_client.get_transcription_job( TranscriptionJobName=job_name ) job = response["TranscriptionJob"] logger.info("Got job %s.", job["TranscriptionJobName"]) except ClientError: logger.exception("Couldn't get job %s.", job_name) raise else: return job
  • 有API關詳細資訊,請參閱 GetTranscriptionJobAWS SDK對於 Python(肉毒桿 3)API參考。

如需完整清單 AWS SDK開發人員指南和代碼示例,請參閱搭配 AWS SDK 使用此服務。本主題也包含有關入門的資訊以及舊SDK版的詳細資訊。