标签: google-cloud-translate

“TranslationServiceClient”对象在谷歌云翻译“translate_v3”上没有属性“location_path”

我正在使用 Python 3.6 和 google-cloud-translate 包。

from google.cloud import translate_v3 as translate
client = translate.TranslationServiceClient(credentials = credentials)
parent = client.location_path("my-location", "global")
Run Code Online (Sandbox Code Playgroud)

从昨天开始,更新了库后,我收到了这个错误:

AttributeError: 'TranslationServiceClient' object has no attribute 'location_path'
Run Code Online (Sandbox Code Playgroud)

是不是这些库变了?引导此查询的正确方法是什么?

google-translate python-3.x google-cloud-translate

6
推荐指数
2
解决办法
1587
查看次数

需要导入语法

有谁知道这行代码的导入语法:

const { Translate } = require("@google-cloud/translate").v2;
Run Code Online (Sandbox Code Playgroud)

我在想这样的事情:

import { Translate } from "@google-cloud/translate.v2"
Run Code Online (Sandbox Code Playgroud)

但这不起作用。有任何想法吗?

javascript import google-translate node.js google-cloud-translate

2
推荐指数
1
解决办法
400
查看次数

将 HTML 字符转换为 Pandas Dataframe 中的字符串

我想将数据框中的 html 字符替换为字符串。

我尝试了下面的代码,但无法更改为 Stirng。

import html
html.unescape(data)
Run Code Online (Sandbox Code Playgroud)

这是我的数据框,我该怎么做?

供您参考,此结果来自 Google Cloud 的 Translation API。

ID A1 A2 A3 1 我不知道它是否不满足实际上我很难理解...我不知道它是否不满足我的exp... 2 NaN NaN NaN 3 I认为这是一个正确的网页设计,至少... NaN 该商品售价 400 日元或 4 英镑。

在此输入图像描述

html python pandas google-cloud-translate

1
推荐指数
1
解决办法
2124
查看次数