Creates a new custom medical vocabulary.
Before creating a new custom medical vocabulary, you must first upload a text file that contains your vocabulary table into an Amazon S3 bucket. Note that this differs from , where you can include a list of terms within your request using the Phrases flag; CreateMedicalVocabulary does not support the Phrases flag and only accepts vocabularies in table format.
Each language has a character set that contains all allowed characters for that specific language. If you use unsupported characters, your custom vocabulary request fails. Refer to Character Sets for Custom Vocabularies to get the character set for your language.
For more information, see Custom vocabularies.
Parameters:
-
vocabulary_name
(VocabularyName)
–
A unique name, chosen by you, for your new custom medical vocabulary.
This name is case sensitive, cannot contain spaces, and must be unique within an Amazon Web Services account. If you try to create a new custom medical vocabulary with the same name as an existing custom medical vocabulary, you get a ConflictException error.
-
language_code
(LanguageCode)
–
The language code that represents the language of the entries in your custom vocabulary. US English (en-US) is the only language supported with Amazon Transcribe Medical.
-
vocabulary_file_uri
(Uri)
–
The Amazon S3 location (URI) of the text file that contains your custom medical vocabulary. The URI must be in the same Amazon Web Services Region as the resource you're calling.
Here's an example URI path: s3://DOC-EXAMPLE-BUCKET/my-vocab-file.txt
-
tags
(Optional[TagList], default:
None
)
–
Adds one or more custom tags, each in the form of a key:value pair, to a new custom medical vocabulary at the time you create this new custom vocabulary.
To learn more about using tags with Amazon Transcribe, refer to Tagging resources.
Raises:
-
BadRequestException
–
Your request didn't pass one or more validation tests. This can occur when the entity you're trying to delete doesn't exist or if it's in a non-terminal state (such as IN PROGRESS). See the exception message field for more information.
-
ConflictException
–
A resource already exists with this name. Resource names must be unique within an Amazon Web Services account.
-
InternalFailureException
–
There was an internal error. Check the error message, correct the issue, and try your request again.
-
LimitExceededException
–
You've either sent too many requests or your input file is too long. Wait before retrying your request, or use a smaller file and try your request again.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_transcribe/_services/transcribe.py
| def create_medical_vocabulary(
self,
vocabulary_name: "capo_transcribe.types.vocabulary_name.VocabularyName",
language_code: "capo_transcribe.types.language_code.LanguageCode",
vocabulary_file_uri: "capo_transcribe.types.uri.Uri",
*,
config_overrides: Optional[TranscribeClientConfig] = None,
tags: Optional["capo_transcribe.types.tag_list.TagList"] = None,
) -> "capo_transcribe.types.create_medical_vocabulary_response.CreateMedicalVocabularyResponse":
"""<p>Creates a new custom medical vocabulary.</p> <p>Before creating a new custom medical vocabulary, you must first upload a text file that contains your vocabulary table into an Amazon S3 bucket. Note that this differs from , where you can include a list of terms within your request using the <code>Phrases</code> flag; <code>CreateMedicalVocabulary</code> does not support the <code>Phrases</code> flag and only accepts vocabularies in table format.</p> <p>Each language has a character set that contains all allowed characters for that specific language. If you use unsupported characters, your custom vocabulary request fails. Refer to <a href="https://docs.aws.amazon.com/transcribe/latest/dg/charsets.html">Character Sets for Custom Vocabularies</a> to get the character set for your language.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/transcribe/latest/dg/custom-vocabulary.html">Custom vocabularies</a>.</p>
Args:
vocabulary_name: <p>A unique name, chosen by you, for your new custom medical vocabulary.</p> <p>This name is case sensitive, cannot contain spaces, and must be unique within an Amazon Web Services account. If you try to create a new custom medical vocabulary with the same name as an existing custom medical vocabulary, you get a <code>ConflictException</code> error.</p>
language_code: <p>The language code that represents the language of the entries in your custom vocabulary. US English (<code>en-US</code>) is the only language supported with Amazon Transcribe Medical.</p>
vocabulary_file_uri: <p>The Amazon S3 location (URI) of the text file that contains your custom medical vocabulary. The URI must be in the same Amazon Web Services Region as the resource you're calling.</p> <p>Here's an example URI path: <code>s3://DOC-EXAMPLE-BUCKET/my-vocab-file.txt</code> </p>
tags: <p>Adds one or more custom tags, each in the form of a key:value pair, to a new custom medical vocabulary at the time you create this new custom vocabulary.</p> <p>To learn more about using tags with Amazon Transcribe, refer to <a href="https://docs.aws.amazon.com/transcribe/latest/dg/tagging.html">Tagging resources</a>.</p>
Raises:
capo_transcribe.errors.bad_request_exception.BadRequestException: <p>Your request didn't pass one or more validation tests. This can occur when the entity you're trying to delete doesn't exist or if it's in a non-terminal state (such as <code>IN PROGRESS</code>). See the exception message field for more information.</p>
capo_transcribe.errors.conflict_exception.ConflictException: <p>A resource already exists with this name. Resource names must be unique within an Amazon Web Services account.</p>
capo_transcribe.errors.internal_failure_exception.InternalFailureException: <p>There was an internal error. Check the error message, correct the issue, and try your request again.</p>
capo_transcribe.errors.limit_exceeded_exception.LimitExceededException: <p>You've either sent too many requests or your input file is too long. Wait before retrying your request, or use a smaller file and try your request again.</p>
capo_transcribe.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_transcribe.types.create_medical_vocabulary_request.CreateMedicalVocabularyRequest]",
) -> OperationResponse[
"capo_transcribe.types.create_medical_vocabulary_response.CreateMedicalVocabularyResponse"
]:
import capo_transcribe._operations.transcribe.create_medical_vocabulary
output, http_response = (
capo_transcribe._operations.transcribe.create_medical_vocabulary.create_medical_vocabulary(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("CreateMedicalVocabulary")
)
input_: capo_transcribe.types.create_medical_vocabulary_request.CreateMedicalVocabularyRequest = {
"vocabulary_name": vocabulary_name,
"language_code": language_code,
"vocabulary_file_uri": vocabulary_file_uri,
}
if tags is not None:
input_["tags"] = tags
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|