Meet npm Pro: unlimited public & private packages + package-based permissions.Learn more »

nbp-adapter-google-natural-language

0.0.4 • Public • Published

Google Natural Language adapter

This is a Google Natural Language adapter for Node.js Bot Platform. You need to provide:

  • projectId is a google project ID;
  • keyFilename is path to the json file with google keys;
  • logger is an instance of your logging tool.
import googleNaturalLanguageAdapterFactory from 'nbp-adapter-google-natural-language';
const googleNaturalLanguageAdapter = googleNaturalLanguageAdapterFactory({
    projectId: 'google-project-id',
    keyFilename: 'path-to-json-keys',
    logger
});

After you can create an instance of GNL and use it's methods:

const googleNaturalLanguage = googleNaturalLanguageAdapter();
 
googleNaturalLanguage.annotate('Here your sentence to annotate');
googleNaturalLanguage.detectEntities('Here your sentence where you can detect entities');
googleNaturalLanguage.detectSentiment('Here your sentence where you can detect sentiment');

Please, look at usage example.

Tunneling

Check tunneling.js. To bind context of all client's function we need to perform tunneling on each request, so inside skills you can do googleLanguage.annotate('Some text) without specifying application tokens.

Look at router-builder.js as an example.

Keywords

none

Install

npm i nbp-adapter-google-natural-language

DownloadsWeekly Downloads

6

Version

0.0.4

License

ISC

Last publish

Collaborators

  • avatar