Skip to content

Bosonnlp sdk for Nodejs, promises & query string are supported

License

Notifications You must be signed in to change notification settings

Debiancc/bosonnlp.js

Repository files navigation

bosonnlp.js

Build Status Greenkeeper badge

Features

  • Based on Nodejs stable api.
  • Promises.
  • Full action params control.
  • Catch more (e.g timeout..).

Usage

const BosonNLP = require('bostonnlp.js');
const bosonNLP = new BosonNLP({ apiToken : 'YOU_KEY', timeout: 1000 * 10 });

(async () => {
  try {
    const result = await bosonNLP.tag(['苟利国家生死已','南京市长江大桥'], { space_mode: 1 });
    console.log(result);
  } catch (error) {
    throw error;
  }
})()

Default timeout value is 10s. Need more method params detail please check http://bosonnlp.com/dev/center

Methods

tag(texts, params)

  • texts:
    • Required
    • Type: Array or String
  • params:
    • Type: Object

sentiment(texts, params)

  • texts:
    • Required
    • Type: Array or String
  • params:
    • Type: Object
    • Value: { auto: true } e.g..

ner(texts, params)

  • texts:
    • Required
    • Type: Array or String
  • params:
    • Type: Object

depparser(texts, params)

  • texts:
    • Required
    • Type: Array or String
  • params:
    • Type: Object

keywords(texts, params)

  • texts:
    • Required
    • Type: Array or String
  • params:
    • Type: Object

classify(texts, params)

  • texts:
    • Required
    • Type: Array or String
  • params:
    • Type: Object

suggest(text, params)

  • texts:
    • Required
    • Type: String
  • params:
    • Type: Object

summary(texts, params)

  • texts:
    • Required
    • Type: Array or String
  • params:
    • Type: Object

License

MIT license.