问题标签 [google-cloud-language]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
python - 找不到记录器“grpc._plugin_wrapping”的处理程序
我收到以下错误:
No handlers could be found for logger "grpc._plugin_wrapping"
(完整的错误文本)
类似于https://github.com/googlecodelabs/iot-data-pipeline/issues/6
我们正在使用 python2.7 和 google-cloud、google-cloud-language。
预计没有错误,代码以前可以工作。不知道什么是触发器。错误发生在client.analyze_entities()
android - 添加 Google 语言 API 会导致 DuplicateRelativeFileException
在一个 android studio 项目中,我添加implementation 'com.google.cloud:google-cloud-language:1.40.0'
到应用程序的 gradle 文件中。
这会导致构建时出现以下错误:
org.gradle.api.tasks.TaskExecutionException:任务':app:transformResourcesWithMergeJavaResForDebug'的执行失败。在 org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:103) 在 org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73) 在 org.gradle .api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51) 在 org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59) 在 org.gradle.api.internal .tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54) 在 org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter。
此错误的原因是什么以及如何解决?
python - 无法从云功能正确访问 GCS 对象
每当我尝试使用支持站点上显示的方法获取云存储桶对象和输入时,我都会收到错误消息
google.api_core.exceptions.InvalidArgument: 400 gcs_content_uri 中指定的 GCS 对象不存在。
打印时 gcs 参考如下所示:
gs://lang-docs-in/b'doc1.txt'
我已经尝试了一切以使其正常工作:编码、解码等几个小时,但似乎无济于事。有什么想法吗?
主文件
要求.txt
python - ImportError:在 AppEngine 标准本地没有名为 grpc._cython.cygrpc 的模块
嗨,我收到以下错误:
grpc/ init .py”,第 22 行,从 grpc._cython 导入 cygrpc 作为 _cygrpc 文件“~/bin/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/runtime/sandbox.py ",第 1095 行,在 load_module raise ImportError('No module named %s' % fullname) ImportError: No module named grpc._cython.cygrpc
从此代码产生:
from google.cloud import language
在本地运行的 App Engine 标准中(Python 2.7)。
我看过几年前的帖子,说某些谷歌云库可能不支持在标准环境上运行或在本地运行。从文档(在产品页面和 github 上非常不同)、几个错误报告和社区讨论中,尚不清楚我是否能够在本地、此时或在标准环境中使用 Google Cloud Natural Language API不是。
是否有任何明确的文档,或者可能是此错误的其他原因?
python - google-cloud-language、pandas 和 conda 之间是否存在冲突?
为了将存储在 .csv 文件中的文本字符串提供给 Google 的命名实体提取器,我想将 Google NLP API 和 pandas 一起使用。我目前正在使用 conda 来管理我的 python 环境。
这些是我采取的步骤:
第 1 部分:在 conda 环境中安装 google-cloud-language
运行示例程序:
输出:
到目前为止,一切都很好。谷歌的示例程序有效
第 2 部分:安装 pandas 并运行相同的程序
或者
运行相同的程序:
使用 conda 或 pip 安装 pandas 并运行相同的程序后,出现错误。
错误信息:
到底是怎么回事?google-cloud-language 和 pandas 之间有冲突吗?如何让两个库一起工作?理想情况下,我想继续使用 conda,因为这是我熟悉的,但 conda 是问题吗?
python - 谷歌云自然语言导入错误
我在运行 Google Cloud Natural Language API 时遇到了很多麻烦。我正在尝试在 Google VM 上的 Linux 中运行 Python 程序。我也不确定如何运行错误的完整追溯。以下代码不起作用:
from google.cloud import language
from google.cloud.language import enums
from google.cloud.language import types
.
在 Python 2 上出现错误:
Traceback (most recent call last):
File "natlangex.py", line 3, in <module>
from google.cloud.language import enums
ImportError: cannot import name enums
我尝试升级到 Python 3,当我运行 Python 3 时出现错误:我更新到 Python 3。令人困惑的一件事是,当我运行 Python 3 时,错误有点不同:
Traceback (most recent call last):
File "natlangex.py", line 2, in <module>
from google.cloud import language
ImportError: No module named 'google'
以下是我尝试过的其他事情:
- 我安装了 SDK。
- 我设置
export GOOGLE_APPLICATION_CREDENTIALS="apikey.json"
。 - 我试过了
!pip install google-cloud-language
- 我升级了点子
pip install --upgrade setuptools pip.
我很失落!先感谢您。
python - Python 中的 Google Cloud API 输出格式
如果我从 Google Cloud Python 库调用函数analyse_syntax ,它会返回
这对我来说是一种奇怪的格式,因为:
我不能通过(看起来像)keys 进行
for key in info.tokens[0].part_of_speech:
迭代TypeError: 'PartOfSpeech' object is not iterable
。访问这些值不像我想的那样工作:
info.tokens[0].part_of_speech.tag
给出 value11
。
问题:那是什么类型的对象,它是如何工作的?
我希望能够将其转换为字典(以比首先将其转换为字符串更好的方式)或以某种方式迭代它(找到它具有哪些键以及对应的值)。
google-cloud-composer - Cloud Composer 中与 google-cloud-language 的兼容性问题
我google-cloud-language 1.3.0
在composer-1.8.3-airflow-1.10.3
.
它曾经很好,但从过去两周开始,它报告ImportError: cannot import name 'aio' from 'grpc.experimental'
我已经检查了包的文档,看起来google-cloud-language
现在需要grpcio>=1.29.0
. 然而,根据 Cloud Composer 版本列表,即使是最新版本的 composer,它的 PyPI 包 grpcio 仍然存在1.23.0
我试图强制其版本升级1.29.0
但失败了。
有人可以检查这个问题吗?
python-3.x - ImportError 无法从“google.cloud”(未知位置)导入“语言”
我正在尝试合并 google-cloud-language 来使用情绪分析。我按照谷歌文档网站上的指南进行操作,如下所示:
当我运行脚本时,我收到以下错误:
我尝试像这样运行脚本:
我已经像这样安装了 google-cloud-language:
我已经在虚拟环境和虚拟环境之外做到了这一点。
没有任何效果。如何正确设置脚本以成功从谷歌云导入 NLP 模块?
python - 如何将谷歌云自然语言实体情感响应转换为 Python 中的 JSON/dict?
我正在尝试使用谷歌云自然语言 API 来分析实体情绪。
然后我从响应中打印出实体及其属性。
现在我想以 JSON 或字典格式存储整个响应,以便我可以将其存储到数据库中的表中或进行处理。我尝试将 Google Cloud NLP API 实体情感输出转换为 JSON以及如何 JSON 序列化来自 google 的自然语言 API 的对象?(没有 __dict__ 属性)但它不起作用。
如果我使用
我收到一条错误消息
如何解析此响应以将其正确转换为 json 或 dict?