简体   繁体   English

如何在 Python 中使用谷歌云翻译 API 翻译大文本?

[英]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.

相关问题 如何使用Python从Google Translate API访问JSON转换 - How to access JSON translation from Google Translate API with Python Python Google Translate API 错误:如何翻译大量数据 - Python Google Translate API error : How to translate a large amount of data Python 如何使用谷歌翻译翻译口语成绩单 - How to translate spoken transcript using google translation by Python 使用谷歌翻译 API 翻译 python(烧瓶)中的文本 - translate text in python (flask) using google translate API 如何使用谷歌翻译API的Python来翻译整个txt文件? - How to translate entire .txt file using Google Translate API in Python? 在Python中使用Google Translate API,您如何指示某些文本不被翻译? - Using Google Translate API in Python, how do you indicate that some text is not to be translated? 使用谷歌云翻译 api 使用 api 密钥 - Use google cloud translation api using api key 如何使用谷歌翻译器 API 翻译抓取的文本 - how to translate scraped text using google translator API 谷歌云语音到 Python 文本:节省翻译和时间到 JSON - Google cloud speech to text in Python: Save translation and time to JSON Google Translate API - 读取和写入云存储 - Python - Google Translate API - Reading and Writing to Cloud Storage - Python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM