An intent detector.
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.
Run the following command in your repository.
npm install satori-flow
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' }
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?
For detailed usage. Please read doc/main.adoc.
Apache 2.0
See CONTRIBUTING.md.