繁体   English   中英

AWS Transcribe,无法找到任何 Boto3 代码片段来利用自定义词汇表

[英]AWS Transcribe, Unable to find any Boto3 code snippet to utilize the custom vocabulary

我正在使用 AWS Transcribe 进行语音识别。 虽然我已经创建了我的自定义词汇表,但我无法找到任何 Boto3 代码片段来在 python 中使用它。 请找到随附的示例代码。

client_transcribe = boto3.client('transcribe') client_transcribe.start_transcription_job(TranscriptionJobName=job_name, Media={'MediaFileUri': file_url}, MediaFormat='mp4',LanguageCode='en-US', OutputBucketName=bucket)

词汇名称是设置对象的成员,是 start_transcription_job 方法的参数。

参考: https : //boto3.amazonaws.com/v1/documentation/api/latest/reference/services/transcribe.html#TranscribeService.Client.start_transcription_job

例子:

settings = {
    'VocabularyName': 'your-custom-vocabulary-name-goes-here'
}

client_transcribe.start_transcription_job(
    TranscriptionJobName=job_name,
    LanguageCode='your-language-code-goes-here',
    Settings=settings,
    MediaFormat='mp4',
    OutputBucketName=bucket
    Media={
        'MediaFileUri': file_url
    })

如果您需要帮助来确定词汇表的语言代码,并且安装了 AWS cli,则可以从终端使用以下 AWS cli 命令:

aws transcribe get-vocabulary --vocabulary-name {your-custom-vocabulary-name}

它返回一个响应,例如:

{
  "LastModifiedTime": 1573523589.419,
  "VocabularyName": "redacted",
  "DownloadUri": "redacted",
  "LanguageCode": "en-US",
  "VocabularyState": "READY"
}

例如,如果词汇表的语言代码是en-US ,则在调用start_transcription_job时使用该语言代码。

希望这可以帮助!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM