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.
-
Read Prerequisites and How to run a sample first.
-
Install dependencies:
npm install
View the documentation or the source code.
Usage: node analyze.js --help
Commands:
sentiment-text <text> Detects sentiment of a string.
sentiment-file <bucket> <filename> Detects sentiment in a file in Google Cloud Storage.
entities-text <text> Detects entities in a string.
entities-file <bucket> <filename> Detects entities in a file in Google Cloud Storage.
syntax-text <text> Detects syntax of a string.
syntax-file <bucket> <filename> Detects syntax in a file in Google Cloud Storage.
Options:
--help Show help [boolean]
Examples:
node analyze.js sentiment-text "President Obama is speaking
at the White House."
node analyze.js sentiment-file my-bucket file.txt Detects sentiment in gs://my-bucket/file.txt
node analyze.js entities-text "President Obama is speaking
at the White House."
node analyze.js entities-file my-bucket file.txt Detects entities in gs://my-bucket/file.txt
node analyze.js syntax-text "President Obama is speaking at
the White House."
node analyze.js syntax-file my-bucket file.txt Detects syntax in gs://my-bucket/file.txt
For more information, see https://cloud.google.com/natural-language/docs
The example in the slackbot subdirectory shows a Slack bot built using the Botkit library. It runs on a Google Container Engine (Kubernetes) cluster, and uses one of the Google Cloud Platform's ML APIs, the Natural Language (NL) API, to interact in a Slack channel. See its README for more information.