【发布时间】:2018-04-10 05:52:30
【问题描述】:
已经搜索过,但在过去一年中找不到类似的问题。我正在尝试关注this tutorial,但自从它于 4 月发布以来,情况似乎发生了变化。我已经构建了 PubNub 模块并注册了 Bluemix Watson 帐户并设置了自然语言理解服务。
当我尝试在 PubNub 中运行测试包时,我收到错误:
23:24:12 js:
[" TypeError: 无法读取未定义的属性 'type' at 情绪/IBM Watson.js:46:43 at process._tickCallback (internal/process/next_tick.js:109:7)"] 情绪/IBM 错误 Watson.js:76:21 在 process._tickCallback (内部/进程/next_tick.js:109:7)
23:24:13 js:
{ "body": "{ \"status\": \"ERROR\", \"statusInfo\": \"invalid-api-key\", \"usage\": \"By accessing AlchemyAPI or using information generated by AlchemyAPI, you are agreeing to be bound by the AlchemyAPI Terms of Use: http://www.alchemyapi.com/company/terms.html\", \"totalTransactions\": \"1\", \"language\": \"unknown\" }
api的教程代码是这样的:
export default (request) => {
// url for sentiment analysis api
const apiUrl = 'https://gateway-a.watsonplatform.net/calls/text/TextGetTextSentiment';
// api key
const apiKey = 'Your_API_Key';
但自编写教程以来,Bluemix 的 API 格式似乎发生了变化。 Bluemix 凭证现在采用以下格式:
{
"url": "https://gateway.watsonplatform.net/natural-language-understanding/api",
"username": "x",
"password": "y"
}
作为一个使用 R 作为统计计算器的人,上周刚刚用 Python 编写了他的第一个(原始)战舰游戏,非常感谢任何帮助!
【问题讨论】:
标签: javascript node.js ibm-cloud ibm-watson pubnub