Skip to content

nlp-hub is a micro-framework that connects your chatbot to multiple natural language processing engines

Notifications You must be signed in to change notification settings

lorenzojlamas/nlp-hub-v4

 
 

Repository files navigation

NLP-Hub

Build Status NPM Coverage

This is a library to connect different recognizers to a bot, currently supports:

  • Regex
  • Luis
  • Rasa

By now, the only strategy supported is that of firsMatch, it goes through the configured recognizers and when the first one passes a certain threshold it returns the common data structure of the response. You must configure a default response as detailed in the example. This library is an open source and anyone who wants to participate will be welcome.

Use example:

const configuration: INlpHubConfiguration = {
    threshold: 0.83,
    recognizers: [
        {
            id: "HolaRegex",
            type: "regex",
            params: {
                intent: "greetings",
                exp: "(^hola$|^holaa$|^holas$|^holi$|^holis$|^hi$|^hello$)"
            }
        },
        {
            id: "recommender",
            type: "regex" ,
            params: {
                intent: "recommender",
                exp: "^Comprar vuelo$"
            }
        },
        {
            id: "Luis-1",
            type: "luis",
            params: {
                "appId": "APP_ID",
                "key": "SUBS_KEY",
                "appHost": "http://westus.api.cognitive.microsoft.com" }
        },
        {
            id: "Rasa-1",
            type: "rasa",
            params: {
                appHost: "http://RASA_HOST" 
            }
        },
        {
            id: "default-1",
            type:"default" ,
            params: {
                intent: "NoneDialog"
            }
        }
    ]
  };

const nlpHub: NlpHub = new NlpHub(configuration);
const utterance: string = 'Hola';
const response: any = await nlpHub.firstMatch(utterance);

About

nlp-hub is a micro-framework that connects your chatbot to multiple natural language processing engines

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 100.0%