refactor(botonic-nlu): first approach nlu refactor #940
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Set as Draft PR if it's not ready to be merged.
PR best practices Reference
Description
A first approach of an improved version of current botonic-nlu engine after being migrated to Typescript.
We still need to modify botonic-cli and (probably) botonic-plugin-nlu, to have it working coordinately.
Context
The previous botonic-nlu engine was hard to maintain as it was written initially in JS. This is an improved version of that project which tries to solve several things:
Approach taken / Explain the design
This NLU provides a new kind of api to operate with the NLU engine. It can be used as a stand-alone node application to play with trainings and predictions. The main idea of this engine is the following:
BotonicNLU
object which provides the main interface. Let's say we declareconst nlu = new BotonicNLU
nlu.addExample(locale, intent, utterance)
.nlu.train('en')
.async() => await trainer.run()
. This will automatically trigger the steps of preprocessing, loading the word embeddings and train with a NN model.For the development workflow, I have been using
nodemon
under the npm scriptnpm run start:dev
. (checkindex.ts
).To document / Usage example
Pending Steps
If you want to run the example:
yarn install
yarn build
node dev-example.js
Testing