adaptjs
A nodejs wrapper around the Adapt Intent Parser from Mycroft, which converts natural language into structured intents based on intent definitions.
Installation
$ npm install --save adaptjs
Install MycroftAI/adapt as described in their README.
Example
"use strict";const EngineBuilder = EngineBuilder; let builder = ; builder;builder;builder; builder ; let engine = builder; engine; /* [ { intent_type: 'WeatherIntent', weatherkey: 'weather', Location: 'San Francisco', confidence: 0.4878048780487805, target: null } ] */
See examples/ for more examples of the API and MycroftAI/adapt for more information about the Adapt Intent Parser itself.
API
adaptInstallationPath: EngineBuilderEngineBuilder: EntityEngineBuilder: RegexEntityEngineBuilder: IntentEngineBuilder: Engine Intent: thisIntent: this EnginestartEngineEngine: boolEngine: Promise
How it works
The EngineBuilder on the JavaScript side creates a definition of all entities and intents and passes it to a python child process as JSON. The python child process keeps running in the background and receives new input over stdin. You have to stop the child process manually using engine.stop()
.
If you have installed Adapt in a specific location (not your current-working-directory), then you can pass that path as the first argument of the EngineBuilder. This path should be absolute, because otherwise it will be relative out of node_modules/ which will lead to problems later on.