axa-group / nlp.js

An NLP library for building bots, with entity extraction, sentiment analysis, automatic language identify, and so more
MIT License
6.28k stars 621 forks source link

Slot filling is not working as documented #242

Closed obaid closed 5 years ago

obaid commented 5 years ago

Describe the bug Running the example found in the docs I found that the output is not as expected.

To Reproduce Steps to reproduce the behavior: See https://runkit.com/obaid/5d5abdd6eaec0b001442678f

Expected behavior The console output should be: Console output:

Screenshots The output we get is:

Desktop (please complete the following information): N/A

Additional context Add any other context about the problem here.

jesus-seijas-sp commented 5 years ago

Hello,

The problem is not the Slot Filling. This is happening beause since 3.4 we avoid false positives using a nonefeature that gives a weight into the intent None to sentences with unknown words. To get the desired behaviour deactivate this option:

  const manager = new NlpManager({ languages: ['en'], nlu: { useNoneFeature: false } });

Explanation of the why NLP.js is for doing chatbots in production, we are working with it with thousands of utterances, houndreds of intents, and to avoid false positives is a must.

In a PoC, to play with it, you train something like: "who are you"-> intent who "good morning" -> intent greet Then you say "who" and you expect to return the intent who.... But what if the user say "Tell me the last LP from The Who"... you expect to return the intent who? Nope, this will be a false positive.

So for test purposes you can deactivate it, but in production you should have it.

obaid commented 5 years ago

This works. Thanks for the details.