本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
ListVocabularies
搭配使用 AWS SDK或 CLI
以下代码示例演示如何使用 ListVocabularies
。
操作示例是大型程序的代码摘录,必须在上下文中运行。在以下代码示例中,您可以查看此操作的上下文:
- .NET
-
- AWS SDK for .NET
-
注意
还有更多相关信息 GitHub。在中查找完整的示例,学习如何设置和运行 AWS 代码示例存储库
。 /// <summary> /// List custom vocabularies for the current account. Optionally specify a name /// filter and a specific state to filter the vocabularies list. /// </summary> /// <param name="nameContains">Optional string the vocabulary name must contain.</param> /// <param name="stateEquals">Optional state of the vocabulary.</param> /// <returns>List of information about the vocabularies.</returns> public async Task<List<VocabularyInfo>> ListCustomVocabularies(string? nameContains = null, VocabularyState? stateEquals = null) { var response = await _amazonTranscribeService.ListVocabulariesAsync( new ListVocabulariesRequest() { NameContains = nameContains, StateEquals = stateEquals }); return response.Vocabularies; }
-
有关API详细信息,请参阅ListVocabularies中的 AWS SDK for .NET API参考。
-
- CLI
-
- AWS CLI
-
列出自定义词汇表
以下
list-vocabularies
示例列出了与您的相关联的自定义词汇表 AWS 账户和区域。aws transcribe list-vocabularies
输出:
{ "NextToken": "NextToken", "Vocabularies": [ { "VocabularyName": "ards-test-1", "LanguageCode": "language-code", "LastModifiedTime": "2020-04-27T22:00:27.330000+00:00", "VocabularyState": "READY" }, { "VocabularyName": "sample-test", "LanguageCode": "language-code", "LastModifiedTime": "2020-04-24T23:04:11.044000+00:00", "VocabularyState": "READY" }, { "VocabularyName": "CRLF-to-LF-test-3-1", "LanguageCode": "language-code", "LastModifiedTime": "2020-04-24T22:12:22.277000+00:00", "VocabularyState": "READY" }, { "VocabularyName": "CRLF-to-LF-test-2", "LanguageCode": "language-code", "LastModifiedTime": "2020-04-24T21:53:50.455000+00:00", "VocabularyState": "READY" }, { "VocabularyName": "CRLF-to-LF-1-1", "LanguageCode": "language-code", "LastModifiedTime": "2020-04-24T21:39:33.356000+00:00", "VocabularyState": "READY" } ] }
有关更多信息,请参阅《Amazon Transcribe 开发人员指南》中的自定义词汇表。
-
有关API详细信息,请参阅ListVocabularies
中的 AWS CLI 命令参考。
-
- Python
-
- SDK适用于 Python (Boto3)
-
注意
还有更多相关信息 GitHub。在中查找完整的示例,学习如何设置和运行 AWS 代码示例存储库
。 def list_vocabularies(vocabulary_filter, transcribe_client): """ Lists the custom vocabularies created for this AWS account. :param vocabulary_filter: The returned vocabularies must contain this string in their names. :param transcribe_client: The Boto3 Transcribe client. :return: The list of retrieved vocabularies. """ try: response = transcribe_client.list_vocabularies(NameContains=vocabulary_filter) vocabs = response["Vocabularies"] next_token = response.get("NextToken") while next_token is not None: response = transcribe_client.list_vocabularies( NameContains=vocabulary_filter, NextToken=next_token ) vocabs += response["Vocabularies"] next_token = response.get("NextToken") logger.info( "Got %s vocabularies with filter %s.", len(vocabs), vocabulary_filter ) except ClientError: logger.exception( "Couldn't list vocabularies with filter %s.", vocabulary_filter ) raise else: return vocabs
-
有关API详细信息,请参阅ListVocabularies中的 AWS SDK供参考 Python (Boto3) API。
-
有关完整列表 AWS SDK开发者指南和代码示例,请参阅将此服务与 AWS SDK 配合使用。本主题还包括有关入门的信息以及有关先前SDK版本的详细信息。
ListTranscriptionJobs
StartMedicalTranscriptionJob