谷歌翻译API之间的区别 [英] Difference between the google translate API

查看:611
本文介绍了谷歌翻译API之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在基于Google翻译构建一个开源Chrome扩展程序(此处).

I am building an Open Source Chrome extension based on Google translate (here).

我已经阅读了有关Google翻译API的其他问题(例如一个),但我仍然没有答案. 我发现Google的几个翻译网址如下:

I have read the other questions about Google translate API (like this one and this one) but I still don't have my answer. I found several URLs for Google translate like these:

  • https://clients5.google.com/translate_a/t?client=dict-chrome-ex&sl=zh-CN&tl=fr&dt=t&q=父亲

    似乎所有URL都是3部分的不同组合:

    It seems all the URL are a different combination of 3 parts:

    • 基本URL:

    • a base URL :

    • translate.googleapis.com/translate_a/
    • https://translate.google.com/translate_a/
    • https://clients5.google.com/translate_a/
    • translate.googleapis.com/translate_a/
    • https://translate.google.com/translate_a/
    • https://clients5.google.com/translate_a/

    translate_a/之后的第一个参数:singlet

    the first argument after the translate_a/: either single or t

    可以是gtxtdict-chrome-ex的客户端[或

    the clients which can be gtx, t or dict-chrome-ex [or apparently any ID]

    到目前为止,我已经看到返回的JSON有所不同. 此

    So far I have seen differences in the JSON returned. This https://translate.googleapis.com/translate_a/single?client=gtx&sl=en&tl=fr&dt=t&q=father&ie=UTF-8&oe=UTF-8 returns this json:

    [[["père","father",null,null,1]
    ]
    ,null,"en"]
    

    与此 https://clients5.google.com/translate_a/t?client=dict-chrome-ex&sl=zh-CN&tl=fr&dt=t&q=父亲返回此json:

    While this https://clients5.google.com/translate_a/t?client=dict-chrome-ex&sl=en&tl=fr&dt=t&q=father returns this json:

    {"sentences":[{"trans":"père","orig":"father","backend":1},{"src_translit":"ˈfäT͟Hər"}],"dict":[{"pos":"noun","terms":["père"],"entry":[{"word":"père","reverse_translation":["father","dad","parent","papa"],"score":0.70910621,"previous_word":"le","gender":1}],"base_form":"father","pos_enum":1},{"pos":"verb","terms":["engendrer","concevoir"],"entry":[{"word":"engendrer","reverse_translation":["generate","engender","give rise to","beget","breed","father"],"synset_id":[52561],"score":0.00017133754},{"word":"concevoir","reverse_translation":["design","conceive","devise","plan","form","father"],"synset_id":[52561],"score":4.8327973e-05}],"base_form":"father","pos_enum":2}],"src":"en","alternative_translations":[{"src_phrase":"father","alternative":[{"word_postproc":"père","score":1000,"has_preceding_space":true,"attach_to_next_token":false}],"srcunicodeoffsets":[{"begin":0,"end":6}],"raw_src_segment":"father","start_pos":0,"end_pos":0}],"confidence":1,"ld_result":{"srclangs":["en"],"srclangs_confidences":[1],"extended_srclangs":["en"]},"query_inflections":[{"written_form":"father","features":{"number":2}},{"written_form":"fathers","features":{"number":1}}],"target_inflections":[{"written_form":"père","features":{"gender":1,"number":2}},{"written_form":"pères","features":{"gender":1,"number":1}},{"written_form":"père","features":{"number":2}},{"written_form":"pères","features":{"number":1}}]}
    

    所以我的问题是以上给出的不同组合之间的区别(除此以外)是什么. 在这种情况下,我应该使用一个而不是另一个(返回的JSON除外).有没有被折旧或支持更多请求的商品?

    So my question is what are the (other than this one) differences between the different combinations given above. In which case should I use one rather than the other (except for the returned JSON). Is there one that is depreciated or that supports more request?

    关于查询的含义: https://stackoverflow.com/a/29537590/3154274

    推荐答案

    关于您的实际问题,除了您所说的内容外,我不确定是否存在任何有意义的区别,因此很难确定是否以及何时进行他们中的任何一个都已弃用.

    In regards to your actual question, I'm not sure there are any meaningful differences other than what you have stated and it would be difficult to determine if and when any of them are deprecated.

    鉴于该API没有记录,并且似乎不打算在此庄园中使用,因此我认为不应将其中的任何一个用于开发实际应用程序.

    Given the API's are undocumented and don't appear to be intended for usage in this manor, I don't think any of them should be considered for use in the development of a real application.

    但是,为了解决您发现免费的人类语言翻译API的问题,我建议使用 Azure Translator Text API (Azure翻译器文本API),该语言每月提供 200万个字符的翻译,他们的免费套餐的一部分.

    However, for solving your problem of finding a free human language translation API, I would recommend the Azure Translator Text API which provides translation of 2 million characters per month as part of their free tier.

    https://azure. microsoft.com/en-us/pricing/details/cognitive-services/translator-text-api/

    对于您的特定用例,我假设可能存在大量重复翻译,我认为缓存结果将为减少您的使用量带来显着的好处.

    For your specific use case, where I assume there may be a high amount of duplicate translations, I feel that caching the results would provide a significant benefit in reducing your usage amount.

    这篇关于谷歌翻译API之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆