2016-10-20 1 views
0

J'ai suivi ce documentation pour implémenter une application d'analyse de texte à l'aide des Microsoft Cognitive Services.Comment resoudre Aucune trouvaille (HTTP 404) dans le package mscstexta4r dans R?

D'abord, j'ai créé un abonnement et j'ai obtenu les clés api here. Ensuite, j'ai créé un nouveau projet R. J'ai créé un fichier json nommé .mscskeys.json dans mon répertoire de travail. Il contient:

{ 
"textanalyticsurl": "https://westus.api.cognitive.microsoft.com/texta/analytics/v2.0/", 
"textanalyticskey": "--my API key--" 
} 

Ceci est le code de mon script R.

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() 

}) 

Mais quand je le lance, je reçois l'erreur suivante:

Error: mscstexta4r: Not Found (HTTP 404). - { "statusCode": 404, "message": "Resource not found" }

ce que je fais mal?

Répondre