Doc AWS SDK 예제 GitHub 리포지토리에서 더 많은 SDK 예제를 사용할 수 있습니다. AWS
기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.
AWS SDK 또는 CLI와 DeleteVocabulary 함께 사용
다음 코드 예시는 DeleteVocabulary의 사용 방법을 보여 줍니다.
작업 예제는 대규모 프로그램에서 발췌한 코드이며 컨텍스트에 맞춰 실행해야 합니다. 다음 코드 예제에서는 컨텍스트 내에서 이 작업을 확인할 수 있습니다.
- .NET
-
- 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
-
- AWS CLI
-
사용자 지정 어휘를 삭제하는 방법
다음 delete-vocabulary 예시에서는 사용자 지정 어휘를 삭제합니다.
aws transcribe delete-vocabulary \
--vocabulary-name vocabulary-name
이 명령은 출력을 생성하지 않습니다.
자세한 내용은 Amazon Transcribe 개발자 안내서의 사용자 지정 어휘를 참조하세요.
- 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