hexanlp-api

0.0.1 • Public • Published

hexanlp-api

hexanlp-api is a node package that allows you to easily configure and train your NLP through HexaNlp HTTP API.

Note that hexanlp-api uses promises, so be aware to always catch at least once when implementing your code.

Please refer to the official HTTP API documentation to know about available endpoints.

Installation

npm install hexanlp-api

Initialization

const HexaNlp = require('hexanlp-api')

const hexanlp = new HexaNlp('<ENDPOINT-URL>', '<YOUR-PROJECT-NAME>','<YOUR-SERVER-ACCESS-TOKEN>', '<TIMEOUT-IN-SECONDS>')

Parse

hexanlp.parse('Wake me up when september end!').then((res) => {
  console.log(res)
}).catch((error) => {
  console.error(error)
})

Training

You must provide data in JSON format.

hexanlp.train({
  "common_examples": [{
    "text": "hey",
    "intent": "greet",
    "entities": []
  }, {
    "text": "i'm looking for a place in the north of town",
    "intent": "restaurant_search",
    "entities": [
      {
        "start": 31,
        "end": 36,
        "value": "north",
        "entity": "location"
      }
    ]
  }],
  "regex_features" : [],
  "lookup_tables"  : [],
  "entity_synonyms": []
}).then(res => {
  console.log(res)
}).catch((error) => {
  console.error(error)
})

Evaluate

You must provide test dataset in JSON format.

hexanlp.evaluate({
  "common_examples": [{
    "text": "hey",
    "intent": "greet",
    "entities": []
  }],
  "regex_features" : [],
  "lookup_tables"  : [],
  "entity_synonyms": []
}).then(res => {
  console.log(res)
})

Status/Version/Config

//
let info = 'version' // You can pass one of the following ['version', 'status', 'config']
hexanlp.get(info).then(res => {
  console.log(res)
}).catch((error) => {
  console.error(error)
})

Delete models

//
let model = 'model_20190221-114950'
hexanlp.delete(model).then(res => {
  console.log(res)
}).catch((error) => {
  console.error(error)
})

Readme

Keywords

Package Sidebar

Install

npm i hexanlp-api

Weekly Downloads

0

Version

0.0.1

License

BSD-4-Clause

Unpacked Size

22.7 kB

Total Files

9

Last publish

Collaborators

  • hexastack_admin