Gunakan GetVocabulary dengan AWS SDK atau CLI - AWS Contoh Kode SDK

Ada lebih banyak contoh AWS SDK yang tersedia di repo Contoh SDK AWS Doc. GitHub

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

Gunakan GetVocabulary dengan AWS SDK atau CLI

Contoh kode berikut menunjukkan cara menggunakanGetVocabulary.

Contoh tindakan adalah kutipan kode dari program yang lebih besar dan harus dijalankan dalam konteks. Anda dapat melihat tindakan ini dalam konteks dalam contoh kode berikut:

.NET
SDK untuk .NET
catatan

Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara mengatur dan menjalankannya di Repositori Contoh Kode AWS.

/// <summary> /// Get information about a custom vocabulary. /// </summary> /// <param name="vocabularyName">Name of the vocabulary.</param> /// <returns>The state of the custom vocabulary.</returns> public async Task<VocabularyState> GetCustomVocabulary(string vocabularyName) { var response = await _amazonTranscribeService.GetVocabularyAsync( new GetVocabularyRequest() { VocabularyName = vocabularyName }); return response.VocabularyState; }
  • Untuk detail API, lihat GetVocabularydi Referensi AWS SDK untuk .NET API.

CLI
AWS CLI

Untuk mendapatkan informasi tentang kosakata khusus

get-vocabularyContoh berikut mendapatkan informasi tentang kosakata kustom yang dibuat sebelumnya.

aws transcribe get-vocabulary \ --vocabulary-name cli-vocab-1

Output:

{ "VocabularyName": "cli-vocab-1", "LanguageCode": "language-code", "VocabularyState": "READY", "LastModifiedTime": "2020-09-19T23:22:32.836000+00:00", "DownloadUri": "https://link-to-download-the-text-file-used-to-create-your-custom-vocabulary" }

Untuk informasi selengkapnya, lihat Kosakata Khusus di Panduan Pengembang Amazon Transcribe.

  • Untuk detail API, lihat GetVocabularydi Referensi AWS CLI Perintah.

Python
SDK untuk Python (Boto3)
catatan

Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara mengatur dan menjalankannya di Repositori Contoh Kode AWS.

def get_vocabulary(vocabulary_name, transcribe_client): """ Gets information about a custom vocabulary. :param vocabulary_name: The name of the vocabulary to retrieve. :param transcribe_client: The Boto3 Transcribe client. :return: Information about the vocabulary. """ try: response = transcribe_client.get_vocabulary(VocabularyName=vocabulary_name) logger.info("Got vocabulary %s.", response["VocabularyName"]) except ClientError: logger.exception("Couldn't get vocabulary %s.", vocabulary_name) raise else: return response
  • Untuk detail API, lihat GetVocabularydi AWS SDK for Python (Boto3) Referensi API.

SAP ABAP
SDK for SAP ABAP
catatan

Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara mengatur dan menjalankannya di Repositori Contoh Kode AWS.

TRY. oo_result = lo_tnb->getvocabulary( iv_vocabulary_name ). MESSAGE 'Retrieved vocabulary details.' TYPE 'I'. CATCH /aws1/cx_tnbbadrequestex INTO DATA(lo_bad_request_ex). MESSAGE lo_bad_request_ex TYPE 'I'. RAISE EXCEPTION lo_bad_request_ex. CATCH /aws1/cx_tnbnotfoundexception INTO DATA(lo_not_found_ex). MESSAGE lo_not_found_ex TYPE 'I'. RAISE EXCEPTION lo_not_found_ex. CATCH /aws1/cx_tnbinternalfailureex INTO DATA(lo_internal_ex). MESSAGE lo_internal_ex TYPE 'I'. RAISE EXCEPTION lo_internal_ex. ENDTRY.
  • Untuk detail API, lihat GetVocabularydi AWS SDK untuk referensi SAP ABAP API.