analyze_sentiment {googlenlp}R Documentation

analyze_sentiment

Description

Send a request, and retrieve the documentSentiment and language responses. This function retrieves the results from the analyzeSentiment method.

Usage

analyze_sentiment(text_body, flatten = TRUE)

Arguments

text_body

The text string to send to the API.

flatten

If TRUE (default), then the results of each method are flattened and converted to a data frame.

Value

A list containing two elements: documentSentiment and language.

If flatten is TRUE, then the documentSentiment element is converted to a data frame.

Examples

## Not run: 
sample_sentiment <- analyze_sentiment(text_body = "Google, headquartered in Mountain View, unveiled
                                       the new Android phone at the Consumer Electronic Show.
                                       Sundar Pichai said in his keynote that users love
                                       their new Android phones.",
                                      flatten = TRUE)
sample_sentiment$documentSentiment
sample_sentiment$language

## End(Not run)


[Package googlenlp version 0.2.0 Index]