Table of Contents
A low-level client representing Amazon Translate:
import boto3
client = boto3.client('translate')
These are the available methods:
Check if an operation can be paginated.
A synchronous action that deletes a custom terminology.
See also: AWS API Documentation
Request Syntax
response = client.delete_terminology(
Name='string'
)
[REQUIRED]
The name of the custom terminology being deleted.
Generate a presigned url given a client, its method, and arguments
The presigned url
Create a paginator for an operation.
Retrieves a custom terminology.
See also: AWS API Documentation
Request Syntax
response = client.get_terminology(
Name='string',
TerminologyDataFormat='CSV'|'TMX'
)
[REQUIRED]
The name of the custom terminology being retrieved.
[REQUIRED]
The data format of the custom terminology being retrieved, either CSV or TMX.
dict
Response Syntax
{
'TerminologyProperties': {
'Name': 'string',
'Description': 'string',
'Arn': 'string',
'SourceLanguageCode': 'string',
'TargetLanguageCodes': [
'string',
],
'EncryptionKey': {
'Type': 'KMS',
'Id': 'string'
},
'SizeBytes': 123,
'TermCount': 123,
'CreatedAt': datetime(2015, 1, 1),
'LastUpdatedAt': datetime(2015, 1, 1)
},
'TerminologyDataLocation': {
'RepositoryType': 'string',
'Location': 'string'
}
}
Response Structure
(dict) --
TerminologyProperties (dict) --
The properties of the custom terminology being retrieved.
Name (string) --
The name of the custom terminology.
Description (string) --
The description of the custom terminology properties.
Arn (string) --
The Amazon Resource Name (ARN) of the custom terminology.
SourceLanguageCode (string) --
The language code for the source text of the translation request for which the custom terminology is being used.
TargetLanguageCodes (list) --
The language codes for the target languages available with the custom terminology file. All possible target languages are returned in array.
EncryptionKey (dict) --
The encryption key for the custom terminology.
Type (string) --
The type of encryption key used by Amazon Translate to encrypt custom terminologies.
Id (string) --
The Amazon Resource Name (ARN) of the encryption key being used to encrypt the custom terminology.
SizeBytes (integer) --
The size of the file used when importing a custom terminology.
TermCount (integer) --
The number of terms included in the custom terminology.
CreatedAt (datetime) --
The time at which the custom terminology was created, based on the timestamp.
LastUpdatedAt (datetime) --
The time at which the custom terminology was last update, based on the timestamp.
TerminologyDataLocation (dict) --
The data location of the custom terminology being retrieved. The custom terminology file is returned in a presigned url that has a 30 minute expiration.
RepositoryType (string) --
The repository type for the custom terminology data.
Location (string) --
The location of the custom terminology data.
Returns an object that can wait for some condition.
Creates or updates a custom terminology, depending on whether or not one already exists for the given terminology name. Importing a terminology with the same name as an existing one will merge the terminologies based on the chosen merge strategy. Currently, the only supported merge strategy is OVERWRITE, and so the imported terminology will overwrite an existing terminology of the same name.
If you import a terminology that overwrites an existing one, the new terminology take up to 10 minutes to fully propagate and be available for use in a translation due to cache policies with the DataPlane service that performs the translations.
See also: AWS API Documentation
Request Syntax
response = client.import_terminology(
Name='string',
MergeStrategy='OVERWRITE',
Description='string',
TerminologyData={
'File': b'bytes',
'Format': 'CSV'|'TMX'
},
EncryptionKey={
'Type': 'KMS',
'Id': 'string'
}
)
[REQUIRED]
The name of the custom terminology being imported.
[REQUIRED]
The merge strategy of the custom terminology being imported. Currently, only the OVERWRITE merge strategy is supported. In this case, the imported terminology will overwrite an existing terminology of the same name.
[REQUIRED]
The terminology data for the custom terminology being imported.
The file containing the custom terminology data.
The data format of the custom terminology. Either CSV or TMX.
The encryption key for the custom terminology being imported.
The type of encryption key used by Amazon Translate to encrypt custom terminologies.
The Amazon Resource Name (ARN) of the encryption key being used to encrypt the custom terminology.
dict
Response Syntax
{
'TerminologyProperties': {
'Name': 'string',
'Description': 'string',
'Arn': 'string',
'SourceLanguageCode': 'string',
'TargetLanguageCodes': [
'string',
],
'EncryptionKey': {
'Type': 'KMS',
'Id': 'string'
},
'SizeBytes': 123,
'TermCount': 123,
'CreatedAt': datetime(2015, 1, 1),
'LastUpdatedAt': datetime(2015, 1, 1)
}
}
Response Structure
(dict) --
TerminologyProperties (dict) --
The properties of the custom terminology being imported.
Name (string) --
The name of the custom terminology.
Description (string) --
The description of the custom terminology properties.
Arn (string) --
The Amazon Resource Name (ARN) of the custom terminology.
SourceLanguageCode (string) --
The language code for the source text of the translation request for which the custom terminology is being used.
TargetLanguageCodes (list) --
The language codes for the target languages available with the custom terminology file. All possible target languages are returned in array.
EncryptionKey (dict) --
The encryption key for the custom terminology.
Type (string) --
The type of encryption key used by Amazon Translate to encrypt custom terminologies.
Id (string) --
The Amazon Resource Name (ARN) of the encryption key being used to encrypt the custom terminology.
SizeBytes (integer) --
The size of the file used when importing a custom terminology.
TermCount (integer) --
The number of terms included in the custom terminology.
CreatedAt (datetime) --
The time at which the custom terminology was created, based on the timestamp.
LastUpdatedAt (datetime) --
The time at which the custom terminology was last update, based on the timestamp.
Provides a list of custom terminologies associated with your account.
See also: AWS API Documentation
Request Syntax
response = client.list_terminologies(
NextToken='string',
MaxResults=123
)
dict
Response Syntax
{
'TerminologyPropertiesList': [
{
'Name': 'string',
'Description': 'string',
'Arn': 'string',
'SourceLanguageCode': 'string',
'TargetLanguageCodes': [
'string',
],
'EncryptionKey': {
'Type': 'KMS',
'Id': 'string'
},
'SizeBytes': 123,
'TermCount': 123,
'CreatedAt': datetime(2015, 1, 1),
'LastUpdatedAt': datetime(2015, 1, 1)
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
TerminologyPropertiesList (list) --
The properties list of the custom terminologies returned on the list request.
(dict) --
The properties of the custom terminology.
Name (string) --
The name of the custom terminology.
Description (string) --
The description of the custom terminology properties.
Arn (string) --
The Amazon Resource Name (ARN) of the custom terminology.
SourceLanguageCode (string) --
The language code for the source text of the translation request for which the custom terminology is being used.
TargetLanguageCodes (list) --
The language codes for the target languages available with the custom terminology file. All possible target languages are returned in array.
EncryptionKey (dict) --
The encryption key for the custom terminology.
Type (string) --
The type of encryption key used by Amazon Translate to encrypt custom terminologies.
Id (string) --
The Amazon Resource Name (ARN) of the encryption key being used to encrypt the custom terminology.
SizeBytes (integer) --
The size of the file used when importing a custom terminology.
TermCount (integer) --
The number of terms included in the custom terminology.
CreatedAt (datetime) --
The time at which the custom terminology was created, based on the timestamp.
LastUpdatedAt (datetime) --
The time at which the custom terminology was last update, based on the timestamp.
NextToken (string) --
If the response to the ListTerminologies was truncated, the NextToken fetches the next group of custom terminologies.
Translates input text from the source language to the target language. It is not necessary to use English (en) as either the source or the target language but not all language combinations are supported by Amazon Translate. For more information, see Supported Language Pairs .
To have Amazon Translate determine the source language of your text, you can specify auto in the SourceLanguageCode field. If you specify auto , Amazon Translate will call Amazon Comprehend to determine the source language.
See also: AWS API Documentation
Request Syntax
response = client.translate_text(
Text='string',
TerminologyNames=[
'string',
],
SourceLanguageCode='string',
TargetLanguageCode='string'
)
[REQUIRED]
The text to translate. The text string can be a maximum of 5,000 bytes long. Depending on your character set, this may be fewer than 5,000 characters.
The TerminologyNames list that is taken as input to the TranslateText request. This has a minimum length of 0 and a maximum length of 1.
[REQUIRED]
The language code for the language of the source text. The language must be a language supported by Amazon Translate.
To have Amazon Translate determine the source language of your text, you can specify auto in the SourceLanguageCode field. If you specify auto , Amazon Translate will call Amazon Comprehend to determine the source language.
[REQUIRED]
The language code requested for the language of the target text. The language must be a language supported by Amazon Translate.
dict
Response Syntax
{
'TranslatedText': 'string',
'SourceLanguageCode': 'string',
'TargetLanguageCode': 'string',
'AppliedTerminologies': [
{
'Name': 'string',
'Terms': [
{
'SourceText': 'string',
'TargetText': 'string'
},
]
},
]
}
Response Structure
(dict) --
TranslatedText (string) --
The the translated text. The maximum length of this text is 5kb.
SourceLanguageCode (string) --
The language code for the language of the source text.
TargetLanguageCode (string) --
The language code for the language of the target text.
AppliedTerminologies (list) --
The names of the custom terminologies applied to the input text by Amazon Translate for the translated text response.
(dict) --
The custom terminology applied to the input text by Amazon Translate for the translated text response. This is optional in the response and will only be present if you specified terminology input in the request. Currently, only one terminology can be applied per TranslateText request.
Name (string) --
The name of the custom terminology applied to the input text by Amazon Translate for the translated text response.
Terms (list) --
The specific terms of the custom terminology applied to the input text by Amazon Translate for the translated text response. A maximum of 250 terms will be returned, and the specific terms applied will be the first 250 terms in the source text.
(dict) --
The term being translated by the custom terminology.
SourceText (string) --
The source text of the term being translated by the custom terminology.
TargetText (string) --
The target text of the term being translated by the custom terminology.
The available paginators are: