keyword_sentiment: Watson Natural Language Understanding: Sentiment Analysis of...

Description Usage Arguments Value See Also Examples

View source: R/keyword_sentiment.R

Description

See the sign-up documentation for step by step instructions to secure your own username and password to enable you to authenticate the Watson NLU API. The keyword_sentiment function takes a text or URL input, along with the input type. The function then returns a dataframe containing the sentiments of the keywords extracted from the input, and the likelihood that the input is described by that sentiment. See the keyword_sentiment documentation for more usage cases.

Usage

1
2
keyword_sentiment(input = NULL, input_type = NULL,
  version = "?version=2018-03-16")

Arguments

input

Either a text string input or website URL. Either text or url argument has to be specified, but not both.

input_type

Specify what type of input was entered. Either text or url argument has to be specified, but not both.

version

The release date of the API version to use. Default value is version="?version=2018-03-16"

Value

Dataframe containing the sentiments of the keywords extracted from the input, and the likelihood that the input is described by that sentiment.

See Also

text_categories, \link[watsonNLU]{keyword_relevance}, \link[watsonNLU]{keyword_emotions}, \link[watsonNLU]{auth_NLU}

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
credentials <- readRDS("../tests/testthat/credentials.rds")
username <- credentials$username
password <- credentials$password

# Authenticate using Watson NLU API Credentials
auth_NLU(username, password)

# Find the keywords and related emotions in the given text input.
keyword_sentiment(input = 'This is a great API wrapper', input_type='text')

# Find the keywords and related emotions in the given URL input.
keyword_sentiment(input = 'http://www.nytimes.com/guides/well/how-to-be-happy', input_type='url')

johannesharmse/watsonNLU documentation built on May 21, 2019, 12:04 p.m.