文件 AWS SDK AWS 範例 SDK 儲存庫中有更多可用的
本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
ListVocabularies
搭配 a AWS SDK 或 CLI 使用
下列程式碼範例示範如何使用 ListVocabularies
。
動作範例是大型程式的程式碼摘錄,必須在內容中執行。您可以在下列程式碼範例的內容中看到此動作:
- .NET
-
- AWS SDK for .NET
-
注意
還有更多 on 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 詳細資訊,請參閱 AWS CLI 命令參考中的 ListVocabularies
。
-
- Python
-
- SDK for Python (Boto3)
-
注意
還有更多 on 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 for Python (Boto3) Word 參考中的 API。
-
ListTranscriptionJobs
StartMedicalTranscriptionJob