
Security News
ESLint Adds Official Support for Linting HTML
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
nlp-hub is a micro-framework that connects you to multiple natural language processing engines such as LUIS, QnA Maker Watson or even local regular expressions.
nlp-hub allows you to build lightweight chatbots aimed for scenarios with minimal context (think: question -> answer). You can use different strategies to reduce processing costs, increase reliability or improve performance, depending on your goals.
Set up the JSON definition file. Note that each provider has its own parameters.
{
"threshold":"0.8",
"apps":[
{"id":"HolaRegex", "intent":"Saludo", "exp":"(^hola$|^holaa$|^holas$|^holi$|^holis$|^hi$|^hello$)", "type":"regex"},
{"id":"ComprarVueloRegex", "intent":"ComprarVuelo", "exp":"^Comprar vuelo$", "type":"regex"},
{"id":"5d90b68...", "key":"3f7eb1b5...", "type":"luis"},
{"id":"3285f3b...", "key":"3f7eb1b5...", "type":"luis"},
{"id":"QnA_BOFA_ES", "kb":"055836...", "key":"bdfa0e...", "type":"qnamaker"}
]
}
Then call the strategy of your choice from your code.
nlp.firstMatch(query, function(response) {
console.log(`The first detected intent was ${response.intent.name} according to ${response.engine}`);
});
Runs each app syncronously on the JSON definition file and stops after finding the first one that goes over the threshold. Use this strategy for cost-effectiveness.
nlp.firstMatch(query, function(response) {
console.log(`The first detected intent was ${response.intent.name} according to ${response.engine}`);
});
Runs each app on the JSON definition file asynchronously and in parallel, computes and finds the best score. Use this strategy for reliability.
nlp.bestMatch(query, function(response) {
console.log(`The first detected intent was ${response.intent.name} according to ${response.engine}`);
});
To support LUIS, add an app on the apps.json definition file with the following fields:
[{"id":"5d90b68..", "key":"3f7eb1..", "type":"luis"}]
To support QnA Maker, add an app on the apps.json definition file with the following fields:
[{"id":"QnA_BOFA_ES", "kb":"05583..", "key":"bdfa0ea..", "type":"qnamaker"}]
To support Regular Expressions, add an app on the apps.json definition file with the following fields:
[{"id":"HolaRegex", "intent":"Saludo", "exp":"(^hola$|^holaa$|^holas$|^holi$|^holis$|^hi$|^hello$)", "type":"regex"},]
To integrate nlp-hub with Microsoft Bot Framework, you can simply use a root dialog to call nlp.firstMatch or any other strategy of your choice. You could also trigger different dialogs based on the user input if you wanted to.
This is an example of the simplest integration between nlp-hub and Microsoft Bot Framework.
var builder = require('botbuilder');
var nlp = require('../core/core.js');
var connector = new builder.ConsoleConnector().listen();
var bot = new builder.UniversalBot(connector);
nlp.load('../apps.json');
bot.dialog('/', [
function (session) {
nlp.firstMatch(session.message.text, function(response) {
session.send(`The first detected intent was ${response.intent.name} according to ${response.engine}`);
});
}
]);
FAQs
The hub for natural language processing (nlp) engines.
The npm package nlp-hub receives a total of 4 weekly downloads. As such, nlp-hub popularity was classified as not popular.
We found that nlp-hub demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.