annotate_text {googlenlp}R Documentation

annotate_text

Description

Send a request, and retrieve the sentences, tokens, entities, documentSentiment, and language responses. This function calls the annotateText method, which performs the analyzeSyntax, analyzeEntities, and analyzeSentiment methods all within one API call.

Usage

annotate_text(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 five elements: sentences, tokens, entities, documentSentiment, and language.

If flatten is TRUE, then the sentences, tokens, entities, and documentSentiment elements are each converted to data frames.

Examples

## Not run: 
sample_annotate <- annotate_text(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_annotate$sentences
sample_annotate$tokens
sample_annotate$entities
sample_annotate$documentSentiment
sample_annotate$language

## End(Not run)


[Package googlenlp version 0.2.0 Index]