1.2.1 • Published 5 years ago

nlp-hub-v4 v1.2.1

Weekly downloads
14
License
MIT
Repository
github
Last release
5 years ago

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

5 years ago

1.2.0

5 years ago

1.0.5

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago