您是否考虑过使用异步调用start_text_translation_job()
而不是同步调用translate_text()
?然后你会有一个更高的限制,而不是 5000 个字节,你会有 1,000,000 个字符 * 1,000,000 个文档 * 10 个批次:https://docs.aws.amazon.com/translate/latest/dg/what-is-limits。 html#limits-节流
同步实时转换限制:
Description Limit
Character encoding UTF-8
Maximum document size (UTF-8 characters) 5,000 bytes
异步批量翻译限制:
Description Limit
Character encoding UTF-8
Maximum number of characters per document 1,000,000
Maximum size per document 20 MB
Maximum number of documents in batch 1,000,000
Maximum size of total documents in batch 5 GB
Maximum number of parallel batch translation jobs 10
异步 调用的代码start_text_translation_job()
可以在这里找到:
https ://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/translate.html
response = client.start_text_translation_job(
JobName='string',
InputDataConfig={
'S3Uri': 'string',
'ContentType': 'string'
},
OutputDataConfig={
'S3Uri': 'string'
},
DataAccessRoleArn='string',
SourceLanguageCode='string',
TargetLanguageCodes=[
'string',
],
TerminologyNames=[
'string',
],
ClientToken='string'
)