Ada lebih banyak contoh AWS SDK yang tersedia di repo Contoh SDK AWS Doc
Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.
Gunakan UpdateVocabulary
dengan AWS SDK atau CLI
Contoh kode berikut menunjukkan cara menggunakanUpdateVocabulary
.
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
-
- AWS SDK for .NET
-
catatan
Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara pengaturan dan menjalankannya di Repositori Contoh Kode AWS
. /// <summary> /// Update a custom vocabulary with new values. Update overwrites all existing information. /// </summary> /// <param name="languageCode">The language code of the vocabulary.</param> /// <param name="phrases">Phrases to use in the vocabulary.</param> /// <param name="vocabularyName">Name for the vocabulary.</param> /// <returns>The state of the custom vocabulary.</returns> public async Task<VocabularyState> UpdateCustomVocabulary(LanguageCode languageCode, List<string> phrases, string vocabularyName) { var response = await _amazonTranscribeService.UpdateVocabularyAsync( new UpdateVocabularyRequest() { LanguageCode = languageCode, Phrases = phrases, VocabularyName = vocabularyName }); return response.VocabularyState; }
-
Untuk detail API, lihat UpdateVocabularydi Referensi AWS SDK for .NET API.
-
- CLI
-
- AWS CLI
-
Untuk memperbarui kosakata khusus dengan istilah baru.
update-vocabulary
Contoh berikut menimpa istilah yang digunakan untuk membuat kosakata khusus dengan yang baru yang Anda berikan. Prasyarat: untuk mengganti istilah dalam kosakata khusus, Anda memerlukan file dengan istilah baru.aws transcribe update-vocabulary \ --vocabulary-file-uri
s3://amzn-s3-demo-bucket/Amazon-S3-Prefix/custom-vocabulary.txt
\ --vocabulary-namecustom-vocabulary
\ --language-code
language-codeOutput:
{ "VocabularyName": "custom-vocabulary", "LanguageCode": "language", "VocabularyState": "PENDING" }
Untuk informasi selengkapnya, lihat Kosakata Khusus di Panduan Pengembang Amazon Transcribe.
-
Untuk detail API, lihat UpdateVocabulary
di Referensi AWS CLI Perintah.
-
- Python
-
- SDK untuk Python (Boto3)
-
catatan
Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara pengaturan dan menjalankannya di Repositori Contoh Kode AWS
. def update_vocabulary( vocabulary_name, language_code, transcribe_client, phrases=None, table_uri=None ): """ Updates an existing custom vocabulary. The entire vocabulary is replaced with the contents of the update. :param vocabulary_name: The name of the vocabulary to update. :param language_code: The language code of the vocabulary. :param transcribe_client: The Boto3 Transcribe client. :param phrases: A list of comma-separated phrases to include in the vocabulary. :param table_uri: A table of phrases and pronunciation hints to include in the vocabulary. """ try: vocab_args = {"VocabularyName": vocabulary_name, "LanguageCode": language_code} if phrases is not None: vocab_args["Phrases"] = phrases elif table_uri is not None: vocab_args["VocabularyFileUri"] = table_uri response = transcribe_client.update_vocabulary(**vocab_args) logger.info("Updated custom vocabulary %s.", response["VocabularyName"]) except ClientError: logger.exception("Couldn't update custom vocabulary %s.", vocabulary_name) raise
-
Untuk detail API, lihat UpdateVocabularydi AWS SDK for Python (Boto3) Referensi API.
-