google云翻译api客户端库

google-cloud-translate的Python项目详细描述


GApypiversions

使用Google Cloud Translation,您可以在 成千上万的语言对。google云翻译api允许网站 程序以编程方式与google云翻译集成。谷歌 云翻译作为付费服务提供。见PricingFAQ页了解详细信息。

快速启动

要使用此库,首先需要执行以下步骤:

  1. Select or create a Cloud Platform project.
  2. Enable billing for your project.
  3. Enable the Google Cloud Translate API.
  4. Setup Authentication.

安装

使用pip在virtualenv中安装此库。virtualenv是 创建独立的python环境。它解决的基本问题是 依赖项和版本,以及间接权限。

使用virtualenv,无需系统即可安装此库 安装权限,且不会与已安装的系统发生冲突 依赖关系。

支持的python版本

python=3.5

不推荐的python版本

python==2.7。Python2.7支持将于2020年1月1日取消。

Mac/Linux

pip install virtualenv
virtualenv <your-env>
source <your-env>/bin/activate
<your-env>/bin/pip install google-cloud-translate

窗口

pip install virtualenv
virtualenv <your-env>
<your-env>\Scripts\activate
<your-env>\Scripts\pip.exe install google-cloud-translate

示例用法

>>>fromgoogle.cloudimporttranslate>>>client=translate.Client()>>>client.get_languages()[{'language':'af','name':'Afrikaans',},...]>>>client.detect_language(['Me llamo','I am'])[{'confidence':0.25830904,'input':'Me llamo','language':'es',},{'confidence':0.17112699,'input':'I am','language':'en',},]>>>fromgoogle.cloudimporttranslate>>>client=translate.Client()>>>client.translate('koszula'){'translatedText':'shirt','detectedSourceLanguage':'pl','input':'koszula',}

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
我可以用C++代码使用java代码吗?   java使用JSR303在派生类中提供更具体的约束   java在这个查找唯一路径数算法中我做错了什么?   java如何为2个不同的服务提供商使用2个不同的SSL证书?   java在Gridview上绘制文本   java使用连接for循环构建字符串名   java StringBuilder拆分无法处理某些文件   java事件关注EditText   Java Web Start“找不到URL的缓存资源”   java程序从命令行运行的速度比在Eclipse中慢   java为什么HttpServletRequest会截断#字符上的url输入?   java自定义折叠工具栏平滑标题大小调整   使用Mockito对安卓 java中调用另一个静态函数的函数进行单元测试   http在java客户机中使用cachecontrol头   java如何使用。是否使用Delimiter从输入文件中排除标点符号和数字?   使用上下文作为参数/参数的java   java更有效地从Jar中提取文件   java为多个JButton提供相同的actionListener