Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-nlp

Package Overview
Dependencies
Maintainers
1
Versions
161
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-nlp - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

63

lib/recognizer/recognizer.js

@@ -141,4 +141,67 @@ /*

}
/**
* Route to a default route of the bot. First the route is calculated as the
* best route based on the results and the dialog stack. If no best route exists
* then is routed to the active dialog.
* @param {Object} bot Microsoft Bot Framework Universal Bot instance.
* @param {Object} session Microsoft bot framework session.
* @param {Object} results Results for the routing.
*/
defaultRouting(bot, session, results) {
const route = bot.libraries.BotBuilder.constructor
.bestRouteResult(results, session.dialogStack(), bot.name);
if (route) {
return bot.library(route.libraryName).selectRoute(session, route);
}
return session.routeToActiveDialog();
}
/**
* Sets the recognizer to a Microsoft bot framework universal bot instance.
* Also, the default bot routing can be overrided and replaced by the
* recognizer routing.
* @param {Object} bot Microsoft Bot Framework Universal Bot instance.
* @param {boolean} activateRouting True if default routing should be overrided.
* @param {number} routingThreshold Threshold for the score of the intent.
*/
setBot(bot, activateRouting = false, routingThreshold = 0.7) {
bot.recognizer(this);
if (!activateRouting) {
return;
}
const self = this;
// eslint-disable-next-line no-underscore-dangle, no-param-reassign
bot._onDisambiguateRoute = function disambiguate(session, results) {
if (self.onBeginRouting && !self.onBeginRouting(session)) {
return undefined;
}
if (session.message && session.message.text) {
self.recognize(session, (err, result) => {
if (result.score > routingThreshold && result.answer && result.answer !== '') {
if (self.onRecognizedRouting && !self.onRecognizedRouting(session, result)) {
return undefined;
}
const response = result.answer;
if (response[0] === '/') {
return session.beginDialog(response);
}
return session.send(response);
}
if (self.onUnrecognizedRouting && !self.onUnrecognizedRouting(session, result)) {
return undefined;
}
return self.defaultRouting(bot, session, results);
});
} else {
if (self.onNoTextRouting && !self.onNoTextRouting(session)) {
return undefined;
}
return self.defaultRouting(bot, session, results);
}
return undefined;
};
}
}
module.exports = Recognizer;

2

package.json
{
"name": "node-nlp",
"version": "1.2.0",
"version": "1.2.1",
"description": "Library for NLU (Natural Language Understanding) done in Node.js",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc