nlp-hub-v4
TypeScript icon, indicating that this package has built-in type declarations

1.2.1 • Public • Published

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);

Readme

Keywords

none

Package Sidebar

Install

npm i nlp-hub-v4

Weekly Downloads

13

Version

1.2.1

License

MIT

Unpacked Size

225 kB

Total Files

79

Last publish

Collaborators

  • lorenzojlamas