Skip to content

Latest commit

 

History

History
102 lines (75 loc) · 2.06 KB

README.md

File metadata and controls

102 lines (75 loc) · 2.06 KB

snips-nlu-js

Quick and dirty NodeJS bindings for snips-nlu-rs.

Work in progress

  • Library needs to be made async, loading and parsing block, will have to work out how to do it in Neon.
  • Implement filter_intents parameter
  • Unit tests
  • Zip/Dir loading
  • Feature parity with other FFI's

Installing

Download Rust

curl https://sh.rustup.rs -sSf | sh

Install

npm install

Building for AWS Lambda

Prerequisite

Set dockers max container memory to 4gb. snips-nlu-rs uses a lot when compiling. See the issue here

Build docker container

docker build -t snips-nlu-js .

Run docker container

docker run -t -i snips-nlu-js

You may also want to mount a local filesystem to the directory /work so you can extract the files from the container with the -v /host/directory:/work command

Build

npm install

Usage

Currently only local usage only, binaries will be published on release

cd path/to/snips-nlu-js
npm link
cd path/to/your/project
npm link snips-nlu-js

In your code:

const createNluEngine = require('snips-nlu-js');

try {
  const nluEngine = createNluEngine('./path/to/assistant.json');
  const result = nluEngine.parse('your string');
  console.log(result);
} catch (e) {
  console.error(e.message);
}

Demo

Cli

./cli.js trained_assistant.json weather

Node Version Support

The package has been developed on Node 8 and it worked on Node 6. Enough for AWS Lambda.

Author

Barry Allwood

Thanks to the Neon project for their rust bindings and Snips for their super fast rust implementation of their nlu engine

License

Licensed under the Apache License, Version 2.0.