NLP Model Detect/Rate Important Sentences utilizing NLP Intent Text Classification using NLP.js in Nodejs

Source Code

See here the index.js code for NLP.js

const { dockStart } = require("@nlpjs/basic");
var path = require('path');
let nlpIntentProcess;
async function intentTrainModel() {
console.log("Server - NLP Intent model training with corpus file start.");
const dock = await dockStart({use: ['Basic']})
const nlp = dock.get('nlp');
await nlp.addCorpus('./src/nlp/nlpjs/corpus.json')
let modelPathFilename = path.join(__dirname, "./src/nlp/nlpjs", "model.nlp");
await nlp.train();;
console.log("Server - NLP Intent model training with corpus file end.");
async function intentQueryModel() {
const response = await nlpIntentProcess.process('en', 'Lets focus on the tasks next.');
console.log("Server - NLP Intent Model Response: ", response);
async function intentLoadModel() {
const dock = await dockStart({use: ['Basic']})
nlpIntentProcess = dock.get('nlp');
await nlpIntentProcess.addCorpus('./src/nlp/nlpjs/corpus.json');
let modelPathFilename = path.join(__dirname, "src/nlp/nlpjs", "model.nlp");
(async() => {
// train model
await intentTrainModel();
// load trained model
await intentLoadModel();
// query model response
await intentQueryModel();

Getting started

Use the following commands to start:

npm install
npm run
"name": "Corpus",
"locale": "en-US",
"data": [
"intent": "agent.relevant",
"utterances": [
"it is important",
"answers": [
"create a talk"

Useful stuff

the source code and all the required files are also available under a git repo. If you like you can have a look here:



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


If you like my work or have question contact me.