AWS 文档 SDK 示例
将 DeleteVocabulary 与 AWS SDK 或 CLI 配合使用
以下代码示例演示如何使用 DeleteVocabulary。
操作示例是大型程序的代码摘录,必须在上下文中运行。在以下代码示例中,您可以查看此操作的上下文:
- .NET
-
- 适用于 .NET 的 SDK
-
注意
查看 GitHub,了解更多信息。在 AWS 代码示例存储库
中查找完整示例,了解如何进行设置和运行。 /// <summary> /// Delete an existing custom vocabulary. /// </summary> /// <param name="vocabularyName">Name of the vocabulary to delete.</param> /// <returns>True if successful.</returns> public async Task<bool> DeleteCustomVocabulary(string vocabularyName) { var response = await _amazonTranscribeService.DeleteVocabularyAsync( new DeleteVocabularyRequest { VocabularyName = vocabularyName }); return response.HttpStatusCode == HttpStatusCode.OK; }-
有关 API 详细信息,请参阅 适用于 .NET 的 AWS SDK API 参考 中的 DeleteVocabulary。
-
- CLI
-
- AWS CLI
-
删除自定义词汇表
以下
delete-vocabulary示例删除一个自定义词汇表。aws transcribe delete-vocabulary \ --vocabulary-namevocabulary-name此命令不生成任何输出。
有关更多信息,请参阅《Amazon Transcribe 开发人员指南》中的自定义词汇表。
-
有关 API 详细信息,请参阅 AWS CLI Command Reference 中的 DeleteVocabulary
。
-
- Python
-
- 适用于 Python 的 SDK (Boto3)
-
注意
查看 GitHub,了解更多信息。在 AWS 代码示例存储库
中查找完整示例,了解如何进行设置和运行。 def delete_vocabulary(vocabulary_name, transcribe_client): """ Deletes a custom vocabulary. :param vocabulary_name: The name of the vocabulary to delete. :param transcribe_client: The Boto3 Transcribe client. """ try: transcribe_client.delete_vocabulary(VocabularyName=vocabulary_name) logger.info("Deleted vocabulary %s.", vocabulary_name) except ClientError: logger.exception("Couldn't delete vocabulary %s.", vocabulary_name) raise-
有关 API 详细信息,请参阅《AWS SDK for Python (Boto3) API Reference》中的 DeleteVocabulary。
-
DeleteTranscriptionJob
GetTranscriptionJob