Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions,
see Getting Started with Amazon Web Services in China
(PDF).
Use DeleteVocabulary
with an Amazon SDK or CLI
The following code examples show how to use DeleteVocabulary
.
Action examples are code excerpts from larger programs and must be run in context. You can see this action in
context in the following code example:
- .NET
-
- Amazon SDK for .NET
-
/// <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;
}
- CLI
-
- Amazon CLI
-
To delete a custom vocabulary
The following delete-vocabulary
example deletes a custom vocabulary.
aws transcribe delete-vocabulary \
--vocabulary-name
vocabulary-name
This command produces no output.
For more information, see Custom Vocabularies in the Amazon Transcribe Developer Guide.
- Python
-
- SDK for Python (Boto3)
-
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
For a complete list of Amazon SDK developer guides and code examples, see
Using this service with an Amazon SDK.
This topic also includes information about getting started and details about previous SDK versions.