gnl v0.1.1
gnl (Google Natural Language)
How to install
npm install gnl
Note
This package is in an alpha state as the Google node api services are also currently in alpha. This will update as Google updates and as features are added.
Requirements
Before using this service on your machine it is imperative that you follow the directions on this page Google Application Default Credentials. Don't worry about anything within or below the section Calling the Application Default Credentials in application code, unless you're curious.
Learn About Google Natural Language
To learn about this wonderful contribution to the world of Computer Science, check out their webpage Google Natural Language
How to use
This package utilizes Rxjs, therefore with every call to the service you will be able to perform all observable actions.
Below are a few examples
const GNLService = require('gnl').service;
...
let gnlService = new GNLService();
// call analyze sentiment
gnlService.analyzeSentiment("The Village is a great movie no matter what anyone says")
.subscribe( results => console.log(results));
// call annotate text service -- basic call
gnlService.annotateText("The Village is a great movie no matter what anyone says. It was a great thriller.")
.subscribe( results => console.log(results));
// analyze the annotated tokens
gnlService.annotateText("The Village is a great movie no matter what anyone says. It was a great thriller.")
.flatMap( data => data.tokens)
.subscribe( results => console.log(results));
// analyze the annotated sentences
gnlService.annotateText("The Village is a great movie no matter what anyone says. It was a great thriller.")
.flatMap( data => data.tokens)
.subscribe( results => console.log(results));
// drill down to get the mentions!
gnlService.analyzeEntities("The Village is a great movie no matter what anyone says")
.flatMap( results => results.entities)
.flatMap( entity => entity.mentions )
.subscribe( mentions => console.log(mentions));
Running tests
To run tests, issue npm test
at the root of the project.
Tests are currently incomplete but will be updated in time
CLI
Coming Soon