gcnlp_post: Send a POST request to the Google Cloud Natural Language API

Description Usage Arguments Value Examples

View source: R/request.R

Description

Send a POST request to the Google Cloud Natural Language API and retrieve the results.

Usage

1
2
gcnlp_post(text_body, extract_syntax = TRUE, extract_entities = TRUE,
  extract_document_sentiment = TRUE)

Arguments

text_body

The text string to send to the API.

extract_syntax

Behavior for the analyzeSyntax method. Defaults to TRUE. See the API documentation for more information.

extract_entities

Behavior for the analyzeEntities method. Defaults to TRUE. See the API documentation for more information.

extract_document_sentiment

Behavior for the analyzeSentiment method. Defaults to TRUE. See the API documentation for more information.

Value

A list containing two elements: [1] content includes the parsed response, and contains the sentences, tokens, entities, documentSentiment, language results specified in the request. [2] raw_response contains the raw response from the API.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
gcnlp_post(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.",
           extract_syntax = TRUE,
           extract_entities = TRUE,
           extract_document_sentiment = TRUE)

## End(Not run)

googlenlp documentation built on May 2, 2019, 9:18 a.m.