Skip to content

Latest commit

 

History

History
 
 

language

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Google Cloud Platform logo

Google Cloud Natural Language API Node.js Samples

Cloud Natural Language API provides natural language understanding technologies to developers, including sentiment analysis, entity recognition, and syntax analysis. This API is part of the larger Cloud Machine Learning API.

Table of Contents

Setup

  1. Read Prerequisites and How to run a sample first.

  2. Install dependencies:

     npm install
    

Samples

Analyze

View the documentation or the source code.

Usage: node analyze --help

Commands:
  sentimentFromString <text>             Detect the sentiment of a block of text.
  sentimentFromFile <bucket> <filename>  Detect the sentiment of text in a GCS file.
  entitiesFromString <text>              Detect the entities of a block of text.
  entitiesFromFile <bucket> <filename>   Detect the entities of text in a GCS file.
  syntaxFromString <text>                Detect the syntax of a block of text.
  syntaxFromFile <bucket> <filename>     Detect the syntax of text in a GCS file.

Options:
  --language, -l  The language of the text.                                             [string]
  --type, -t      Type of text              [string] [choices: "text", "html"] [default: "text"]
  --help          Show help                                                            [boolean]

Examples:
  node analyze sentimentFromString "President Obama is speaking at the White House."
  node analyze sentimentFromFile my-bucket file.txt
  node analyze entitiesFromString "<p>President Obama is speaking at the White House.</p>" -t html
  node analyze entitiesFromFile my-bucket file.txt
  node analyze syntaxFromString "President Obama is speaking at the White House."
  node analyze syntaxFromFile my-bucket es_file.txt -l es

For more information, see https://cloud.google.com/natural-language/docs