Skip to content

Latest commit

 

History

History
71 lines (48 loc) · 2.11 KB

README.md

File metadata and controls

71 lines (48 loc) · 2.11 KB

Build Status

Satori

An intent detector.

Overview

Satori is a tiny library to detect intent of input sentence. Specifically Ssatori gets the input JSON (containing sentence, device type and user id) and then returns the intention and the arguments, which are needed to process the selected tasks.

Install

Run the following command in your repository.

npm install satori-flow

Sample

After you install the Satori, you can use satori as a library. a sample is bundled in this repository. The following is a sample code to detect intent from user by Satori.

import { ConfigurationBuilder } from 'satori-flow'
import { IntentDetector } from 'satori-flow'

const config = new ConfigurationBuilder()
      .addIntent("repeat", { "type" : "verbatim", "patterns" : [ "repeat", "please repeat" ]})
      .addRunner("repeat", {"type" : "random", "list" : ["sure"]} )
      .build();

const detector = new IntentDetector(config);
const result = detector.match({"text" : "I would like to repeat again.", "userId" : 985499 });
console.log(result)

You can run the above script (saved as sample/satori-sample.js) with the following command.

$ babel-node sample/satori-sample.js
{ text: 'I would like to repeat again.',
  userId: 985499,
  state: {},
  match: 'repeat' }

CLI command

Satori provides a cli command tool, after the installation of the package, we can run the satori command specifying a configuration file (a sample configuration file is available here).

satori -c test/fixtures/sample_conf.json
repeat again
excuse me?

Usage

For detailed usage. Please read doc/main.adoc.

License

Apache 2.0

Contribution

See CONTRIBUTING.md.