首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何解决R包mscstexta4r中未找到的问题(HTTP404)?

如何解决R包mscstexta4r中未找到的问题(HTTP404)?
EN

Stack Overflow用户
提问于 2016-10-20 12:53:46
回答 2查看 1.4K关注 0票数 2

我遵循这个文档实现了一个文本分析应用程序,使用微软认知服务。

首先,我创建了一个订阅,并获得了api键这里。然后我创建了一个新的R项目。我在我的工作目录中创建了一个名为.mscskeys.json的json文件。它包括:

代码语言:javascript
复制
{
"textanalyticsurl": "https://westus.api.cognitive.microsoft.com/texta/analytics/v2.0/",
"textanalyticskey": "--my API key--"
}

这是我R脚本中的代码。

代码语言:javascript
复制
install.packages("mscstexta4r")

library(mscstexta4r)
textaInit()



docsText <- c(
  "Loved the food, service and atmosphere! We'll definitely be back.",
  "Very good food, reasonable prices, excellent service.",
  "It was a great restaurant.",
  "If steak is what you want, this is the place.",
  "The atmosphere is pretty bad but the food is quite good.",
  "The food is quite good but the atmosphere is pretty bad.",
  "The food wasn't very good.",
  "I'm not sure I would come back to this restaurant.",
  "While the food was good the service was a disappointment.",
  "I was very disappointed with both the service and my entree."
)
docsLanguage <- rep("en", length(docsText))

tryCatch({
  textaDetectLanguages('love', numberOfLanguagesToDetect = 1L)
  # Perform sentiment analysis
  textaSentiment(
    documents = docsText,    # Input sentences or documents
    languages = docsLanguage
    # "en"(English, default)|"es"(Spanish)|"fr"(French)|"pt"(Portuguese)
  )

}, error = function(err) {

  # Print error
  geterrmessage()

})

但是,当我运行它时,我会得到以下错误:

错误: mscstexta4r: Not (HTTP404)。-{ "statusCode":404,“消息”:“资源未找到”}

我做错什么了?

EN

回答 2

Stack Overflow用户

发布于 2016-11-07 15:57:36

票数 1
EN

Stack Overflow用户

发布于 2018-07-19 15:45:35

在我的例子中,我不得不修改

https://eastus.api.cognitive.microsoft.com/text/analytics/v2.0

https://eastus.api.cognitive.microsoft.com/text/analytics/v2.0/

请注意附加的/,它允许应用程序连接到适当的服务,例如

.../sentiment

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40155057

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档