## Not run:
#
# 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.",
# "I'm not sure I would come back to this restaurant.",
# "The food wasn't very good.",
# "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({
#
# # Get key talking points in documents
# docsKeyPhrases <- textaKeyPhrases(
# documents = docsText, # Input sentences or documents
# languages = docsLanguage
# # "en"(English, default)|"de"(German)|"es"(Spanish)|"fr"(French)|"ja"(Japanese)
# )
#
# # Class and structure of docsKeyPhrases
# class(docsKeyPhrases)
# #> [1] "texta"
# str(docsKeyPhrases, max.level = 1)
# #> List of 3
# #> $ results:'data.frame': 10 obs. of 2 variables:
# #> $ json : chr "{\"documents\":[{\"keyPhrases\":[\"atmosphere\",\"food\", __truncated__ ]}]}
# #> $ request:List of 7
# #> ..- attr(*, "class")= chr "request"
# #> - attr(*, "class")= chr "texta"
#
# # Print results
# docsKeyPhrases
# #> texta [https://westus.api.cognitive.microsoft.com/text/analytics/v2.0/keyPhrases]
# #>
# #> -----------------------------------------------------------
# #> text keyPhrases
# #> ------------------------------ ----------------------------
# #> Loved the food, service and atmosphere, food, service
# #> atmosphere! We'll definitely
# #> be back.
# #>
# #> Very good food, reasonable reasonable prices, good food
# #> prices, excellent service.
# #>
# #> It was a great restaurant. great restaurant
# #>
# #> If steak is what you want, steak, place
# #> this is the place.
# #>
# #> The atmosphere is pretty bad atmosphere, food
# #> but the food is quite good.
# #>
# #> The food is quite good but the food, atmosphere
# #> atmosphere is pretty bad.
# #>
# #> I'm not sure I would come back restaurant
# #> to this restaurant.
# #>
# #> The food wasn't very good. food
# #>
# #> While the food was good the service, food
# #> service was a disappointment.
# #>
# #> I was very disappointed with service, entree
# #> both the service and my
# #> entree.
# #> -----------------------------------------------------------
#
# }, error = function(err) {
#
# # Print error
# geterrmessage()
#
# })
# ## End(Not run)
Run the code above in your browser using DataLab