Learn R Programming

aws.comprehend (version 0.2.1)

detect_sentiment: Detect sentiment in a source text

Description

Detect sentiment in a source text

Usage

detect_sentiment(text, language = "en", ...)

Arguments

text

A character string containing a text to sentiment analyze, or a character vector to perform analysis separately for each element.

language

A character string containing a two-letter language code. Currently “en” and “es” are supported.

Additional arguments passed to comprehendHTTP.

Value

A data frame

Examples

Run this code
# NOT RUN {
  # simple example
  detect_sentiment("I have never been happier. This is the best day ever.")

  txt <-c("I have never been happier. This is the best day ever.",
          "I have always been happier. This is the worst day ever.")
  detect_sentiment(txt)
# }

Run the code above in your browser using DataLab