import { NewBot } from 'newbot/bootstrap/browser-with-nlp'
import MainSkill from '<path to your skill>'
import { LangFr } from '@nlpjs/lang-fr'
const converse = new NewBot(MainSkill, {
model: '/model/model.nlp',
modelLangs: [LangFr]
})
On-the-fly training
import { NewBot } from 'newbot/bootstrap/browser-with-nlp'
import { train } from 'newbot/packages/train'
import { LangFr } from '@nlpjs/lang-fr'
import MainSkill from '<path to your skill>';
(async function() {
const converse = new NewBot(MainSkill)
// second parameter is optional if only english
const model = await train(converse, [LangFr])
await converse.setModelNlp(model, [LangFr])
converse.exec('hey', (output, done) => {
console.log(output)
done()
})
})()
Use a bundler like webpack, parcel, rollup, etc. to read imports and generate a file
Use the parser
If you want to test uncompiled code directly in the browser, integrate the newbot.with-parser.min.js file instead