有中英翻译API服务吗?

发布于 2024-09-28 17:50:07 字数 95 浏览 4 评论 0原文

我有一份中文产品名称列表。我想将这些翻译成英文,我尝试过Google AJAX语言API,但似乎翻译不好,如果有人能给我一些建议或指出我更好的选择,那就太好了。
谢谢。

I have a list of product names in Chinese. I want to translate these into English, I have tried Google AJAX language API, but it seems that translation is not good, it would be great if someone could give me some advice about or point me towards a better choice.
Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

与往事干杯 2024-10-05 17:50:07

呃,谷歌当然是一个很棒的翻译服务,但如果你正在寻找可靠的翻译,你可能需要人工翻译 - 机器翻译最多只能是粗略的。 myGengo 有一个 API 可以促进机器翻译;你的问题被标记为“python”,所以我在下面抛出了一些示例代码,但是你可以 如果您愿意,可以获取更广泛的演练

最酷的是,您可以在等待人工翻译完成的同时获得机器翻译,因此,如果您在这段时间需要某些东西,您也不会感到兴奋和干燥。 ;)

首先,安装适用于 Python 的 mygengo API 库:

pip install mygengo

然后,请求如下翻译:

# -*- coding: utf-8 -*-
from mygengo import MyGengo

gengo = MyGengo(
    public_key = 'your_mygengo_api_key',
    private_key = 'your_mygengo_private_key',
    sandbox = False, # possibly False, depending on your dev needs
)

translation = gengo.postTranslationJob(job = {
    'type': 'text', # REQUIRED. Type to translate, you'll probably always put 'text' here (for now ;)
    'slug': 'Translating Chinese to English with the myGengo API', # REQUIRED. For storing on the myGengo side
    'body_src': '我們今天要去那裏嗎', # REQUIRED. The text you're translating. ;P
    'lc_src': 'zh', # REQUIRED. source_language_code (see getServiceLanguages() for a list of codes)  
    'lc_tgt': 'en', # REQUIRED. target_language_code (see getServiceLanguages() for a list of codes)
    'tier': 'standard', # REQUIRED. tier type ("machine", "standard", "pro", or "ultra")
})

# This will print out a machine translation; for your human translation, you can
# poll and check often, or set up a URL for it to post the results to.
print translation['response']['job']['body_tgt']

Eh, Google is certainly a great translation service, but if you're looking for reliable translations you probably need to go human - machine translation can be sketchy at best. myGengo has an API to facilitate machine translation; your question is tagged with "python", so I've thrown some sample code below, but you can get a more extensive walkthrough if you so desire.

The cool thing is that you can get a machine translation while you wait for your human translation to be done, so if you need something in the time between you're not high and dry. ;)

First, install the mygengo API library for Python:

pip install mygengo

Then, request translations like below:

# -*- coding: utf-8 -*-
from mygengo import MyGengo

gengo = MyGengo(
    public_key = 'your_mygengo_api_key',
    private_key = 'your_mygengo_private_key',
    sandbox = False, # possibly False, depending on your dev needs
)

translation = gengo.postTranslationJob(job = {
    'type': 'text', # REQUIRED. Type to translate, you'll probably always put 'text' here (for now ;)
    'slug': 'Translating Chinese to English with the myGengo API', # REQUIRED. For storing on the myGengo side
    'body_src': '我們今天要去那裏嗎', # REQUIRED. The text you're translating. ;P
    'lc_src': 'zh', # REQUIRED. source_language_code (see getServiceLanguages() for a list of codes)  
    'lc_tgt': 'en', # REQUIRED. target_language_code (see getServiceLanguages() for a list of codes)
    'tier': 'standard', # REQUIRED. tier type ("machine", "standard", "pro", or "ultra")
})

# This will print out a machine translation; for your human translation, you can
# poll and check often, or set up a URL for it to post the results to.
print translation['response']['job']['body_tgt']
少钕鈤記 2024-10-05 17:50:07

我认为谷歌可能是最好的基于网络的自动翻译服务之一。

I think Google are probably one of the best web based automatic translation services.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文