Skip to content

evilai/nbp-adapter-google-natural-language

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Google Natural Language adapter for Node.js Bot Platform

Resources

Stars

Watchers

Forks

Packages

No packages published