[英]How to translate large text using Google Cloud Translation API in Python?
I want to translate large text using GoogleCloud Translation API.我想使用 GoogleCloud Translation API 翻译大文本。 I am able to translate short sentences, but I can't translate large text because there is a limit.
我可以翻译短句,但我不能翻译大文本,因为有限制。 The Cloud Translation API is optimized for translation of short requests.
Cloud Translation API 针对短请求的翻译进行了优化。 The recommended maximum length for each request is 2K code points.
每个请求的建议最大长度为 2K 个代码点。 Documentation link: https://cloud.google.com/translate/quotas
文档链接: https://cloud.google.com/translate/quotas
I am thinking to break the large content into small parts and call the API in a loop.我正在考虑将大内容分成小部分并循环调用 API。 But, I don't know the limit for different languages(for example English and Chinese character limit will be different).
但是,我不知道不同语言的限制(例如英文和中文字符限制会不同)。
What is 2k code points in the documentation?文档中的2k 代码点是什么? and how can I calculate the limit for different languages?
以及如何计算不同语言的限制?
You can request for 5k characters per Google translation request.您可以为每个 Google 翻译请求请求 5k 个字符。 Our product applied 5k characters per request in Google Console platform.
我们的产品在 Google Console 平台中的每个请求应用了 5k 个字符。 You can do that too.
你也可以那样做。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.