[英]AWS Transcribe, Unable to find any Boto3 code snippet to utilize the custom vocabulary
I am using AWS Transcribe for speech recognition.我正在使用 AWS Transcribe 进行语音识别。 Though I have created my custom vocabulary, I am unable to find any Boto3 code snippet to utilize the it in python.
虽然我已经创建了我的自定义词汇表,但我无法找到任何 Boto3 代码片段来在 python 中使用它。 Kindly find the sample code attached.
请找到随附的示例代码。
client_transcribe = boto3.client('transcribe') client_transcribe.start_transcription_job(TranscriptionJobName=job_name, Media={'MediaFileUri': file_url}, MediaFormat='mp4',LanguageCode='en-US', OutputBucketName=bucket) client_transcribe = boto3.client('transcribe') client_transcribe.start_transcription_job(TranscriptionJobName=job_name, Media={'MediaFileUri': file_url}, MediaFormat='mp4',LanguageCode='en-US', OutputBucketName=bucket)
The vocabulary name is a member of the settings object, a parameter to the start_transcription_job method.词汇名称是设置对象的成员,是 start_transcription_job 方法的参数。
Reference: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/transcribe.html#TranscribeService.Client.start_transcription_job参考: https : //boto3.amazonaws.com/v1/documentation/api/latest/reference/services/transcribe.html#TranscribeService.Client.start_transcription_job
Example:例子:
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
})
If you need help to determine the language code of your vocabulary, you can use the following AWS cli command from your terminal if you have AWS cli installed:如果您需要帮助来确定词汇表的语言代码,并且安装了 AWS cli,则可以从终端使用以下 AWS cli 命令:
aws transcribe get-vocabulary --vocabulary-name {your-custom-vocabulary-name}
It returns a response such as:它返回一个响应,例如:
{
"LastModifiedTime": 1573523589.419,
"VocabularyName": "redacted",
"DownloadUri": "redacted",
"LanguageCode": "en-US",
"VocabularyState": "READY"
}
For example, if the language code for your vocabulary is en-US
, then use that language code when calling start_transcription_job
.例如,如果词汇表的语言代码是
en-US
,则在调用start_transcription_job
时使用该语言代码。
Hope this helps!希望这可以帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.